diff options
author | Matěj Cepl <mcepl@redhat.com> | 2011-04-28 00:39:52 +0200 |
---|---|---|
committer | Matěj Cepl <mcepl@redhat.com> | 2011-06-05 14:46:50 +0200 |
commit | cb82da27fc37ebe74aa9678506e72eb1a7308ca3 (patch) | |
tree | 743209aab4c515fd62c57c7f7982347ff760dec6 | |
parent | 680ad8225d72703dcdc98a128c7dd4f408a3018b (diff) | |
download | bugzilla-triage-cb82da27fc37ebe74aa9678506e72eb1a7308ca3.tar.gz |
Use self.on and self.postMessage instead of global on and postMessage.
The reason is https://bugzilla.mozilla.org/show_bug.cgi?id=635748 and
effort to save the world from global variables in content scripts.
-rw-r--r-- | data/lib/addAttachmentRow.js | 2 | ||||
-rw-r--r-- | data/lib/bzpage.js | 4 | ||||
-rw-r--r-- | data/lib/cc-context.js | 4 | ||||
-rw-r--r-- | data/lib/checkin-context.js | 6 | ||||
-rw-r--r-- | data/lib/fixingAttMIME.js | 2 | ||||
-rw-r--r-- | data/lib/logging-front.js | 8 | ||||
-rw-r--r-- | data/lib/makeBacktraceAttachment.js | 2 | ||||
-rw-r--r-- | data/lib/queries.js | 8 | ||||
-rw-r--r-- | data/lib/rhbzpage.js | 8 | ||||
-rw-r--r-- | data/lib/util.js | 4 |
10 files changed, 24 insertions, 24 deletions
diff --git a/data/lib/addAttachmentRow.js b/data/lib/addAttachmentRow.js index 13ad226..204192e 100644 --- a/data/lib/addAttachmentRow.js +++ b/data/lib/addAttachmentRow.js @@ -30,7 +30,7 @@ function addAttachment(data, callback, param) { nomail: true }); - postMessage(new Message("MakeXMLRPCall", { + self.postMessage(new Message("MakeXMLRPCall", { url: constantData.XMLRPCData[window.location.hostname].url, login: getLogin(), method: "bugzilla.addAttachment", diff --git a/data/lib/bzpage.js b/data/lib/bzpage.js index f99d60c..3a832ea 100644 --- a/data/lib/bzpage.js +++ b/data/lib/bzpage.js @@ -318,7 +318,7 @@ function setConfigurationButton () { document.getElementById("configurationButton").addEventListener( "click", function(evt) { - postMessage(new Message("ChangeJSONURL", null)); + self.postMessage(new Message("ChangeJSONURL", null)); evt.stopPropagation(); evt.preventDefault(); }, false); @@ -423,7 +423,7 @@ function startup() { checkComments(); - postMessage(new Message("GetInstalledPackages", { + self.postMessage(new Message("GetInstalledPackages", { location: window.location.href, login: getLogin() })); diff --git a/data/lib/cc-context.js b/data/lib/cc-context.js index 38397a9..81b0a2d 100644 --- a/data/lib/cc-context.js +++ b/data/lib/cc-context.js @@ -1,8 +1,8 @@ -on('click', function(node, data) { +self.on('click', function(node, data) { var style = document.getElementById("bztw_cc"); style.disabled = !style.disabled; }); -on('context', function(node) { +self.on('context', function(node) { return onBugzillaPage(document.URL); }); diff --git a/data/lib/checkin-context.js b/data/lib/checkin-context.js index 4d073be..8ae482d 100644 --- a/data/lib/checkin-context.js +++ b/data/lib/checkin-context.js @@ -1,9 +1,9 @@ -on('click', function(node, data) { +self.on('click', function(node, data) { var message = document.getElementById("__bz_tw_checkin_comment"); - postMessage(message.textContent); + self.postMessage(message.textContent); }); -on('context', function(node) { +self.on('context', function(node) { if (!onBugzillaPage(document.URL)) return false; var message = document.getElementById("__bz_tw_checkin_comment"); diff --git a/data/lib/fixingAttMIME.js b/data/lib/fixingAttMIME.js index 99c32f7..a016fe6 100644 --- a/data/lib/fixingAttMIME.js +++ b/data/lib/fixingAttMIME.js @@ -62,7 +62,7 @@ function fixAttachById(id, XMLRPCURL, type, email) { 'nomail' : !email }); - postMessage(new Message("MakeXMLRPCall", { + self.postMessage(new Message("MakeXMLRPCall", { url: XMLRPCURL, login: getLogin(), method: "bugzilla.updateAttachMimeType", diff --git a/data/lib/logging-front.js b/data/lib/logging-front.js index 8d383e8..b8343a4 100644 --- a/data/lib/logging-front.js +++ b/data/lib/logging-front.js @@ -24,7 +24,7 @@ function addLogRecord() { var bugNo = getBugNoFromURL(window.location.href); rec.key = dateStr + "+" + urlStr + "+" + bugNo; - postMessage(new Message("AddLogRecord", rec)); + self.postMessage(new Message("AddLogRecord", rec)); } return rec; } @@ -57,17 +57,17 @@ function setUpLogging () { // (id, text, parent, callback, params, before, covered, accesskey) createDeadLink("generateTSButton", "Generate TS", additionalButtons, function(evt) { - postMessage(new Message("GenerateTS")); + self.postMessage(new Message("GenerateTS")); }, [], "dash", "li"); createDeadLink("clearLogs", "Clear TS", additionalButtons, function(evt) { - postMessage(new Message("ClearTS")); + self.postMessage(new Message("ClearTS")); }, [], "dash", "li"); createDeadLink("importTSButton", "Import TS", additionalButtons, function(evt) { - postMessage(new Message("ImportTS")); + self.postMessage(new Message("ImportTS")); }, [], "dash", "li"); /* TODO diff --git a/data/lib/makeBacktraceAttachment.js b/data/lib/makeBacktraceAttachment.js index e938b11..a6b6ab0 100644 --- a/data/lib/makeBacktraceAttachment.js +++ b/data/lib/makeBacktraceAttachment.js @@ -78,7 +78,7 @@ function pasteBacktraceInComments(atts) { * @return none */ function showAttachment(id) { - postMessage(new Message("OpenURLinPanel", + self.postMessage(new Message("OpenURLinPanel", "https://" + window.location.hostname + "/attachment.cgi?id=" + id)); } diff --git a/data/lib/queries.js b/data/lib/queries.js index 7f935c8..4bf959a 100644 --- a/data/lib/queries.js +++ b/data/lib/queries.js @@ -51,7 +51,7 @@ function queryInNewTab(text, component, product, equivComps) { + "&field0-0-2=status_whiteboard&type0-0-2=substring&value0-0-2=" + text; urlStr += searchText; - postMessage(new Message("OpenURLinTab", urlStr)); // utils.js is always avaiulable + self.postMessage(new Message("OpenURLinTab", urlStr)); // utils.js is always avaiulable } } @@ -62,7 +62,7 @@ function queryInNewTab(text, component, product, equivComps) { function queryForSelection() { var text = getSelection(); if (!text) { - postMessage(new Message("GetClipboard", "queryLocal")); + self.postMessage(new Message("GetClipboard", "queryLocal")); } else { if (equivalentComponents) { queryInNewTab(text, getComponent(), getProduct(), equivalentComponents); @@ -87,7 +87,7 @@ function queryUpstreamCallback(text, queryUpBug) { text = text.replace("$$$", getComponent()); } text = encodeURIComponent(text).replace("%20","+"); - postMessage(new Message("OpenURLinTab", urlBase + text)); + self.postMessage(new Message("OpenURLinTab", urlBase + text)); } /** @@ -102,7 +102,7 @@ function queryUpstream(qUpBug) { } var text = getSelection(); if (!text) { - postMessage(new Message("GetClipboard", "queryUpstream")); + self.postMessage(new Message("GetClipboard", "queryUpstream")); } else { queryUpstreamCallback(text, qUpBug); diff --git a/data/lib/rhbzpage.js b/data/lib/rhbzpage.js index a61eedf..69317ff 100644 --- a/data/lib/rhbzpage.js +++ b/data/lib/rhbzpage.js @@ -187,7 +187,7 @@ function sendBugUpstream() { return null; } - postMessage(new Message("OpenBugUpstream", { + self.postMessage(new Message("OpenBugUpstream", { url: urlStr, subject: document.getElementById("short_desc_nonedit_display"). textContent.trim(), @@ -274,7 +274,7 @@ function chipsetMagic (interestingLineArr) { PCIid = PCIid.toLowerCase().replace(",",":"); cardStr = null; alert("PCI ID " + PCIid + " is not known!"); - postMessage(new Message("SetClipboard", PCIid.toString())); + self.postMessage(new Message("SetClipboard", PCIid.toString())); } catch (e) { throw e; } @@ -311,7 +311,7 @@ function analyzeXorg(results) { innerString += "No matching lines found!"; } - postMessage(new Message("OpenStringInPanel", + self.postMessage(new Message("OpenStringInPanel", '<!DOCTYPE html PUBLIC "-//IETF//DTD HTML 2.0//EN">' + "<html><head><title>Xorg.0.log analysis</title></head><body><pre>\n" + innerString.trim() + @@ -319,7 +319,7 @@ function analyzeXorg(results) { } function analyzeXorgLog(attachID, backMsg) { - postMessage(new Message("GetURL", { + self.postMessage(new Message("GetURL", { url: "https://" + window.location.hostname + "/attachment.cgi?id=" + attachID, backMessage: backMsg })); diff --git a/data/lib/util.js b/data/lib/util.js index c2989d2..4a46403 100644 --- a/data/lib/util.js +++ b/data/lib/util.js @@ -333,7 +333,7 @@ function removeDuplicates (arr) { // ============================================ /** * object to pack messaging. Use as in - postMessage(new Message("GetPassword", { + self.postMessage(new Message("GetPassword", { login: login, hostname: location.hostname })); @@ -344,7 +344,7 @@ function Message(cmd, data) { } function log(msg) { - postMessage(new Message("LogMessage", msg)); + self.postMessage(new Message("LogMessage", msg)); } var NotLoggedinException = function NotLoggedinException (message) { |