Closed
Bug 964875
Opened 11 years ago
Closed 11 years ago
Figure out a plan for ChromeWindow in the WebIDL world
Categories
(Core :: DOM: Core & HTML, defect)
Tracking
()
RESOLVED
FIXED
mozilla30
People
(Reporter: bzbarsky, Assigned: bzbarsky)
References
Details
Attachments
(3 files, 1 obsolete file)
part 1. Add a WebIDL ChromeWindow interface for use in instanceof once Window is on WebIDL bindings.
3.25 KB,
patch
|
peterv
:
review+
|
Details | Diff | Splinter Review |
2.18 KB,
patch
|
peterv
:
review+
|
Details | Diff | Splinter Review |
21.25 KB,
patch
|
peterv
:
review+
|
Details | Diff | Splinter Review |
We could make an interface inheriting from Window, but that runs into the slight issue that [Global] does not allow interfaces inheriting from it in the spec and also that [StoreInSlot] is not supported on non-leaf interfaces.
We could try to change those, or we could try to hack around this as follows:
1) Define an empty [ChromeOnly] ChromeWindow interface and have Window implement it. Change the hasInstance codegen to treat that case like the "have prototype object" case, by doing a QI to nsIDOMChromeWindow and put this in Bindings.conf:
'ChromeWindow': {
'concrete': False,
'headerFile': 'nsGlobalWindow.h',
'nativeType': 'nsGlobalChromeWindow',
},
2) Put all the nsIDOMChromeWindow bits on Window, with Func that QIs the object to nsIDOMChromeWindow guarding them.
This will give us the right instanceof behavior and members. The one thing that would break is adding things to ChromeWindow.prototype making theme exposed on the chrome window (and in fact ChromeWindow.prototype would no longer exist). I suspect that's OK.
Assignee | ||
Comment 1•11 years ago
|
||
Addons mxr shows no hits for ChromeWindow.prototype, fwiw.
Assignee | ||
Comment 2•11 years ago
|
||
Peter points out that nsGlobalWindow::IsChromeWindow exists; we should use that in the Func instead. And maybe in the HasInstance code.
Blocks: 789261
Assignee | ||
Comment 3•11 years ago
|
||
Attachment #8367131 -
Flags: review?(peterv)
Assignee | ||
Updated•11 years ago
|
Assignee: nobody → bzbarsky
Status: NEW → ASSIGNED
Assignee | ||
Comment 4•11 years ago
|
||
Attachment #8367132 -
Flags: review?(peterv)
Assignee | ||
Comment 5•11 years ago
|
||
Attachment #8367133 -
Flags: review?(peterv)
Assignee | ||
Updated•11 years ago
|
Whiteboard: [need review]
Assignee | ||
Comment 6•11 years ago
|
||
Attachment #8367824 -
Flags: review?(peterv)
Assignee | ||
Updated•11 years ago
|
Attachment #8367133 -
Attachment is obsolete: true
Attachment #8367133 -
Flags: review?(peterv)
Comment 7•11 years ago
|
||
Comment on attachment 8367131 [details] [diff] [review]
part 1. Add a WebIDL ChromeWindow interface for use in instanceof once Window is on WebIDL bindings.
Review of attachment 8367131 [details] [diff] [review]:
-----------------------------------------------------------------
::: dom/bindings/Codegen.py
@@ +1265,5 @@
> return true;
> }
> """
> + if self.descriptor.interface.identifier.name == "ChromeWindow":
> + setBp = "*bp = UnwrapDOMObject<nsGlobalWindow>(js::UncheckedUnwrap(instance))->IsChromeWindow()"
I know there are very few of these special cases, but how about a IsInstanceOf function templated on prototype id that does this check for ChromeWindow and just returns true for all other ids? We could use it for ModalWindow too.
Attachment #8367131 -
Flags: review?(peterv) → review+
Comment 8•11 years ago
|
||
Comment on attachment 8367132 [details] [diff] [review]
part 2. Add a static nsGlobalWindow::IsChromeWindow test function for use in Func annotations.
Review of attachment 8367132 [details] [diff] [review]:
-----------------------------------------------------------------
::: dom/base/nsGlobalWindow.cpp
@@ +4045,5 @@
> + nsGlobalWindow* win;
> + nsresult rv = UNWRAP_OBJECT(Window, aObj, win);
> + if (NS_FAILED(rv)) {
> + nsCOMPtr<nsPIDOMWindow> piWin = do_QueryInterface(
> + nsContentUtils::XPConnect()->GetNativeOfWrapper(aCx, aObj));
do_QueryWrapper?
Attachment #8367132 -
Flags: review?(peterv) → review+
Updated•11 years ago
|
Attachment #8367824 -
Flags: review?(peterv) → review+
Assignee | ||
Comment 9•11 years ago
|
||
> how about a IsInstanceOf function templated on prototype id that does this check for
> ChromeWindow
The prototype id in this case is prototypes::id::Window. That's why I need the additional check; the current setup assumes that if "Foo implements Bar" then any Foo instance is a Bar instance, but for "Window implements ChromeWindow" that's not actually true...
> do_QueryWrapper?
Yes, good idea.
Assignee | ||
Comment 10•11 years ago
|
||
https://hg.mozilla.org/integration/mozilla-inbound/rev/97ee8ec34362
https://hg.mozilla.org/integration/mozilla-inbound/rev/ef6e5cfea527
https://hg.mozilla.org/integration/mozilla-inbound/rev/9dcc5957f89e
Flags: in-testsuite+
Whiteboard: [need review]
Target Milestone: --- → mozilla30
Comment 11•11 years ago
|
||
https://hg.mozilla.org/mozilla-central/rev/97ee8ec34362
https://hg.mozilla.org/mozilla-central/rev/ef6e5cfea527
https://hg.mozilla.org/mozilla-central/rev/9dcc5957f89e
Status: ASSIGNED → RESOLVED
Closed: 11 years ago
Resolution: --- → FIXED
Updated•6 years ago
|
Component: DOM → DOM: Core & HTML
You need to log in
before you can comment on or make changes to this bug.
Description
•