importScripts in incognito mode fails to load file larger than 1310720 bytes (0x140000 bytes)
Reported by
jameslam...@lucidchart.com,
Mar 2 2018
|
||||||
Issue description
UserAgent: Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/64.0.3282.167 Safari/537.36
Steps to reproduce the problem:
Setup a service worker with the content
importScripts(
'/js/serviceworker?ts=1519949108000',
);
where /js/serviceworker points to a file with 1310720 space characters
Attempt to load the service working in an incognito window
The service worker should load fine
Then increase the file size of /js/serviceworker to 1310721 and it will fail with this error
The request to fetch the script was interrupted.
What is the expected behavior?
The service worker should be able to use importScripts with a file larger than 1310720 bytes in incognito mode
What went wrong?
It doesn't load a file large than 1310720 in incognito mode
Did this work before? N/A
Chrome version: 64.0.3282.167 Channel: stable
OS Version: Ubuntu 16.04.3 LTS
Flash Version:
,
Mar 2 2018
I could confirm it's reproducible in the incognito mode and also the guest mode in 66.0.3346.8 on Linux. The error was "Uncaught (in promise) TypeError: Failed to register a ServiceWorker: ServiceWorker script evaluation failed". It happens at the initial evaluation of the service worker script, so I think something wrong around ServiceWorkerWriteToCacheJob. falken: Do you know if some special quota limitation exists for incognito/guest modes?
,
Mar 2 2018
Attached files to reproduce the issue.
,
Mar 2 2018
,
Mar 23 2018
This also occurs when initially loading the service worker. If the worker file is larger than ~1.2MB, the same 'Request to fetch the script was interrupted' message appears.
,
Apr 20 2018
,
Dec 11
We've observed this issue on a chromebook that we've been testing with in the past couple days. This is blocking us from moving forward with a commercial project. What are the chances that the priority of this one can be re-evaluated? Considering it affects Chromebooks, although there would be a relatively small number of developers constrained by this bug. The obvious solution may be to break the imported scripts down into smaller portions, but our scripts are large because they're transpiled using bridge.net. And we have little control over the size of the transpiled output.
,
Dec 11
Thanks for the signal, that's useful to know. Let me see if we can look at this soon.
,
Dec 14
re c#7: Can I ask a bit more detail about this? As far as I understand, the issue is the limit of size imported through importScripts() when the site is opened by a tab on incognito mode or guest mode. Does your project need to use incognito mode or guest mode intentionally? Or, if c#5 happens without those modes, it seems a bit different problem. Could you tell us a bit more detail about what "initially loading the service worker" exactly is? Is it happening when calling navigator.serviceWorker.register()?
,
Dec 14
,
Dec 16
Thanks for following up so quickly. I'll try to provide as much details as I think would be helpful. If you have any more specific questions I'll be happy to try and answer them as we go on.
The importance of Incognito mode is not so much that our use of Chrome Incognito depends on it, more so that it appears to behave the same as our Chromebook app. We experienced the bug first in our testing of a new chromebook app that installs a service worker. And we stumbled across the same error when trying to reproduce the error on Chrome running on Windows 10 by launching the browser in incognito mode.
Since my last comment we have done some experimentation to find a workaround and so far we've had some success.
My original thought was that the large scripts being imported were creating a problem for the SW installation process. So I removed the large scripts from the importScripts() function and that allowed the service worker to be installed.
I tried loading the large scripts later by calling importScripts() after the service worker was successfully instead. But this failed with the same error.
Later I tried to see if a quick and dirty script loader would work:
const imports = ['/largeScriptA.js', '/largeScriptB.js'];
for (const url of imports) {
const response = await fetch(url);
const script = await response.text();
eval(script);
}
And that worked fine. Obviously, I'd much prefer using the importScripts API, but I'll resort to a script loader like the above if I have no alternative.
|
||||||
►
Sign in to add a comment |
||||||
Comment 1 by ajha@chromium.org
, Mar 2 2018Labels: Needs-Triage-M64