Returning undefined from a context listener in a contentScript should hide the menu

RESOLVED FIXED

Status

Add-on SDK
General
RESOLVED FIXED
5 years ago
5 years ago

People

(Reporter: mossop, Assigned: mossop)

Tracking

Firefox Tracking Flags

(Not tracked)

Details

Attachments

(2 attachments)

(Assignee)

Description

5 years ago
From the forum, if you have this in a contentScript:

self.on("context", function(node) {
  if (node.nodeName == "A") return true
});

It should hide the menu item if not clicking on an anchor node.
Created attachment 712214 [details]
Pointer to Github pull request: https://github.com/mozilla/addon-sdk/pull/778

Pointer to Github pull-request
Attachment #712214 - Flags: review?(dtownsend+bugmail)
(Assignee)

Comment 2

5 years ago
Comment on attachment 712214 [details]
Pointer to Github pull request: https://github.com/mozilla/addon-sdk/pull/778

This breaks when a context listener returns a string to change the item's label. I have a fix for this bug already though I'm just verifying one edge case against the old behaviour before submitting.
Attachment #712214 - Flags: review?(dtownsend+bugmail) → review-
(Assignee)

Comment 3

5 years ago
Created attachment 712217 [details]
Pointer to Github pull request: https://github.com/mozilla/addon-sdk/pull/779

Pointer to Github pull-request
(Assignee)

Updated

5 years ago
Attachment #712217 - Flags: review?(evold)
Attachment #712217 - Flags: review?(evold) → review+

Comment 4

5 years ago
Commits pushed to master at https://github.com/mozilla/addon-sdk

https://github.com/mozilla/addon-sdk/commit/11b766d803947adbc36e460bab5758c00c22be37
Bug 839814: Returning undefined from a context listener should hide the menu item.

https://github.com/mozilla/addon-sdk/commit/f26737bba08fa80e0775ecf08d2af59b02200cec
Merge pull request #779 from Mossop/bug839814

Fix Bug 839814: Returning undefined from a context listener should hide the menu item. r=@erikvold
Status: NEW → RESOLVED
Last Resolved: 5 years ago
Resolution: --- → FIXED

Comment 5

5 years ago
Commit pushed to stabilization at https://github.com/mozilla/addon-sdk

https://github.com/mozilla/addon-sdk/commit/22cda4b088a46f086fdfd6d8cabbf7e30605b7f3
Bug 839814: Returning undefined from a context listener should hide the menu item.
(cherry picked from commit 11b766d803947adbc36e460bab5758c00c22be37)
You need to log in before you can comment on or make changes to this bug.