Closed Bug 964576 Opened 6 years ago Closed 6 years ago

JavaScript error: 'target is null' in CustomizableUI.jsm

Categories

(Firefox :: Toolbars and Customization, defect)

defect
Not set

Tracking

()

RESOLVED FIXED
Firefox 29

People

(Reporter: mikedeboer, Assigned: Gijs)

References

(Blocks 1 open bug)

Details

(Whiteboard: [Australis:P4])

Attachments

(1 file, 1 obsolete file)

Error from console:

************************************************************
* Call to xpconnect wrapped JSObject produced this error:  *
[Exception... "[JavaScript Error: "target is null" {file: "resource:///modules/CustomizableUI.jsm" line: 1236}]'[JavaScript Error: "target is null" {file: "resource:///modules/CustomizableUI.jsm" line: 1236}]' when calling method: [nsIDOMEventListener::handleEvent]"  nsresult: "0x80570021 (NS_ERROR_XPC_JAVASCRIPT_ERROR_WITH_DETAILS)"  location: "native frame :: <unknown filename> :: <TOP_LEVEL> :: line 0"  data: yes]
************************************************************

Relevant line:

http://dxr.mozilla.org/mozilla-central/source/browser/components/customizableui/src/CustomizableUI.jsm#1223

This happened while I was dragging the Bookmarks widget around.

Obvious fix: `if (!target) break;` before line 1223.
Status: NEW → ASSIGNED
Whiteboard: [Australis:P2] → [Australis:P4]
The issue here is with the fact that in customize mode, the panel node isn't in the ancestor tree, so the loop walks all the way up before terminating. Not a good idea. We can just bail out if there's no panel.
Attachment #8366364 - Flags: review?(mdeboer)
Assignee: nobody → gijskruitbosch+bugs
... of course, the right return value would kind of help.
Attachment #8366365 - Flags: review?(mdeboer)
Attachment #8366364 - Attachment is obsolete: true
Attachment #8366364 - Flags: review?(mdeboer)
Comment on attachment 8366365 [details] [diff] [review]
fix target is null JS error in Australis' CustomizableUI,

Review of attachment 8366365 [details] [diff] [review]:
-----------------------------------------------------------------

::: browser/components/customizableui/src/CustomizableUI.jsm
@@ +1207,5 @@
> +    // This can happen in e.g. customize mode. If there's no panel,
> +    // there's clearly nothing for us to close; pretend we're interactive.
> +    if (!panel) {
> +      return true;
> +    }

nit: no need for curlies here.
Attachment #8366365 - Flags: review?(mdeboer) → review+
(In reply to Mike de Boer [:mikedeboer] from comment #3)
> Comment on attachment 8366365 [details] [diff] [review]
> fix target is null JS error in Australis' CustomizableUI,
> 
> Review of attachment 8366365 [details] [diff] [review]:
> -----------------------------------------------------------------
> 
> ::: browser/components/customizableui/src/CustomizableUI.jsm
> @@ +1207,5 @@
> > +    // This can happen in e.g. customize mode. If there's no panel,
> > +    // there's clearly nothing for us to close; pretend we're interactive.
> > +    if (!panel) {
> > +      return true;
> > +    }
> 
> nit: no need for curlies here.

Almost every single-line if statement in this file uses braces...
remote:   https://hg.mozilla.org/integration/fx-team/rev/4ff11d0219cc
Whiteboard: [Australis:P4] → [Australis:P4][fixed-in-fx-team]
https://hg.mozilla.org/mozilla-central/rev/4ff11d0219cc
Status: ASSIGNED → RESOLVED
Closed: 6 years ago
Resolution: --- → FIXED
Whiteboard: [Australis:P4][fixed-in-fx-team] → [Australis:P4]
Target Milestone: --- → Firefox 29
You need to log in before you can comment on or make changes to this bug.