Bug 82192 - [EFL][DRT] Catch the "resource,request,willsend" signal
Summary: [EFL][DRT] Catch the "resource,request,willsend" signal
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: WebKit EFL (show other bugs)
Version: 528+ (Nightly build)
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Chris Dumez
URL:
Keywords:
Depends on:
Blocks: 81891 82443 82722
  Show dependency treegraph
 
Reported: 2012-03-26 05:07 PDT by Chris Dumez
Modified: 2012-05-06 22:48 PDT (History)
6 users (show)

See Also:


Attachments
Proposed patch (5.83 KB, patch)
2012-03-26 07:13 PDT, Chris Dumez
no flags Details | Formatted Diff | Diff
Improved patch based on Raphael Kubo da Costa's review (4.81 KB, patch)
2012-03-26 22:43 PDT, Chris Dumez
no flags Details | Formatted Diff | Diff
Improved patch based on Raphael Kubo da Costa's review (#2) (4.79 KB, patch)
2012-03-27 11:41 PDT, Chris Dumez
no flags Details | Formatted Diff | Diff
Second patch proposal (listening for signal on the view) (8.10 KB, patch)
2012-03-28 07:46 PDT, Chris Dumez
no flags Details | Formatted Diff | Diff
Second patch proposal (listening for signal on the view) (8.97 KB, patch)
2012-03-29 00:05 PDT, Chris Dumez
no flags Details | Formatted Diff | Diff
Second patch proposal (listening for signal on the view) (9.85 KB, patch)
2012-03-29 01:20 PDT, Chris Dumez
no flags Details | Formatted Diff | Diff
Proposed patch (10.45 KB, patch)
2012-04-03 03:01 PDT, Chris Dumez
no flags Details | Formatted Diff | Diff
Proposed patch (10.54 KB, patch)
2012-04-03 04:05 PDT, Chris Dumez
no flags Details | Formatted Diff | Diff
Proposed patch (10.69 KB, patch)
2012-04-03 05:55 PDT, Chris Dumez
gustavo: review+
gustavo: commit-queue-
Details | Formatted Diff | Diff
Proposed patch (10.68 KB, patch)
2012-04-04 05:52 PDT, Chris Dumez
no flags Details | Formatted Diff | Diff
Proposed patch (10.68 KB, patch)
2012-04-04 06:25 PDT, Chris Dumez
kkristof: commit-queue-
Details | Formatted Diff | Diff
Proposed patch (10.70 KB, patch)
2012-04-04 12:08 PDT, Chris Dumez
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Chris Dumez 2012-03-26 05:07:26 PDT
EFL's DRT should catch the "resource,request,willsend" signal in order to implement the "Blocked access to external URL" behavior.

This allows the following test cases to be removed from the skip list:
    fast/ruby/before-block-doesnt-crash.html
    fast/ruby/before-table-doesnt-crash.html
    fast/ruby/generated-before-counter-doesnt-crash.html
    fast/workers/worker-crash-with-invalid-location.html
Comment 1 Chris Dumez 2012-03-26 07:13:14 PDT
Created attachment 133803 [details]
Proposed patch
Comment 2 Raphael Kubo da Costa (:rakuco) 2012-03-26 07:25:21 PDT
Comment on attachment 133803 [details]
Proposed patch

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

> Source/WebKit/efl/ChangeLog:11
> +        Reviewed by NOBODY (OOPS!).

Style-wise, the "Reviewed by" line usually goes right after the bug URL.

> Source/WebKit/efl/ChangeLog:14
> +        * WebCoreSupport/FrameLoaderClientEfl.cpp:
> +        (WebCore::FrameLoaderClientEfl::dispatchWillSendRequest):

It looks like this part of the patch is missing.

> Tools/DumpRenderTree/efl/DumpRenderTreeChrome.cpp:310
> +

Style nitpick: extra empty line here.
Comment 3 Chris Dumez 2012-03-26 22:43:26 PDT
Created attachment 133979 [details]
Improved patch based on Raphael Kubo da Costa's review
Comment 4 Gyuyoung Kim 2012-03-26 23:16:37 PDT
Comment on attachment 133979 [details]
Improved patch based on Raphael Kubo da Costa's review

Looks fine before.
Comment 5 Gyuyoung Kim 2012-03-26 23:17:58 PDT
(In reply to comment #4)
> (From update of attachment 133979 [details])
> Looks fine before.
Oops. I mean looks better than before. :-)
Comment 6 Raphael Kubo da Costa (:rakuco) 2012-03-27 07:37:55 PDT
Comment on attachment 133979 [details]
Improved patch based on Raphael Kubo da Costa's review

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

