New issue
Advanced search Search tips
Note: Color blocks (like or ) mean that a user may not be available. Tooltip shows the reason.

Issue 776408 link

Starred by 4 users

Issue metadata

Status: Assigned
Owner:
Cc:
Components:
EstimatedDays: ----
NextAction: ----
OS: ----
Pri: 2
Type: Bug



Sign in to add a comment

Failed to get a ServiceWorkerRegistration: No URL is associated with the caller's document.

Project Member Reported by falken@chromium.org, Oct 19 2017

Issue description

From an internal report (b/67635738), the "Failed to get a ServiceWorkerRegistration: No URL is associated with the caller's document." error message is happening even though they don't expect script-created iframes to be involved (issue 439697).

We set the document URL when the request for the navigation arrives, so we expect the URL to be set by the time getRegistration is called from the document.

I think this might get fixed with s13n/mojofication, as the browser-side tracking of document URL based on resource requests may go away... not sure though.
 

Comment 1 by falken@chromium.org, Nov 12 2017

Labels: -Pri-3 M-64 Pri-1
Owner: falken@chromium.org
Status: Assigned (was: Available)
b/67635738 is now P1.

It seems likely that mojofication caused a regression where this is happening more frequently.

Comment 2 by falken@chromium.org, Nov 13 2017

Cc: leon....@intel.com xiaofeng...@intel.com
Leon, Xiaofeng: Do you know what could cause the " No URL is associated with the caller's document" error to occur more often as a result of getRegistration()?

I'm curious if the URL check can somehow be removed. It seems the browser shouldn't send the ServiceWorkerRegistrationObjectInfo to the renderer unless it knows the origin of the renderer, somehow can we rely on Mojo endpoints to understand the origin instead of manually in SWProviderHost?

Comment 3 by leon....@intel.com, Nov 13 2017

I checked around current logic compared with the logic before mojofication for getRegistration(), no idea yet why it occurs more often now.. 

And sorry I have a question about this problem, should the following 2 getRegistration() return the same thing? From the point view of both spec and current implementations.
<!doctype html>
<iframe id=x></iframe>
<script>
var x = document.getElementById('x');
x.contentWindow.navigator.serviceWorker.getRegistration(xx).then(reg =>
  // in case of blank iframe page
);
x.src = 'https://the.current.domain.com/iframepage.html';
x.contentWindow.navigator.serviceWorker.getRegistration(xx).then(reg =>
  // in case of iframe page with a valid url
);
</script>

Comment 4 by falken@chromium.org, Nov 13 2017

I think those are expected to return the same thing in the spec, but not in the current implementation.

The iframe without src attribute is an about:blank window and it's supposed to inherit from its parent document.

But I think Chrome doesn't do that yet: issue 439697

Comment 5 by leon....@intel.com, Nov 13 2017

I see, thanks! So for the above case 1 we have to raise the "Failed to get a ServiceWorkerRegistration: No URL is associated with the caller's document." error for now.
And the problem of this issue is that it became more often than before and even occurred without script-created iframes involved, right? I can't open b/67635738, I'm curious whether we can find the detailed scenarios there to help investigation..

Comment 6 by falken@chromium.org, Nov 13 2017

Right, there doesn't seem to be iframes involved yet we're still getting the error.

Comment 7 by aaronsn@google.com, Nov 13 2017

Apologies, b/67635738 should not have been upgraded to P1. The rate has not significantly increased, we just thought it did because of an incorrect query.

This happens much more frequently on ChromeOS, in case that gives you any insight.

Unfortunately we don't have any repro steps, we just see error reports of this. It happens too infrequently for us to repro at the moment. One user said they were using the product normally, which suggests there weren't iframes involved.

Comment 8 by falken@chromium.org, Nov 16 2017

Labels: -Pri-1 Pri-2
Chrome OS also seems to have a high rate of IPC_FAILED during service worker startup so there could be some common cause there. 

Comment 9 by horo@chromium.org, Jan 11 2018

