Closed
Bug 865377
Opened 12 years ago
Closed 12 years ago
Give EventTarget a chrome-only getter that returns the relevant global
Categories
(Core :: DOM: Events, defect)
Tracking
()
RESOLVED
FIXED
mozilla24
People
(Reporter: bzbarsky, Assigned: bzbarsky)
Details
Attachments
(1 file, 1 obsolete file)
The goal is that given an EventTarget "t" you can do:
t.dispatchEvent(new t.global.Event("something"));
in chrome code and create the Event with the right permissions that event listeners on the target can touch it.
Questions:
1) What should the attribute return? I'm tempted to say "Window" for now...
2) What should it be named?
Flags: needinfo?(bugs)
![]() |
Assignee | |
Comment 2•12 years ago
|
||
Attachment #756097 -
Flags: review?(bugs)
![]() |
Assignee | |
Updated•12 years ago
|
Assignee: nobody → bzbarsky
Comment 3•12 years ago
|
||
Comment on attachment 756097 [details] [diff] [review]
Give EventTarget a chrome-only getter that returns its global. idea is that you then do things like t.dispatchEvent(new t.ownerGlobal.Event("something")).
Hmm, you're returning outer window for nodes and inner window for DETHs.
{ goes to its own line at the beginning of a method.
r- because we need to return always same kind of window, and would be
good to even document that in EventTarget.h
Attachment #756097 -
Flags: review?(bugs) → review-
![]() |
Assignee | |
Comment 4•12 years ago
|
||
> Hmm, you're returning outer window for nodes and inner window for DETHs.
Doesn't matter for JS callers. Are you worried about C++ callers?
Do you just always want to see the outer window here?
Flags: needinfo?(bugs)
![]() |
Assignee | |
Comment 5•12 years ago
|
||
Attachment #756158 -
Flags: review?(bugs)
![]() |
Assignee | |
Updated•12 years ago
|
Attachment #756097 -
Attachment is obsolete: true
Comment 6•12 years ago
|
||
Comment on attachment 756158 [details] [diff] [review]
Give EventTarget a chrome-only getter that returns its global. idea is that you then do things like t.dispatchEvent(new t.ownerGlobal.Event("something")).
>+nsIDOMWindow*
>+nsINode::GetOwnerGlobal()
>+{
>+ return nsPIDOMWindow::GetOuterFromCurrentInner(OwnerDoc()->GetInnerWindow());
>+}
oh, crap. I realized we want to support data documents too.
So this should use GetScriptHandlingObject().
bool dummy;
return nsPIDOMWindow::GetOuterFromCurrentInner(static_cast<nsGlobalWindow*>OwnerDoc()->GetScriptHandlingObject(dummy));
Something like that.
>+ virtual nsIDOMWindow* GetOwnerGlobal() MOZ_OVERRIDE {
{ goes to the next line
>+'WindowProxy': [
>+{
>+ 'nativeType': 'nsIDOMWindow',
>+ 'concrete': False
>+},
>+{
>+ 'workers': True
>+}],
workers True needs some explanation.
Attachment #756158 -
Flags: review?(bugs) → review+
Updated•12 years ago
|
Flags: needinfo?(bugs)
![]() |
Assignee | |
Comment 7•12 years ago
|
||
> So this should use GetScriptHandlingObject().
Good catch, done.
Addressed the other two as well.
https://hg.mozilla.org/integration/mozilla-inbound/rev/a6de622f9574
Flags: in-testsuite?
Target Milestone: --- → mozilla24
Comment 8•12 years ago
|
||
Status: NEW → RESOLVED
Closed: 12 years ago
Resolution: --- → FIXED
You need to log in
before you can comment on or make changes to this bug.
Description
•