Bug 175880

Summary: REGRESSION(r218437): [GTK][WPE] Test /webkit2/WebKitWebExtension/isolated-world is failing since r218437
Product: WebKit Reporter: Ms2ger (he/him; ⌚ UTC+1/+2) <Ms2ger>
Component: WebKitGTKAssignee: Ms2ger (he/him; ⌚ UTC+1/+2) <Ms2ger>
Status: RESOLVED FIXED    
Severity: Normal CC: andersca, bugs-noreply, cgarcia, clopez, commit-queue
Priority: P2    
Version: WebKit Nightly Build   
Hardware: Unspecified   
OS: Unspecified   
Attachments:
Description Flags
Patch
none
Patch
none
Patch none

Description Ms2ger (he/him; ⌚ UTC+1/+2) 2017-08-23 02:42:41 PDT
.
Comment 1 Ms2ger (he/him; ⌚ UTC+1/+2) 2017-08-23 02:44:58 PDT
Created attachment 318860 [details]
Patch
Comment 2 Carlos Alberto Lopez Perez 2017-08-23 03:39:48 PDT
Comment on attachment 318860 [details]
Patch

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

> Tools/TestWebKitAPI/Tests/WebKitGLib/TestWebExtensions.cpp:151
> -        "document.open(1, 2, 3);";
> +        "window.open(1, 2, 3);";

What mean the parameters 1, 2, 3 here?
Comment 3 Ms2ger (he/him; ⌚ UTC+1/+2) 2017-08-23 03:54:22 PDT
(In reply to Carlos Alberto Lopez Perez from comment #2)
> Comment on attachment 318860 [details]
> Patch
> 
> View in context:
> https://bugs.webkit.org/attachment.cgi?id=318860&action=review
> 
> > Tools/TestWebKitAPI/Tests/WebKitGLib/TestWebExtensions.cpp:151
> > -        "document.open(1, 2, 3);";
> > +        "window.open(1, 2, 3);";
> 
> What mean the parameters 1, 2, 3 here?

The forwarding to window.open() only happens with at least three arguments. No idea why this used such a roundabout approach; CC'ing some people from bug 103377.
Comment 4 Carlos Alberto Lopez Perez 2017-08-23 03:59:00 PDT
(In reply to Ms2ger from comment #3)
> (In reply to Carlos Alberto Lopez Perez from comment #2)
> > Comment on attachment 318860 [details]
> > Patch
> > 
> > View in context:
> > https://bugs.webkit.org/attachment.cgi?id=318860&action=review
> > 
> > > Tools/TestWebKitAPI/Tests/WebKitGLib/TestWebExtensions.cpp:151
> > > -        "document.open(1, 2, 3);";
> > > +        "window.open(1, 2, 3);";
> > 
> > What mean the parameters 1, 2, 3 here?
> 
> The forwarding to window.open() only happens with at least three arguments.
> No idea why this used such a roundabout approach; CC'ing some people from
> bug 103377.

Just doing window.open() seems to work here to make the test pass
Comment 5 Carlos Alberto Lopez Perez 2017-08-23 04:05:52 PDT
(In reply to Carlos Alberto Lopez Perez from comment #4)
> (In reply to Ms2ger from comment #3)
> > (In reply to Carlos Alberto Lopez Perez from comment #2)
> > > Comment on attachment 318860 [details]
> > > Patch
> > > 
> > > View in context:
> > > https://bugs.webkit.org/attachment.cgi?id=318860&action=review
> > > 
> > > > Tools/TestWebKitAPI/Tests/WebKitGLib/TestWebExtensions.cpp:151
> > > > -        "document.open(1, 2, 3);";
> > > > +        "window.open(1, 2, 3);";
> > > 
> > > What mean the parameters 1, 2, 3 here?
> > 
> > The forwarding to window.open() only happens with at least three arguments.
> > No idea why this used such a roundabout approach; CC'ing some people from
> > bug 103377.
> 

Ah! I see what you mean.. previously (before r218437) 3 parameter where needed to pass the call from document.open to window.open()

> Just doing window.open() seems to work here to make the test pass

Now simply calling window.open without any parameter seems enough
Comment 6 Ms2ger (he/him; ⌚ UTC+1/+2) 2017-08-23 06:41:51 PDT
Created attachment 318865 [details]
Patch
Comment 7 Ms2ger (he/him; ⌚ UTC+1/+2) 2017-08-23 06:49:39 PDT
Since I don't know what purpose the function call served, I just removed it entirely.
Comment 8 Carlos Alberto Lopez Perez 2017-08-23 07:10:22 PDT
Comment on attachment 318865 [details]
Patch

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

> Tools/TestWebKitAPI/Tests/WebKitGLib/TestWebExtensions.cpp:150
> -        "window.open = function () { alert('Main World'); }\n"
> -        "document.open(1, 2, 3);";
> +        "alert('Main World');";

Looks fine to me, but I prefer to wait for cgarcia r+ here (as I'm a bit confused about the previous window.open usage here and maybe there is something i'm overlooking)
Comment 9 Carlos Garcia Campos 2017-08-28 00:43:12 PDT
I find the bug title a bit confusing, it's not that the test has a way of running pop ups, that was the way to test isolated worlds, it was actually a "port" of the layout test http/tests/security/isolatedWorld/document-open.html.
Comment 10 Carlos Garcia Campos 2017-08-28 00:46:35 PDT
Comment on attachment 318865 [details]
Patch

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

Thanks for looking at this failure, it has been in my TODO since it started to fail.

> Tools/TestWebKitAPI/Tests/WebKitGLib/TestWebExtensions.cpp:161
> -        "window.open = function () { alert('Isolated World'); }\n"
> -        "document.open(1, 2, 3);";
> +        "alert('Isolated World');";

I'm not sure this is testing what we want, running this alert in the main world would still show an alert with the text 'Isolated World'. Here we were testing that property open of window can be set in an isolated world and it can be used, without affecting the normal world. Maybe we can simply keep the window.open line but use window open directly instead of document.open?
Comment 11 Carlos Garcia Campos 2017-08-28 02:38:19 PDT
Comment on attachment 318865 [details]
Patch

Sorry, I used the wrong r flag. r- because I don't think the test is correct.
Comment 12 Ms2ger (he/him; ⌚ UTC+1/+2) 2017-08-28 03:54:21 PDT
Created attachment 319173 [details]
Patch
Comment 13 Carlos Garcia Campos 2017-08-28 04:17:00 PDT
Comment on attachment 319173 [details]
Patch

Thanks!
Comment 14 WebKit Commit Bot 2017-08-28 04:46:18 PDT
Comment on attachment 319173 [details]
Patch

Clearing flags on attachment: 319173

Committed r221240: <http://trac.webkit.org/changeset/221240>
Comment 15 WebKit Commit Bot 2017-08-28 04:46:19 PDT
All reviewed patches have been landed.  Closing bug.