Bug 126935

Summary: Add support for managing WebGL load policy
Product: WebKit Reporter: Roger Fong <roger_fong>
Component: WebGLAssignee: Roger Fong <roger_fong>
Status: RESOLVED FIXED    
Severity: Normal CC: andersca, bfulgham, buildbot, commit-queue, dino, eflews.bot, esprehn+autocc, gyuyoung.kim, japhet, jonlee, ltilve+ews, piotr.grad, p.szymanski3, rniwa, roger_fong, sam, thorton, xan.lopez
Priority: P2    
Version: 528+ (Nightly build)   
Hardware: Unspecified   
OS: Unspecified   
Bug Depends on: 127009    
Bug Blocks: 127042, 127044    
Attachments:
Description Flags
Patch
none
Patch
none
Patch
none
Patch
none
Patch
none
Archive of layout-test-results from webkit-ews-04 for mac-mountainlion
none
Archive of layout-test-results from webkit-ews-09 for mac-mountainlion-wk2
none
Archive of layout-test-results from webkit-ews-06 for mac-mountainlion
none
Archive of layout-test-results from webkit-ews-11 for mac-mountainlion-wk2
none
WebKit2 Patch
none
WebKit2 Patch v2
none
WebKit2 patch v3
none
Patch thorton: review+

