Closed Bug 931884 Opened 11 years ago Closed 4 years ago

Implement document.origin

Categories

(Core :: DOM: Core & HTML, defect, P3)

defect

Tracking

()

RESOLVED INVALID

People

(Reporter: annevk, Assigned: bzbarsky)

References

Details

(Keywords: dev-doc-needed)

Attachments

(3 files, 3 obsolete files)

Keywords: dev-doc-needed
Attached patch Impl (obsolete) — Splinter Review
Not sure where to affix a test so left that out for now.
Attachment #824203 - Flags: review?(bugs)
The best place for a test should be somewhere in imptests where we have the tests for specs,
it is still a bit tricky to submit such tests to github and then get them to be
updated in our tree, so mochitest in content/base/ or dom/tests should be ok.
OS: Mac OS X → All
Hardware: x86 → All
Blocks: 699466
Attached patch Implement document.origin (obsolete) — Splinter Review
Attachment #8530870 - Flags: review?(bugs)
Assignee: nobody → bzbarsky
Status: NEW → ASSIGNED
Comment on attachment 8530870 [details] [diff] [review]
Implement document.origin

>+  void GetOrigin(nsString& retval) const;
Nit, (should fix also other case, but) aRetVal


>+<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=931884">Mozilla Bug 931884</a>
>+<p id="display">
>+  <iframe></iframe>
>+  <iframe id="blob-test"></iframe> <!-- will get blob: URI -->
>+  <iframe src="data:text/html,Data"></iframe>
>+  <iframe src="javascript:'javascript'"></iframe>
>+  <iframe src="http://test1.mochi.test:8888/tests/dom/base/test/file_document_origin.html"></iframe>
>+  <iframe src="http://sub1.xn--lt-uia.example.org:8000/tests/dom/base/test/file_document_origin.html"></iframe>

I think we really should have tests for sandboxed stuff and srcdoc too.
Attachment #8530870 - Flags: review?(bugs) → review-
Attached patch Implement document.origin (obsolete) — Splinter Review
Attachment #8531041 - Flags: review?(bugs)
Attachment #8530870 - Attachment is obsolete: true
Attachment #824203 - Attachment is obsolete: true
Attachment #8531041 - Flags: review?(bugs) → review+
what's the status of this?
Flags: needinfo?(bzbarsky)
The status is that people were not happy with the spec for this when I posted an intent to implement, because document.origin is window-only, self.origin is worker-only, and the thing both contexts have is location.origin which is a completely nonsensical thing.  So there was a lot of discussion about moving .origin to somewhere other than document (self?) for the window case... and then nothing happened.

Anne, what's the story here?  Seems like the spec still basically specs the thing which will cause everyone to write code that uses location.origin...
Flags: needinfo?(bzbarsky) → needinfo?(annevk)
Chrome implements document.origin. We could make it self.origin instead I suppose if we can convince Chrome that is worth the churn. Making location.origin magical still seems like a bad solution to me. Trying to get rid of location.origin also seems like something that is unlikely to succeed, but we could try?
Flags: needinfo?(annevk) → needinfo?(mike)
I think we should probably just do self.origin (in both window and worker) _and_ document.origin, give up on location.origin and just steer people away from it, and move on.

The other question is whether we need to make any of these origin attributes on window/document/workerglobalscope unforgeable.
Sounds fine to me. I filed https://www.w3.org/Bugs/Public/show_bug.cgi?id=28801 on adding self.origin to HTML.
No longer blocks: 1168540
I rebased this on top of bug 1306170, because I figure we want that one for sure, but aren't sure about this one.
Attachment #8531041 - Attachment is obsolete: true
Depends on: 1306170
Blink just sent an intent to deprecate: https://groups.google.com/a/chromium.org/forum/#!topic/blink-dev/CO52Bt15cuc

so going to hold off on this for now.
Priority: -- → P3
Component: DOM → DOM: Core & HTML

This is gone from the spec and unshipped in Chrome and Safari.

Status: ASSIGNED → RESOLVED
Closed: 4 years ago
Resolution: --- → INVALID
Resolving bug as invalid removed the following wpt triage data:

/dom/idlharness.window.html?exclude=Node
  subtest: Document interface: attribute origin
  subtest: Document interface: xmlDoc must inherit property "origin" with the proper type (3)
  subtest: Document interface: new Document() must inherit property "origin" with the proper type (3)

James, I'm not sure what comment 19 is saying. Presumably at some point we were tracking the WPT failures from not implementing document.origin, but that should have stopped failing back when https://github.com/web-platform-tests/wpt/pull/21055 got merged in and then https://hg.mozilla.org/mozilla-central/diff/8cdbc2ef524268d720bb6e1dfded1724a72a0b95/testing/web-platform/meta/dom/idlharness.window.js.ini removed the annotations, no?

Flags: needinfo?(mike) → needinfo?(james)

These are the annotations in the shared metadata repo that's used in wpt.fyi and by the sync bot, not the annotations in the the ini files, although I copied the ini annotations into the external system at some point.

There's a consistency problem where we don't remove annotations when tests stop failing, so we might have a bug associated with a test that actually now passes. The above bot is part of trying to fix that issue by at least making sure we don't have bugs that are marked as invalid or duplicate associated with tests.

(note: we're actually currently running the bot against a fork of the metadata repo, pending some changes in the backend, so you can't actually see this change there; instead it's in my fork at https://github.com/jgraham/wpt-metadata/commit/84fcc5e11e69e7ff769855a4f15d6e1bef6d87c5 )

Does that help?

Flags: needinfo?(james)

Yep, thank you!

You need to log in before you can comment on or make changes to this bug.