Closed
Bug 690163
Opened 14 years ago
Closed 14 years ago
URL section "Attaching content scripts to tabs" incorrect?
Categories
(Add-on SDK Graveyard :: Documentation, defect, P2)
Add-on SDK Graveyard
Documentation
Tracking
(Not tracked)
RESOLVED
FIXED
1.2
People
(Reporter: Terry.F1Com, Assigned: KWierso)
References
()
Details
(Whiteboard: [cherry-pick-1.2])
Attachments
(1 file, 1 obsolete file)
515 bytes,
patch
|
wbamberg
:
review+
|
Details | Diff | Splinter Review |
Reported from the webmaster email address:
At the example "Attaching content scripts to tabs", the Widget ID is missing and it doesn't work.
The right way would be:
var widgets = require("widget");
var tabs = require("tabs");
var widget = widgets.Widget({
id: "Div-Show",
label: "Show divs",
contentURL: "http://www.mozilla.org/favicon.ico",
onClick: function() {
tabs.activeTab.attach({
contentScript:
'var divs = document.getElementsByTagName("div");' +
'for (var i = 0; i < divs.length; ++i) {' +
'divs[i].setAttribute("style", "border: solid red 1px;");' +
'}'
});
}
});
Assignee | ||
Comment 1•14 years ago
|
||
So this patch adds an ID attribute to the widget's constructor.
I'm open to a better ID, though. :)
Attachment #563254 -
Flags: review?(wbamberg)
Assignee | ||
Updated•14 years ago
|
Hardware: x86 → All
Comment 2•14 years ago
|
||
Comment on attachment 563254 [details] [diff] [review]
Add an id to the widget.
"Div-Show" would be a better ID, I think.
Thanks Terry R. for catching this, and KWierso for the patch! But this patch adds an attribute called "div" not one called "id" :(.
Attachment #563254 -
Flags: review?(wbamberg) → review-
I wasn't the one who caught it. Just passed on what someone reported.
Assignee | ||
Comment 4•14 years ago
|
||
Wow, can't believe I did that...
Attachment #563254 -
Attachment is obsolete: true
Attachment #563267 -
Flags: review?(wbamberg)
Comment 5•14 years ago
|
||
Comment on attachment 563267 [details] [diff] [review]
Actually add an id to the widget constructor
Thanks KWierso!
Attachment #563267 -
Flags: review?(wbamberg) → review+
Updated•14 years ago
|
Keywords: checkin-needed
Assignee | ||
Updated•14 years ago
|
Priority: -- → P2
Whiteboard: [cherry-pick-wanted]
Comment 6•14 years ago
|
||
https://github.com/mozilla/addon-sdk/commit/13228be19730cb7b57e3ee52edeeba47661cca2d
https://github.com/mozilla/addon-sdk/commit/4f2ec8936c4bab1ed23b4688ae829d0968f7b0c6
Assignee: nobody → kwierso
Status: NEW → RESOLVED
Closed: 14 years ago
Keywords: checkin-needed
Resolution: --- → FIXED
Whiteboard: [cherry-pick-wanted] → [cherry-pick-1.2]
Target Milestone: --- → 1.2
You need to log in
before you can comment on or make changes to this bug.
Description
•