Closed
Bug 1440407
Opened 6 years ago
Closed 6 years ago
add a method to cast nsPIDOMWindowInner to nsIGlobalObject without QI
Categories
(Core :: DOM: Core & HTML, enhancement)
Core
DOM: Core & HTML
Tracking
()
RESOLVED
FIXED
mozilla60
Tracking | Status | |
---|---|---|
firefox60 | --- | fixed |
People
(Reporter: bkelly, Assigned: bkelly)
References
Details
Attachments
(2 files)
1.47 KB,
patch
|
nika
:
review+
|
Details | Diff | Splinter Review |
31.27 KB,
patch
|
nika
:
review+
|
Details | Diff | Splinter Review |
Currently we have code in a number of places that QIs nsPIDOMWindowInner to nsIGlobalObject. Since nsPIDOMWindowInner is only ever implemented by nsGlobalWindowInner and nsGlobalWindowInner implements nsIGlobalObject, then this QI can never fail. We should perhaps instead just expose a simple cast method on nsPIDOMWindowInner to avoid this QI overhead. I would like to use this in bug 1438211.
Assignee | ||
Comment 1•6 years ago
|
||
We can kind of already do this with nsGlobalWindowInner::Cast(), but that requires code to include nsGlobalWindowInner.h which is not really ideal.
Assignee | ||
Comment 2•6 years ago
|
||
Assignee | ||
Comment 3•6 years ago
|
||
Assignee | ||
Comment 4•6 years ago
|
||
Comment on attachment 8953199 [details] [diff] [review] P1 Add nsPIDOMWindowInner::AsGlobal() to cheaply cast to nsIGlobalObject*. r=mystor Nika, this patch adds the AsGlobal() cast method as we discussed. I followed the example of AsInner() and provided both const/non-const versions.
Attachment #8953199 -
Flags: review?(nika)
Assignee | ||
Comment 5•6 years ago
|
||
Comment on attachment 8953200 [details] [diff] [review] P2 Remove some unnecessary nsPIDOMWindowInner QI to nsIGlobalObject. r=mystor This patch converts the cases of QI from window-to-global that I could find. Its kind of hard to search for in searchfox. Note, some of these callsites were relying on the nullptr check post-QI to catch a nullptr window. So I had to add some additional window checking in places. I also fixed up some unrelated error checking like not looking for aRv.Failed() after Promise::Create(), etc.
Attachment #8953200 -
Flags: review?(nika)
Updated•6 years ago
|
Attachment #8953199 -
Flags: review?(nika) → review+
Comment 6•6 years ago
|
||
Comment on attachment 8953200 [details] [diff] [review] P2 Remove some unnecessary nsPIDOMWindowInner QI to nsIGlobalObject. r=mystor Review of attachment 8953200 [details] [diff] [review]: ----------------------------------------------------------------- Much cleaner, thanks!
Attachment #8953200 -
Flags: review?(nika) → review+
Pushed by bkelly@mozilla.com: https://hg.mozilla.org/integration/mozilla-inbound/rev/65cd02963e83 P1 Add nsPIDOMWindowInner::AsGlobal() to cheaply cast to nsIGlobalObject*. r=mystor https://hg.mozilla.org/integration/mozilla-inbound/rev/607de876681e P2 Remove some unnecessary nsPIDOMWindowInner QI to nsIGlobalObject. r=mystor
Comment 8•6 years ago
|
||
bugherder |
https://hg.mozilla.org/mozilla-central/rev/65cd02963e83 https://hg.mozilla.org/mozilla-central/rev/607de876681e
Status: ASSIGNED → RESOLVED
Closed: 6 years ago
status-firefox60:
--- → fixed
Resolution: --- → FIXED
Target Milestone: --- → mozilla60
Updated•5 years ago
|
Component: DOM → DOM: Core & HTML
You need to log in
before you can comment on or make changes to this bug.
Description
•