Closed Bug 141717 Opened 23 years ago Closed 22 years ago

function getSelection() breaks context menus

Categories

(Core :: XUL, defect)

defect
Not set
major

Tracking

()

RESOLVED FIXED

People

(Reporter: caillon, Assigned: caillon)

References

()

Details

Attachments

(1 file)

If a page tries to write its own |function getSelection()| context menus will break since it uses getSelection for the "Search engine" context menu item. Mozilla should either prevent users over-writing this, or not break context menus. See also bug 141716 for fixing Bugzilla to not use that method.
There's nothing that can be done about this in the DOM, the code that deals with the context menus can work around this to be certain (or more so at least) they're calling the right method. The "right" getSelection() method can be found on the window object's prototype even if a webpage defines its own function named getSelection. To do this, the context menu code can do something like this (not exactly clean, but we don't have much better options here): window.__proto__.getSelection.call(window);
Assignee: jst → jaggernaut
Component: DOM Level 0 → XP Toolkit/Widgets
QA Contact: desale → jrgm
jst's workaround might be useful for other chrome javascript that interacts with the page's window object. See bug 36946 (still security-sensitive!?) for related discussion.
Attached patch Patch v.1.0Splinter Review
Yeah this works I guess. Also fixes a problem where we reference an undefined property (this.onMetaDataItem).
Comment on attachment 90364 [details] [diff] [review] Patch v.1.0 sr=jst
Attachment #90364 - Flags: superreview+
Checked in.
Status: NEW → RESOLVED
Closed: 22 years ago
Resolution: --- → FIXED
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: