Bug 143283

Summary: WebKitTestRunner Injected bundle messages should be at the page level
Product: WebKit Reporter: Enrica Casucci <enrica>
Component: WebKit2Assignee: Enrica Casucci <enrica>
Status: RESOLVED FIXED    
Severity: Normal CC: sam, thorton
Priority: P2    
Version: 528+ (Nightly build)   
Hardware: Unspecified   
OS: Unspecified   
Attachments:
Description Flags
Patch
none
Patch2
none
Patch3 ap: review+

Description Enrica Casucci 2015-03-31 16:42:58 PDT
All the messaging to the UIProcess from the injected bundle should be page messages instead of context level messages.
Comment 1 Enrica Casucci 2015-03-31 23:27:25 PDT
Created attachment 249895 [details]
Patch
Comment 2 Tim Horton 2015-04-01 00:09:09 PDT
Comment on attachment 249895 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=249895&action=review

> Source/WebKit2/UIProcess/WebPageInjectedBundleClient.cpp:2
> + * Copyright (C) 2010 Apple Inc. All rights reserved.

The years don't look right

> Source/WebKit2/UIProcess/WebPageInjectedBundleClient.cpp:54
> +/*

This commented out thing probably should be deleted (?)

> Source/WebKit2/UIProcess/API/Cocoa/WKWebViewInternal.h:49
> +// ?

? what did we decide here

> Tools/WebKitTestRunner/TestController.cpp:532
> +//        0 // getInjectedBundleInitializationUserData

ditto on the commented out stuff
Comment 3 Enrica Casucci 2015-04-01 11:14:58 PDT
(In reply to comment #2)
> Comment on attachment 249895 [details]
> Patch
> 
> View in context:
> https://bugs.webkit.org/attachment.cgi?id=249895&action=review
> 
> > Source/WebKit2/UIProcess/WebPageInjectedBundleClient.cpp:2
> > + * Copyright (C) 2010 Apple Inc. All rights reserved.
> 
> The years don't look right
> 
There were even more wrong. I fixed them all.

> > Source/WebKit2/UIProcess/WebPageInjectedBundleClient.cpp:54
> > +/*
> 
> This commented out thing probably should be deleted (?)
>Yes, done.

> > Source/WebKit2/UIProcess/API/Cocoa/WKWebViewInternal.h:49
> > +// ?
> 
> ? what did we decide here
> 
Nothing officially. I think it is ok to have it here since it is internal.
I've removed the question mark.

> > Tools/WebKitTestRunner/TestController.cpp:532
> > +//        0 // getInjectedBundleInitializationUserData
> 
> ditto on the commented out stuff
Done.
Comment 4 Enrica Casucci 2015-04-01 11:25:16 PDT
Created attachment 249935 [details]
Patch2
Comment 5 Alexey Proskuryakov 2015-04-01 13:45:49 PDT
Comment on attachment 249935 [details]
Patch2

View in context: https://bugs.webkit.org/attachment.cgi?id=249935&action=review

> Source/WebKit2/WebProcess/WebPage/WebPage.cpp:4837
> +    auto& webProcess = WebProcess::singleton();

This variable is not needed.

> Tools/WebKitTestRunner/TestController.cpp:532
> +//        0 // getInjectedBundleInitializationUserData

?

> Tools/WebKitTestRunner/InjectedBundle/EventSendingController.cpp:212
> -    auto& injectedBungle = InjectedBundle::singleton();
> -    WKBundlePageRef page = injectedBungle.page()->page();
> +    auto& injectedBundle = InjectedBundle::singleton();
> +    WKBundlePageRef page = injectedBundle.page()->page();

This patch doesn't make it worse, but doesn't the code mean that it's not possible to use EventSendingController in a secondary window? Maybe it's easy to fix now?
Comment 6 Enrica Casucci 2015-04-01 15:32:18 PDT
Created attachment 249949 [details]
Patch3

Trying to fix EFL and GTK builds
Comment 7 Alexey Proskuryakov 2015-04-01 15:47:05 PDT
Comment on attachment 249949 [details]
Patch3

View in context: https://bugs.webkit.org/attachment.cgi?id=249949&action=review

> Source/WebKit2/WebProcess/WebPage/WebPage.cpp:4844
> +    auto& webProcess = WebProcess::singleton();

I feel kind of uneasy about this one, it's probably slightly better to call WebProcess::singleton() twice than to hold a reference to something over a sync call.

Anything can happen during a sync call, as synchronous messages from UI process can be executed. That's unlikely to invalidate a singleton, of course, but the way the code is structured now is unusual.
Comment 8 Enrica Casucci 2015-04-01 15:48:14 PDT
(In reply to comment #7)
> Comment on attachment 249949 [details]
> Patch3
> 
> View in context:
> https://bugs.webkit.org/attachment.cgi?id=249949&action=review
> 
> > Source/WebKit2/WebProcess/WebPage/WebPage.cpp:4844
> > +    auto& webProcess = WebProcess::singleton();
> 
> I feel kind of uneasy about this one, it's probably slightly better to call
> WebProcess::singleton() twice than to hold a reference to something over a
> sync call.
> 
> Anything can happen during a sync call, as synchronous messages from UI
> process can be executed. That's unlikely to invalidate a singleton, of
> course, but the way the code is structured now is unusual.

I agree with you. I'll change it.
Comment 9 Enrica Casucci 2015-04-01 16:23:34 PDT
Fixed the remaining build issues with elf and gtk before landing.
Committed revision 182260.