Roger Fong
Reported 2014-01-13 15:15:55 PST
Add support for handling WebGL load policy. This includes adding a letting the UI process know when we are attempting to create a webgl context and providing API to query for the WebGL load policy associated with a host.
Attachments
Patch (25.27 KB, patch)
2014-01-13 15:46 PST, Roger Fong
no flags
Patch (26.42 KB, patch)
2014-01-13 17:28 PST, Roger Fong
no flags
Patch (27.34 KB, patch)
2014-01-13 18:05 PST, Roger Fong
no flags
Patch (2.31 KB, patch)
2014-01-13 20:27 PST, Roger Fong
no flags
Patch (28.24 KB, patch)
2014-01-14 09:48 PST, Roger Fong
no flags
Archive of layout-test-results from webkit-ews-04 for mac-mountainlion (547.02 KB, application/zip)
2014-01-14 11:32 PST, Build Bot
no flags
Archive of layout-test-results from webkit-ews-09 for mac-mountainlion-wk2 (500.92 KB, application/zip)
2014-01-14 12:06 PST, Build Bot
no flags
Archive of layout-test-results from webkit-ews-06 for mac-mountainlion (530.11 KB, application/zip)
2014-01-14 12:32 PST, Build Bot
no flags
Archive of layout-test-results from webkit-ews-11 for mac-mountainlion-wk2 (496.15 KB, application/zip)
2014-01-14 13:06 PST, Build Bot
no flags
WebKit2 Patch (20.42 KB, patch)
2014-01-14 18:58 PST, Roger Fong
no flags
WebKit2 Patch v2 (32.75 KB, patch)
2014-01-15 10:23 PST, Roger Fong
no flags
WebKit2 patch v3 (18.94 KB, patch)
2014-01-15 16:33 PST, Roger Fong
no flags
Patch (18.87 KB, patch)
2014-01-16 11:33 PST, Roger Fong
thorton: review+
Roger Fong
Comment 1 2014-01-13 15:46:24 PST
Build Bot
Comment 2 2014-01-13 16:27:01 PST
Build Bot
Comment 3 2014-01-13 16:43:28 PST
Roger Fong
Comment 4 2014-01-13 16:58:36 PST
Roger Fong
Comment 5 2014-01-13 17:28:20 PST
Build Bot
Comment 6 2014-01-13 17:53:11 PST
Roger Fong
Comment 7 2014-01-13 18:05:43 PST
Jon Lee
Comment 8 2014-01-13 19:04:15 PST
Comment on attachment 221094 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=221094&action=review > Source/WebCore/html/HTMLCanvasElement.cpp:235 > + return 0; nullptr. > Source/WebCore/html/HTMLCanvasElement.cpp:238 > + return 0; ditto.
Brent Fulgham
Comment 9 2014-01-13 19:31:06 PST
Comment on attachment 221094 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=221094&action=review This looks great! My only suggestion would be to make as many of these 'const' as possible. > Source/WebCore/loader/FrameLoaderClient.h:334 > + virtual WebGLLoadPolicy webGLPolicyForHost(const String&) { return WebGLAsk; } Could this be const? > Source/WebKit2/UIProcess/WebLoaderClient.h:108 > + void webGLLoadPolicy(WebPageProxy*, WebCore::WebGLLoadPolicy&, const String&); Const? > Source/WebKit2/UIProcess/WebPageProxy.cpp:2684 > +void WebPageProxy::webGLContextCreated(const String& pageURLString) Const! > Source/WebKit2/UIProcess/WebPageProxy.cpp:2689 > +void WebPageProxy::webGLPolicyForHost(const String& host, uint32_t& loadPolicy) Could probably be const. > Source/WebKit2/UIProcess/WebUIClient.cpp:211 > +void WebUIClient::webGLContextCreated(WebPageProxy* page, const String& originatingURL) Const > Source/WebKit2/UIProcess/API/C/WKAPICast.h:476 > +inline WebCore::WebGLLoadPolicy toWebGLLoadPolicy(WKWebGLLoadPolicy webGLLoadPolicy) Const. > Source/WebKit2/WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp:1382 > +WebCore::WebGLLoadPolicy WebFrameLoaderClient::webGLPolicyForHost(const String& host) Const as well.
Build Bot
Comment 10 2014-01-13 19:48:00 PST
Build Bot
Comment 11 2014-01-13 20:10:49 PST
Roger Fong
Comment 12 2014-01-13 20:12:51 PST
(In reply to comment #9) I'm assuming you mean the methods themselves should be const'ified if they're returning something that isn't a pointer (and hence won't be modified) right? All the parameters are about as const'ified as I can make em already. A lot of them are references that definitely shouldn't be const.
Roger Fong
Comment 13 2014-01-13 20:27:30 PST
EFL EWS Bot
Comment 14 2014-01-13 20:37:01 PST
Build Bot
Comment 15 2014-01-13 21:01:33 PST
Brent Fulgham
Comment 16 2014-01-13 21:04:22 PST
(In reply to comment #12) > (In reply to comment #9) > > I'm assuming you mean the methods themselves should be const'ified if they're returning something that isn't a pointer (and hence won't be modified) right? Right. These methods don't seem to modify any internal state, so it would be best to mark them const to maximize the methods where you can call your new interface.
Build Bot
Comment 17 2014-01-13 21:15:20 PST
Roger Fong
Comment 18 2014-01-14 09:45:52 PST
(In reply to comment #17) > (From update of attachment 221101 [details]) > Attachment 221101 [details] did not pass mac-ews (mac): > Output: http://webkit-queues.appspot.com/results/6668306094227456 My local run of build-webkit tells me that everything built swimmingly...not sure what's going on here..
Roger Fong
Comment 19 2014-01-14 09:47:16 PST
(In reply to comment #18) > (In reply to comment #17) > > (From update of attachment 221101 [details] [details]) > > Attachment 221101 [details] [details] did not pass mac-ews (mac): > > Output: http://webkit-queues.appspot.com/results/6668306094227456 > > My local run of build-webkit tells me that everything built swimmingly...not sure what's going on here.. And now EWS is telling me to get rid of the things that it just told me to add in. Will reland the exact same patch again, because I don't trust EWS.
Roger Fong
Comment 20 2014-01-14 09:48:38 PST
Build Bot
Comment 21 2014-01-14 11:32:02 PST
Comment on attachment 221172 [details] Patch Attachment 221172 [details] did not pass mac-ews (mac): Output: http://webkit-queues.appspot.com/results/5621195886034944 New failing tests: http/tests/canvas/webgl/origin-clean-conformance.html http/tests/webgl/1.0.2/texSubImage2DHTML.html http/tests/security/webgl-remote-read-remote-image-allowed.html http/tests/security/webgl-remote-read-remote-image-allowed-with-credentials.html http/tests/webgl/1.0.2/texImage2DHTML.html http/tests/security/webgl-remote-read-remote-image-blocked-no-crossorigin.html
Build Bot
Comment 22 2014-01-14 11:32:04 PST
Created attachment 221184 [details] Archive of layout-test-results from webkit-ews-04 for mac-mountainlion The attached test failures were seen while running run-webkit-tests on the mac-ews. Bot: webkit-ews-04 Port: mac-mountainlion Platform: Mac OS X 10.8.5
Roger Fong
Comment 23 2014-01-14 11:53:04 PST
It is unsurprising that these tests are now failing seeing as the we won't immediately load because a webglcontext has now been created and those tests are being run from a server. I will skip these tests in a followup patch and will make the correct fix for them in the near future. All previous review comments have been addressed, can I get an r+?
Build Bot
Comment 24 2014-01-14 12:06:31 PST
Comment on attachment 221172 [details] Patch Attachment 221172 [details] did not pass mac-wk2-ews (mac-wk2): Output: http://webkit-queues.appspot.com/results/5490028792774656 New failing tests: http/tests/canvas/webgl/origin-clean-conformance.html http/tests/webgl/1.0.2/texSubImage2DHTML.html http/tests/security/webgl-remote-read-remote-image-allowed.html http/tests/security/webgl-remote-read-remote-image-allowed-with-credentials.html http/tests/webgl/1.0.2/texImage2DHTML.html http/tests/security/webgl-remote-read-remote-image-blocked-no-crossorigin.html
Build Bot
Comment 25 2014-01-14 12:06:36 PST
Created attachment 221186 [details] Archive of layout-test-results from webkit-ews-09 for mac-mountainlion-wk2 The attached test failures were seen while running run-webkit-tests on the mac-wk2-ews. Bot: webkit-ews-09 Port: mac-mountainlion-wk2 Platform: Mac OS X 10.8.5
Build Bot
Comment 26 2014-01-14 12:32:15 PST
Comment on attachment 221172 [details] Patch Attachment 221172 [details] did not pass mac-ews (mac): Output: http://webkit-queues.appspot.com/results/5138185071886336 New failing tests: http/tests/canvas/webgl/origin-clean-conformance.html http/tests/webgl/1.0.2/texSubImage2DHTML.html http/tests/security/webgl-remote-read-remote-image-allowed.html http/tests/security/webgl-remote-read-remote-image-allowed-with-credentials.html http/tests/webgl/1.0.2/texImage2DHTML.html http/tests/security/webgl-remote-read-remote-image-blocked-no-crossorigin.html
Build Bot
Comment 27 2014-01-14 12:32:18 PST
Created attachment 221188 [details] Archive of layout-test-results from webkit-ews-06 for mac-mountainlion The attached test failures were seen while running run-webkit-tests on the mac-ews. Bot: webkit-ews-06 Port: mac-mountainlion Platform: Mac OS X 10.8.5
Brent Fulgham
Comment 28 2014-01-14 12:42:08 PST
Comment on attachment 221172 [details] Patch r=me.
Build Bot
Comment 29 2014-01-14 13:06:45 PST
Comment on attachment 221172 [details] Patch Attachment 221172 [details] did not pass mac-wk2-ews (mac-wk2): Output: http://webkit-queues.appspot.com/results/6404822467084288 New failing tests: http/tests/canvas/webgl/origin-clean-conformance.html http/tests/webgl/1.0.2/texSubImage2DHTML.html http/tests/security/webgl-remote-read-remote-image-allowed.html http/tests/security/webgl-remote-read-remote-image-allowed-with-credentials.html http/tests/webgl/1.0.2/texImage2DHTML.html http/tests/security/webgl-remote-read-remote-image-blocked-no-crossorigin.html
Build Bot
Comment 30 2014-01-14 13:06:50 PST
Created attachment 221193 [details] Archive of layout-test-results from webkit-ews-11 for mac-mountainlion-wk2 The attached test failures were seen while running run-webkit-tests on the mac-wk2-ews. Bot: webkit-ews-11 Port: mac-mountainlion-wk2 Platform: Mac OS X 10.8.5
Roger Fong
Comment 31 2014-01-14 13:37:57 PST
Sam Weinig
Comment 32 2014-01-14 13:58:11 PST
(In reply to comment #28) > (From update of attachment 221172 [details]) > r=me. This needs review from a WebKit2 maintainer. Please roll this out until that happens.
WebKit Commit Bot
Comment 33 2014-01-14 14:06:26 PST
Re-opened since this is blocked by bug 127009
Roger Fong
Comment 34 2014-01-14 17:18:38 PST
Reping for review. We'd like to get this in ASAP.
Roger Fong
Comment 35 2014-01-14 18:58:40 PST
Created attachment 221225 [details] WebKit2 Patch
Przemyslaw Szymanski
Comment 36 2014-01-15 02:58:42 PST
Hello. I'm not an expert but with this patch MiniBrowser with debug build and EFL port does not support WebGL. Try to run Khronos conformance tests: https://www.khronos.org/registry/webgl/sdk/tests/webgl-conformance-tests.html?version=1.0.3 or this sites http://get.webgl.org/ https://www.khronos.org/registry/webgl/sdk/demos/webkit/SpiritBox.html This page fails to create webgl context because this code is called: if (policy == WebGLAsk) { page->chrome().client().webGLContextCreated(this); return nullptr; } In my opinion we have a bug now.
Piotr Grad
Comment 37 2014-01-15 05:07:46 PST
(In reply to comment #35) > Created an attachment (id=221225) [details] > Patch Please rollback 162036 as this patch breaks WebGL on Win, GTK & EFL.
Roger Fong
Comment 38 2014-01-15 09:52:44 PST
(In reply to comment #37) > (In reply to comment #35) > > Created an attachment (id=221225) [details] [details] > > Patch > > Please rollback 162036 as this patch breaks WebGL on Win, GTK & EFL. I'm seeing all green on Win. Where do you see the failure?
Roger Fong
Comment 39 2014-01-15 09:55:13 PST
(In reply to comment #38) > (In reply to comment #37) > > (In reply to comment #35) > > > Created an attachment (id=221225) [details] [details] [details] > > > Patch > > > > Please rollback 162036 as this patch breaks WebGL on Win, GTK & EFL. > > I'm seeing all green on Win. Where do you see the failure? Oh you must mean WinCairo. What kind of failures are you seeing?
Roger Fong
Comment 40 2014-01-15 09:58:21 PST
(In reply to comment #36) > Hello. I'm not an expert but with this patch MiniBrowser with debug build and EFL port does not support WebGL. Try to run Khronos conformance tests: > https://www.khronos.org/registry/webgl/sdk/tests/webgl-conformance-tests.html?version=1.0.3 > > or this sites > http://get.webgl.org/ > https://www.khronos.org/registry/webgl/sdk/demos/webkit/SpiritBox.html > > This page fails to create webgl context because this code is called: > if (policy == WebGLAsk) { > page->chrome().client().webGLContextCreated(this); > return nullptr; > } > > In my opinion we have a bug now. Ah you're right. I'll need to add some sort of check to disable this check when the client doesn't want it. I'll comment it out for now and put a fix me.
Roger Fong
Comment 41 2014-01-15 10:08:13 PST
In theory, fixed it here: http://trac.webkit.org/changeset/162078 Let me know if it's still broken
Roger Fong
Comment 42 2014-01-15 10:23:46 PST
Created attachment 221283 [details] WebKit2 Patch v2
Roger Fong
Comment 43 2014-01-15 16:33:48 PST
Created attachment 221314 [details] WebKit2 patch v3
Piotr Grad
Comment 44 2014-01-16 00:21:16 PST
(In reply to comment #39) > (In reply to comment #38) > > (In reply to comment #37) > > > (In reply to comment #35) > > > > Created an attachment (id=221225) [details] [details] [details] [details] > > > > Patch > > > > > > Please rollback 162036 as this patch breaks WebGL on Win, GTK & EFL. > > > > I'm seeing all green on Win. Where do you see the failure? > > Oh you must mean WinCairo. What kind of failures are you seeing? I didn't mean build break, but that WebGL was not working. Don't know if its working now.
Brent Fulgham
Comment 45 2014-01-16 09:05:25 PST
(In reply to comment #44) > > > > Please rollback 162036 as this patch breaks WebGL on Win, GTK & EFL. > > > > > > I'm seeing all green on Win. Where do you see the failure? > > > > Oh you must mean WinCairo. What kind of failures are you seeing? > > I didn't mean build break, but that WebGL was not working. Don't know if its working now. This is now working for me. I think he was referring to the WebGL load policy defaulting to 'off', with no way to activate it. For example, yesterday's OS X nightly couldn't be used for WebGL content because it rejected every WebGL site. That behavior was fixed by your changes yesterday.
Roger Fong
Comment 46 2014-01-16 11:33:41 PST
Tim Horton
Comment 47 2014-01-16 11:42:26 PST
Comment on attachment 221395 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=221395&action=review > Source/WebKit2/UIProcess/WebLoaderClient.cpp:337 > +WebCore::WebGLLoadPolicy WebLoaderClient::webGLLoadPolicy(WebPageProxy* page, const String& site) const s/site/url/, I think? > Source/WebKit2/UIProcess/WebPageProxy.cpp:2683 > +void WebPageProxy::webGLPolicyForSite(const String& site, uint32_t& loadPolicy) s/Site/URL/, I think? > Source/WebKit2/UIProcess/WebPageProxy.h:930 > + void webGLPolicyForSite(const String& site, uint32_t& loadPolicy); ditto > Source/WebKit2/UIProcess/WebPageProxy.messages.in:37 > + WebGLPolicyForSite(String host) -> (uint32_t loadPolicy) ditto > Source/WebKit2/UIProcess/API/C/WKAPICast.h:488 > + return WebCore::WebGLAsk; your default in other places seems to be Allow; why Ask here? > Source/WebKit2/WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp:1342 > +WebCore::WebGLLoadPolicy WebFrameLoaderClient::webGLPolicyForSite(const String& site) const ditto > Source/WebKit2/WebProcess/WebCoreSupport/WebFrameLoaderClient.h:190 > + virtual WebCore::WebGLLoadPolicy webGLPolicyForSite(const String&) const OVERRIDE; ditto > Source/WebKit2/WebProcess/WebPage/WebPage.cpp:603 > +WebCore::WebGLLoadPolicy WebPage::webGLPolicyForSite(WebFrame* frame, const String& url) ditto (and here hilariously the argument is url already) > Source/WebKit2/WebProcess/WebPage/WebPage.h:293 > + WebCore::WebGLLoadPolicy webGLPolicyForSite(WebFrame*, const String&); ditto
Note You need to log in before you can comment on or make changes to this bug.