Calling "fetch" inside Service Worker's "onfetch" handler in b2g causes "onfetch" again that leads to an infinite loop

RESOLVED FIXED in Firefox 41

Status

()

Core
DOM: Service Workers
RESOLVED FIXED
3 years ago
3 years ago

People

(Reporter: azasypkin, Assigned: ferjm)

Tracking

unspecified
FxOS-S1 (26Jun)
Points:
---
Dependency tree / graph
Bug Flags:
in-testsuite +

Firefox Tracking Flags

(firefox41 fixed)

Details

Attachments

(2 attachments, 1 obsolete attachment)

STR:

1. Install [1] as preinstalled app (to workaround bug 1173539);
2. Run it and make sure that service worker is registered;
3. Kill app with Task Manager and run again;
4. Observe log - there is infinite loop that infinitely requests first resource in the app index.html - app.css. 

Flame PVT mc Engineering Build:

Build Identifier: 20150611010205
Git Commit Info: 2015-06-11 18:43:32, 4219419a

[1] https://github.com/azasypkin/sw-tests/tree/master/fxos-app
(Assignee)

Updated

3 years ago
Whiteboard: [s4]
(Assignee)

Updated

3 years ago
Blocks: 1153312, 1131322
Status: NEW → ASSIGNED
Target Milestone: --- → NGA S3 (26Jun)

Comment 1

3 years ago
Is this an issue with intercepting the app: protocol?
(Reporter)

Comment 2

3 years ago
(In reply to Ben Kelly [:bkelly] from comment #1)
> Is this an issue with intercepting the app: protocol?

I was able to reproduce it only with app:// protocol on b2g. I tried to run app in b2g browser [1], but service worker registration was always failing for me at that time, so I just gave up.

[1] http://azasypkin.github.io/sw-tests/fxos-app/
(Assignee)

Comment 3

3 years ago
Created attachment 8622374 [details] [diff] [review]
v1

I'll be adding a new test on another patch
Attachment #8622374 - Flags: review?(nsm.nikhil)
(Assignee)

Comment 4

3 years ago
(In reply to Ben Kelly [:bkelly] from comment #1)
> Is this an issue with intercepting the app: protocol?

Yes, this is only happening with the app:// protocol.

Updated

3 years ago
Whiteboard: [s4]
(Assignee)

Comment 5

3 years ago
Created attachment 8622404 [details] [diff] [review]
Test
Attachment #8622404 - Flags: review?(nsm.nikhil)
Comment on attachment 8622374 [details] [diff] [review]
v1

Review of attachment 8622374 [details] [diff] [review]:
-----------------------------------------------------------------

::: netwerk/protocol/app/AppProtocolHandler.cpp
@@ +297,5 @@
>  }
>  
> +NS_IMETHODIMP DummyChannel::ForceNoIntercept()
> +{
> +  return NS_OK;

return NS_ERROR_NOT_IMPLEMENTED?
Attachment #8622374 - Flags: review?(nsm.nikhil) → review+
Comment on attachment 8622404 [details] [diff] [review]
Test

Review of attachment 8622404 [details] [diff] [review]:
-----------------------------------------------------------------

I'd like to see the new patch.

::: dom/workers/test/serviceworkers/app-protocol/sw.js
@@ +22,5 @@
> +    var results = regex.exec(event.request.url);
> +    return results === null ?
> +                       ''   :
> +                       decodeURIComponent(results[1].replace(/\+/g, ' '));
> +  }

Please use the URL and URLSearchParams interfaces instead of manual regexp parsing.
Attachment #8622404 - Flags: review?(nsm.nikhil)
(Assignee)

Comment 8

3 years ago
Created attachment 8622953 [details] [diff] [review]
Test
Attachment #8622404 - Attachment is obsolete: true
Attachment #8622953 - Flags: review?(nsm.nikhil)
(Reporter)

Updated

3 years ago
Blocks: 1172902
Comment on attachment 8622953 [details] [diff] [review]
Test

Review of attachment 8622953 [details] [diff] [review]:
-----------------------------------------------------------------

::: dom/workers/test/serviceworkers/app-protocol/sw.js
@@ +16,5 @@
>  });
>  
>  self.addEventListener('fetch', (event) => {
>    if (event.request.url.indexOf('foo.txt') >= 0) {
> +    var searchParams = new URLSearchParams(event.request.url.split("?")[1]);

var searchParams = new URLSearchParams(new URL(event.request.url));
Attachment #8622953 - Flags: review?(nsm.nikhil) → review+
https://hg.mozilla.org/mozilla-central/rev/e8d2c117e4b1
https://hg.mozilla.org/mozilla-central/rev/9ea2dfc3325d
Status: ASSIGNED → RESOLVED
Last Resolved: 3 years ago
status-firefox41: --- → fixed
Flags: in-testsuite+
Resolution: --- → FIXED
checked in today's m-c build (6/18) with Flame device and it works as expected. Thanks for fixing it so quickly!
(Reporter)

Updated

3 years ago
Blocks: 1175944
As NGA Program Manager suggested, let's replace the NGA-X milestones with FxOS-Sx ones (more generic ones), once Bug 1174794 has already landed
Target Milestone: NGA S3 (26Jun) → FxOS-S1 (26Jun)
You need to log in before you can comment on or make changes to this bug.