<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<!DOCTYPE bugzilla SYSTEM "https://www.w3.org/Bugs/Public/page.cgi?id=bugzilla.dtd">

<bugzilla version="5.0.4"
          urlbase="https://www.w3.org/Bugs/Public/"
          
          maintainer="sysbot+bugzilla@w3.org"
>

    <bug>
          <bug_id>23406</bug_id>
          
          <creation_ts>2013-10-01 09:04:31 +0000</creation_ts>
          <short_desc>location.origin, origin of the document or origin of location.href?</short_desc>
          <delta_ts>2013-10-28 16:55:31 +0000</delta_ts>
          <reporter_accessible>1</reporter_accessible>
          <cclist_accessible>1</cclist_accessible>
          <classification_id>1</classification_id>
          <classification>Unclassified</classification>
          <product>WebAppsWG</product>
          <component>DOM</component>
          <version>unspecified</version>
          <rep_platform>PC</rep_platform>
          <op_sys>All</op_sys>
          <bug_status>RESOLVED</bug_status>
          <resolution>FIXED</resolution>
          
          
          <bug_file_loc></bug_file_loc>
          <status_whiteboard></status_whiteboard>
          <keywords></keywords>
          <priority>P2</priority>
          <bug_severity>normal</bug_severity>
          <target_milestone>---</target_milestone>
          
          
          <everconfirmed>1</everconfirmed>
          <reporter name="Simon Pieters">zcorpan</reporter>
          <assigned_to name="Anne">annevk</assigned_to>
          <cc>ian</cc>
    
    <cc>mike</cc>
    
    <cc>www-dom</cc>
          
          <qa_contact>public-webapps-bugzilla</qa_contact>

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>94067</commentid>
    <comment_count>0</comment_count>
    <who name="Simon Pieters">zcorpan</who>
    <bug_when>2013-10-01 09:04:31 +0000</bug_when>
    <thetext>http://url.spec.whatwg.org/#dom-url-origin

[[
Return the Unicode serialization of url&apos;s origin.
]]

It looks like currently, location.origin gives the origin of the location.href URL. This can be different from the document&apos;s origin, e.g. if document.domain is set, or if the origin is inherited (e.g. about:blank or javascript: URL in an iframe).

IIRC a use case for location.origin is checking e.origin in cross-document messaging. For that case it seems like you want the document&apos;s origin.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>94084</commentid>
    <comment_count>1</comment_count>
    <who name="Anne">annevk</who>
    <bug_when>2013-10-01 15:59:19 +0000</bug_when>
    <thetext>We should have document.origin for that. We could add it to the DOM.

Adding Ian just in case he has a different opinion.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>94409</commentid>
    <comment_count>2</comment_count>
    <who name="Ian &apos;Hixie&apos; Hickson">ian</who>
    <bug_when>2013-10-07 20:57:57 +0000</bug_when>
    <thetext>LGTM.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>95440</commentid>
    <comment_count>3</comment_count>
    <who name="Anne">annevk</who>
    <bug_when>2013-10-28 16:45:47 +0000</bug_when>
    <thetext>https://github.com/whatwg/dom/commit/0999d4d9acbe9cb178021b9f6ceba8cc72cc00fd</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>95442</commentid>
    <comment_count>4</comment_count>
    <who name="Anne">annevk</who>
    <bug_when>2013-10-28 16:55:31 +0000</bug_when>
    <thetext>And serializing it is this commit because I&apos;m an idiot: https://github.com/whatwg/dom/commit/b5dcd1560f4c19a70f2dfc7eb1e00289809554e2</thetext>
  </long_desc>
      
      

    </bug>

</bugzilla>