Open Bug 451553 Opened 16 years ago Updated 2 years ago

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

Categories

(Toolkit :: UI Widgets, defect, P5)

defect

Tracking

()

People

(Reporter: TheSeer, Unassigned)

References

Details

Attachments

(1 file)

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
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

The bug assignee didn't login in Bugzilla in the last 7 months.
:mstriemer, could you have a look please?
For more information, please visit auto_nag documentation.

Assignee: TheSeer → nobody
Flags: needinfo?(mstriemer)

This should get moved to comm-central in bug 1591355

Severity: minor → S4
Flags: needinfo?(mstriemer)
Priority: -- → P5
See Also: → 1591355
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: