Closed Bug 789261 Opened 12 years ago Closed 10 years ago

WebIDL bindings for Window

Categories

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

x86
macOS
defect
Not set
normal

Tracking

()

RESOLVED FIXED
mozilla32

People

(Reporter: bzbarsky, Assigned: peterv)

References

(Depends on 1 open bug, Blocks 3 open bugs)

Details

Attachments

(1 file, 1 obsolete file)

We should move Window to WebIDL.  Then we could do things like have 

  [ChromeOnly]
  readonly attribute nsIDocShell docshell;

and whatnot.

Prereqs that probably need separate bugs and can be done somewhat independently of each other:

* [Unforgeable] support
* [Replaceable] support
* Moving support for indexed access on Window to the outer-window proxy object.
* [NamedPropertiesObject] support, though this is hard to test without Window
  being converted.
* Adding a [Global] extended attr we can use to make sure to give globals the
  right sort of jsclass.

We would also need to make sure that our bindings only use reserved slot 0, which I think is true.

Once the above are done, I think it's a "straightforward" conversion...
Recent es-discuss & public-script-coord discussion led to realize that currently window.location is reflected as a data property. Solving this bug should solve this for Gecko and make location reflected as an own non-configurable accessor.
I'm not filing a separate bug, because I don't think it's necessary. I just wanted to keep this in mind.
Blocks: 875198
Depends on: 881886
Blocks: 888591
Depends on: 890684
The spec now requires properties from Window and its superinterfaces to be own properties on the window object.

http://lists.w3.org/Archives/Public/public-script-coord/2013JulSep/0119.html
Blocks: 824217
Blocks: 908099
Blocks: 866222
Blocks: 916586
Depends on: 918345
No longer depends on: 760095
Depends on: 945411
Depends on: 945416
Depends on: 946289
Depends on: 935855
Depends on: 953024
Depends on: 962747
Blocks: 962747
No longer depends on: 962747
Depends on: 964875
Depends on: 965144
Blocks: 965153
Depends on: 965154
Blocks: 965898
Blocks: 981796
Depends on: 982680
Depends on: 982684
Depends on: 982112, 982114
Depends on: 983619
Depends on: 983620
Depends on: 984495
Depends on: 984497
Depends on: CVE-2014-1526
Depends on: 988310
No longer blocks: CVE-2014-8636
Depends on: 988863
Depends on: 990158
Depends on: 990475
Depends on: 993047
Depends on: 993053
Depends on: 993057
Depends on: 993058
Depends on: 993060
Depends on: 993688
Depends on: 993706
Depends on: 993710
Depends on: 1010658
Depends on: 1010955
Depends on: 1010872
Attached patch v1 (obsolete) (deleted) — Splinter Review
Assignee: nobody → peterv
Status: NEW → ASSIGNED
Attachment #8423108 - Flags: review?(bzbarsky)
Comment on attachment 8423108 [details] [diff] [review]
v1

>+++ b/dom/bindings/Bindings.conf
>-    'register': False,

Hmm.  So if the pref is flipped without undoing this, we'll have Window.prototype not be window.__proto__, right?  The former will be the WebIDL thing, the latter the XPConnect proto.

Maybe add comments next to the the pref in all.js to put these 'register':
False bits in when flipping the pref?  Alternately, we could maybe add a [Pref]
on Window in the webidl?  Not sure whether that would end up doing the right thing.

r=me
Attachment #8423108 - Flags: review?(bzbarsky) → review+
Blocks: 1012798
(In reply to Boris Zbarsky [:bz] from comment #5)
> Hmm.  So if the pref is flipped without undoing this, we'll have
> Window.prototype not be window.__proto__, right?  The former will be the
> WebIDL thing, the latter the XPConnect proto.

Turns out no, since XPConnect global creation ends up calling PostCreatePrototype which will define the XPConnect proto as window.Window.

https://hg.mozilla.org/integration/mozilla-inbound/rev/c744c837c732
The failures mostly seem to be around EventTarget stuff being detected as "global leaks".  I wonder whether the tests are seeing inconsistent views via Xrays and non-Xrays or something....
Although, gaia/source/dev_apps/test-agent/common/vendor/mocha/mocha.js has some nasty hardcoded list of "globals", as does gaia/source/dev_apps/test-ime/lib/mocha.js
The problem is with tests that stub properties on window with the Sinon.JS framework, the stubs are installed as own properties on the object. These properties are then detected as 'leaking' by the Mocha framework. This only happens for properties that are not originally own properties, so basically the EventTarget properties. It's actually a problem with Window on XPConnect too, except that we install the EventTarget WebIDL properties on the XPConnect wrapper (http://hg.mozilla.org/mozilla-central/annotate/cb9f34f73ebe/dom/base/nsDOMClassInfo.cpp#l1809) :-/.
Flags: needinfo?(peterv)
Depends on: 1013796
Depends on: 1013802
Depends on: 1013816
Depends on: 1014180
Depends on: 1014537
And backed out again.

https://hg.mozilla.org/integration/mozilla-inbound/rev/771ac7138d0a

Bug 1012944 made |back()| ChromeOnly but didn't fix any tests that depended on it.
Ugh.  I'd looked for those, but must have missed them.  :(

Should we undo the chromeonly bit for "back" for now?
Attached patch v1 (deleted) — Splinter Review
With the fixes for ChromeOnly |back()|. Still waiting for the gaia merge to pick up the fix for bug 1014180.
Attachment #8423108 - Attachment is obsolete: true
Attachment #8428576 - Flags: review+
Comment on attachment 8428576 [details] [diff] [review]
v1

Would it not make more sense to use window.history.back() instead of window.back() instead?
https://hg.mozilla.org/mozilla-central/rev/2587cd80a66e
Status: ASSIGNED → RESOLVED
Closed: 10 years ago
Flags: in-testsuite+
Resolution: --- → FIXED
Target Milestone: --- → mozilla32
Depends on: 1016960
Blocks: 824495
Depends on: 1017134
Blocks: 1017424
Depends on: 1016988
Depends on: 1017811
Depends on: 1018351
Depends on: 1017176
Depends on: 1018830
Depends on: 1018797
No longer depends on: 1018830
Depends on: 1018085
No longer depends on: 1018797
Depends on: 1019275
Could this have caused a ~10 MiB reduction in the "JS: After TP5" measurements on areweslimyet.com? It certainly looks that way :)
Depending on how many windows are live, possibly: we used to create a bunch of function objects on both the window and its prototype and now they're just on the window itself.
Blocks: 1031945
Depends on: 1031988
Blocks: 1036185
Depends on: 1032958
No longer depends on: 1032958
Depends on: 1067869
Blocks: 890081
Component: DOM → DOM: Core & HTML
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: