getHTMLEditor() of editor.xml binding can trigger js error

NEW
Assigned to

Status

()

--
minor
10 years ago
10 years ago

People

(Reporter: TheSeer, Assigned: TheSeer)

Tracking

Trunk
Points:
---

Firefox Tracking Flags

(Not tracked)

Details

Attachments

(1 attachment)

(Assignee)

Description

10 years ago
User-Agent:       Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.0.1) Gecko/2008071615 Fedora/3.0.1-1.fc9 Firefox/3.0.1
Build Identifier: http://mxr.mozilla.org/mozilla/source/toolkit/content/widgets/editor.xml

In line 91, the return value of the assignment from line 90 is used directly though the code in line 90 might return NULL if executed to early before initialization could complete.

Additionally, line 90 is redundant to what getEditor() does (Line 78+), so it might be called instead.

For consistency with getEditor(), the code for getHtmlEditor() should return NULL as well

Reproducible: Sometimes

Actual Results:  
Javascript Error

Expected Results:  
return value of false or NULL
(Assignee)

Comment 1

10 years ago
Created attachment 334895 [details] [diff] [review]
Proposed solution to avoid the js error and return consistent result
Comment on attachment 334895 [details] [diff] [review]
Proposed solution to avoid the js error and return consistent result

>--- toolkit/content/widgets/editor_orig.xml	2008-04-03 01:15:03.000000000 +0200
>+++ toolkit/content/widgets/editor.xml	2008-08-21 17:02:01.459890163 +0200

>-          var editor = this.editingSession.getEditorForWindow(containingWindow);
>-          return editor.QueryInterface(Components.interfaces.nsIHTMLEditor);
>+          var editor = this.getEditor(containingWindow);
>+          return editor ? editor.QueryInterface(Components.interfaces.nsIHTMLEditor) : editor;

Return null explicitly instead of "editor"?

r=me with that.
Attachment #334895 - Flags: review+
Assignee: nobody → TheSeer
Status: UNCONFIRMED → NEW
Ever confirmed: true
Version: unspecified → Trunk
You need to log in before you can comment on or make changes to this bug.