This is an archived snapshot of W3C's public bugzilla bug tracker, decommissioned in April 2019. Please see the home page for more details.

Bug 22863 - Have scripts's document, base URL, etc, be packaged into a "script settings" object owned by globals
Summary: Have scripts's document, base URL, etc, be packaged into a "script settings" ...
Status: RESOLVED FIXED
Alias: None
Product: WHATWG
Classification: Unclassified
Component: HTML (show other bugs)
Version: unspecified
Hardware: Other other
: P1 trivial
Target Milestone: Unsorted
Assignee: Ian 'Hixie' Hickson
QA Contact: contributor
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2013-08-02 19:10 UTC by Ian 'Hixie' Hickson
Modified: 2013-11-08 23:53 UTC (History)
5 users (show)

See Also:


Attachments

Description Ian 'Hixie' Hickson 2013-08-02 19:10:33 UTC
Instead of each script having a "script's document", "script's base URL", etc, we should package those settings into a single "script settings" object owned by each global, and then when scripts are created they just use the settings of their global. Then, consider changing references to the "entry script" to all be references to the "entry script's settings object" or some such. Maybe same with incumbent script.
Comment 1 contributor 2013-08-02 21:48:14 UTC
Checked in as WHATWG revision r8124.
Check-in comment: Rejigger how scripts are described. Work in progress.
http://html5.org/tools/web-apps-tracker?from=8123&to=8124
Comment 2 Ian 'Hixie' Hickson 2013-10-26 00:01:29 UTC
So, each script should have:
  - code entry-point
  - muted errors flag
  - a reference to a settings bag

Each Window, Worker, etc should have:
  - a settings bag, which should have:
      - a script execution environment per language
      - a global object
      - a browsing context
      - a document
      - a referrer source
      - a URL character encoding
      - a base URL
Comment 3 Ian 'Hixie' Hickson 2013-10-30 23:23:18 UTC
http://html5.org/tools/web-apps-tracker?from=8246&to=8247

I must admit I've now forgotten the original purpose of this (other than to do a cleanup... there was some plan to make the stack cleaner or something).
Comment 4 Bobby Holley (:bholley) 2013-10-31 09:35:00 UTC
(In reply to Ian 'Hixie' Hickson from comment #3)
> http://html5.org/tools/web-apps-tracker?from=8246&to=8247
> 
> I must admit I've now forgotten the original purpose of this (other than to
> do a cleanup... there was some plan to make the stack cleaner or something).

It had to do with a discussion about the incumbent script stack and what needed to be stored. I asked whether we could get away with just storing globals, and you realized that most script state was actually shared for all the scripts in a given global, and wanted to update the spec to reflect that.
Comment 5 Ian 'Hixie' Hickson 2013-11-01 23:06:29 UTC
Ok. Nothing else needs doing specifically here then, right? (Please reopen if something more needs doing.)
Comment 6 Ian 'Hixie' Hickson 2013-11-07 17:53:21 UTC
I remember what I needed to do. The stack of incumbent scripts has to be changed to be a stack of settings objects, so that bug 18242 can make sense.
Comment 7 Ian 'Hixie' Hickson 2013-11-07 22:30:17 UTC
Also, the origin of scripts needs to move into the settings global if possible.
Comment 8 Bobby Holley (:bholley) 2013-11-07 22:35:39 UTC
(In reply to Ian 'Hixie' Hickson from comment #7)
> Also, the origin of scripts needs to move into the settings global if
> possible.

Well, scripts have 2 origins, right? The origin of their execution context, and the origin the script was loaded from, both of which are relevant for implementations. That's in the spec somewhere, right?
Comment 9 Ian 'Hixie' Hickson 2013-11-07 23:03:07 UTC
There's probably dozens of relevant origins, but what I'm talking about in comment 7 is about moving the "origin" and "effective script origin" of scripts as defined in the spec from something that's a feature of scripts to something that's a feature of their script settings object, since all scripts that share a script settings object also share the same origin and effective script origin, as far as I can tell. This is distinct from the the "muted errors flag", which is based on where the script came from.
Comment 10 Bobby Holley (:bholley) 2013-11-07 23:06:16 UTC
(In reply to Ian 'Hixie' Hickson from comment #9)
> This is distinct from the the
> "muted errors flag", which is based on where the script came from.

Yes, that was my concern. Sounds great.
Comment 11 contributor 2013-11-08 23:47:52 UTC
Checked in as WHATWG revision r8262.
Check-in comment: Move the spec from a stack of incumbent scripts to a stack of script settings object. This should in theory have no concrete effects (though I may have changed some of the origin used for Web Workers started from document.domain-affected scripts that were called from other scripts with different original origins).
http://html5.org/tools/web-apps-tracker?from=8261&to=8262