Skip to content

Commit

Permalink
Merged Anthony's 917a45f and made functions consistently either alway…
Browse files Browse the repository at this point in the history
…s or never return a declared value.
  • Loading branch information
johan committed Aug 24, 2009
2 parents 7bb545d + 917a45f commit 7904dbb
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 9 deletions.
7 changes: 7 additions & 0 deletions components/greasemonkey.js
Expand Up @@ -286,6 +286,10 @@ var greasemonkeyService = {

registerMenuCommand: function(unsafeContentWin, commandName, commandFunc,
accelKey, accelModifiers, accessKey) {
if (!GM_apiLeakCheck("GM_registerMenuCommand")) {
return;
}

var command = {name: commandName,
accelKey: accelKey,
accelModifiers: accelModifiers,
Expand All @@ -299,6 +303,9 @@ var greasemonkeyService = {
},

openInTab: function(safeContentWin, chromeWin, url) {
if (!GM_apiLeakCheck("GM_openInTab")) {
return undefined;
}
var newTab = chromeWin.openNewTabWith(
url, safeContentWin.document, null, null, null, null);
// Source:
Expand Down
18 changes: 9 additions & 9 deletions content/miscapis.js
Expand Up @@ -16,7 +16,7 @@ GM_ScriptStorage.prototype.setValue = function(name, val) {

GM_ScriptStorage.prototype.getValue = function(name, defVal) {
if (!GM_apiLeakCheck("GM_getValue")) {
return;
return undefined;
}

return this.prefMan.getValue(name, defVal);
Expand All @@ -28,15 +28,15 @@ function GM_Resources(script){

GM_Resources.prototype.getResourceURL = function(name) {
if (!GM_apiLeakCheck("GM_getResourceURL")) {
return;
return undefined;
}

return this.getDep_(name).dataContent;
};

GM_Resources.prototype.getResourceText = function(name) {
if (!GM_apiLeakCheck("GM_getResourceText")) {
return;
return undefined;
}

return this.getDep_(name).textContent;
Expand Down Expand Up @@ -65,20 +65,20 @@ GM_ScriptLogger.prototype.log = function(message) {
};

GM_ScriptStorage.prototype.deleteValue = function(name) {
if (!GM_apiLeakCheck("GM_setValue")) {
return;
if (!GM_apiLeakCheck("GM_deleteValue")) {
return undefined;
}

return this.prefMan.remove(name);
}
};

GM_ScriptStorage.prototype.listValues = function() {
if (!GM_apiLeakCheck("GM_setValue")) {
return;
if (!GM_apiLeakCheck("GM_listValues")) {
return undefined;
}

return this.prefMan.listValues();
}
};

// Based on Mark Pilgrim's GM_addGlobalStyle from
// http://diveintogreasemonkey.org/patterns/add-css.html. Used by permission
Expand Down

0 comments on commit 7904dbb

Please sign in to comment.