Closed Bug 1263204 Opened 8 years ago Closed 8 years ago

Clients.matchAll returns about:blank

Categories

(Core :: DOM: Service Workers, defect)

48 Branch
defect
Not set
normal

Tracking

()

RESOLVED DUPLICATE of bug 1265771

People

(Reporter: matt, Assigned: bkelly)

References

Details

(Whiteboard: btpp-active)

User Agent: Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/50.0.2661.66 Safari/537.36

Steps to reproduce:

Running some unit tests, one of which makes use of clients.matchAll():

    self.clients.matchAll({
      type: 'window',
      includeUncontrolled: true
    })

This is run on Firefox 45, 47 + 48.



Actual results:

I found that one of the clients returned has the url about:blank.

I didn't have any blank tabs open (none that I was aware of) and my assumption was that clients.matchAll would be for the same origin, which I would have said about:blank wasn't.


Expected results:

Not receive about:blank as a window client.
Component: Untriaged → DOM: Service Workers
Product: Firefox → Core
Well, about:blank should be controlled if it inherits its origin from its parent.  I didn't think we did this yet, though.  See bug 1261403.

Do you know where this about:blank window actually lives in your tabs?  Is it an embedded iframe?

Finally, we don't implement includeUncontrolled yet, AFAIK.
Thanks for info Ben.

Originally I thought it could be a rogue iframe, but there is only one iframe on the page and that is being assigned a URL which I am also retrieving in the clients.matchAll().

Ultimately I'm lost with where the about:blank is coming from.
Steps to reproduce:
1. Clone https://github.com/gauntface/Propel
2. Checkout the 'worker-get-windows' branch (git checkout worker-get-windows)
2. Run npm install
3. Run gulp build
4. Run gulp test:manual
5. In a browser navigate to http://localhost:8888/test/browser-tests/
6. Open the console and view the logs and you'll see a list of values similar to:

----------------------------------- Client Matches ---------------------------------
"1        http://localhost:8888/test/iframe/14604681268781"
2        about:blank
"3        http://localhost:8888/test/browser-tests/"
"4        http://localhost:8888/test/browser-tests/"
"5        http://localhost:8888/test/browser-tests/"
-----------------------------------------------------------------------------

There are a few things to note / bugs:
- about:blank I'm not sure where that comes from
- If you keep on refreshing the page in 48.0a1 the 'http://localhost:8888/test/browser-tests/' client keeps on getting appended to the list despite being the same window.
Flags: needinfo?(bkelly)
Whiteboard: btpp-active
Matt, did something change in this repo?  I'm not getting any clients in the list when I run it here.

Note, I am running it from an origin like http://ubuntu:8888 instead of localhost.
Flags: needinfo?(bkelly) → needinfo?(matt)
I'm running it and still seeing the logs (Admittedly on Chrome I have to have the console open before loading the page - otherwise chrome seems to ignore the logs from the SW).

Did you checkout the branch?

I've uploaded the top of the logs I get when I refresh the page a few times on Firefox Nightly:

http://imgur.com/6W1rExo
Flags: needinfo?(matt)
Blocks: 1265761
No longer blocks: 1265761
Depends on: 1265761
Ok, I found out why I wasn't seeing anything.  We have a bug in Clients.matchAll() when using our devtools http testing option.  Filed bug 1265761 to fix that...
Depends on: 1265771
I think the ever growing list is due to exposing Client objects for documents in the bfcache.  Working on a fix for that over in bug 1265771.

Matt, is it possible you do in fact have an about:blank iframe somewhere?  Those will inherit the origin of their parent window.  So it is possible they will pass the origin check.

So far I haven't been able to reproduce the about:blank entry, but that could be because I'm using a very slow debug build.  I'll try an opt build later today.
Flags: needinfo?(matt)
The way the test works is as follows:

- Browser loads up and loads test via mocha
- In the page the test creates and iframe
- In the page the test registers a service worker with a unique scope
- In the page the test sets the src of the iframe to match the unique scope
- In the page the test waits for the iframe to load it's page and waits for the serviceworker.ready promise to resolve
- In the page the test sends a message to the service worker to perform some tests
- In the service worker it gets the clients and prints them out

I tried printing iframes in the window to ensure there was only one and that seemed to be the case and the iframes url is turning up in firefox (/text/iframe/******).
Flags: needinfo?(matt)
Ok.  I'm not seeing the about:blank window because of the http devtools setting again.  I'll try to work on localhost directly.
Assignee: nobody → bkelly
Status: UNCONFIRMED → ASSIGNED
Ever confirmed: true
Depends on: 1266221
I retested with the fix from bug 1265771 and the about:blank Client doesn't show up any more.  I believe it was a similar issue to the window refresh.  The previous, inactive document was showing up in Clients.matchAll() when it should not have.

Marking dupe since the patches landed in that other bug.
Status: ASSIGNED → RESOLVED
Closed: 8 years ago
No longer depends on: 1265761
Resolution: --- → DUPLICATE
You need to log in before you can comment on or make changes to this bug.