Cc: clamy@chromium.org
Owner: horo@chromium.org
Status: Started (was: Assigned)
I created a cl to fix a bug in handling "externalfile" scheme URL.
https://chromium-review.googlesource.com/c/chromium/src/+/861558
Most error case of ChromeOS will be fixed by this cl.

I think non-ChromeOS case of this issue is caused by the race issue 789111.

Project Member

Comment 10 by bugdroid1@chromium.org, Jan 11 2018

The following revision refers to this bug:
  https://chromium.googlesource.com/chromium/src.git/+/38a50a39ec3867e1816e63a0fe116a91692ca99f

commit 38a50a39ec3867e1816e63a0fe116a91692ca99f
Author: Tsuyoshi Horo <horo@chromium.org>
Date: Thu Jan 11 10:18:28 2018

Create ServiceWorkerRequestHandler for ExternalFileScheme

When a file in Drive is opened from ChromeOS Files app, Chrome opens
"externalfile" scheme URL. And ExternalFileURLRequestJob redirects the request
to the Drive's HTTPS URL.

Currently ServiceWorkerRequestHandler::InitializeForNavigation() doesn't create
a ServiceWorkerProviderHost for the "externalfile" scheme URL.
So ServiceWorkerProviderHost is not created during the navigation.

A new ServiceWorkerProviderHost will be created when ServiceWorkerDispatcherHost
receives OnProviderCreated() IPC from the renderer process.
https://chromium.googlesource.com/chromium/src/+/86ff9bc/content/browser/service_worker/service_worker_dispatcher_host.cc#355

But SetDocumentUrl() of the ServiceWorkerProviderHost which is created here will
not be called because the navigation is already finished.
So all ServiceWorker related API in the page will fail with
"No URL is associated with the caller's document." error.

Bug: 776408
Change-Id: Ic4a0cd2ec5fb16ff995fb96927ca3fea61c3359a
Reviewed-on: https://chromium-review.googlesource.com/861558
Commit-Queue: Tsuyoshi Horo <horo@chromium.org>
Reviewed-by: Matt Falkenhagen <falken@chromium.org>
Cr-Commit-Position: refs/heads/master@{#528590}
[modify] https://crrev.com/38a50a39ec3867e1816e63a0fe116a91692ca99f/content/browser/service_worker/service_worker_request_handler.cc
[modify] https://crrev.com/38a50a39ec3867e1816e63a0fe116a91692ca99f/content/browser/service_worker/service_worker_request_handler_unittest.cc

Labels: -M-64 M-65 OS-Chrome
Status: Fixed (was: Started)
horo fixed in 65.0.3319.0.

Let's mark this as fixed since the P1 bug that was reported internally was about the Chrome OS files app.

If we need to track the general no document url bug, we can do it in a new issue.
Labels: -OS-Chrome
Status: Available (was: Fixed)
Ah sorry, the original bug was not 100% CrOS.
Status: Assigned (was: Available)
falken@
Does this issue still exist?
Cc: horo@chromium.org
Owner: falken@chromium.org
Update on this from our end - this issue now occurs at the same rate for Chrome OS as for other platforms. This seems to indicate that the specific issue when opening from the Chrome OS files app is fixed.

However, this does still occur at a rate of about 1 out of every 1000 loads, so the issue still exists in general.
aaronsw: ServiceWorkerServicification still has this bug in M70 but it's fixed in M71 ( issue 896157 ). That might help explain the 1 out of 1000 loads. It's enabled at 1% on Stable.
Actually, I messed up the denominator for my query. I reran again and it seems like Chrome OS is still higher than the other platforms. The overall rate is lower than before, but still higher for Chrome OS. It's about 0.02% overall and 0.04% for just Chrome OS.

I just tried reproducing on a Chromebook and the error still occurs when opening from the Chrome OS app (Chrome 69).

Apologies for the confusion. Can you look into this again? It seems like the fix didn't work.
Cc: aaronsn@google.com
aaronsn: On Chrome 69 did you have ServiceWorkerServicification on or off? (Will try to test ourselves too)
Owner: bashi@chromium.org
bashi: could you investigate this?
I've been trying to repro but couldn't so far.

Sign in to add a comment