Closed
Bug 853607
Opened 11 years ago
Closed 11 years ago
Mousing across a <video controls> element triggers tons of "WARNING: NS_ENSURE_TRUE(wrapper) failed: file dom/base/nsJSUtils.cpp, line 84"
Categories
(Core :: DOM: Core & HTML, defect)
Tracking
()
RESOLVED
FIXED
mozilla22
People
(Reporter: dholbert, Assigned: dholbert)
References
()
Details
Attachments
(1 file)
1.13 KB,
patch
|
bzbarsky
:
review+
|
Details | Diff | Splinter Review |
STR:
1. Load data:text/html,<video controls> in a debug build
2. Mouse over the video
ACTUAL RESULTS:
We spam tons of instances of this warning to the terminal:
> WARNING: NS_ENSURE_TRUE(wrapper) failed: file /mozilla/dom/base/nsJSUtils.cpp, line 84
We spam an instance for every mousemove event on top of the <video>, it looks like.
Assignee | ||
Comment 1•11 years ago
|
||
The code in question is: ==== 50 nsIScriptGlobalObject * 51 nsJSUtils::GetStaticScriptGlobal(JSObject* aObj) 52 { [...] 75 // We might either have a window directly (e.g. if the global is a 76 // sandbox whose script object principal pointer is a window), or an 77 // XPCWrappedNative for a window. We could also have other 78 // sandbox-related script object principals, but we can't do much 79 // about those short of trying to walk the proto chain of |glob| 80 // looking for a window or something. 81 nsCOMPtr<nsIScriptGlobalObject> sgo(do_QueryInterface(supports)); 82 if (!sgo) { 83 nsCOMPtr<nsIXPConnectWrappedNative> wrapper(do_QueryInterface(supports)); 84 NS_ENSURE_TRUE(wrapper, nullptr); 85 sgo = do_QueryWrappedNative(wrapper); 86 } ==== https://mxr.mozilla.org/mozilla-central/source/dom/base/nsJSUtils.cpp#75 and we're failing the NS_ENSURE_TRUE, because our 'supports' object is an instance of 'PrincipalHolder' that apparently can't be QI'd to a nsIXPConnectWrappedNative. Based on the comment, it sounds like this is the "we can't do much" case, and this is a non-scary situation that's not worthy of spamming up anyone's terminal. If that's the case, we should just null-check and return, instead of using the spammy NS_ENSURE_TRUE.
Assignee | ||
Comment 2•11 years ago
|
||
Looks like this was last-modified in https://hg.mozilla.org/mozilla-central/rev/78fd73ca849e but that just really added an "if" check (and the explanatory comment quoted above) around an existing QI / NS_ENSURE_TRUE that dates back to 2001 (line 187 here: http://bonsai.mozilla.org/cvsblame.cgi?file=mozilla/dom/src/base/nsJSUtils.cpp&rev=1.71#187 ) Anyway -- per the explanatory comment, I don't think we need the NS_ENSURE-spam here.
Assignee | ||
Comment 3•11 years ago
|
||
Assignee | ||
Comment 4•11 years ago
|
||
Note that according to bz and Ms2ger (in IRC), do_QueryWrappedNative isn't guaranteed to be null-safe. (If it were, then we could just completely drop the NS_ENSURE_TRUE, let do_QueryWrappedNative fail, and end up returning null via the "return sgo;" at the end)
Comment 5•11 years ago
|
||
Comment on attachment 727861 [details] [diff] [review] fix v1 r=me
Attachment #727861 -
Flags: review?(bzbarsky) → review+
Assignee | ||
Comment 6•11 years ago
|
||
https://hg.mozilla.org/integration/mozilla-inbound/rev/37b1ec12f606
Comment 7•11 years ago
|
||
https://hg.mozilla.org/mozilla-central/rev/37b1ec12f606
Status: ASSIGNED → RESOLVED
Closed: 11 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla22
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
•