Last Comment Bug 675267 - Remove unnecessary target arguments from some event listener manager apis
: Remove unnecessary target arguments from some event listener manager apis
Status: RESOLVED FIXED
:
Product: Core
Classification: Components
Component: DOM: Events (show other bugs)
: Trunk
: x86 Mac OS X
: -- normal (vote)
: mozilla8
Assigned To: Boris Zbarsky [:bz] (TPAC)
:
Mentors:
Depends on:
Blocks: 659350
  Show dependency treegraph
 
Reported: 2011-07-29 11:03 PDT by Boris Zbarsky [:bz] (TPAC)
Modified: 2011-08-01 07:52 PDT (History)
3 users (show)
bzbarsky: in‑testsuite-
See Also:
Crash Signature:
(edit)
QA Whiteboard:
Iteration: ---
Points: ---
Has Regression Range: ---
Has STR: ---


Attachments
Fix (25.68 KB, patch)
2011-07-29 11:05 PDT, Boris Zbarsky [:bz] (TPAC)
bugs: review+
Details | Diff | Splinter Review

Description Boris Zbarsky [:bz] (TPAC) 2011-07-29 11:03:51 PDT
As far as I can tell, all the callers pass exactly what we have in mTarget.
Comment 1 Boris Zbarsky [:bz] (TPAC) 2011-07-29 11:05:53 PDT
Created attachment 549425 [details] [diff] [review]
Fix

Try run is http://tbpl.mozilla.org/?tree=Try&rev=b683e4a9e6bf and looks good
Comment 2 Olli Pettay [:smaug] (TPAC) 2011-07-29 12:23:30 PDT
Comment on attachment 549425 [details] [diff] [review]
Fix


>     if (document &&
>         (win = document->GetInnerWindow()) && win->IsInnerWindow()) {
>       nsCOMPtr<nsIDOMEventTarget> piTarget(do_QueryInterface(win));
>-      NS_ENSURE_TRUE(piTarget, NS_ERROR_FAILURE);
>-
>-      *aManager = piTarget->GetListenerManager(PR_TRUE);
>-
>-      if (*aManager) {
>-        NS_ADDREF(*aTarget = win);
>-        NS_ADDREF(*aManager);
>-      }
>-      *aDefer = PR_FALSE;
>-    } else {
>-      *aManager = nsnull;
>-      *aTarget = nsnull;
>-      *aDefer = PR_FALSE;
>+      NS_ENSURE_TRUE(piTarget, nsnull);
You could just drop NS_ENSURE_TRUE.
If nsPIDOMWindow doesn't implement nsIDOMEventTarget, something is badly wrong and it is
ok to crash, IMO.
Comment 3 Boris Zbarsky [:bz] (TPAC) 2011-07-29 12:38:35 PDT
Done.
Comment 4 Boris Zbarsky [:bz] (TPAC) 2011-07-29 18:37:49 PDT
http://hg.mozilla.org/integration/mozilla-inbound/rev/c5defc500925
Comment 5 Marco Bonardo [::mak] 2011-08-01 07:52:13 PDT
http://hg.mozilla.org/mozilla-central/rev/c5defc500925

Note You need to log in before you can comment on or make changes to this bug.