Implement Location.ancestorOrigins
Categories
(Core :: DOM: Window and Location, enhancement, P3)
Tracking
()
People
(Reporter: erik, Assigned: sfarre)
References
(Blocks 1 open bug, )
Details
(4 keywords, Whiteboard: [domcore-bugbash-triaged][platform-feature], [wptsync upstream])
User Story
user-impact-score:200 platform-scheduled:2025-12-31
Attachments
(2 files, 2 obsolete files)
Comment 1•11 years ago
|
||
Comment 2•11 years ago
|
||
Updated•11 years ago
|
Comment 4•11 years ago
|
||
Comment 5•11 years ago
|
||
| Reporter | ||
Comment 6•11 years ago
|
||
Comment 7•11 years ago
|
||
| Reporter | ||
Comment 8•10 years ago
|
||
Comment 10•10 years ago
|
||
Comment 11•10 years ago
|
||
Comment 12•10 years ago
|
||
Comment 13•10 years ago
|
||
Comment 14•10 years ago
|
||
| Reporter | ||
Comment 15•10 years ago
|
||
Comment 16•10 years ago
|
||
| Reporter | ||
Comment 17•10 years ago
|
||
Comment 19•10 years ago
|
||
| Reporter | ||
Comment 20•10 years ago
|
||
Updated•10 years ago
|
Comment 21•10 years ago
|
||
| Reporter | ||
Comment 22•9 years ago
|
||
Comment 23•9 years ago
|
||
Updated•7 years ago
|
Comment 24•7 years ago
|
||
FWIW, https://github.com/whatwg/html/pull/2480 has a proposal for a revised specification and https://github.com/web-platform-tests/wpt/pull/5402 has tests. (They are about a year old, might need rebasing. Happy to help if we prioritize this.)
Updated•6 years ago
|
Updated•6 years ago
|
Comment 25•5 years ago
|
||
Anne, do we want to implement this?
kmag says this should be easy to implement because we have WebExtension code that implements something similar.
Comment 26•5 years ago
|
||
We discussed this feature in the privacy team as it came up at https://github.com/privacycg/storage-partitioning/issues/14 as well. bz's concern about passive trackers is very much alive so we would have to mitigate that if we were to expose this. In particular, if there's no passive way (referrer) for an embedded site to know its parent, this should not reveal the parent to an embedded site.
If we apply that strictly, this would tell you at most about your parent and the only information you would get about further ancestors is how many there are.
This is even further complicated when an embedded site is navigated as the site being navigated to would never know about its parent (other than that one exists).
I'm not sure if that meets the use cases you envision for this feature.
(The HTML Standard PR doesn't account for some of these considerations and would have to be redone, if we were to pursue this further.)
Comment 27•5 years ago
|
||
From the webcompat side of things, PG Slots is (accidentally?) treating location.ancestorOrigins as though it exists, but may be zero-length. This seems to just be a coding oversight, as they have fallback code which is just not correctly being falled-back-upon. Thankfully this seems to be a one-off case rather than an obviously-shared code snippet circulating online.
Updated•5 years ago
|
Updated•5 years ago
|
Updated•4 years ago
|
Updated•4 years ago
|
Comment 28•3 years ago
|
||
WebCompat P3, but we'll bump it higher if we see more critical breakage in the wild.
Comment 29•3 years ago
|
||
Really interested in having this feature in Firefox too. Looking forward to it!
I hope P3 means soon : )
Updated•1 year ago
|
Updated•1 year ago
|
Updated•1 year ago
|
Updated•1 year ago
|
Comment 30•1 year ago
|
||
While the standards position is still open, there aren't blocking spec issues. Removing the keyword spec-needed.
Comment 31•1 year ago
|
||
I have a work-in-progress patch for this which I will attach to the bug after I've had a moment to rebase it.
I think we'll want to consider whether to really expose all origins. Brave is also considering that: https://github.com/brave/brave-browser/issues/33671
Comment 32•1 year ago
•
|
||
In our triage meeting today I missed Comment 23, which indicates that https://github.com/whatwg/html/issues/1918 is a blocker (and there's a PR at https://github.com/whatwg/html/pull/2480 but it looks like it stalled in 2017 or 2018). (I was going to add back the spec-needed keyword but it was still set.)
Updated•1 year ago
|
| Comment hidden (advocacy) |
| Comment hidden (advocacy) |
Comment 35•1 year ago
|
||
(In reply to Simon Pieters [:zcorpan] from comment #32)
In our triage meeting today I missed Comment 23, which indicates that https://github.com/whatwg/html/issues/1918 is a blocker (and there's a PR at https://github.com/whatwg/html/pull/2480 but it looks like it stalled in 2017 or 2018). (I was going to add back the
spec-neededkeyword but it was still set.)
Adding webcompat:blocked according to comment 32.
Updated•1 year ago
|
Comment 36•1 year ago
|
||
I found this by looking over an issue with Windows Admin Center (ref: https://github.com/MicrosoftDocs/Windows-Admin-Center-Ideas-and-Feedback/issues/290) where people have discovered that, in that particular case, it can be worked around by either returning an empty array, or by returning the window.location.origin, to the code that tries to utilise the ancestorOrigin object.
Could we potentially, until the situation with the spec and privacy concerns is resolved, use one of these within Firefox to prevent issues where third-party code tries to use the object but has no fallbacks like the Windows Admin Center?
References for people's attempts to hack the Windows Admin Center's code on each WAC installation showing how we might be able to get some third-party apps and sites running again if we did something similar within Firefox directly:
- https://github.com/MicrosoftDocs/Windows-Admin-Center-Ideas-and-Feedback/issues/290#issuecomment-2599677400
- https://github.com/HerdHeaven/Admin-Scripts/blob/main/Add-FFSupportToWindowsAdminCenter.ps1 (from https://github.com/MicrosoftDocs/Windows-Admin-Center-Ideas-and-Feedback/issues/290#issuecomment-2608238396)
Comment 37•1 year ago
•
|
||
Returning an empty array could work only for top-level frames as an empty window.location.ancestorOrigins could be used as clue no valid ancestor frames are present for subframes.
Returning an array with one or more window.location.origin would only work if the whole frame subtree is same-origin. Otherwise false information would be given to frames.
In all other scenarios it seems best to keep window.location.ancestorOrigins undefined until an implementation is ready and supported.
Comment 38•7 months ago
|
||
I've got a working example at https://github.com/theIDinside/firefox/tree/location-ancestor-origins-list - and I intend to also add the newer version of the spec that's being worked on by :zcorpan, today. Is it ok if nick this bug?
Comment 39•7 months ago
|
||
(In reply to Simon Farre [:sfarre] from comment #38)
I've got a working example at https://github.com/theIDinside/firefox/tree/location-ancestor-origins-list - and I intend to also add the newer version of the spec that's being worked on by :zcorpan, today. Is it ok if nick this bug?
Thank you, Simon, for your interest in helping with this. It sounds good to me. :) However, I think it would be worth needinfo-ing Tom, given that he mentioned he had WIPs in comment 31.
Comment 40•7 months ago
|
||
Sure, feel free to grab this bug, Simon. Thanks!
Comment 41•7 months ago
|
||
Thank you :hsinyi! And cool :twisniewski!
I have new tests written for the spec in it's current form (found at https://github.com/whatwg/html/pull/11560, which might be subject to minor changes). I do wonder who would/should be the reviewer for the patch?
Comment 42•7 months ago
|
||
(In reply to Simon Farre [:sfarre] from comment #41)
Thank you :hsinyi! And cool :twisniewski!
I have new tests written for the spec in it's current form (found at https://github.com/whatwg/html/pull/11560, which might be subject to minor changes). I do wonder who would/should be the reviewer for the patch?
If it's new web platform tests, I believe :zcorpan can help.
Updated•6 months ago
|
Updated•5 months ago
|
| Assignee | ||
Updated•4 months ago
|
Updated•4 months ago
|
| Assignee | ||
Comment 43•4 months ago
|
||
This implements this attribute on Location and also adheres to the
changes to the spec introduced in
https://github.com/whatwg/html/pull/11560
Tentative tests are also added in this patch.
Updated•4 months ago
|
Updated•4 months ago
|
Comment 44•4 months ago
|
||
Comment 46•4 months ago
|
||
Comment 47•4 months ago
•
|
||
Backed out for causing failures at location-ancestor-origins.sub.html.
Backout link: https://hg-edge.mozilla.org/integration/autoland/rev/4d1d053e8f79a60d298e3a77e790cfbb2036deb0
Failure log: https://treeherder.mozilla.org/logviewer?job_id=539564689&repo=autoland&task=Zgrd4h3lRiOn-ekgEorUBQ.0&lineNumber=2626
| Assignee | ||
Comment 48•3 months ago
|
||
Added ini file to wpt test to enable pref so that the test run with the feature turned on & requested landing for that.
Comment 49•3 months ago
|
||
Comment 50•3 months ago
|
||
| Assignee | ||
Comment 53•3 months ago
|
||
I've identified & addressed the issue causing the backout. Submitted new try runs for that and will request new landing if all green.
| Assignee | ||
Comment 54•3 months ago
|
||
| Assignee | ||
Comment 55•3 months ago
|
||
Latest try run pushed here: https://treeherder.mozilla.org/jobs?repo=try&landoCommitID=169300 - will land when green.
After discussion on matrix, we will enable this in nightly by default.
Comment 56•3 months ago
|
||
Comment 58•3 months ago
|
||
| bugherder | ||
Comment 60•3 months ago
|
||
:sfarre, could you consider nominating this for a release note? (Process info)
Comment 61•3 months ago
|
||
Comment 62•3 months ago
|
||
Backed out for causing dt failures @browser_dbg-expressions-error.js. It was hidded by Bug 2006557 until now.
Updated•3 months ago
|
Updated•3 months ago
|
| Assignee | ||
Comment 64•3 months ago
|
||
(In reply to agoloman from comment #62)
Backed out for causing dt failures @browser_dbg-expressions-error.js. It was hidded by Bug 2006557 until now.
Trying to find where it uses location.ancestorOrigins. Is it expecting a result that we now provide differently or what?
Comment 65•3 months ago
|
||
(In reply to Simon Farre [:sfarre] from comment #64)
Trying to find where it uses location.ancestorOrigins. Is it expecting a result that we now provide differently or what?
I was similarly a bit confused about the connection, so I checked in with sheriffs to be sure the backout wasn't a mistake... But it looks like the backout did indeed make the test go from failing to passing.
Push before backout:
https://treeherder.mozilla.org/jobs?repo=autoland&group_state=expanded&searchStr=linux%2C24.04%2Cdebug%2Cmochitests%2Cwith%2Chttp3%2Cserver%2Ctest-linux2404-64%2Fdebug-mochitest-devtools-chrome-http3%2Cdt&revision=0c56dd09060daf98d508498c19c0c012948db1b2
The test browser_dbg-expressions-error.js runs in dt13 and fails:
https://treeherder.mozilla.org/logviewer?job_id=540716004&repo=autoland&task=M53lLjg3Qqu3YdAkPBagCQ.0&lineNumber=7575
The backout push:
https://treeherder.mozilla.org/jobs?repo=autoland&group_state=expanded&searchStr=linux%2C24.04%2Cdebug%2Cmochitests%2Cwith%2Chttp3%2Cserver%2Ctest-linux2404-64%2Fdebug-mochitest-devtools-chrome-http3%2Cdt&revision=79fc433e7198a1493c08115f0ef8f5d40fe8fce8
The test browser_dbg-expressions-error.js runs in dt11 and passes:
https://treeherder.mozilla.org/logviewer?job_id=540719863&repo=autoland&task=a4E3QR5lQsGcIDPkOEhagA.0
https://treeherder.mozilla.org/logviewer?job_id=540716957&repo=autoland&task=b1QpeQQJQM-ZyddQDUkRxg.0
| Assignee | ||
Comment 66•3 months ago
|
||
At first review this does not seem to be an error on this patch behalf, but on the test itself, what is the path forward in such a scenario?
Ancestor origins is not used by the failing test: https://searchfox.org/firefox-main/source/devtools/client/debugger/test/mochitest/browser_dbg-expressions-error.js#22
I will look into it further but its surprising if location.ancestorOrigins is the problem and not the test itself.
| Assignee | ||
Comment 67•3 months ago
|
||
Yeah it's difficult to tell what the test actually is testing because it's just magic numbers and no explanation.
I will need-info the people who has worked on it. :nchevobbe you seem to have touched the test, can you explain what's going on? Is this just a matter of bumping the expected number from 37 to 39?
Comment 68•3 months ago
|
||
The addExpression stuff uses the location object and most likely gathers own properties for autocomplete or display in the debugger. So it is fairly likely that it changed the expectation of that test fwiw.
| Assignee | ||
Comment 69•3 months ago
|
||
(In reply to Emilio Cobos Álvarez [:emilio] from comment #68)
The addExpression stuff uses the location object and most likely gathers own properties for autocomplete or display in the debugger. So it is fairly likely that it changed the expectation of that test fwiw.
Seems likely, right. One for the property of the DOM string list, and one for the getter, would account for the difference of 2. Thanks!
Comment 70•3 months ago
|
||
The backout merged to central: https://hg.mozilla.org/mozilla-central/rev/79fc433e7198
Comment 71•3 months ago
•
|
||
(In reply to Simon Farre [:sfarre] from comment #67)
Yeah it's difficult to tell what the test actually is testing because it's just magic numbers and no explanation.
I will need-info the people who has worked on it. :nchevobbe you seem to have touched the test, can you explain what's going on? Is this just a matter of bumping the expected number from 37 to 39?
The test adds a location watch expression in the debugger and expands it so we have all its properties displayed.
You patch adds ancestorOrigins and we also show the getter node (see screenshot). So yes, we have 2 additional properties now, and we should bump the number from 37 to 39
The same goes for the two failing assertions in devtools/client/debugger/test/mochitest/browser_dbg-expressions.js
| Assignee | ||
Comment 72•3 months ago
|
||
The test adds a
locationwatch expression in the debugger and expands it so we have all its properties displayed.
You patch addsancestorOriginsand we also show the getter node (see screenshot). So yes, we have 2 additional properties now, and we should bump the number from 37 to 39
The same goes for the two failing assertions indevtools/client/debugger/test/mochitest/browser_dbg-expressions.js
Thanks a bunch!
Addressed failing tests & latest/last update to spec.
Try run: https://treeherder.mozilla.org/jobs?repo=try&landoCommitID=170036
Comment 74•3 months ago
|
||
Comment 76•3 months ago
|
||
| bugherder | ||
Comment 78•3 months ago
|
||
:sfarre, could you consider nominating this for a release note? (Process info)
| Assignee | ||
Comment 79•3 months ago
|
||
Why is this notable:
Adds support for location.ancestorOrigins attribute, with support for the redacted ancestor origins spec that's being finalized.
Affects Firefox for Android:
Support of the attribute is intended for all platforms.
Links:
The current work in progress implementation of the spec that :zcorpan is working on can be found here.
Previous spec iteration of Location.ancestorOrigins is described here
Comment 80•3 months ago
|
||
Thanks, added to the Fx148 nightly release notes, please allow 30 minutes for the site to update.
Keeping the relnote-firefox flag as ? to keep it on the radar for inclusion in the final Fx148 release notes.
Updated•2 months ago
|
Comment 81•2 months ago
|
||
The feature is already documented on MDN; I've added a rel note in https://github.com/mdn/content/pull/42826. I think we can therefore consider this one complete in terms of MDN docs requirements.
Description
•