> Tools/DumpRenderTree/efl/DumpRenderTreeChrome.cpp:102
> +    Evas_Object* mainFrame = ewk_view_frame_main_get(view);
> +    if (mainFrame)

Sorry for not noticing this earlier. Some time ago I added code which emitted "resource,request,willsend" on the view when a request was sent to its main frame (see FrameLoaderClientEfl::dispatchWillSendRequest). Have you checked if it works in this case?

> Tools/DumpRenderTree/efl/DumpRenderTreeChrome.cpp:308
> +        return;

This return statement is unnecessary.
Comment 7 Chris Dumez 2012-03-27 08:19:02 PDT
(In reply to comment #6)
> (From update of attachment 133979 [details])
> View in context: https://bugs.webkit.org/attachment.cgi?id=133979&action=review
> 
> > Tools/DumpRenderTree/efl/DumpRenderTreeChrome.cpp:102
> > +    Evas_Object* mainFrame = ewk_view_frame_main_get(view);
> > +    if (mainFrame)
> 
> Sorry for not noticing this earlier. Some time ago I added code which emitted "resource,request,willsend" on the view when a request was sent to its main frame (see FrameLoaderClientEfl::dispatchWillSendRequest). Have you checked if it works in this case?

My initial attempt was to listen for the "resource,request,willsend" signal on the view (instead of on the main frame). However, this did not work because my callback would only get called when the main frame is loaded, but not when each subcomponent of the main frame gets loaded. The tests check for subcomponents in the frame.
Comment 8 Raphael Kubo da Costa (:rakuco) 2012-03-27 08:30:30 PDT
Alright then, thanks.
Comment 9 Chris Dumez 2012-03-27 11:41:12 PDT
Created attachment 134106 [details]
Improved patch based on Raphael Kubo da Costa's review (#2)

Removed the "useless" return statement.
Comment 10 Chris Dumez 2012-03-28 06:35:10 PDT
@Raphael Kubo da Costa: I ran more test cases and figured out that I'm not getting the "resource,request,willsend" signal for resources in a iframe (e.g. "LayoutTests/http/tests/misc/window-dot-stop.html").

I believe this is a side effect on me listening for the signal on the main frame instead of the view.

However, unlike the GTK port equivalent, the FrameLoaderClientEfl dispatchWillSendRequest() will emit the "resource,request,willsend" signal on the view, only for the main frame:

************
    ewk_frame_request_will_send(m_frame, &messages);
    // We want to distinguish between a request for a document to be loaded into
    // the main frame, a sub-frame, or the sub-objects in that document (via Chromium).
    if (loader) {
        const FrameLoader* frameLoader = loader->frameLoader();
        const bool isMainFrameRequest = (loader == frameLoader->provisionalDocumentLoader() && frameLoader->isLoadingMainFrame());
        if (isMainFrameRequest)
            evas_object_smart_callback_call(m_view, "resource,request,willsend", &messages);
    }
************

Is this really required or can I remove the check and emit the signal on the view for all resources (like in GTK port)?
Comment 11 Chris Dumez 2012-03-28 07:46:08 PDT
Created attachment 134293 [details]
Second patch proposal (listening for signal on the view)

Here is a second proposal where DRT is listening for "resource,request,willsend" signal on the view (not the main frame).
To support this, I'm now emitting the signal on the view for all resources (not just the main frame).

Also, to help the browser identify the frame (seems like it was the needed use-case), I added a frame property to the Ewk_Frame_Resource_Request struct.
Comment 12 Raphael Kubo da Costa (:rakuco) 2012-03-28 14:43:24 PDT
(In reply to comment #10) 
> Is this really required or can I remove the check and emit the signal on the view for all resources (like in GTK port)?

I imported this code from Chromium some time ago while working on a downstream project; as I don't have access to the project's code anymore, I'll let glima (CC'ed) answer more properly.

In short, from what I remember, the idea was to be able to differentiate requests to the main frame from other types of requests, so that SSL requests to servers with invalid SSL certificates would be made only if they were to the main frame and the user had accepted that, and dropped automatically otherwise.
Comment 13 Chris Dumez 2012-03-29 00:05:22 PDT
Created attachment 134512 [details]
Second patch proposal (listening for signal on the view)

Forgot to update the Changelogs in the patch.
Comment 14 Chris Dumez 2012-03-29 01:20:01 PDT
Created attachment 134521 [details]
Second patch proposal (listening for signal on the view)

Forgot to update the ewk_view signals documentation accordingly.
Comment 15 Gyuyoung Kim 2012-03-29 17:53:22 PDT
(In reply to comment #12)

> In short, from what I remember, the idea was to be able to differentiate requests to the main frame from other types of requests, so that SSL requests to servers with invalid SSL certificates would be made only if they were to the main frame and the user had accepted that, and dropped automatically otherwise.

I have not used this function yet. Are there any problems when we fire a signal on frame ?
Comment 16 Raphael Kubo da Costa (:rakuco) 2012-03-29 18:27:09 PDT
(In reply to comment #15)
> (In reply to comment #12)
> 
> > In short, from what I remember, the idea was to be able to differentiate requests to the main frame from other types of requests, so that SSL requests to servers with invalid SSL certificates would be made only if they were to the main frame and the user had accepted that, and dropped automatically otherwise.
> 
> I have not used this function yet. Are there any problems when we fire a signal on frame ?

No, there aren't -- the frame signal is still being emitted. It's just that listening on the frame signal cannot do what I mentioned above.
Comment 17 Chris Dumez 2012-04-03 03:01:49 PDT
Created attachment 135296 [details]
Proposed patch

Updated the patch so that the Ewk_Frame_Resource_Request now contains an "is_main_frame_request" boolean flag.
The browser needs to distinguish requests that are made for the main frame from those made for sub-resources.
Comment 18 Chris Dumez 2012-04-03 04:05:42 PDT
Created attachment 135306 [details]
Proposed patch

Updated the Changelogs in the patch.
Comment 19 Raphael Kubo da Costa (:rakuco) 2012-04-03 04:54:55 PDT
Comment on attachment 135306 [details]
Proposed patch

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

Thanks for the work, looks almost good to me.

> Source/WebKit/efl/WebCoreSupport/FrameLoaderClientEfl.cpp:-176
> -    // We want to distinguish between a request for a document to be loaded into
> -    // the main frame, a sub-frame, or the sub-objects in that document (via Chromium).

Please keep the comment in the code for the chunk it's related to to be easier to understand.

> Tools/DumpRenderTree/efl/DumpRenderTreeChrome.cpp:303
> +        return;

`return' not needed.
Comment 20 Chris Dumez 2012-04-03 05:55:35 PDT
Created attachment 135315 [details]
Proposed patch

Updated based on informal review.
Comment 21 Raphael Kubo da Costa (:rakuco) 2012-04-03 06:00:31 PDT
Comment on attachment 135315 [details]
Proposed patch

LGTM.
Comment 22 Gustavo Noronha (kov) 2012-04-04 05:11:41 PDT
Comment on attachment 135315 [details]
Proposed patch

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

cq- because of the comments

> Source/WebKit/efl/WebCoreSupport/FrameLoaderClientEfl.cpp:169
> +    // the main frame, a sub-frame, or the sub-objects in that document (via Chromium).

I know this line was still here, but via Chromium here means what? you are doing the same chromium does? or the author misspelled Chrome(Client)?

> Source/WebKit/efl/ewk/ewk_frame.h:110
> +    Eina_Bool is_main_frame_request; /** < indicates is the request is for the main frame */

is the request -> if the request
Comment 23 Chris Dumez 2012-04-04 05:52:01 PDT
Created attachment 135570 [details]
Proposed patch

Update to take Gustavo Noronha's comment into consideration.
Comment 24 Chris Dumez 2012-04-04 06:25:39 PDT
Created attachment 135577 [details]
Proposed patch

Rebase on master since it does not apply anymore.
Comment 25 Kristóf Kosztyó 2012-04-04 11:53:29 PDT
Comment on attachment 135577 [details]
Proposed patch

Rejecting attachment 135577 [details] from commit-queue.

rakuco@webkit.org does not have committer permissions according to http://trac.webkit.org/browser/trunk/Tools/Scripts/webkitpy/common/config/committers.py.

- If you do not have committer rights please read http://webkit.org/coding/contributing.html for instructions on how to use bugzilla flags.

- If you have committer rights please correct the error in Tools/Scripts/webkitpy/common/config/committers.py by adding yourself to the file (no review needed).  The commit-queue restarts itself every 2 hours.  After restart the commit-queue will correctly respect your committer rights.
Comment 26 Chris Dumez 2012-04-04 12:08:37 PDT
Created attachment 135645 [details]
Proposed patch

Updated reviewer name.
Comment 27 Raphael Kubo da Costa (:rakuco) 2012-04-04 12:11:25 PDT
Comment on attachment 135645 [details]
Proposed patch

Clearing flags on attachment: 135645

Committed r113224: <http://trac.webkit.org/changeset/113224>
Comment 28 Raphael Kubo da Costa (:rakuco) 2012-04-04 12:11:35 PDT
All reviewed patches have been landed.  Closing bug.