|
|
Created:
4 years ago by tyoshino (SeeGerritForStatus) Modified:
4 years ago CC:
chromium-reviews, michaeln, jsbell+serviceworker_chromium.org, kenjibaheux+watch_chromium.org, shimazu+serviceworker_chromium.org, yhirano+watch_chromium.org, serviceworker-reviews, tyoshino+watch_chromium.org, nhiroki, haraken, kinuko+serviceworker, blink-reviews, horo+watch_chromium.org, falken+watch_chromium.org, tzik Target Ref:
refs/pending/heads/master Project:
chromium Visibility:
Public. |
DescriptionMake WebSocket available again in service workers
The patch https://codereview.chromium.org/2284473002/ was basically a
refactoring change, but it also included a change that it started using
the InterfaceProvider instance of the LocalFrame of the associated
Document if any. However, in a service worker, the LocalFrame returns
the empty provider obtained by calling
InterfaceProvider::getEmptyInterfaceProvider(). This is because the
WebEmbeddedWorkerImpl used for service workers doesn't override
the WebFrameClient::interfaceProvider() method which returns nullptr by
default while one on the WebSharedWorkerImpl and RenderFrameImpl
returns an effective InterfaceProvider instance.
This patch fixes the issue by changing the code to use the
InterfaceProvider of the LocalFrame only when it's not the empty
provider.
R=falken@chromium.org
TBR=yhirano@chromium.org
BUG=671588
Committed: https://crrev.com/dd3b58a1f0073215d58bcb8dc216b89e546bc9f7
Cr-Commit-Position: refs/heads/master@{#437406}
Patch Set 1 #Patch Set 2 : a #
Total comments: 10
Patch Set 3 : Use platform interface provide when the frame() doesn't have it #Patch Set 4 : Addressed #5 #Patch Set 5 : Removed unnecessary line #
Total comments: 6
Patch Set 6 : Don't use the interface provider returned by the frame if it's empty provider #Patch Set 7 : Addressed #15 #
Total comments: 2
Patch Set 8 : Addressed #26 #
Messages
Total messages: 40 (25 generated)
Description was changed from ========== Make WebSocket available again in Service Workers BUG=671588 ========== to ========== Make WebSocket available again in Service Workers BUG=671588 ==========
The CQ bit was checked by tyoshino@chromium.org to run a CQ dry run
Dry run: CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/v2/patch-status/codereview.chromium.or...
falken@chromium.org changed reviewers: + falken@chromium.org
Thanks for the fix. Could you add to the CL description why "(document()->frame()->interfaceProvider())" was incorrect? https://codereview.chromium.org/2564493002/diff/20001/third_party/WebKit/Layo... File third_party/WebKit/LayoutTests/http/tests/serviceworker/websocket/resources/simple.js (right): https://codereview.chromium.org/2564493002/diff/20001/third_party/WebKit/Layo... third_party/WebKit/LayoutTests/http/tests/serviceworker/websocket/resources/simple.js:34: }; this file should also be indented in service worker style. https://codereview.chromium.org/2564493002/diff/20001/third_party/WebKit/Layo... File third_party/WebKit/LayoutTests/http/tests/serviceworker/websocket/websocket-in-service-worker.html (right): https://codereview.chromium.org/2564493002/diff/20001/third_party/WebKit/Layo... third_party/WebKit/LayoutTests/http/tests/serviceworker/websocket/websocket-in-service-worker.html:5: <script src="/resources/get-host-info.js?pipe=sub"></script> i don't think you need this https://codereview.chromium.org/2564493002/diff/20001/third_party/WebKit/Layo... third_party/WebKit/LayoutTests/http/tests/serviceworker/websocket/websocket-in-service-worker.html:24: registration.active.postMessage({port: channel.port2}, [channel.port2]); You don't need ports. Just registration.active.postMessage(). And inside the worker, you do event.source.postMessage(). https://codereview.chromium.org/2564493002/diff/20001/third_party/WebKit/Layo... third_party/WebKit/LayoutTests/http/tests/serviceworker/websocket/websocket-in-service-worker.html:28: return service_worker_unregister(t, SCOPE); you can just call add_completion_callback(() => { r.unregister(); }) after registration so we cleanup even if the test fails. https://codereview.chromium.org/2564493002/diff/20001/third_party/WebKit/Layo... third_party/WebKit/LayoutTests/http/tests/serviceworker/websocket/websocket-in-service-worker.html:30: }, 'Verify WebSockets can be created in a Service Worker'); this should be indented in service worker test style: promise_test(t => { const ....; return unregistre_and_register(...) .then(r => { registratino = r; }) .then(() => { ..... }); }, 'Verify');
The CQ bit was unchecked by commit-bot@chromium.org
Dry run: Try jobs failed on following builders: android_n5x_swarming_rel on master.tryserver.chromium.android (JOB_FAILED, https://build.chromium.org/p/tryserver.chromium.android/builders/android_n5x_...)
The CQ bit was checked by tyoshino@chromium.org to run a CQ dry run
Dry run: CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/v2/patch-status/codereview.chromium.or...
https://codereview.chromium.org/2564493002/diff/20001/third_party/WebKit/Layo... File third_party/WebKit/LayoutTests/http/tests/serviceworker/websocket/resources/simple.js (right): https://codereview.chromium.org/2564493002/diff/20001/third_party/WebKit/Layo... third_party/WebKit/LayoutTests/http/tests/serviceworker/websocket/resources/simple.js:34: }; On 2016/12/08 07:29:26, falken wrote: > this file should also be indented in service worker style. Done. https://codereview.chromium.org/2564493002/diff/20001/third_party/WebKit/Layo... File third_party/WebKit/LayoutTests/http/tests/serviceworker/websocket/websocket-in-service-worker.html (right): https://codereview.chromium.org/2564493002/diff/20001/third_party/WebKit/Layo... third_party/WebKit/LayoutTests/http/tests/serviceworker/websocket/websocket-in-service-worker.html:5: <script src="/resources/get-host-info.js?pipe=sub"></script> On 2016/12/08 07:29:26, falken wrote: > i don't think you need this Done. https://codereview.chromium.org/2564493002/diff/20001/third_party/WebKit/Layo... third_party/WebKit/LayoutTests/http/tests/serviceworker/websocket/websocket-in-service-worker.html:24: registration.active.postMessage({port: channel.port2}, [channel.port2]); On 2016/12/08 07:29:26, falken wrote: > You don't need ports. Just registration.active.postMessage(). And inside the > worker, you do event.source.postMessage(). Done. https://codereview.chromium.org/2564493002/diff/20001/third_party/WebKit/Layo... third_party/WebKit/LayoutTests/http/tests/serviceworker/websocket/websocket-in-service-worker.html:28: return service_worker_unregister(t, SCOPE); On 2016/12/08 07:29:26, falken wrote: > you can just call add_completion_callback(() => { r.unregister(); }) after > registration so we cleanup even if the test fails. Done. https://codereview.chromium.org/2564493002/diff/20001/third_party/WebKit/Layo... third_party/WebKit/LayoutTests/http/tests/serviceworker/websocket/websocket-in-service-worker.html:30: }, 'Verify WebSockets can be created in a Service Worker'); On 2016/12/08 07:29:26, falken wrote: > this should be indented in service worker test style: > > promise_test(t => { > const ....; > return unregistre_and_register(...) > .then(r => { > registratino = r; > }) > .then(() => { > ..... > }); > }, 'Verify'); Done.
We need to change LocalFrame to make it distinguishable whether the retrieved interface provider is empty impl or not.
The CQ bit was checked by tyoshino@chromium.org to run a CQ dry run
Dry run: CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/v2/patch-status/codereview.chromium.or...
tyoshino@chromium.org changed reviewers: + yhirano@chromium.org
https://codereview.chromium.org/2564493002/diff/80001/third_party/WebKit/Layo... File third_party/WebKit/LayoutTests/http/tests/serviceworker/websocket/resources/simple.js (right): https://codereview.chromium.org/2564493002/diff/80001/third_party/WebKit/Layo... third_party/WebKit/LayoutTests/http/tests/serviceworker/websocket/resources/simple.js:34: }; sorry I gave a bad review about simple.js formatting. the original formatting was correct since none of these functions are function arguments. so basically this whole file should be two-space indent, not four. i.e.: function a(b) { // two space indent console.log('hi'); } onmessage = function(a) { // two space indent console.log('hi'); }; is actually correct. but we would do: .then(r => { add_completion_callback(...) }); as in websocket-in-service-worker.html since the function is an argument to then(). https://codereview.chromium.org/2564493002/diff/80001/third_party/WebKit/Layo... File third_party/WebKit/LayoutTests/http/tests/serviceworker/websocket/websocket-in-service-worker.html (right): https://codereview.chromium.org/2564493002/diff/80001/third_party/WebKit/Layo... third_party/WebKit/LayoutTests/http/tests/serviceworker/websocket/websocket-in-service-worker.html:19: navigator.serviceWorker.onmessage = t.step_func(msg => { generally you don't need step_func in promise chain promise_tests since an error in the promise chain bubbles up to result in a rejected promise returned by the test. you could confirm manually. https://codereview.chromium.org/2564493002/diff/80001/third_party/WebKit/Layo... third_party/WebKit/LayoutTests/http/tests/serviceworker/websocket/websocket-in-service-worker.html:26: }, 'Verify WebSockets can be created in a Service Worker'); nit: indent line 26 an additional two spaces
https://codereview.chromium.org/2564493002/diff/80001/third_party/WebKit/Layo... File third_party/WebKit/LayoutTests/http/tests/serviceworker/websocket/resources/simple.js (right): https://codereview.chromium.org/2564493002/diff/80001/third_party/WebKit/Layo... third_party/WebKit/LayoutTests/http/tests/serviceworker/websocket/resources/simple.js:34: }; On 2016/12/08 13:12:29, falken wrote: > sorry I gave a bad review about simple.js formatting. the original formatting > was correct since none of these functions are function arguments. so basically > this whole file should be two-space indent, not four. i.e.: > > function a(b) { > // two space indent > console.log('hi'); > } > > onmessage = function(a) { > // two space indent > console.log('hi'); > }; > > is actually correct. but we would do: > > .then(r => { > add_completion_callback(...) > }); > > as in websocket-in-service-worker.html since the function is an argument to > then(). Oops. No. It's my bad, sorry. I was hurried and misunderstood that SW directories are still using 4sp indent. You were talking about lines right after line wrapping for e.g. { and (. Fixed! https://codereview.chromium.org/2564493002/diff/80001/third_party/WebKit/Layo... File third_party/WebKit/LayoutTests/http/tests/serviceworker/websocket/websocket-in-service-worker.html (right): https://codereview.chromium.org/2564493002/diff/80001/third_party/WebKit/Layo... third_party/WebKit/LayoutTests/http/tests/serviceworker/websocket/websocket-in-service-worker.html:19: navigator.serviceWorker.onmessage = t.step_func(msg => { On 2016/12/08 13:12:30, falken wrote: > generally you don't need step_func in promise chain promise_tests since an error > in the promise chain bubbles up to result in a rejected promise returned by the > test. you could confirm manually. Yes, but this line is setting a handler function to onmessage. Not inside .then() or the Promise construction function where any error will bubble up to the Promise and get propagated to itself or the promise returned by the .then(). AssertionErrors wouldn't get handled correctly by the testharness unless we insert step_func() here. https://codereview.chromium.org/2564493002/diff/80001/third_party/WebKit/Layo... third_party/WebKit/LayoutTests/http/tests/serviceworker/websocket/websocket-in-service-worker.html:26: }, 'Verify WebSockets can be created in a Service Worker'); On 2016/12/08 13:12:30, falken wrote: > nit: indent line 26 an additional two spaces Done.
Sorry, I've uploaded the patch with the fixes now. PTAL at ps7. In ps6, I've finally fixed the issue while keeping the Android third-party blocking working. I said: > We need to change LocalFrame to make it distinguishable whether the retrieved interface provider is empty impl or not. But this would need more code change. Instead, I just added a comparison with InterfaceProvider::getEmptyInterfaceProvider() so that we use document()->frame()->interfaceProvider() only when it's not the empty provider. InterfaceProvider::getEmptyInterfaceProvider() returns a static instance of InterfaceProvider with no-op impl. A LocalFrame::interfaceProvider() returns the empty provider when a nullptr was provided to LocalFrame::create(), and otherwise it returns the InterfaceProvider provided to LocalFrame::create().
The CQ bit was checked by tyoshino@chromium.org to run a CQ dry run
Dry run: CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/v2/patch-status/codereview.chromium.or...
Description was changed from ========== Make WebSocket available again in Service Workers BUG=671588 ========== to ========== Make WebSocket available again in service workers The patch https://codereview.chromium.org/2284473002/ was basically a refactoring change, but it also included a change that it started using the InterfaceProvider instance of the LocalFrame of the associated Document if any. However, in a service worker, the LocalFrame returns the empty provider obtained by calling InterfaceProvider::getEmptyInterfaceProvider(). This is because the WebEmbeddedWorkerImpl used for service workers doesn't override the WebFrameClient::interfaceProvider() method which returns nullptr by default while one on the WebSharedWorkerImpl and RenderFrameImpl returns an effective InterfaceProvider instance. This patch fixes the issue by changing the code to use the InterfaceProvider of the LocalFrame only when it's not the empty provider. BUG=671588 ==========
Description was changed from ========== Make WebSocket available again in service workers The patch https://codereview.chromium.org/2284473002/ was basically a refactoring change, but it also included a change that it started using the InterfaceProvider instance of the LocalFrame of the associated Document if any. However, in a service worker, the LocalFrame returns the empty provider obtained by calling InterfaceProvider::getEmptyInterfaceProvider(). This is because the WebEmbeddedWorkerImpl used for service workers doesn't override the WebFrameClient::interfaceProvider() method which returns nullptr by default while one on the WebSharedWorkerImpl and RenderFrameImpl returns an effective InterfaceProvider instance. This patch fixes the issue by changing the code to use the InterfaceProvider of the LocalFrame only when it's not the empty provider. BUG=671588 ========== to ========== Make WebSocket available again in service workers The patch https://codereview.chromium.org/2284473002/ was basically a refactoring change, but it also included a change that it started using the InterfaceProvider instance of the LocalFrame of the associated Document if any. However, in a service worker, the LocalFrame returns the empty provider obtained by calling InterfaceProvider::getEmptyInterfaceProvider(). This is because the WebEmbeddedWorkerImpl used for service workers doesn't override the WebFrameClient::interfaceProvider() method which returns nullptr by default while one on the WebSharedWorkerImpl and RenderFrameImpl returns an effective InterfaceProvider instance. This patch fixes the issue by changing the code to use the InterfaceProvider of the LocalFrame only when it's not the empty provider. BUG=671588 ==========
I've updated the CL description to explain all the background and what change this patch made.
OK. All bots are green now for ps6.
The CQ bit was unchecked by commit-bot@chromium.org
Dry run: This issue passed the CQ dry run.
lgtm https://codereview.chromium.org/2564493002/diff/120001/third_party/WebKit/Lay... File third_party/WebKit/LayoutTests/http/tests/serviceworker/websocket/resources/simple.js (right): https://codereview.chromium.org/2564493002/diff/120001/third_party/WebKit/Lay... third_party/WebKit/LayoutTests/http/tests/serviceworker/websocket/resources/simple.js:26: reportFailure('Closed before receiving reply'); nit: won't make a difference but could return; here
https://codereview.chromium.org/2564493002/diff/120001/third_party/WebKit/Lay... File third_party/WebKit/LayoutTests/http/tests/serviceworker/websocket/resources/simple.js (right): https://codereview.chromium.org/2564493002/diff/120001/third_party/WebKit/Lay... third_party/WebKit/LayoutTests/http/tests/serviceworker/websocket/resources/simple.js:26: reportFailure('Closed before receiving reply'); On 2016/12/08 15:48:24, falken wrote: > nit: won't make a difference but could return; here Ooo. Good catch. Fixed.
Description was changed from ========== Make WebSocket available again in service workers The patch https://codereview.chromium.org/2284473002/ was basically a refactoring change, but it also included a change that it started using the InterfaceProvider instance of the LocalFrame of the associated Document if any. However, in a service worker, the LocalFrame returns the empty provider obtained by calling InterfaceProvider::getEmptyInterfaceProvider(). This is because the WebEmbeddedWorkerImpl used for service workers doesn't override the WebFrameClient::interfaceProvider() method which returns nullptr by default while one on the WebSharedWorkerImpl and RenderFrameImpl returns an effective InterfaceProvider instance. This patch fixes the issue by changing the code to use the InterfaceProvider of the LocalFrame only when it's not the empty provider. BUG=671588 ========== to ========== Make WebSocket available again in service workers The patch https://codereview.chromium.org/2284473002/ was basically a refactoring change, but it also included a change that it started using the InterfaceProvider instance of the LocalFrame of the associated Document if any. However, in a service worker, the LocalFrame returns the empty provider obtained by calling InterfaceProvider::getEmptyInterfaceProvider(). This is because the WebEmbeddedWorkerImpl used for service workers doesn't override the WebFrameClient::interfaceProvider() method which returns nullptr by default while one on the WebSharedWorkerImpl and RenderFrameImpl returns an effective InterfaceProvider instance. This patch fixes the issue by changing the code to use the InterfaceProvider of the LocalFrame only when it's not the empty provider. R=falken@chromium.org TBR=yhirano@chromium.org BUG=671588 ==========
The CQ bit was checked by tyoshino@chromium.org
The patchset sent to the CQ was uploaded after l-g-t-m from falken@chromium.org Link to the patchset: https://codereview.chromium.org/2564493002/#ps140001 (title: "Addressed #26")
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/v2/patch-status/codereview.chromium.or...
The CQ bit was unchecked by commit-bot@chromium.org
Try jobs failed on following builders: android_n5x_swarming_rel on master.tryserver.chromium.android (JOB_FAILED, https://build.chromium.org/p/tryserver.chromium.android/builders/android_n5x_...)
The CQ bit was checked by falken@chromium.org
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/v2/patch-status/codereview.chromium.or...
CQ is committing da patch. Bot data: {"patchset_id": 140001, "attempt_start_ts": 1481243885883320, "parent_rev": "88c08792d4d33b9fd6b1de293fff8cbea3cae224", "commit_rev": "e844f364e85b3c3f787b18d0d1bdc8ffe970e4d2"}
Message was sent while issue was closed.
Description was changed from ========== Make WebSocket available again in service workers The patch https://codereview.chromium.org/2284473002/ was basically a refactoring change, but it also included a change that it started using the InterfaceProvider instance of the LocalFrame of the associated Document if any. However, in a service worker, the LocalFrame returns the empty provider obtained by calling InterfaceProvider::getEmptyInterfaceProvider(). This is because the WebEmbeddedWorkerImpl used for service workers doesn't override the WebFrameClient::interfaceProvider() method which returns nullptr by default while one on the WebSharedWorkerImpl and RenderFrameImpl returns an effective InterfaceProvider instance. This patch fixes the issue by changing the code to use the InterfaceProvider of the LocalFrame only when it's not the empty provider. R=falken@chromium.org TBR=yhirano@chromium.org BUG=671588 ========== to ========== Make WebSocket available again in service workers The patch https://codereview.chromium.org/2284473002/ was basically a refactoring change, but it also included a change that it started using the InterfaceProvider instance of the LocalFrame of the associated Document if any. However, in a service worker, the LocalFrame returns the empty provider obtained by calling InterfaceProvider::getEmptyInterfaceProvider(). This is because the WebEmbeddedWorkerImpl used for service workers doesn't override the WebFrameClient::interfaceProvider() method which returns nullptr by default while one on the WebSharedWorkerImpl and RenderFrameImpl returns an effective InterfaceProvider instance. This patch fixes the issue by changing the code to use the InterfaceProvider of the LocalFrame only when it's not the empty provider. R=falken@chromium.org TBR=yhirano@chromium.org BUG=671588 ==========
Message was sent while issue was closed.
Committed patchset #8 (id:140001)
Message was sent while issue was closed.
Description was changed from ========== Make WebSocket available again in service workers The patch https://codereview.chromium.org/2284473002/ was basically a refactoring change, but it also included a change that it started using the InterfaceProvider instance of the LocalFrame of the associated Document if any. However, in a service worker, the LocalFrame returns the empty provider obtained by calling InterfaceProvider::getEmptyInterfaceProvider(). This is because the WebEmbeddedWorkerImpl used for service workers doesn't override the WebFrameClient::interfaceProvider() method which returns nullptr by default while one on the WebSharedWorkerImpl and RenderFrameImpl returns an effective InterfaceProvider instance. This patch fixes the issue by changing the code to use the InterfaceProvider of the LocalFrame only when it's not the empty provider. R=falken@chromium.org TBR=yhirano@chromium.org BUG=671588 ========== to ========== Make WebSocket available again in service workers The patch https://codereview.chromium.org/2284473002/ was basically a refactoring change, but it also included a change that it started using the InterfaceProvider instance of the LocalFrame of the associated Document if any. However, in a service worker, the LocalFrame returns the empty provider obtained by calling InterfaceProvider::getEmptyInterfaceProvider(). This is because the WebEmbeddedWorkerImpl used for service workers doesn't override the WebFrameClient::interfaceProvider() method which returns nullptr by default while one on the WebSharedWorkerImpl and RenderFrameImpl returns an effective InterfaceProvider instance. This patch fixes the issue by changing the code to use the InterfaceProvider of the LocalFrame only when it's not the empty provider. R=falken@chromium.org TBR=yhirano@chromium.org BUG=671588 Committed: https://crrev.com/dd3b58a1f0073215d58bcb8dc216b89e546bc9f7 Cr-Commit-Position: refs/heads/master@{#437406} ==========
Message was sent while issue was closed.
Patchset 8 (id:??) landed as https://crrev.com/dd3b58a1f0073215d58bcb8dc216b89e546bc9f7 Cr-Commit-Position: refs/heads/master@{#437406} |