Closed Bug 290420 Opened 19 years ago Closed 19 years ago

Firefox context menu code shouldn't rely on localname tests

Categories

(Firefox :: General, defect, P2)

defect

Tracking

()

RESOLVED FIXED
Firefox1.5

People

(Reporter: bzbarsky, Assigned: asaf)

References

Details

(Keywords: fixed-aviary1.0.5, fixed1.7.9)

Attachments

(1 file)

The Firefox context menu code uses the localName of DOM nodes to identify the
type of node.  It should just use the appropriate |instanceof| tests instead. 
For example, replace:

296             } else if ( this.target.localName.toUpperCase() == "TEXTAREA" ) {
297                  this.onTextInput = true;
298             } else if ( this.target.localName.toUpperCase() == "HTML" ) {

with:

  } else if ( this.target instanceof HTMLTextAreaElement ) {
      this.onTextInput = true;
  } else if ( this.target instanceof HTMLHtmlElement ) {

etc.  As things stand, the code behaves incorrectly for XML documents, and the
existing code may even be subject to spoofing or security issues (see bug 290324
for an example, though with an extension).

Note also bug 245660, which removes some cases of this.
Assignee: firefox → bugs
Assignee: bugs → bugs.mano
Priority: -- → P2
Target Milestone: --- → Firefox1.1
Attached patch patchSplinter Review
I am sure if I need to lowercase the type property.
Attachment #186534 - Flags: superreview?(bzbarsky)
I won't be able to get to this till July, and this needs review from firefox
folks anyway (and doesn't need sr, being a firefox change).
Comment on attachment 186534 [details] [diff] [review]
patch

ok
Attachment #186534 - Flags: superreview?(bzbarsky) → review?(mconnor)
Comment on attachment 186534 [details] [diff] [review]
patch

>@@ -4202,10 +4201,9 @@
>+                    if ( ( elem instanceof HTMLQuoteElemen && 'cite' in elem && elem.cite)  ||
You've got a typo here, this should probably be HTMLQuoteElement.
Blocks: 298892
Status: NEW → ASSIGNED
Flags: blocking1.8b4?
patch incorporated into the fix for bug 298892 -- thanks!
fixed on trunk and branches.
Status: ASSIGNED → RESOLVED
Closed: 19 years ago
Resolution: --- → FIXED
Flags: blocking1.8b4?
Attachment #186534 - Flags: review?(mconnor)
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: