merge m-c to fx-team

This commit is contained in:
Tim Taubert 2012-10-25 21:23:58 +02:00
commit c0ec641283
40 changed files with 546 additions and 395 deletions

View File

@ -38,10 +38,22 @@ let FormAssistant = {
},
isKeyboardOpened: false,
focusedElement : null,
selectionStart: 0,
selectionEnd: 0,
_focusedElement: null,
get focusedElement() {
if (this._focusedElement && Cu.isDeadWrapper(this._focusedElement))
this._focusedElement = null;
return this._focusedElement;
},
set focusedElement(val) {
this._focusedElement = val;
},
setFocusedElement: function fa_setFocusedElement(element) {
if (element === this.focusedElement)
return;

View File

@ -130,12 +130,13 @@ var Scratchpad = {
*/
_updateTitle: function SP__updateTitle()
{
if (this.filename) {
document.title = (this.editor && this.editor.dirty ? "*" : "") +
this.filename;
} else {
document.title = this._initialWindowTitle;
let title = this.filename || this._initialWindowTitle;
if (this.editor && this.editor.dirty) {
title = "*" + title;
}
document.title = title;
},
/**
@ -1267,7 +1268,7 @@ var Scratchpad = {
*/
promptSave: function SP_promptSave(aCallback)
{
if (this.filename && this.editor.dirty) {
if (this.editor.dirty) {
let ps = Services.prompt;
let flags = ps.BUTTON_POS_0 * ps.BUTTON_TITLE_SAVE +
ps.BUTTON_POS_1 * ps.BUTTON_TITLE_CANCEL +

View File

@ -9,7 +9,7 @@ let NetUtil = tempScope.NetUtil;
let FileUtils = tempScope.FileUtils;
// only finish() when correct number of tests are done
const expected = 6;
const expected = 9;
var count = 0;
function done()
{
@ -68,16 +68,42 @@ function testSavedFile()
function testUnsaved()
{
testUnsavedFileCancel();
function setFilename(aScratchpad, aFile) {
aScratchpad.setFilename(aFile);
}
testUnsavedFileCancel(setFilename);
testUnsavedFileSave(setFilename);
testUnsavedFileDontSave(setFilename);
testCancelAfterLoad();
testUnsavedFileSave();
function mockSaveFile(aScratchpad) {
let SaveFileStub = function (aCallback) {
/*
* An argument for aCallback must pass Components.isSuccessCode
*
* A version of isSuccessCode in JavaScript:
* function isSuccessCode(returnCode) {
* return (returnCode & 0x80000000) == 0;
* }
*/
aCallback(1);
};
aScratchpad.saveFile = SaveFileStub;
}
// Run these tests again but this time without setting a filename to
// test that Scratchpad always asks for confirmation on dirty editor.
testUnsavedFileCancel(mockSaveFile);
testUnsavedFileSave(mockSaveFile);
testUnsavedFileDontSave();
}
function testUnsavedFileCancel()
function testUnsavedFileCancel(aCallback=function () {})
{
openScratchpad(function(win) {
win.Scratchpad.setFilename("test.js");
aCallback(win.Scratchpad, "test.js");
win.Scratchpad.editor.dirty = true;
promptButton = win.BUTTON_POSITION_CANCEL;
@ -118,11 +144,11 @@ function testCancelAfterLoad()
}, {noFocus: true});
}
function testUnsavedFileSave()
function testUnsavedFileSave(aCallback=function () {})
{
openScratchpad(function(win) {
win.Scratchpad.importFromFile(gFile, true, function(status, content) {
win.Scratchpad.setFilename(gFile.path);
aCallback(win.Scratchpad, gFile.path);
let text = "new text";
win.Scratchpad.setText(text);
@ -140,10 +166,10 @@ function testUnsavedFileSave()
}, {noFocus: true});
}
function testUnsavedFileDontSave()
function testUnsavedFileDontSave(aCallback=function () {})
{
openScratchpad(function(win) {
win.Scratchpad.setFilename(gFile.path);
aCallback(win.Scratchpad, gFile.path);
win.Scratchpad.editor.dirty = true;
promptButton = win.BUTTON_POSITION_DONT_SAVE;

View File

@ -1,6 +1,6 @@
/* vim: set ts=2 et sw=2 tw=80: */
/* Any copyright is dedicated to the Public Domain.
http://creativecommons.org/publicdomain/zero/1.0/ */
http://creativecommons.org/publicdomain/zero/1.0/ */
// only finish() when correct number of tests are done
const expected = 4;
@ -18,7 +18,7 @@ var ScratchpadManager = Scratchpad.ScratchpadManager;
function test()
{
waitForExplicitFinish();
testListeners();
testRestoreNotFromFile();
testRestoreFromFileSaved();
@ -32,7 +32,7 @@ function testListeners()
{
openScratchpad(function(aWin, aScratchpad) {
aScratchpad.setText("new text");
ok(!isStar(aWin), "no star if scratchpad isn't from a file");
ok(isStar(aWin), "show start if scratchpad text changes");
aScratchpad.editor.dirty = false;
ok(!isStar(aWin), "no star before changing text");
@ -68,7 +68,7 @@ function testRestoreNotFromFile()
let [win] = ScratchpadManager.restoreSession(session);
openScratchpad(function(aWin, aScratchpad) {
aScratchpad.setText("new text");
ok(!isStar(win), "no star if restored scratchpad isn't from a file");
ok(isStar(win), "show star if restored scratchpad isn't from a file");
win.close();
done();

View File

@ -29,6 +29,7 @@ function testMixedContent(hud) {
waitForSuccess(
{
name: "mixed content warning displayed successfully",
timeout: 20000,
validatorFn: function() {
return ( aOutputNode.querySelector(".webconsole-mixed-content") );
},

View File

@ -42,51 +42,52 @@ function testViewSource(hud) {
function checkStyleEditorForSheetAndLine(aStyleSheetIndex, aLine, aCallback) {
function doCheck(aEditor) {
if (aEditor.styleSheetIndex != aStyleSheetIndex) {
ok(false, "Correct Style Sheet was not selected.");
function checkLineAndCallback() {
info("In checkLineAndCallback()");
ok(aEditor.sourceEditor != null, "sourceeditor not null");
ok(aEditor.sourceEditor.getCaretPosition() != null, "position not null");
ok(aEditor.sourceEditor.getCaretPosition().line != null, "line not null");
is(aEditor.sourceEditor.getCaretPosition().line, aLine,
"Correct line is selected");
if (aCallback) {
executeSoon(aCallback);
aCallback();
}
return;
}
ok(true, "Correct Style Sheet is selected in the editor");
// Editor is already loaded, check the current line of caret.
if (aEditor.sourceEditor) {
ok(true, "Editor is already loaded, check the current line of caret");
executeSoon(function() {
ok(true, "Execute soon occured");
ok(aEditor.sourceEditor != null, "sourceeditor not null");
ok(aEditor.sourceEditor.getCaretPosition() != null, "position not null");
ok(aEditor.sourceEditor.getCaretPosition().line != null, "line not null");
is(aEditor.sourceEditor.getCaretPosition().line, aLine,
"Correct line is selected");
if (aCallback) {
aCallback();
}
});
return;
}
ok(true, "Editor is not loaded, waiting for it.");
ok(aEditor, "aEditor is defined.");
// Source-editor is already loaded, check the current line of caret.
if (aEditor.sourceEditor) {
if (aEditor.styleSheetIndex != SEC.selectedStyleSheetIndex) {
ok(false, "Correct Style Sheet was not selected.");
if (aCallback) {
executeSoon(aCallback);
}
return;
}
info("Correct Style Sheet is selected in the editor");
info("Editor is already loaded, check the current line of caret");
executeSoon(checkLineAndCallback);
return;
}
info("source editor is not loaded, waiting for it.");
// Wait for source editor to be loaded.
aEditor.addActionListener({
onAttach: function onAttach() {
ok(true, "on attach happened");
info("on attach happened");
aEditor.removeActionListener(this);
ok(true, "this removed");
info("this removed");
executeSoon(function() {
ok(true, "execute soon");
ok(aEditor.sourceEditor != null, "sourceeditor not null");
ok(aEditor.sourceEditor.getCaretPosition() != null, "position not null");
ok(aEditor.sourceEditor.getCaretPosition().line != null, "line not null");
is(aEditor.sourceEditor.getCaretPosition().line, aLine,
"Correct line is selected");
if (aCallback) {
aCallback();
if (aEditor.styleSheetIndex != SEC.selectedStyleSheetIndex) {
ok(false, "Correct Style Sheet was not selected.");
if (aCallback) {
aCallback();
}
return;
}
checkLineAndCallback()
});
}
});
@ -98,19 +99,27 @@ function checkStyleEditorForSheetAndLine(aStyleSheetIndex, aLine, aCallback) {
// Editors are not ready, so wait for them.
if (!SEC.editors.length) {
info("Editor is not ready, waiting before doing check.");
SEC.addChromeListener({
onEditorAdded: function onEditorAdded(aChrome, aEditor) {
info("Editor loaded now. Removing listener and doing check.");
aChrome.removeChromeListener(this);
doCheck(aEditor);
executeSoon(function() {
doCheck(aEditor);
});
}
});
}
// Execute soon so that selectedStyleSheetIndex has correct value.
else {
executeSoon(function() {
let aEditor = SEC.editors[SEC.selectedStyleSheetIndex];
doCheck(aEditor);
});
info("Editor is defined, opening the desired editor for now and " +
"checking later if it is correct");
for (let aEditor of SEC.editors) {
if (aEditor.styleSheetIndex == aStyleSheetIndex) {
doCheck(aEditor);
break;
}
}
}
}
@ -120,26 +129,28 @@ let observer = {
return;
}
Services.ww.unregisterNotification(observer);
ok(true, "Style Editor window was opened in response to clicking " +
"the location node");
info("Style Editor window was opened in response to clicking " +
"the location node");
executeSoon(function() {
styleEditorWin = window.StyleEditor
.StyleEditorManager
.getEditorForWindow(content.window);
ok(styleEditorWin, "Style Editor Window is defined");
styleEditorWin.addEventListener("load", function onStyleEditorWinLoad() {
styleEditorWin.removeEventListener("load", onStyleEditorWinLoad);
waitForFocus(function() {
//styleEditorWin.addEventListener("load", function onStyleEditorWinLoad() {
//styleEditorWin.removeEventListener("load", onStyleEditorWinLoad);
checkStyleEditorForSheetAndLine(0, 7, function() {
checkStyleEditorForSheetAndLine(1, 6, function() {
window.StyleEditor.toggle();
styleEditorWin = null;
finishTest();
checkStyleEditorForSheetAndLine(0, 7, function() {
checkStyleEditorForSheetAndLine(1, 6, function() {
window.StyleEditor.toggle();
styleEditorWin = null;
finishTest();
});
EventUtils.sendMouseEvent({ type: "click" }, nodes[1]);
});
EventUtils.sendMouseEvent({ type: "click" }, nodes[1]);
});
});
//});
}, styleEditorWin);
});
}
};

View File

@ -16,7 +16,7 @@
<!ENTITY debuggerMenu.label2 "Debugger">
<!-- LOCALIZATION NOTE (debuggerMenu.accesskey): This is accesskey for the
- Tools meny entry of Debugger that opens the debugger UI. -->
- Tools menu entry of Debugger that opens the debugger UI. -->
<!ENTITY debuggerMenu.accesskey "D">
<!-- LOCALIZATION NOTE (remoteDebuggerMenu.label): This is the label for the

View File

@ -116,7 +116,7 @@ breakpointMenuItem.disableAll=Disable all breakpoints
breakpointMenuItem.deleteAll=Remove all breakpoints
# LOCALIZATION NOTE (loadingText): The text that is displayed in the script
# editor when the laoding process has started but there is no file to display
# editor when the loading process has started but there is no file to display
# yet.
loadingText=Loading\u2026

View File

@ -104,13 +104,13 @@ screenshotFullPageDesc=Entire webpage? (true/false)
# asks for help on what it does.
screenshotFullPageManual=True if the screenshot should also include parts of the webpage which are outside the current scrolled bounds.
# LOCALIZATION NOTE (screenshotSelectorChromeConflict) Exception thwon when user
# LOCALIZATION NOTE (screenshotSelectorChromeConflict) Exception thrown when user
# tries to use 'selector' option along with 'chrome' option of the screenshot
# command. Refer: https://bugzilla.mozilla.org/show_bug.cgi?id=659268#c7
screenshotSelectorChromeConflict=selector option is not supported when chrome option is true
# LOCALIZATION NOTE (screenshotGeneratedFilename) The auto generated filename
# when no file name is provided. the first argument (%1$S) is the date string
# when no file name is provided. The first argument (%1$S) is the date string
# in yyyy-mm-dd format and the second argument (%2$S) is the time string
# in HH.MM.SS format. Please don't add the extension here.
screenshotGeneratedFilename=Screen Shot %1$S at %2$S
@ -141,11 +141,11 @@ restartFirefoxDesc=Restart Firefox
# displayed in a dialog when the user is using this command.
restartFirefoxNocacheDesc=Disables loading content from cache upon restart
# LOCALIZATION NOTE (restartFirefoxRequestCancelled) A string dispalyed to the
# LOCALIZATION NOTE (restartFirefoxRequestCancelled) A string displayed to the
# user when a scheduled restart has been aborted by the user.
restartFirefoxRequestCancelled=Restart request cancelled by user.
# LOCALIZATION NOTE (restartFirefoxRestarting) A string dispalyed to the
# LOCALIZATION NOTE (restartFirefoxRestarting) A string displayed to the
# user when a restart has been initiated without a delay.
restartFirefoxRestarting=Restarting Firefox...

View File

@ -63,7 +63,7 @@ NetworkPanel.label=Inspect Network Request
# LOCALIZATION NOTE (NetworkPanel.deltaDurationMS):
#
# This string is used to show the duration between two network events (e.g
# request and respones header or response header and response body).
# request and response header or response header and response body).
NetworkPanel.durationMS=%Sms
# LOCALIZATION NOTE (NetworkPanel.imageSizeDeltaDurationMS):
# This string is used to show the duration between the response header and the

View File

@ -562,6 +562,12 @@ static NS_DEFINE_CID(kDOMSOF_CID, NS_DOM_SCRIPT_OBJECT_FACTORY_CID);
static const char kDOMStringBundleURL[] =
"chrome://global/locale/dom/dom.properties";
#ifdef MOZ_DISABLE_DOMCRYPTO
static const bool domCryptoEnabled = false;
#else
static const bool domCryptoEnabled = true;
#endif
// NOTE: DEFAULT_SCRIPTABLE_FLAGS and DOM_DEFAULT_SCRIPTABLE_FLAGS
// are defined in nsIDOMClassInfo.h.
@ -2370,7 +2376,8 @@ nsDOMClassInfo::RegisterExternalClasses()
DOM_CLASSINFO_MAP_CONDITIONAL_ENTRY(nsIDOMWindowPerformance, \
nsGlobalWindow::HasPerformanceSupport()) \
DOM_CLASSINFO_MAP_CONDITIONAL_ENTRY(nsITouchEventReceiver, \
nsDOMTouchEvent::PrefEnabled())
nsDOMTouchEvent::PrefEnabled()) \
DOM_CLASSINFO_MAP_CONDITIONAL_ENTRY(nsIWindowCrypto, domCryptoEnabled)
nsresult
nsDOMClassInfo::Init()

View File

@ -1245,6 +1245,7 @@ NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION(nsGlobalWindow)
NS_INTERFACE_MAP_ENTRY(nsIDOMWindowPerformance)
NS_INTERFACE_MAP_ENTRY(nsITouchEventReceiver)
NS_INTERFACE_MAP_ENTRY(nsIInlineEventHandlers)
NS_INTERFACE_MAP_ENTRY(nsIWindowCrypto)
NS_DOM_INTERFACE_MAP_ENTRY_CLASSINFO(Window)
OUTER_WINDOW_ONLY
NS_WRAPPERCACHE_INTERFACE_MAP_ENTRY

View File

@ -270,7 +270,8 @@ class nsGlobalWindow : public nsPIDOMWindow,
public PRCListStr,
public nsIDOMWindowPerformance,
public nsITouchEventReceiver,
public nsIInlineEventHandlers
public nsIInlineEventHandlers,
public nsIWindowCrypto
{
public:
friend class nsDOMMozURLProperty;
@ -335,6 +336,9 @@ public:
// nsIInlineEventHandlers
NS_DECL_NSIINLINEEVENTHANDLERS
// nsIWindowCrypto
NS_DECL_NSIWINDOWCRYPTO
// nsPIDOMWindow
virtual NS_HIDDEN_(nsPIDOMWindow*) GetPrivateRoot();
virtual NS_HIDDEN_(void) ActivateOrDeactivate(bool aActivate);

View File

@ -32,7 +32,7 @@ interface nsIDOMMozURLProperty : nsISupports
* @see <http://www.whatwg.org/html/#window>
*/
[scriptable, uuid(43933989-912e-4b6a-b889-3c9fc9dd9ed4)]
[scriptable, uuid(148ab425-5d38-40fd-9fe0-0eae9fed81df)]
interface nsIDOMWindow : nsISupports
{
// the current browsing context
@ -365,9 +365,6 @@ interface nsIDOMWindow : nsISupports
[noscript] readonly attribute nsIPrompt prompter;
readonly attribute boolean closed;
// http://wiki.whatwg.org/wiki/Crypto
readonly attribute nsIDOMCrypto crypto;
readonly attribute nsIDOMPkcs11 pkcs11;
// XXX Shouldn't this be in nsIDOMChromeWindow?
/* [replaceable] controllers */
@ -517,6 +514,17 @@ interface nsIDOMWindowPerformance : nsISupports
readonly attribute nsISupports performance;
};
[scriptable, uuid(2ed9ace1-172c-443f-b92f-c4f74bf8f2c5)]
interface nsIWindowCrypto : nsISupports
{
/**
* A namespace to hold crypto related data and statistics.
* http://wiki.whatwg.org/wiki/Crypto
*/
readonly attribute nsIDOMCrypto crypto;
readonly attribute nsIDOMPkcs11 pkcs11;
};
/**
* Empty interface for compatibility with older versions.
* @deprecated Use nsIDOMWindow instead

View File

@ -484,7 +484,7 @@ nsNSSComponent::DispatchEventToWindow(nsIDOMWindow *domWin,
// NOTE: it's not an error to say that we aren't going to dispatch
// the event.
{
nsCOMPtr<nsIDOMWindow> domWindow = domWin;
nsCOMPtr<nsIWindowCrypto> domWindow = do_QueryInterface(domWin);
if (!domWindow) {
return NS_OK; // nope, it's not an internal window
}

View File

@ -182,7 +182,7 @@ let dataProviders = {
// include the suggested version, which the consumer likely needs to plug
// into a format string from a localization file. Rather than returning
// a string in some cases and an array in others, return an array always.
let msg = ["no information"];
let msg = [""];
try {
var status = gfxInfo.getFeatureStatus(feature);
}
@ -289,11 +289,25 @@ let dataProviders = {
data.direct2DEnabledMessage =
statusMsgForFeature(Ci.nsIGfxInfo.FEATURE_DIRECT2D);
let doc =
Cc["@mozilla.org/xmlextras/domparser;1"]
.createInstance(Ci.nsIDOMParser)
.parseFromString("<html/>", "text/html");
let canvas = doc.createElement("canvas");
let gl;
try {
data.webglRenderer = gfxInfo.getWebGLParameter("full-renderer");
}
catch (e) {}
if (!("webglRenderer" in data)) {
gl = canvas.getContext("experimental-webgl");
} catch(e) {}
if (gl) {
let ext = gl.getExtension("WEBGL_debug_renderer_info");
// this extension is unconditionally available to chrome. No need to check.
data.webglRenderer = gl.getParameter(ext.UNMASKED_VENDOR_WEBGL)
+ " -- "
+ gl.getParameter(ext.UNMASKED_RENDERER_WEBGL);
} else {
let feature =
#ifdef XP_WIN
// If ANGLE is not available but OpenGL is, we want to report on the

View File

@ -15,7 +15,8 @@
let expectedConsoleCalls = [];
let expectedPageErrors = [];
(function() {
function doPageErrors()
{
Services.console.reset();
expectedPageErrors = [
@ -53,7 +54,7 @@ let expectedPageErrors = [];
body.appendChild(container);
container.textContent = "document.doTheImpossible();";
body.removeChild(container);
})();
}
function doConsoleCalls()
{
@ -93,9 +94,9 @@ function doConsoleCalls()
<script class="testbody" type="text/javascript;version=1.8">
SimpleTest.waitForExplicitFinish();
let consoleAPIListener;
let consoleAPIListener, pageErrorListener;
let consoleAPICalls = 0;
let pageErrors = 0;
let handlers = {
onConsoleAPICall: function onConsoleAPICall()
@ -105,6 +106,14 @@ let handlers = {
checkConsoleAPICache();
}
},
onPageError: function onPageError()
{
pageErrors++;
if (pageErrors == expectedPageErrors.length) {
testPageErrors();
}
},
};
function startTest()
@ -142,11 +151,17 @@ function onCachedConsoleAPI(aState, aResponse)
checkConsoleAPICall(msgs[aIndex], expectedConsoleCalls[aIndex]);
});
closeDebugger(aState, testPageErrors);
closeDebugger(aState, function() {
pageErrorListener = new PageErrorListener(null, handlers);
pageErrorListener.init();
doPageErrors();
});
}
function testPageErrors()
{
pageErrorListener.destroy();
pageErrorListener = null;
attachConsole(["PageError"], onAttach2);
}

View File

@ -69,6 +69,7 @@ function onFileActivity(aType, aPacket)
gState.dbgClient.removeListener("fileActivity", onFileActivity);
info("aPacket.uri: " + aPacket.uri);
ok(/bug798764\.html$/.test(aPacket.uri), "file URI match");
testEnd();
@ -77,8 +78,10 @@ function onFileActivity(aType, aPacket)
function testEnd()
{
if (gTmpFile) {
gTmpFile.remove(false);
gTmpFile = null;
SimpleTest.executeSoon(function() {
gTmpFile.remove(false);
gTmpFile = null;
});
}
if (gState) {

View File

@ -69,7 +69,7 @@ function AddonLogger(aName) {
AddonLogger.prototype = {
name: null,
error: function(aStr, aException) {
error: function AddonLogger_error(aStr, aException) {
let message = formatLogMessage("error", this.name, aStr, aException);
let stack = getStackDetails(aException);
@ -100,7 +100,7 @@ AddonLogger.prototype = {
catch (e) { }
},
warn: function(aStr, aException) {
warn: function AddonLogger_warn(aStr, aException) {
let message = formatLogMessage("warn", this.name, aStr, aException);
let stack = getStackDetails(aException);
@ -115,7 +115,7 @@ AddonLogger.prototype = {
dump("*** " + message + "\n");
},
log: function(aStr, aException) {
log: function AddonLogger_log(aStr, aException) {
if (gDebugLogEnabled) {
let message = formatLogMessage("log", this.name, aStr, aException);
dump("*** " + message + "\n");
@ -125,14 +125,14 @@ AddonLogger.prototype = {
};
var LogManager = {
getLogger: function(aName, aTarget) {
getLogger: function LogManager_getLogger(aName, aTarget) {
let logger = new AddonLogger(aName);
if (aTarget) {
["error", "warn", "log"].forEach(function(name) {
let fname = name.toUpperCase();
delete aTarget[fname];
aTarget[fname] = function(aStr, aException) {
aTarget[fname] = function LogManager_targetName(aStr, aException) {
logger[name](aStr, aException);
};
});
@ -143,13 +143,13 @@ var LogManager = {
};
var PrefObserver = {
init: function() {
init: function PrefObserver_init() {
Services.prefs.addObserver(PREF_LOGGING_ENABLED, this, false);
Services.obs.addObserver(this, "xpcom-shutdown", false);
this.observe(null, NS_PREFBRANCH_PREFCHANGE_TOPIC_ID, PREF_LOGGING_ENABLED);
},
observe: function(aSubject, aTopic, aData) {
observe: function PrefObserver_observe(aSubject, aTopic, aData) {
if (aTopic == "xpcom-shutdown") {
Services.prefs.removeObserver(PREF_LOGGING_ENABLED, this);
Services.obs.removeObserver(this, "xpcom-shutdown");

View File

@ -44,7 +44,7 @@ const VALID_TYPES_REGEXP = /^[\w\-]+$/;
Components.utils.import("resource://gre/modules/Services.jsm");
Components.utils.import("resource://gre/modules/XPCOMUtils.jsm");
XPCOMUtils.defineLazyGetter(this, "CertUtils", function() {
XPCOMUtils.defineLazyGetter(this, "CertUtils", function certUtilsLazyGetter() {
let certUtils = {};
Components.utils.import("resource://gre/modules/CertUtils.jsm", certUtils);
return certUtils;
@ -62,7 +62,7 @@ const DEFAULT_PROVIDERS = [
];
["LOG", "WARN", "ERROR"].forEach(function(aName) {
this.__defineGetter__(aName, function() {
this.__defineGetter__(aName, function logFuncGetter() {
Components.utils.import("resource://gre/modules/AddonLogging.jsm");
LogManager.getLogger("addons.manager", this);
@ -204,7 +204,7 @@ AddonAuthor.prototype = {
url: null,
// Returns the author's name, defaulting to the empty string
toString: function() {
toString: function AddonAuthor_toString() {
return this.name || "";
}
}
@ -248,7 +248,7 @@ AddonScreenshot.prototype = {
caption: null,
// Returns the screenshot URL, defaulting to the empty string
toString: function() {
toString: function AddonScreenshot_toString() {
return this.url || "";
}
}
@ -354,7 +354,7 @@ function AddonType(aID, aLocaleURI, aLocaleKey, aViewType, aUIPriority, aFlags)
this.flags = aFlags;
if (aLocaleURI) {
this.__defineGetter__("name", function() {
this.__defineGetter__("name", function nameGetter() {
delete this.name;
let bundle = Services.strings.createBundle(aLocaleURI);
this.name = bundle.GetStringFromName(aLocaleKey.replace("%ID%", aID));
@ -391,7 +391,7 @@ var AddonManagerInternal = {
// A read-only wrapper around the types dictionary
typesProxy: Proxy.create({
getOwnPropertyDescriptor: function(aName) {
getOwnPropertyDescriptor: function typesProxy_getOwnPropertyDescriptor(aName) {
if (!(aName in AddonManagerInternal.types))
return undefined;
@ -403,34 +403,34 @@ var AddonManagerInternal = {
}
},
getPropertyDescriptor: function(aName) {
getPropertyDescriptor: function typesProxy_getPropertyDescriptor(aName) {
return this.getOwnPropertyDescriptor(aName);
},
getOwnPropertyNames: function() {
getOwnPropertyNames: function typesProxy_getOwnPropertyNames() {
return Object.keys(AddonManagerInternal.types);
},
getPropertyNames: function() {
getPropertyNames: function typesProxy_getPropertyNames() {
return this.getOwnPropertyNames();
},
delete: function(aName) {
delete: function typesProxy_delete(aName) {
// Not allowed to delete properties
return false;
},
defineProperty: function(aName, aProperty) {
defineProperty: function typesProxy_defineProperty(aName, aProperty) {
// Ignore attempts to define properties
},
fix: function() {
fix: function typesProxy_fix(){
return undefined;
},
// Despite MDC's claims to the contrary, it is required that this trap
// be defined
enumerate: function() {
enumerate: function typesProxy_enumerate() {
// All properties are enumerable
return this.getPropertyNames();
}
@ -587,7 +587,7 @@ var AddonManagerInternal = {
let typeListeners = this.typeListeners.slice(0);
for (let listener of typeListeners) {
safeCall(function() {
safeCall(function listenerSafeCall() {
listener.onTypeAdded(aType);
});
}
@ -623,14 +623,14 @@ var AddonManagerInternal = {
}
for (let type in this.types) {
this.types[type].providers = this.types[type].providers.filter(function(p) p != aProvider);
this.types[type].providers = this.types[type].providers.filter(function filterProvider(p) p != aProvider);
if (this.types[type].providers.length == 0) {
let oldType = this.types[type].type;
delete this.types[type];
let typeListeners = this.typeListeners.slice(0);
for (let listener of typeListeners) {
safeCall(function() {
safeCall(function listenerSafeCall() {
listener.onTypeRemoved(oldType);
});
}
@ -844,7 +844,7 @@ var AddonManagerInternal = {
// Replace custom parameters (names of custom parameters must have at
// least 3 characters to prevent lookups for something like %D0%C8)
var catMan = null;
uri = uri.replace(/%(\w{3,})%/g, function(aMatch, aParam) {
uri = uri.replace(/%(\w{3,})%/g, function parameterReplace(aMatch, aParam) {
if (!catMan) {
catMan = Cc["@mozilla.org/categorymanager;1"].
getService(Ci.nsICategoryManager);
@ -911,8 +911,10 @@ var AddonManagerInternal = {
// Repopulate repository cache first, to ensure compatibility overrides
// are up to date before checking for addon updates.
scope.AddonRepository.backgroundUpdateCheck(ids, function BUC_backgroundUpdateCheckCallback() {
AddonManagerInternal.updateAddonRepositoryData(function BUC_updateAddonCallback() {
scope.AddonRepository.backgroundUpdateCheck(
ids, function BUC_backgroundUpdateCheckCallback() {
AddonManagerInternal.updateAddonRepositoryData(
function BUC_updateAddonCallback() {
pendingUpdates += aAddons.length;
aAddons.forEach(function BUC_forEachCallback(aAddon) {
@ -966,8 +968,8 @@ var AddonManagerInternal = {
pendingUpdates++;
Components.utils.import("resource://gre/modules/AddonUpdateChecker.jsm");
AddonUpdateChecker.checkForUpdates(hotfixID, "extension", null, url, {
onUpdateCheckComplete: function(aUpdates) {
AddonUpdateChecker.checkForUpdates(hotfixID, null, url, {
onUpdateCheckComplete: function BUC_onUpdateCheckComplete(aUpdates) {
let update = AddonUpdateChecker.getNewestCompatibleUpdate(aUpdates);
if (!update) {
notifyComplete();
@ -982,9 +984,10 @@ var AddonManagerInternal = {
}
LOG("Downloading hotfix version " + update.version);
AddonManager.getInstallForURL(update.updateURL, function(aInstall) {
AddonManager.getInstallForURL(update.updateURL,
function BUC_getInstallForURL(aInstall) {
aInstall.addListener({
onDownloadEnded: function(aInstall) {
onDownloadEnded: function BUC_onDownloadEnded(aInstall) {
try {
if (!Services.prefs.getBoolPref(PREF_EM_CERT_CHECKATTRIBUTES))
return;
@ -1005,13 +1008,13 @@ var AddonManagerInternal = {
}
},
onInstallEnded: function(aInstall) {
onInstallEnded: function BUC_onInstallEnded(aInstall) {
// Remember the last successfully installed version.
Services.prefs.setCharPref(PREF_EM_HOTFIX_LASTVERSION,
aInstall.version);
},
onInstallCancelled: function(aInstall) {
onInstallCancelled: function BUC_onInstallCancelled(aInstall) {
// Revert to the previous version if the installation was
// cancelled.
Services.prefs.setCharPref(PREF_EM_HOTFIX_LASTVERSION,
@ -1089,7 +1092,8 @@ var AddonManagerInternal = {
if (!(aType in this.startupChanges))
return;
this.startupChanges[aType] = this.startupChanges[aType].filter(function(aItem) aItem != aID);
this.startupChanges[aType] = this.startupChanges[aType].filter(
function filterItem(aItem) aItem != aID);
},
/**
@ -1130,7 +1134,8 @@ var AddonManagerInternal = {
* An optional array of extra InstallListeners to also call
* @return false if any of the listeners returned false, true otherwise
*/
callInstallListeners: function AMI_callInstallListeners(aMethod, aExtraListeners, ...aArgs) {
callInstallListeners: function AMI_callInstallListeners(aMethod,
aExtraListeners, ...aArgs) {
if (!gStarted)
throw Components.Exception("AddonManager is not initialized",
Cr.NS_ERROR_NOT_INITIALIZED);
@ -1251,13 +1256,13 @@ var AddonManagerInternal = {
Cr.NS_ERROR_INVALID_ARG);
new AsyncObjectCaller(this.providers, "updateAddonRepositoryData", {
nextObject: function(aCaller, aProvider) {
nextObject: function updateAddonRepositoryData_nextObject(aCaller, aProvider) {
callProvider(aProvider,
"updateAddonRepositoryData",
null,
aCaller.callNext.bind(aCaller));
},
noMoreObjects: function(aCaller) {
noMoreObjects: function updateAddonRepositoryData_noMoreObjects(aCaller) {
safeCall(aCallback);
}
});
@ -1334,7 +1339,7 @@ var AddonManagerInternal = {
if (callProvider(provider, "supportsMimetype", false, aMimetype)) {
callProvider(provider, "getInstallForURL", null,
aUrl, aHash, aName, aIcons, aVersion, aLoadGroup,
function(aInstall) {
function getInstallForURL_safeCall(aInstall) {
safeCall(aCallback, aInstall);
});
return;
@ -1372,9 +1377,9 @@ var AddonManagerInternal = {
Cr.NS_ERROR_INVALID_ARG);
new AsyncObjectCaller(this.providers, "getInstallForFile", {
nextObject: function(aCaller, aProvider) {
nextObject: function getInstallForFile_nextObject(aCaller, aProvider) {
callProvider(aProvider, "getInstallForFile", null, aFile,
function(aInstall) {
function getInstallForFile_safeCall(aInstall) {
if (aInstall)
safeCall(aCallback, aInstall);
else
@ -1382,7 +1387,7 @@ var AddonManagerInternal = {
});
},
noMoreObjects: function(aCaller) {
noMoreObjects: function getInstallForFile_noMoreObjects(aCaller) {
safeCall(aCallback, null);
}
});
@ -1414,15 +1419,15 @@ var AddonManagerInternal = {
let installs = [];
new AsyncObjectCaller(this.providers, "getInstallsByTypes", {
nextObject: function(aCaller, aProvider) {
nextObject: function getInstallsByTypes_nextObject(aCaller, aProvider) {
callProvider(aProvider, "getInstallsByTypes", null, aTypes,
function(aProviderInstalls) {
function getInstallsByTypes_safeCall(aProviderInstalls) {
installs = installs.concat(aProviderInstalls);
aCaller.callNext();
});
},
noMoreObjects: function(aCaller) {
noMoreObjects: function getInstallsByTypes_noMoreObjects(aCaller) {
safeCall(aCallback, installs);
}
});
@ -1589,7 +1594,8 @@ var AddonManagerInternal = {
throw Components.Exception("aListener must be a InstallListener object",
Cr.NS_ERROR_INVALID_ARG);
if (!this.installListeners.some(function(i) { return i == aListener; }))
if (!this.installListeners.some(function addInstallListener_matchListener(i) {
return i == aListener; }))
this.installListeners.push(aListener);
},
@ -1636,8 +1642,9 @@ var AddonManagerInternal = {
Cr.NS_ERROR_INVALID_ARG);
new AsyncObjectCaller(this.providers, "getAddonByID", {
nextObject: function(aCaller, aProvider) {
callProvider(aProvider, "getAddonByID", null, aID, function(aAddon) {
nextObject: function getAddonByID_nextObject(aCaller, aProvider) {
callProvider(aProvider, "getAddonByID", null, aID,
function getAddonByID_safeCall(aAddon) {
if (aAddon)
safeCall(aCallback, aAddon);
else
@ -1645,7 +1652,7 @@ var AddonManagerInternal = {
});
},
noMoreObjects: function(aCaller) {
noMoreObjects: function getAddonByID_noMoreObjects(aCaller) {
safeCall(aCallback, null);
}
});
@ -1674,8 +1681,9 @@ var AddonManagerInternal = {
Cr.NS_ERROR_INVALID_ARG);
new AsyncObjectCaller(this.providers, "getAddonBySyncGUID", {
nextObject: function(aCaller, aProvider) {
callProvider(aProvider, "getAddonBySyncGUID", null, aGUID, function(aAddon) {
nextObject: function getAddonBySyncGUID_nextObject(aCaller, aProvider) {
callProvider(aProvider, "getAddonBySyncGUID", null, aGUID,
function getAddonBySyncGUID_safeCall(aAddon) {
if (aAddon) {
safeCall(aCallback, aAddon);
} else {
@ -1684,7 +1692,7 @@ var AddonManagerInternal = {
});
},
noMoreObjects: function(aCaller) {
noMoreObjects: function getAddonBySyncGUID_noMoreObjects(aCaller) {
safeCall(aCallback, null);
}
});
@ -1715,14 +1723,15 @@ var AddonManagerInternal = {
let addons = [];
new AsyncObjectCaller(aIDs, null, {
nextObject: function(aCaller, aID) {
AddonManagerInternal.getAddonByID(aID, function(aAddon) {
nextObject: function getAddonsByIDs_nextObject(aCaller, aID) {
AddonManagerInternal.getAddonByID(aID,
function getAddonsByIDs_getAddonByID(aAddon) {
addons.push(aAddon);
aCaller.callNext();
});
},
noMoreObjects: function(aCaller) {
noMoreObjects: function getAddonsByIDs_noMoreObjects(aCaller) {
safeCall(aCallback, addons);
}
});
@ -1753,15 +1762,15 @@ var AddonManagerInternal = {
let addons = [];
new AsyncObjectCaller(this.providers, "getAddonsByTypes", {
nextObject: function(aCaller, aProvider) {
nextObject: function getAddonsByTypes_nextObject(aCaller, aProvider) {
callProvider(aProvider, "getAddonsByTypes", null, aTypes,
function(aProviderAddons) {
function getAddonsByTypes_concatAddons(aProviderAddons) {
addons = addons.concat(aProviderAddons);
aCaller.callNext();
});
},
noMoreObjects: function(aCaller) {
noMoreObjects: function getAddonsByTypes_noMoreObjects(aCaller) {
safeCall(aCallback, addons);
}
});
@ -1812,15 +1821,17 @@ var AddonManagerInternal = {
let addons = [];
new AsyncObjectCaller(this.providers, "getAddonsWithOperationsByTypes", {
nextObject: function(aCaller, aProvider) {
nextObject: function getAddonsWithOperationsByTypes_nextObject
(aCaller, aProvider) {
callProvider(aProvider, "getAddonsWithOperationsByTypes", null, aTypes,
function(aProviderAddons) {
function getAddonsWithOperationsByTypes_concatAddons
(aProviderAddons) {
addons = addons.concat(aProviderAddons);
aCaller.callNext();
});
},
noMoreObjects: function(caller) {
noMoreObjects: function getAddonsWithOperationsByTypes_noMoreObjects(caller) {
safeCall(aCallback, addons);
}
});
@ -1837,7 +1848,8 @@ var AddonManagerInternal = {
throw Components.Exception("aListener must be an AddonManagerListener object",
Cr.NS_ERROR_INVALID_ARG);
if (!this.managerListeners.some(function(i) { return i == aListener; }))
if (!this.managerListeners.some(function addManagerListener_matchListener(i) {
return i == aListener; }))
this.managerListeners.push(aListener);
},
@ -1872,7 +1884,8 @@ var AddonManagerInternal = {
throw Components.Exception("aListener must be an AddonListener object",
Cr.NS_ERROR_INVALID_ARG);
if (!this.addonListeners.some(function(i) { return i == aListener; }))
if (!this.addonListeners.some(function addAddonListener_matchListener(i) {
return i == aListener; }))
this.addonListeners.push(aListener);
},
@ -1907,7 +1920,8 @@ var AddonManagerInternal = {
throw Components.Exception("aListener must be a TypeListener object",
Cr.NS_ERROR_INVALID_ARG);
if (!this.typeListeners.some(function(i) { return i == aListener; }))
if (!this.typeListeners.some(function addTypeListener_matchListener(i) {
return i == aListener; }))
this.typeListeners.push(aListener);
},

View File

@ -1869,7 +1869,7 @@ var AddonDatabase = {
function getAllIcons() {
self.getAsyncStatement("getAllIcons").executeAsync({
handleResult: function(aResults) {
handleResult: function getAllIcons_handleResult(aResults) {
let row = null;
while (row = aResults.getNextRow()) {
let addon_internal_id = row.getResultByName("addon_internal_id");
@ -1888,7 +1888,7 @@ var AddonDatabase = {
handleError: self.asyncErrorLogger,
handleCompletion: function(aReason) {
handleCompletion: function getAllIcons_handleCompletion(aReason) {
if (aReason != Ci.mozIStorageStatementCallback.REASON_FINISHED) {
ERROR("Error retrieving icons from database. Returning empty results");
aCallback({});

View File

@ -35,7 +35,7 @@ XPCOMUtils.defineLazyModuleGetter(this, "AddonRepository",
"resource://gre/modules/AddonRepository.jsm");
// Shared code for suppressing bad cert dialogs.
XPCOMUtils.defineLazyGetter(this, "CertUtils", function() {
XPCOMUtils.defineLazyGetter(this, "CertUtils", function certUtilsLazyGetter() {
let certUtils = {};
Components.utils.import("resource://gre/modules/CertUtils.jsm", certUtils);
return certUtils;
@ -45,7 +45,7 @@ var gRDF = Cc["@mozilla.org/rdf/rdf-service;1"].
getService(Ci.nsIRDFService);
["LOG", "WARN", "ERROR"].forEach(function(aName) {
this.__defineGetter__(aName, function() {
this.__defineGetter__(aName, function logFuncGetter() {
Components.utils.import("resource://gre/modules/AddonLogging.jsm");
LogManager.getLogger("addons.updates", this);
@ -225,8 +225,6 @@ RDFSerializer.prototype = {
*
* @param aId
* The ID of the add-on being checked for updates
* @param aType
* The type of the add-on being checked for updates
* @param aUpdateKey
* An optional update key for the add-on
* @param aRequest
@ -234,7 +232,7 @@ RDFSerializer.prototype = {
* @return an array of update objects
* @throws if the update manifest is invalid in any way
*/
function parseRDFManifest(aId, aType, aUpdateKey, aRequest) {
function parseRDFManifest(aId, aUpdateKey, aRequest) {
function EM_R(aProp) {
return gRDF.GetResource(PREFIX_NS_EM + aProp);
}
@ -383,8 +381,6 @@ function parseRDFManifest(aId, aType, aUpdateKey, aRequest) {
*
* @param aId
* The ID of the add-on being checked for updates
* @param aType
* The type of add-on being checked for updates
* @param aUpdateKey
* An optional update key for the add-on
* @param aUrl
@ -392,9 +388,8 @@ function parseRDFManifest(aId, aType, aUpdateKey, aRequest) {
* @param aObserver
* An observer to pass results to
*/
function UpdateParser(aId, aType, aUpdateKey, aUrl, aObserver) {
function UpdateParser(aId, aUpdateKey, aUrl, aObserver) {
this.id = aId;
this.type = aType;
this.updateKey = aUpdateKey;
this.observer = aObserver;
@ -418,8 +413,8 @@ function UpdateParser(aId, aType, aUpdateKey, aUrl, aObserver) {
this.request.channel.loadFlags |= Ci.nsIRequest.LOAD_BYPASS_CACHE;
this.request.overrideMimeType("text/xml");
var self = this;
this.request.addEventListener("load", function(event) { self.onLoad() }, false);
this.request.addEventListener("error", function(event) { self.onError() }, false);
this.request.addEventListener("load", function loadEventListener(event) { self.onLoad() }, false);
this.request.addEventListener("error", function errorEventListener(event) { self.onError() }, false);
this.request.send(null);
}
catch (e) {
@ -429,7 +424,6 @@ function UpdateParser(aId, aType, aUpdateKey, aUrl, aObserver) {
UpdateParser.prototype = {
id: null,
type: null,
updateKey: null,
observer: null,
request: null,
@ -484,7 +478,7 @@ UpdateParser.prototype = {
let results = null;
try {
results = parseRDFManifest(this.id, this.type, this.updateKey, request);
results = parseRDFManifest(this.id, this.updateKey, request);
}
catch (e) {
WARN(e);
@ -715,8 +709,6 @@ var AddonUpdateChecker = {
*
* @param aId
* The ID of the add-on being checked for updates
* @param aType
* The type of add-on being checked for updates
* @param aUpdateKey
* An optional update key for the add-on
* @param aUrl
@ -724,8 +716,8 @@ var AddonUpdateChecker = {
* @param aObserver
* An observer to notify of results
*/
checkForUpdates: function AUC_checkForUpdates(aId, aType, aUpdateKey, aUrl,
checkForUpdates: function AUC_checkForUpdates(aId, aUpdateKey, aUrl,
aObserver) {
new UpdateParser(aId, aType, aUpdateKey, aUrl, aObserver);
new UpdateParser(aId, aUpdateKey, aUrl, aObserver);
}
};

View File

@ -152,7 +152,7 @@ var ChromeManifestParser = {
* @return True if any matching instructions were found in the manifest.
*/
hasType: function CMP_hasType(aManifest, aType) {
return aManifest.some(function(aEntry) {
return aManifest.some(function hasType_matchEntryType(aEntry) {
return aEntry.type == aType;
});
}

View File

@ -97,7 +97,7 @@ let ImageCropper = {
delete inProgress[aTargetFile.path];
}
ImageFile.read(aURI, function (aInputStream, aContentType) {
ImageFile.read(aURI, function crop_readImageFile(aInputStream, aContentType) {
if (aInputStream && aContentType) {
let image = ImageTools.decode(aInputStream, aContentType);
if (image && image.width && image.height) {
@ -116,7 +116,7 @@ let ImageCropper = {
let ImageFile = {
read: function ImageFile_read(aURI, aCallback) {
this._netUtil.asyncFetch(aURI, function (aInputStream, aStatus, aRequest) {
this._netUtil.asyncFetch(aURI, function read_asyncFetch(aInputStream, aStatus, aRequest) {
if (Components.isSuccessCode(aStatus) && aRequest instanceof Ci.nsIChannel) {
let channel = aRequest.QueryInterface(Ci.nsIChannel);
aCallback(aInputStream, channel.contentType);
@ -128,7 +128,7 @@ let ImageFile = {
write: function ImageFile_write(aFile, aInputStream, aCallback) {
let fos = FileUtils.openSafeFileOutputStream(aFile);
this._netUtil.asyncCopy(aInputStream, fos, function (aResult) {
this._netUtil.asyncCopy(aInputStream, fos, function write_asyncCopy(aResult) {
FileUtils.closeSafeFileOutputStream(fos);
// Remove the file if writing was not successful.

View File

@ -42,12 +42,12 @@ const PERSIST_FILES = {
XPCOMUtils.defineLazyModuleGetter(this, "LightweightThemeImageOptimizer",
"resource://gre/modules/LightweightThemeImageOptimizer.jsm");
__defineGetter__("_prefs", function () {
__defineGetter__("_prefs", function prefsGetter() {
delete this._prefs;
return this._prefs = Services.prefs.getBranch("lightweightThemes.");
});
__defineGetter__("_maxUsedThemes", function() {
__defineGetter__("_maxUsedThemes", function maxUsedThemesGetter() {
delete this._maxUsedThemes;
try {
this._maxUsedThemes = _prefs.getIntPref("maxUsedThemes");
@ -58,7 +58,7 @@ __defineGetter__("_maxUsedThemes", function() {
return this._maxUsedThemes;
});
__defineSetter__("_maxUsedThemes", function(aVal) {
__defineSetter__("_maxUsedThemes", function maxUsedThemesSetter(aVal) {
delete this._maxUsedThemes;
return this._maxUsedThemes = aVal;
});
@ -108,11 +108,11 @@ var LightweightThemeManager = {
return _setCurrentTheme(aData, false);
},
setLocalTheme: function (aData) {
setLocalTheme: function LightweightThemeManager_setLocalTheme(aData) {
_setCurrentTheme(aData, true);
},
getUsedTheme: function (aId) {
getUsedTheme: function LightweightThemeManager_getUsedTheme(aId) {
var usedThemes = this.usedThemes;
for (let usedTheme of usedThemes) {
if (usedTheme.id == aId)
@ -121,7 +121,7 @@ var LightweightThemeManager = {
return null;
},
forgetUsedTheme: function (aId) {
forgetUsedTheme: function LightweightThemeManager_forgetUsedTheme(aId) {
let theme = this.getUsedTheme(aId);
if (!theme)
return;
@ -139,7 +139,7 @@ var LightweightThemeManager = {
AddonManagerPrivate.callAddonListeners("onUninstalled", wrapper);
},
previewTheme: function (aData) {
previewTheme: function LightweightThemeManager_previewTheme(aData) {
if (!aData)
return;
@ -161,7 +161,7 @@ var LightweightThemeManager = {
_notifyWindows(aData);
},
resetPreview: function () {
resetPreview: function LightweightThemeManager_resetPreview() {
if (_previewTimer) {
_previewTimer.cancel();
_previewTimer = null;
@ -169,7 +169,7 @@ var LightweightThemeManager = {
}
},
parseTheme: function (aString, aBaseURI) {
parseTheme: function LightweightThemeManager_parseTheme(aString, aBaseURI) {
try {
return _sanitizeTheme(JSON.parse(aString), aBaseURI, false);
} catch (e) {
@ -177,7 +177,7 @@ var LightweightThemeManager = {
}
},
updateCurrentTheme: function () {
updateCurrentTheme: function LightweightThemeManager_updateCurrentTheme() {
try {
if (!_prefs.getBoolPref("update.enabled"))
return;
@ -197,7 +197,7 @@ var LightweightThemeManager = {
req.open("GET", theme.updateURL, true);
var self = this;
req.addEventListener("load", function () {
req.addEventListener("load", function loadEventListener() {
if (req.status != 200)
return;
@ -221,7 +221,7 @@ var LightweightThemeManager = {
* @param aData
* The lightweight theme to switch to
*/
themeChanged: function(aData) {
themeChanged: function LightweightThemeManager_themeChanged(aData) {
if (_previewTimer) {
_previewTimer.cancel();
_previewTimer = null;
@ -233,7 +233,7 @@ var LightweightThemeManager = {
_updateUsedThemes(usedThemes);
if (PERSIST_ENABLED) {
LightweightThemeImageOptimizer.purge();
_persistImages(aData, function () {
_persistImages(aData, function themeChanged_persistImages() {
_notifyWindows(this.currentThemeForDisplay);
}.bind(this));
}
@ -248,7 +248,7 @@ var LightweightThemeManager = {
* Starts the Addons provider and enables the new lightweight theme if
* necessary.
*/
startup: function() {
startup: function LightweightThemeManager_startup() {
if (Services.prefs.prefHasUserValue(PREF_LWTHEME_TO_SELECT)) {
let id = Services.prefs.getCharPref(PREF_LWTHEME_TO_SELECT);
if (id)
@ -264,7 +264,7 @@ var LightweightThemeManager = {
/**
* Shuts down the provider.
*/
shutdown: function() {
shutdown: function LightweightThemeManager_shutdown() {
_prefs.removeObserver("", _prefObserver);
},
@ -280,7 +280,7 @@ var LightweightThemeManager = {
* true if the newly enabled add-on will only become enabled after a
* restart
*/
addonChanged: function(aId, aType, aPendingRestart) {
addonChanged: function LightweightThemeManager_addonChanged(aId, aType, aPendingRestart) {
if (aType != ADDON_TYPE)
return;
@ -353,7 +353,7 @@ var LightweightThemeManager = {
* @param aCallback
* A callback to pass the Addon to
*/
getAddonByID: function(aId, aCallback) {
getAddonByID: function LightweightThemeManager_getAddonByID(aId, aCallback) {
let id = _getInternalID(aId);
if (!id) {
aCallback(null);
@ -377,7 +377,7 @@ var LightweightThemeManager = {
* @param aCallback
* A callback to pass an array of Addons to
*/
getAddonsByTypes: function(aTypes, aCallback) {
getAddonsByTypes: function LightweightThemeManager_getAddonsByTypes(aTypes, aCallback) {
if (aTypes && aTypes.indexOf(ADDON_TYPE) == -1) {
aCallback([]);
return;
@ -392,49 +392,51 @@ var LightweightThemeManager = {
* consumers of the AddonManager API.
*/
function AddonWrapper(aTheme) {
this.__defineGetter__("id", function() aTheme.id + ID_SUFFIX);
this.__defineGetter__("type", function() ADDON_TYPE);
this.__defineGetter__("isActive", function() {
this.__defineGetter__("id", function AddonWrapper_idGetter() aTheme.id + ID_SUFFIX);
this.__defineGetter__("type", function AddonWrapper_typeGetter() ADDON_TYPE);
this.__defineGetter__("isActive", function AddonWrapper_isActiveGetter() {
let current = LightweightThemeManager.currentTheme;
if (current)
return aTheme.id == current.id;
return false;
});
this.__defineGetter__("name", function() aTheme.name);
this.__defineGetter__("version", function() {
this.__defineGetter__("name", function AddonWrapper_nameGetter() aTheme.name);
this.__defineGetter__("version", function AddonWrapper_versionGetter() {
return "version" in aTheme ? aTheme.version : "";
});
["description", "homepageURL", "iconURL"].forEach(function(prop) {
this.__defineGetter__(prop, function() {
this.__defineGetter__(prop, function AddonWrapper_optionalPropGetter() {
return prop in aTheme ? aTheme[prop] : null;
});
}, this);
["installDate", "updateDate"].forEach(function(prop) {
this.__defineGetter__(prop, function() {
this.__defineGetter__(prop, function AddonWrapper_datePropGetter() {
return prop in aTheme ? new Date(aTheme[prop]) : null;
});
}, this);
this.__defineGetter__("creator", function() {
this.__defineGetter__("creator", function AddonWrapper_creatorGetter() {
return new AddonManagerPrivate.AddonAuthor(aTheme.author);
});
this.__defineGetter__("screenshots", function() {
this.__defineGetter__("screenshots", function AddonWrapper_screenshotsGetter() {
let url = aTheme.previewURL;
return [new AddonManagerPrivate.AddonScreenshot(url)];
});
this.__defineGetter__("pendingOperations", function() {
this.__defineGetter__("pendingOperations",
function AddonWrapper_pendingOperationsGetter() {
let pending = AddonManager.PENDING_NONE;
if (this.isActive == this.userDisabled)
pending |= this.isActive ? AddonManager.PENDING_DISABLE : AddonManager.PENDING_ENABLE;
return pending;
});
this.__defineGetter__("operationsRequiringRestart", function() {
this.__defineGetter__("operationsRequiringRestart",
function AddonWrapper_operationsRequiringRestartGetter() {
// If a non-default theme is in use then a restart will be required to
// enable lightweight themes unless dynamic theme switching is enabled
if (Services.prefs.prefHasUserValue(PREF_GENERAL_SKINS_SELECTEDSKIN)) {
@ -450,13 +452,13 @@ function AddonWrapper(aTheme) {
return AddonManager.OP_NEEDS_RESTART_NONE;
});
this.__defineGetter__("size", function() {
this.__defineGetter__("size", function AddonWrapper_sizeGetter() {
// The size changes depending on whether the theme is in use or not, this is
// probably not worth exposing.
return null;
});
this.__defineGetter__("permissions", function() {
this.__defineGetter__("permissions", function AddonWrapper_permissionsGetter() {
let permissions = AddonManager.PERM_CAN_UNINSTALL;
if (this.userDisabled)
permissions |= AddonManager.PERM_CAN_ENABLE;
@ -465,7 +467,7 @@ function AddonWrapper(aTheme) {
return permissions;
});
this.__defineGetter__("userDisabled", function() {
this.__defineGetter__("userDisabled", function AddonWrapper_userDisabledGetter() {
if (_themeIDBeingEnabled == aTheme.id)
return false;
if (_themeIDBeingDisbled == aTheme.id)
@ -481,7 +483,7 @@ function AddonWrapper(aTheme) {
}
});
this.__defineSetter__("userDisabled", function(val) {
this.__defineSetter__("userDisabled", function AddonWrapper_userDisabledSetter(val) {
if (val == this.userDisabled)
return val;
@ -493,15 +495,15 @@ function AddonWrapper(aTheme) {
return val;
});
this.uninstall = function() {
this.uninstall = function AddonWrapper_uninstall() {
LightweightThemeManager.forgetUsedTheme(aTheme.id);
};
this.cancelUninstall = function() {
this.cancelUninstall = function AddonWrapper_cancelUninstall() {
throw new Error("Theme is not marked to be uninstalled");
};
this.findUpdates = function(listener, reason, appVersion, platformVersion) {
this.findUpdates = function AddonWrapper_findUpdates(listener, reason, appVersion, platformVersion) {
if ("onNoCompatibilityUpdateAvailable" in listener)
listener.onNoCompatibilityUpdateAvailable(this);
if ("onNoUpdateAvailable" in listener)
@ -535,7 +537,7 @@ AddonWrapper.prototype = {
},
// Lightweight themes are always compatible
isCompatibleWith: function(appVersion, platformVersion) {
isCompatibleWith: function AddonWrapper_isCompatibleWith(appVersion, platformVersion) {
return true;
},
@ -669,7 +671,8 @@ function _sanitizeTheme(aData, aBaseURI, aLocal) {
}
function _usedThemesExceptId(aId)
LightweightThemeManager.usedThemes.filter(function (t) "id" in t && t.id != aId);
LightweightThemeManager.usedThemes.filter(
function usedThemesExceptId_filterID(t) "id" in t && t.id != aId);
function _version(aThemeData)
aThemeData.version || "";
@ -701,7 +704,7 @@ function _notifyWindows(aThemeData) {
var _previewTimer;
var _previewTimerCallback = {
notify: function () {
notify: function _previewTimerCallback_notify() {
LightweightThemeManager.resetPreview();
}
};
@ -774,11 +777,11 @@ function _persistImage(sourceURL, localFileName, successCallback) {
}
function _persistProgressListener(successCallback) {
this.onLocationChange = function () {};
this.onProgressChange = function () {};
this.onStatusChange = function () {};
this.onSecurityChange = function () {};
this.onStateChange = function (aWebProgress, aRequest, aStateFlags, aStatus) {
this.onLocationChange = function persistProgressListener_onLocationChange() {};
this.onProgressChange = function persistProgressListener_onProgressChange() {};
this.onStatusChange = function persistProgressListener_onStatusChange() {};
this.onSecurityChange = function persistProgressListener_onSecurityChange() {};
this.onStateChange = function persistProgressListener_onStateChange(aWebProgress, aRequest, aStateFlags, aStatus) {
if (aRequest &&
aStateFlags & Ci.nsIWebProgressListener.STATE_IS_NETWORK &&
aStateFlags & Ci.nsIWebProgressListener.STATE_STOP) {

View File

@ -15,7 +15,7 @@ endif
# This is used in multiple places, so is defined here to avoid it getting
# out of sync.
DEFINES += -DMOZ_EXTENSIONS_DB_SCHEMA=13
DEFINES += -DMOZ_EXTENSIONS_DB_SCHEMA=14
# Additional debugging info is exposed in debug builds, or by setting the
# MOZ_EM_DEBUG environment variable when building.

View File

@ -110,6 +110,15 @@ const DB_MIGRATE_METADATA= ["installDate", "userDisabled", "softDisabled",
"sourceURI", "applyBackgroundUpdates",
"releaseNotesURI", "isForeignInstall", "syncGUID"];
// Note: When adding/changing/removing items here, remember to change the
// DB schema version to ensure changes are picked up ASAP.
const STATIC_BLOCKLIST_PATTERNS = [
{ creator: "Mozilla Corp.",
level: Ci.nsIBlocklistService.STATE_BLOCKED,
blockID: "i162" }
];
const BOOTSTRAP_REASONS = {
APP_STARTUP : 1,
APP_SHUTDOWN : 2,
@ -180,6 +189,19 @@ for (let name of LAZY_OBJECTS) {
}
function findMatchingStaticBlocklistItem(aAddon) {
for (let item of STATIC_BLOCKLIST_PATTERNS) {
if ("creator" in item && typeof item.creator == "string") {
if ((aAddon.defaultLocale && aAddon.defaultLocale.creator == item.creator) ||
(aAddon.selectedLocale && aAddon.selectedLocale.creator == item.creator)) {
return item;
}
}
}
return null;
}
/**
* Sets permissions on a file
*
@ -5308,7 +5330,7 @@ function UpdateChecker(aAddon, aListener, aReason, aAppVersion, aPlatformVersion
aReason |= UPDATE_TYPE_NEWVERSION;
let url = escapeAddonURI(aAddon, updateURL, aReason, aAppVersion);
AddonUpdateChecker.checkForUpdates(aAddon.id, aAddon.type, aAddon.updateKey,
AddonUpdateChecker.checkForUpdates(aAddon.id, aAddon.updateKey,
url, this);
}
@ -5590,12 +5612,22 @@ AddonInternal.prototype = {
},
get blocklistState() {
let staticItem = findMatchingStaticBlocklistItem(this);
if (staticItem)
return staticItem.level;
let bs = Cc["@mozilla.org/extensions/blocklist;1"].
getService(Ci.nsIBlocklistService);
return bs.getAddonBlocklistState(this.id, this.version);
},
get blocklistURL() {
let staticItem = findMatchingStaticBlocklistItem(this);
if (staticItem) {
let url = Services.urlFormatter.formatURLPref("extensions.blocklist.itemURL");
return url.replace(/%blockID%/g, staticItem.blockID);
}
let bs = Cc["@mozilla.org/extensions/blocklist;1"].
getService(Ci.nsIBlocklistService);
return bs.getAddonBlocklistURL(this.id, this.version);

View File

@ -18,7 +18,7 @@ XPCOMUtils.defineLazyModuleGetter(this, "FileUtils",
["LOG", "WARN", "ERROR"].forEach(function(aName) {
this.__defineGetter__(aName, function() {
this.__defineGetter__(aName, function logFuncGetter () {
Components.utils.import("resource://gre/modules/AddonLogging.jsm");
LogManager.getLogger("addons.xpi-utils", this);
@ -82,7 +82,7 @@ const PREFIX_NS_EM = "http://www.mozilla.org/2004/em-rdf#";
var XPIProvider;
this.__defineGetter__("gRDF", function() {
this.__defineGetter__("gRDF", function gRDFGetter() {
delete this.gRDF;
return this.gRDF = Cc["@mozilla.org/rdf/rdf-service;1"].
getService(Ci.nsIRDFService);
@ -145,12 +145,12 @@ AsyncAddonListCallback.prototype = {
count: 0,
addons: null,
handleResult: function(aResults) {
handleResult: function AsyncAddonListCallback_handleResult(aResults) {
let row = null;
while ((row = aResults.getNextRow())) {
this.count++;
let self = this;
XPIDatabase.makeAddonFromRowAsync(row, function(aAddon) {
XPIDatabase.makeAddonFromRowAsync(row, function handleResult_makeAddonFromRowAsync(aAddon) {
function completeAddon(aRepositoryAddon) {
aAddon._repositoryAddon = aRepositoryAddon;
aAddon.compatibilityOverrides = aRepositoryAddon ?
@ -171,7 +171,7 @@ AsyncAddonListCallback.prototype = {
handleError: asyncErrorLogger,
handleCompletion: function(aReason) {
handleCompletion: function AsyncAddonListCallback_handleCompletion(aReason) {
this.complete = true;
if (this.addons.length == this.count)
this.callback(this.addons);
@ -856,12 +856,12 @@ var XPIDatabase = {
// Re-create the connection smart getter to allow the database to be
// re-loaded during testing.
this.__defineGetter__("connection", function() {
this.__defineGetter__("connection", function connectionGetter() {
this.openConnection(true);
return this.connection;
});
connection.asyncClose(function() {
connection.asyncClose(function shutdown_asyncClose() {
LOG("Database closed");
aCallback();
});
@ -1121,7 +1121,7 @@ var XPIDatabase = {
stmt.params.id = aLocale.id;
stmt.executeAsync({
handleResult: function(aResults) {
handleResult: function readLocaleStrings_handleResult(aResults) {
let row = null;
while ((row = aResults.getNextRow())) {
let type = row.getResultByName("type");
@ -1133,7 +1133,7 @@ var XPIDatabase = {
handleError: asyncErrorLogger,
handleCompletion: function(aReason) {
handleCompletion: function readLocaleStrings_handleCompletion(aReason) {
aCallback();
}
});
@ -1145,7 +1145,7 @@ var XPIDatabase = {
stmt.params.id = aAddon._defaultLocale;
stmt.executeAsync({
handleResult: function(aResults) {
handleResult: function readDefaultLocale_handleResult(aResults) {
aAddon.defaultLocale = copyRowProperties(aResults.getNextRow(),
PROP_LOCALE_SINGLE);
aAddon.defaultLocale.id = aAddon._defaultLocale;
@ -1153,7 +1153,7 @@ var XPIDatabase = {
handleError: asyncErrorLogger,
handleCompletion: function(aReason) {
handleCompletion: function readDefaultLocale_handleCompletion(aReason) {
if (aAddon.defaultLocale) {
readLocaleStrings(aAddon.defaultLocale, readLocales);
}
@ -1172,7 +1172,7 @@ var XPIDatabase = {
stmt.params.internal_id = aAddon._internal_id;
stmt.executeAsync({
handleResult: function(aResults) {
handleResult: function readLocales_handleResult(aResults) {
let row = null;
while ((row = aResults.getNextRow())) {
let locale = {
@ -1186,7 +1186,7 @@ var XPIDatabase = {
handleError: asyncErrorLogger,
handleCompletion: function(aReason) {
handleCompletion: function readLocales_handleCompletion(aReason) {
let pos = 0;
function readNextLocale() {
if (pos < aAddon.locales.length)
@ -1207,7 +1207,7 @@ var XPIDatabase = {
stmt.params.internal_id = aAddon._internal_id;
stmt.executeAsync({
handleResult: function(aResults) {
handleResult: function readTargetApplications_handleResult(aResults) {
let row = null;
while ((row = aResults.getNextRow()))
aAddon.targetApplications.push(copyRowProperties(row, PROP_TARGETAPP));
@ -1215,7 +1215,7 @@ var XPIDatabase = {
handleError: asyncErrorLogger,
handleCompletion: function(aReason) {
handleCompletion: function readTargetApplications_handleCompletion(aReason) {
readTargetPlatforms();
}
});
@ -1228,7 +1228,7 @@ var XPIDatabase = {
stmt.params.internal_id = aAddon._internal_id;
stmt.executeAsync({
handleResult: function(aResults) {
handleResult: function readTargetPlatforms_handleResult(aResults) {
let row = null;
while ((row = aResults.getNextRow()))
aAddon.targetPlatforms.push(copyRowProperties(row, ["os", "abi"]));
@ -1236,7 +1236,7 @@ var XPIDatabase = {
handleError: asyncErrorLogger,
handleCompletion: function(aReason) {
handleCompletion: function readTargetPlatforms_handleCompletion(aReason) {
let callbacks = aAddon._pendingCallbacks;
delete aAddon._pendingCallbacks;
callbacks.forEach(function(aCallback) {
@ -1353,7 +1353,7 @@ var XPIDatabase = {
stmt.params.id = aId;
stmt.params.location = aLocation;
stmt.executeAsync(new AsyncAddonListCallback(function(aAddons) {
stmt.executeAsync(new AsyncAddonListCallback(function getAddonInLocation_executeAsync(aAddons) {
if (aAddons.length == 0) {
aCallback(null);
return;
@ -1383,7 +1383,7 @@ var XPIDatabase = {
let stmt = this.getStatement("getVisibleAddonForID");
stmt.params.id = aId;
stmt.executeAsync(new AsyncAddonListCallback(function(aAddons) {
stmt.executeAsync(new AsyncAddonListCallback(function getVisibleAddonForID_executeAsync(aAddons) {
if (aAddons.length == 0) {
aCallback(null);
return;
@ -1527,7 +1527,7 @@ var XPIDatabase = {
let stmt = this.getStatement("getAddonBySyncGUID");
stmt.params.syncGUID = aGUID;
stmt.executeAsync(new AsyncAddonListCallback(function(aAddons) {
stmt.executeAsync(new AsyncAddonListCallback(function getAddonBySyncGUID_executeAsync(aAddons) {
if (aAddons.length == 0) {
aCallback(null);
return;

View File

@ -94,7 +94,7 @@ amManager.prototype = {
return;
}
let uri = aUris.shift();
AddonManager.getInstallForURL(uri, function(aInstall) {
AddonManager.getInstallForURL(uri, function buildNextInstall_getInstallForURL(aInstall) {
function callCallback(aUri, aStatus) {
try {
aCallback.onInstallEnded(aUri, aStatus);
@ -108,22 +108,22 @@ amManager.prototype = {
installs.push(aInstall);
if (aCallback) {
aInstall.addListener({
onDownloadCancelled: function(aInstall) {
onDownloadCancelled: function buildNextInstall_onDownloadCancelled(aInstall) {
callCallback(uri, USER_CANCELLED);
},
onDownloadFailed: function(aInstall) {
onDownloadFailed: function buildNextInstall_onDownloadFailed(aInstall) {
if (aInstall.error == AddonManager.ERROR_CORRUPT_FILE)
callCallback(uri, CANT_READ_ARCHIVE);
else
callCallback(uri, DOWNLOAD_ERROR);
},
onInstallFailed: function(aInstall) {
onInstallFailed: function buildNextInstall_onInstallFailed(aInstall) {
callCallback(uri, EXECUTION_ERROR);
},
onInstallEnded: function(aInstall, aStatus) {
onInstallEnded: function buildNextInstall_onInstallEnded(aInstall, aStatus) {
callCallback(uri, SUCCESS);
}
});
@ -150,7 +150,7 @@ amManager.prototype = {
* Listens to requests from child processes for InstallTrigger
* activity, and sends back callbacks.
*/
receiveMessage: function(aMessage) {
receiveMessage: function AMC_receiveMessage(aMessage) {
var payload = aMessage.json;
var referer = Services.io.newURI(payload.referer, null, null);
switch (aMessage.name) {
@ -191,7 +191,7 @@ amManager.prototype = {
classID: Components.ID("{4399533d-08d1-458c-a87a-235f74451cfa}"),
_xpcom_factory: {
createInstance: function(aOuter, aIid) {
createInstance: function AMC_createInstance(aOuter, aIid) {
if (aOuter != null)
throw Components.Exception("Component does not support aggregation",
Cr.NS_ERROR_NO_AGGREGATION);

View File

@ -76,7 +76,7 @@ amContentHandler.prototype = {
classID: Components.ID("{7beb3ba8-6ec3-41b4-b67c-da89b8518922}"),
QueryInterface: XPCOMUtils.generateQI([Ci.nsIContentHandler]),
log : function(aMsg) {
log : function XCH_log(aMsg) {
let msg = "amContentHandler.js: " + (aMsg.join ? aMsg.join("") : aMsg);
Cc["@mozilla.org/consoleservice;1"].getService(Ci.nsIConsoleService).
logStringMessage(msg);

View File

@ -30,7 +30,7 @@ const READY_STATES = [
];
["LOG", "WARN", "ERROR"].forEach(function(aName) {
this.__defineGetter__(aName, function() {
this.__defineGetter__(aName, function logFuncGetter() {
Components.utils.import("resource://gre/modules/AddonLogging.jsm");
LogManager.getLogger("addons.weblistener", this);
@ -88,7 +88,7 @@ Installer.prototype = {
/**
* Checks if all downloads are now complete and if so prompts to install.
*/
checkAllDownloaded: function() {
checkAllDownloaded: function Installer_checkAllDownloaded() {
// Prevent re-entrancy caused by the confirmation dialog cancelling unwanted
// installs.
if (!this.isDownloading)
@ -192,7 +192,7 @@ Installer.prototype = {
/**
* Checks if all installs are now complete and if so notifies observers.
*/
checkAllInstalled: function() {
checkAllInstalled: function Installer_checkAllInstalled() {
var failed = [];
for (let install of this.downloads) {
@ -218,32 +218,32 @@ Installer.prototype = {
this.installed = null;
},
onDownloadCancelled: function(aInstall) {
onDownloadCancelled: function Installer_onDownloadCancelled(aInstall) {
aInstall.removeListener(this);
this.checkAllDownloaded();
},
onDownloadFailed: function(aInstall) {
onDownloadFailed: function Installer_onDownloadFailed(aInstall) {
aInstall.removeListener(this);
this.checkAllDownloaded();
},
onDownloadEnded: function(aInstall) {
onDownloadEnded: function Installer_onDownloadEnded(aInstall) {
this.checkAllDownloaded();
return false;
},
onInstallCancelled: function(aInstall) {
onInstallCancelled: function Installer_onInstallCancelled(aInstall) {
aInstall.removeListener(this);
this.checkAllInstalled();
},
onInstallFailed: function(aInstall) {
onInstallFailed: function Installer_onInstallFailed(aInstall) {
aInstall.removeListener(this);
this.checkAllInstalled();
},
onInstallEnded: function(aInstall) {
onInstallEnded: function Installer_onInstallEnded(aInstall) {
aInstall.removeListener(this);
this.installed.push(aInstall);
@ -265,7 +265,7 @@ extWebInstallListener.prototype = {
/**
* @see amIWebInstallListener.idl
*/
onWebInstallDisabled: function(aWindow, aUri, aInstalls) {
onWebInstallDisabled: function extWebInstallListener_onWebInstallDisabled(aWindow, aUri, aInstalls) {
let info = {
originatingWindow: aWindow,
originatingURI: aUri,
@ -279,13 +279,13 @@ extWebInstallListener.prototype = {
/**
* @see amIWebInstallListener.idl
*/
onWebInstallBlocked: function(aWindow, aUri, aInstalls) {
onWebInstallBlocked: function extWebInstallListener_onWebInstallBlocked(aWindow, aUri, aInstalls) {
let info = {
originatingWindow: aWindow,
originatingURI: aUri,
installs: aInstalls,
install: function() {
install: function onWebInstallBlocked_install() {
new Installer(this.originatingWindow, this.originatingURI, this.installs);
},
@ -299,7 +299,7 @@ extWebInstallListener.prototype = {
/**
* @see amIWebInstallListener.idl
*/
onWebInstallRequested: function(aWindow, aUri, aInstalls) {
onWebInstallRequested: function extWebInstallListener_onWebInstallRequested(aWindow, aUri, aInstalls) {
new Installer(aWindow, aUri, aInstalls);
// We start the installs ourself

View File

@ -26,7 +26,7 @@ function init() {
var richlist = document.getElementById("addonList");
var list = gArgs.list;
list.sort(function(a, b) { return String.localeCompare(a.name, b.name); });
list.sort(function listSort(a, b) { return String.localeCompare(a.name, b.name); });
for (let listItem of list) {
let item = document.createElement("richlistitem");
item.setAttribute("name", listItem.name);

View File

@ -48,7 +48,7 @@ function createInstallTrigger(window) {
/**
* @see amIInstallTriggerInstaller.idl
*/
enabled: function() {
enabled: function createInstallTrigger_enabled() {
return sendSyncMessage(MSG_INSTALL_ENABLED, {
mimetype: "application/x-xpinstall", referer: this.url.spec
})[0];
@ -57,14 +57,14 @@ function createInstallTrigger(window) {
/**
* @see amIInstallTriggerInstaller.idl
*/
updateEnabled: function() {
updateEnabled: function createInstallTrigger_updateEnabled() {
return this.enabled();
},
/**
* @see amIInstallTriggerInstaller.idl
*/
install: function(aArgs, aCallback) {
install: function createInstallTrigger_install(aArgs, aCallback) {
if (!aArgs || typeof aArgs != "object")
throw Components.Exception("Incorrect arguments passed to InstallTrigger.install()",
Cr.NS_ERROR_INVALID_ARGS);
@ -113,7 +113,7 @@ function createInstallTrigger(window) {
/**
* @see amIInstallTriggerInstaller.idl
*/
startSoftwareUpdate: function(aUrl, aFlags) {
startSoftwareUpdate: function createInstallTrigger_startSoftwareUpdate(aUrl, aFlags) {
var url = gIoService.newURI(aUrl, null, null)
.QueryInterface(Ci.nsIURL).filename;
var object = {};
@ -124,7 +124,7 @@ function createInstallTrigger(window) {
/**
* @see amIInstallTriggerInstaller.idl
*/
installChrome: function(aType, aUrl, aSkin) {
installChrome: function createInstallTrigger_installChrome(aType, aUrl, aSkin) {
return this.startSoftwareUpdate(aUrl);
},
@ -137,7 +137,7 @@ function createInstallTrigger(window) {
*
* @return A resolved, absolute nsURI object.
*/
resolveURL: function(aUrl) {
resolveURL: function createInstallTrigger_resolveURL(aUrl) {
return gIoService.newURI(aUrl, null, this.url);
},
@ -146,7 +146,7 @@ function createInstallTrigger(window) {
* TODO: When e10s lands on m-c, consider removing amInstallTrigger.cpp
* See bug 571166
*/
checkLoadURIFromScript: function(aUri) {
checkLoadURIFromScript: function createInstallTrigger_checkLoadURIFromScript(aUri) {
var secman = Cc["@mozilla.org/scriptsecuritymanager;1"].
getService(Ci.nsIScriptSecurityManager);
var principal = this.window.document.nodePrincipal;
@ -204,7 +204,7 @@ function InstallTriggerManager() {
// only if we live in a child process...
if (Cc["@mozilla.org/xre/app-info;1"].getService(Ci.nsIXULRuntime).processType !== Ci.nsIXULRuntime.PROCESS_TYPE_DEFAULT) {
// ... propagate JAR cache flush notifications across process boundaries
addMessageListener(MSG_JAR_FLUSH, function(msg) {
addMessageListener(MSG_JAR_FLUSH, function jar_flushMessageListener(msg) {
let file = Cc["@mozilla.org/file/local;1"].createInstance(Ci.nsIFile);
file.initWithPath(msg.json);
Cc["@mozilla.org/observer-service;1"].getService(Ci.nsIObserverService)
@ -218,17 +218,17 @@ function InstallTriggerManager() {
addEventListener("DOMWindowCreated", this, false);
var self = this;
addEventListener("unload", function() {
addEventListener("unload", function unloadEventListener() {
// Clean up all references, to help gc work quickly
self.callbacks = null;
}, false);
}
InstallTriggerManager.prototype = {
handleEvent: function handleEvent(aEvent) {
handleEvent: function ITM_handleEvent(aEvent) {
var window = aEvent.target.defaultView;
window.wrappedJSObject.__defineGetter__("InstallTrigger", function() {
window.wrappedJSObject.__defineGetter__("InstallTrigger", function installTriggerGetter() {
// We do this in a getter, so that we create these objects
// only on demand (this is a potential concern, since
// otherwise we might add one per iframe, and keep them
@ -255,7 +255,7 @@ InstallTriggerManager.prototype = {
*
* @return The callback ID, an integer identifying this callback.
*/
addCallback: function(aCallback, aUrls) {
addCallback: function ITM_addCallback(aCallback, aUrls) {
if (!aCallback || typeof aCallback != "function")
return -1;
var callbackId = 0;
@ -279,7 +279,7 @@ InstallTriggerManager.prototype = {
* The IPC message. Contains the callback ID.
*
*/
receiveMessage: function(aMessage) {
receiveMessage: function ITM_receiveMessage(aMessage) {
var payload = aMessage.json;
var callbackId = payload.callbackId;
var url = payload.url;

View File

@ -13,7 +13,7 @@ var gAddon = null;
// If the user enables the add-on through some other UI close this window
var EnableListener = {
onEnabling: function(aAddon) {
onEnabling: function EnableListener_onEnabling(aAddon) {
if (aAddon.id == gAddon.id)
window.close();
}
@ -38,7 +38,7 @@ function initialize() {
let bundle = Services.strings.createBundle("chrome://mozapps/locale/extensions/newaddon.properties");
AddonManager.getAddonByID(id, function(aAddon) {
AddonManager.getAddonByID(id, function initialize_getAddonByID(aAddon) {
// If the add-on doesn't exist or it is already enabled or it cannot be
// enabled then this UI is useless, just close it. This shouldn't normally
// happen unless session restore restores the tab

View File

@ -62,18 +62,18 @@ var gChecking = {
_addonCount: 0,
_completeCount: 0,
show: function() {
show: function gChecking_show() {
showButtons(true, false, false, false);
this._progress = document.getElementById("checking-progress");
let self = this;
AddonManager.getAllAddons(function(aAddons) {
AddonManager.getAllAddons(function gChecking_getAllAddons(aAddons) {
if (aAddons.length == 0) {
window.close();
return;
}
aAddons = aAddons.filter(function(aAddon) {
aAddons = aAddons.filter(function gChecking_filterAddons(aAddon) {
if (aAddon.type == "plugin")
return false;
@ -97,8 +97,8 @@ var gChecking = {
// Ensure compatibility overrides are up to date before checking for
// individual addon updates.
let ids = [addon.id for each (addon in aAddons)];
AddonRepository.repopulateCache(ids, function() {
AddonManagerPrivate.updateAddonRepositoryData(function() {
AddonRepository.repopulateCache(ids, function gChecking_repopulateCache() {
AddonManagerPrivate.updateAddonRepositoryData(function gChecking_updateAddonRepositoryData() {
for (let addonItem of aAddons) {
// Ignore disabled themes
@ -117,13 +117,13 @@ var gChecking = {
});
},
onUpdateAvailable: function(aAddon, aInstall) {
onUpdateAvailable: function gChecking_onUpdateAvailable(aAddon, aInstall) {
// If the add-on can be upgraded then remember the new version
if (aAddon.permissions & AddonManager.PERM_CAN_UPGRADE)
gAddons[aAddon.id].install = aInstall;
},
onUpdateFinished: function(aAddon, aError) {
onUpdateFinished: function gChecking_onUpdateFinished(aAddon, aError) {
this._completeCount++;
this._progress.value = this._completeCount;
@ -132,7 +132,7 @@ var gChecking = {
var addons = [gAddons[id] for (id in gAddons)];
addons.sort(function(a, b) {
addons.sort(function sortAddons(a, b) {
let orderA = orderForScope(a.addon.scope);
let orderB = orderForScope(b.addon.scope);
@ -171,11 +171,11 @@ var gChecking = {
var gSelect = {
nodeID: "select",
show: function() {
show: function gSelect_show() {
this.updateButtons();
},
updateButtons: function() {
updateButtons: function gSelect_updateButtons() {
for (let row = document.getElementById("select-rows").firstChild;
row; row = row.nextSibling) {
if (row.localName == "separator")
@ -190,11 +190,11 @@ var gSelect = {
showButtons(false, false, false, true);
},
next: function() {
next: function gSelect_next() {
showView(gConfirm);
},
done: function() {
done: function gSelect_done() {
window.close();
}
};
@ -202,7 +202,7 @@ var gSelect = {
var gConfirm = {
nodeID: "confirm",
show: function() {
show: function gConfirm_show() {
showButtons(false, true, false, true);
let box = document.getElementById("confirm-scrollbox").firstChild;
@ -239,15 +239,15 @@ var gConfirm = {
}
},
back: function() {
back: function gConfirm_back() {
showView(gSelect);
},
next: function() {
next: function gConfirm_next() {
showView(gUpdate);
},
done: function() {
done: function gConfirm_done() {
for (let row = document.getElementById("select-rows").firstChild;
row; row = row.nextSibling) {
if (row.localName != "separator")
@ -266,7 +266,7 @@ var gUpdate = {
_completeCount: 0,
_errorCount: 0,
show: function() {
show: function gUpdate_show() {
showButtons(true, false, false, false);
this._progress = document.getElementById("update-progress");
@ -282,7 +282,7 @@ var gUpdate = {
this._progress.value = this._completeCount;
},
checkComplete: function() {
checkComplete: function gUpdate_checkComplete() {
this._progress.value = this._completeCount;
if (this._completeCount < this._waitingCount)
return;
@ -295,23 +295,23 @@ var gUpdate = {
window.close();
},
onDownloadStarted: function(aInstall) {
onDownloadStarted: function gUpdate_onDownloadStarted(aInstall) {
this._waitingCount++;
},
onDownloadFailed: function(aInstall) {
onDownloadFailed: function gUpdate_onDownloadFailed(aInstall) {
this._errorCount++;
this._completeCount++;
this.checkComplete();
},
onInstallFailed: function(aInstall) {
onInstallFailed: function gUpdate_onInstallFailed(aInstall) {
this._errorCount++;
this._completeCount++;
this.checkComplete();
},
onInstallEnded: function(aInstall) {
onInstallEnded: function gUpdate_onInstallEnded(aInstall) {
this._completeCount++;
this.checkComplete();
}
@ -320,19 +320,20 @@ var gUpdate = {
var gErrors = {
nodeID: "errors",
show: function() {
show: function gErrors_show() {
showButtons(false, false, false, true);
},
done: function() {
done: function gErrors_done() {
window.close();
}
};
window.addEventListener("load", function() { showView(gChecking); }, false);
window.addEventListener("load", function loadEventListener() {
showView(gChecking); }, false);
// When closing the window cancel any pending or in-progress installs
window.addEventListener("unload", function() {
window.addEventListener("unload", function unloadEventListener() {
for (let id in gAddons) {
let entry = gAddons[id];
if (!entry.install)

View File

@ -36,7 +36,7 @@ var gUpdateWizard = {
xpinstallEnabled: true,
xpinstallLocked: false,
init: function ()
init: function gUpdateWizard_init()
{
this.inactiveAddonIDs = window.arguments[0];
@ -60,13 +60,13 @@ var gUpdateWizard = {
document.documentElement.currentPage = document.getElementById("versioninfo");
},
onWizardFinish: function ()
onWizardFinish: function gUpdateWizard_onWizardFinish ()
{
if (this.shouldSuggestAutoChecking)
Services.prefs.setBoolPref(PREF_UPDATE_EXTENSIONS_ENABLED, this.shouldAutoCheck);
},
_setUpButton: function (aButtonID, aButtonKey, aDisabled)
_setUpButton: function gUpdateWizard_setUpButton(aButtonID, aButtonKey, aDisabled)
{
var strings = document.getElementById("updateStrings");
var button = document.documentElement.getButton(aButtonID);
@ -81,7 +81,7 @@ var gUpdateWizard = {
button.disabled = aDisabled;
},
setButtonLabels: function (aBackButton, aBackButtonIsDisabled,
setButtonLabels: function gUpdateWizard_setButtonLabels(aBackButton, aBackButtonIsDisabled,
aNextButton, aNextButtonIsDisabled,
aCancelButton, aCancelButtonIsDisabled)
{
@ -94,18 +94,18 @@ var gUpdateWizard = {
// Update Errors
errorItems: [],
checkForErrors: function (aElementIDToShow)
checkForErrors: function gUpdateWizard_checkForErrors(aElementIDToShow)
{
if (this.errorItems.length > 0)
document.getElementById(aElementIDToShow).hidden = false;
},
onWizardClose: function (aEvent)
onWizardClose: function gUpdateWizard_onWizardClose(aEvent)
{
return this.onWizardCancel();
},
onWizardCancel: function ()
onWizardCancel: function gUpdateWizard_onWizardCancel()
{
if (!gInteruptable) {
gPendingClose = true;
@ -124,13 +124,13 @@ var gUpdateWizard = {
};
var gOfflinePage = {
onPageAdvanced: function ()
onPageAdvanced: function gOfflinePage_onPageAdvanced()
{
Services.io.offline = false;
return true;
},
toggleOffline: function ()
toggleOffline: function gOfflinePage_toggleOffline()
{
var nextbtn = document.documentElement.getButton("next");
nextbtn.disabled = !nextbtn.disabled;
@ -140,7 +140,7 @@ var gOfflinePage = {
var gVersionInfoPage = {
_completeCount: 0,
_totalCount: 0,
onPageShow: function ()
onPageShow: function gVersionInfoPage_onPageShow()
{
gUpdateWizard.setButtonLabels(null, true,
"nextButtonText", true,
@ -152,8 +152,8 @@ var gVersionInfoPage = {
catch (e) { }
// Retrieve all add-ons in order to sync their app compatibility information
AddonManager.getAllAddons(function(aAddons) {
gUpdateWizard.addons = aAddons.filter(function(a) {
AddonManager.getAllAddons(function gVersionInfoPage_getAllAddons(aAddons) {
gUpdateWizard.addons = aAddons.filter(function gVersionInfoPage_filterAddons(a) {
return a.type != "plugin" && a.id != hotfixID;
});
@ -164,8 +164,8 @@ var gVersionInfoPage = {
let ids = [addon.id for each (addon in gUpdateWizard.addons)];
gInteruptable = false;
AddonRepository.repopulateCache(ids, function() {
AddonManagerPrivate.updateAddonRepositoryData(function() {
AddonRepository.repopulateCache(ids, function gVersionInfoPage_repolulateCache() {
AddonManagerPrivate.updateAddonRepositoryData(function gVersionInfoPage_updateAddonRepoData() {
gInteruptable = true;
if (gPendingClose) {
window.close();
@ -179,10 +179,10 @@ var gVersionInfoPage = {
});
},
onAllUpdatesFinished: function() {
onAllUpdatesFinished: function gVersionInfoPage_onAllUpdatesFinished() {
// Filter out any add-ons that were disabled before the application was
// upgraded or are already compatible
gUpdateWizard.addons = gUpdateWizard.addons.filter(function(a) {
gUpdateWizard.addons = gUpdateWizard.addons.filter(function onAllUpdatesFinished_filterAddons(a) {
return a.appDisabled && gUpdateWizard.inactiveAddonIDs.indexOf(a.id) < 0;
});
@ -201,7 +201,7 @@ var gVersionInfoPage = {
/////////////////////////////////////////////////////////////////////////////
// UpdateListener
onUpdateFinished: function(aAddon, status) {
onUpdateFinished: function gVersionInfoPage_onUpdateFinished(aAddon, status) {
// If the add-on is now active then it won't have been disabled by startup
if (aAddon.active)
AddonManagerPrivate.removeStartupChange("disabled", aAddon.id);
@ -228,7 +228,7 @@ var gVersionInfoPage = {
};
var gMismatchPage = {
onPageShow: function ()
onPageShow: function gMismatchPage_onPageShow()
{
gUpdateWizard.setButtonLabels(null, true,
"mismatchCheckNow", false,
@ -247,7 +247,7 @@ var gMismatchPage = {
var gUpdatePage = {
_totalCount: 0,
_completeCount: 0,
onPageShow: function ()
onPageShow: function gUpdatePage_onPageShow()
{
if (!gUpdateWizard.xpinstallEnabled && gUpdateWizard.xpinstallLocked) {
document.documentElement.currentPage = document.getElementById("adminDisabled");
@ -266,7 +266,7 @@ var gUpdatePage = {
addon.findUpdates(this, AddonManager.UPDATE_WHEN_NEW_APP_INSTALLED);
},
onAllUpdatesFinished: function() {
onAllUpdatesFinished: function gUpdatePage_onAllUpdatesFinished() {
var nextPage = document.getElementById("noupdates");
if (gUpdateWizard.addonsToUpdate.length > 0)
nextPage = document.getElementById("found");
@ -275,11 +275,11 @@ var gUpdatePage = {
/////////////////////////////////////////////////////////////////////////////
// UpdateListener
onUpdateAvailable: function(aAddon, aInstall) {
onUpdateAvailable: function gUpdatePage_onUpdateAvailable(aAddon, aInstall) {
gUpdateWizard.addonsToUpdate.push(aInstall);
},
onUpdateFinished: function(aAddon, status) {
onUpdateFinished: function gUpdatePage_onUpdateFinished(aAddon, status) {
if (status != AddonManager.UPDATE_STATUS_NO_ERROR)
gUpdateWizard.errorItems.push(aAddon);
@ -300,7 +300,7 @@ var gUpdatePage = {
};
var gFoundPage = {
onPageShow: function ()
onPageShow: function gFoundPage_onPageShow()
{
gUpdateWizard.setButtonLabels(null, true,
"installButtonText", false,
@ -326,7 +326,7 @@ var gFoundPage = {
}
},
toggleXPInstallEnable: function(aEvent)
toggleXPInstallEnable: function gFoundPage_toggleXPInstallEnable(aEvent)
{
var enabled = aEvent.target.checked;
gUpdateWizard.xpinstallEnabled = enabled;
@ -336,7 +336,7 @@ var gFoundPage = {
this.updateNextButton();
},
updateNextButton: function ()
updateNextButton: function gFoundPage_updateNextButton()
{
if (!gUpdateWizard.xpinstallEnabled) {
document.documentElement.getButton("next").disabled = true;
@ -368,7 +368,7 @@ var gInstallingPage = {
_currentInstall : -1,
_installing : false,
onPageShow: function ()
onPageShow: function gInstallingPage_onPageShow()
{
gUpdateWizard.setButtonLabels(null, true,
"nextButtonText", true,
@ -388,7 +388,7 @@ var gInstallingPage = {
this.startNextInstall();
},
startNextInstall: function() {
startNextInstall: function gInstallingPage_startNextInstall() {
if (this._currentInstall >= 0) {
this._installs[this._currentInstall].removeListener(this);
}
@ -407,42 +407,42 @@ var gInstallingPage = {
this._installs[this._currentInstall].install();
},
cancelInstalls: function() {
cancelInstalls: function gInstallingPage_cancelInstalls() {
this._installs[this._currentInstall].removeListener(this);
this._installs[this._currentInstall].cancel();
},
/////////////////////////////////////////////////////////////////////////////
// InstallListener
onDownloadStarted: function(aInstall) {
onDownloadStarted: function gInstallingPage_onDownloadStarted(aInstall) {
var strings = document.getElementById("updateStrings");
var label = strings.getFormattedString("downloadingPrefix", [aInstall.name]);
var actionItem = document.getElementById("actionItem");
actionItem.value = label;
},
onDownloadProgress: function(aInstall) {
onDownloadProgress: function gInstallingPage_onDownloadProgress(aInstall) {
var downloadProgress = document.getElementById("downloadProgress");
downloadProgress.value = Math.ceil(100 * aInstall.progress / aInstall.maxProgress);
},
onDownloadEnded: function(aInstall) {
onDownloadEnded: function gInstallingPage_onDownloadEnded(aInstall) {
},
onDownloadFailed: function(aInstall) {
onDownloadFailed: function gInstallingPage_onDownloadFailed(aInstall) {
this._errors.push(aInstall);
this.startNextInstall();
},
onInstallStarted: function(aInstall) {
onInstallStarted: function gInstallingPage_onInstallStarted(aInstall) {
var strings = document.getElementById("updateStrings");
var label = strings.getFormattedString("installingPrefix", [aInstall.name]);
var actionItem = document.getElementById("actionItem");
actionItem.value = label;
},
onInstallEnded: function(aInstall, aAddon) {
onInstallEnded: function gInstallingPage_onInstallEnded(aInstall, aAddon) {
// Remember that this add-on was updated during startup
AddonManagerPrivate.addStartupChange(AddonManager.STARTUP_CHANGE_CHANGED,
aAddon.id);
@ -450,7 +450,7 @@ var gInstallingPage = {
this.startNextInstall();
},
onInstallFailed: function(aInstall) {
onInstallFailed: function gInstallingPage_onInstallFailed(aInstall) {
this._errors.push(aInstall);
this.startNextInstall();
@ -458,7 +458,7 @@ var gInstallingPage = {
};
var gInstallErrorsPage = {
onPageShow: function ()
onPageShow: function gInstallErrorsPage_onPageShow()
{
gUpdateWizard.setButtonLabels(null, true, null, true, null, true);
document.documentElement.getButton("finish").focus();
@ -468,7 +468,7 @@ var gInstallErrorsPage = {
// Displayed when there are incompatible add-ons and the xpinstall.enabled
// pref is false and locked.
var gAdminDisabledPage = {
onPageShow: function ()
onPageShow: function gAdminDisabledPage_onPageShow()
{
gUpdateWizard.setButtonLabels(null, true, null, true,
"cancelButtonText", true);
@ -479,7 +479,7 @@ var gAdminDisabledPage = {
// Displayed when selected add-on updates have been installed without error.
// There can still be add-ons that are not compatible and don't have an update.
var gFinishedPage = {
onPageShow: function ()
onPageShow: function gFinishedPage_onPageShow()
{
gUpdateWizard.setButtonLabels(null, true, null, true, null, true);
document.documentElement.getButton("finish").focus();
@ -498,7 +498,7 @@ var gFinishedPage = {
// Displayed when there are incompatible add-ons and there are no available
// updates.
var gNoUpdatesPage = {
onPageShow: function (aEvent)
onPageShow: function gNoUpdatesPage_onPageLoad(aEvent)
{
gUpdateWizard.setButtonLabels(null, true, null, true, null, true);
if (gUpdateWizard.shouldSuggestAutoChecking) {

View File

@ -8,7 +8,7 @@ var args
var XPInstallConfirm = {};
XPInstallConfirm.init = function ()
XPInstallConfirm.init = function XPInstallConfirm_init()
{
var _installCountdown;
var _installCountdownInterval;
@ -136,7 +136,7 @@ XPInstallConfirm.init = function ()
okButton.label = bundle.getString("installButtonLabel");
}
XPInstallConfirm.onOK = function ()
XPInstallConfirm.onOK = function XPInstallConfirm_onOk()
{
Components.classes["@mozilla.org/base/telemetry;1"].
getService(Components.interfaces.nsITelemetry).
@ -147,7 +147,7 @@ XPInstallConfirm.onOK = function ()
return true;
}
XPInstallConfirm.onCancel = function ()
XPInstallConfirm.onCancel = function XPInstallConfirm_onCancel()
{
for (let install of args.installs)
install.cancel();

View File

@ -275,7 +275,7 @@ Blocklist.prototype = {
_addonEntries: null,
_pluginEntries: null,
observe: function(aSubject, aTopic, aData) {
observe: function Blocklist_observe(aSubject, aTopic, aData) {
switch (aTopic) {
case "xpcom-shutdown":
let os = getObserverService();
@ -300,13 +300,13 @@ Blocklist.prototype = {
},
/* See nsIBlocklistService */
isAddonBlocklisted: function(id, version, appVersion, toolkitVersion) {
isAddonBlocklisted: function Blocklist_isAddonBlocklisted(id, version, appVersion, toolkitVersion) {
return this.getAddonBlocklistState(id, version, appVersion, toolkitVersion) ==
Ci.nsIBlocklistService.STATE_BLOCKED;
},
/* See nsIBlocklistService */
getAddonBlocklistState: function(id, version, appVersion, toolkitVersion) {
getAddonBlocklistState: function Blocklist_getAddonBlocklistState(id, version, appVersion, toolkitVersion) {
if (!this._addonEntries)
this._loadBlocklist();
return this._getAddonBlocklistState(id, version, this._addonEntries,
@ -332,7 +332,8 @@ Blocklist.prototype = {
* @returns The blocklist state for the item, one of the STATE constants as
* defined in nsIBlocklistService.
*/
_getAddonBlocklistState: function(id, version, addonEntries, appVersion, toolkitVersion) {
_getAddonBlocklistState: function Blocklist_getAddonBlocklistStateCall(id,
version, addonEntries, appVersion, toolkitVersion) {
if (!gBlocklistEnabled)
return Ci.nsIBlocklistService.STATE_NOT_BLOCKED;
@ -354,7 +355,7 @@ Blocklist.prototype = {
},
/* See nsIBlocklistService */
getAddonBlocklistURL: function(id, version, appVersion, toolkitVersion) {
getAddonBlocklistURL: function Blocklist_getAddonBlocklistURL(id, version, appVersion, toolkitVersion) {
if (!gBlocklistEnabled)
return "";
@ -368,14 +369,14 @@ Blocklist.prototype = {
return this._createBlocklistURL(blItem.blockID);
},
_createBlocklistURL: function(id) {
_createBlocklistURL: function Blocklist_createBlocklistURL(id) {
let url = Services.urlFormatter.formatURLPref(PREF_BLOCKLIST_ITEM_URL);
url = url.replace(/%blockID%/g, id);
return url;
},
notify: function(aTimer) {
notify: function Blocklist_notify(aTimer) {
if (!gBlocklistEnabled)
return;
@ -479,8 +480,10 @@ Blocklist.prototype = {
request.QueryInterface(Components.interfaces.nsIJSXMLHttpRequest);
var self = this;
request.addEventListener("error", function(event) { self.onXMLError(event); }, false);
request.addEventListener("load", function(event) { self.onXMLLoad(event); }, false);
request.addEventListener("error", function errorEventListener(event) {
self.onXMLError(event); }, false);
request.addEventListener("load", function loadEventListener(event) {
self.onXMLLoad(event); }, false);
request.send(null);
// When the blocklist loads we need to compare it to the current copy so
@ -489,7 +492,7 @@ Blocklist.prototype = {
this._loadBlocklist();
},
onXMLLoad: function(aEvent) {
onXMLLoad: function Blocklist_onXMLLoad(aEvent) {
var request = aEvent.target;
try {
gCertUtils.checkCert(request.channel);
@ -521,7 +524,7 @@ Blocklist.prototype = {
this._blocklistUpdated(oldAddonEntries, oldPluginEntries);
},
onXMLError: function(aEvent) {
onXMLError: function Blocklist_onXMLError(aEvent) {
try {
var request = aEvent.target;
// the following may throw (e.g. a local file or timeout)
@ -547,7 +550,7 @@ Blocklist.prototype = {
* Finds the newest blocklist file from the application and the profile and
* load it or does nothing if neither exist.
*/
_loadBlocklist: function() {
_loadBlocklist: function Blocklist_loadBlocklist() {
this._addonEntries = { };
this._pluginEntries = { };
var profFile = FileUtils.getFile(KEY_PROFILEDIR, [FILE_BLOCKLIST]);
@ -615,7 +618,7 @@ Blocklist.prototype = {
# </blocklist>
*/
_loadBlocklistFromFile: function(file) {
_loadBlocklistFromFile: function Blocklist_loadBlocklistFromFile(file) {
if (!gBlocklistEnabled) {
LOG("Blocklist::_loadBlocklistFromFile: blocklist is disabled");
return;
@ -667,7 +670,7 @@ Blocklist.prototype = {
fileStream.close();
},
_processItemNodes: function(itemNodes, prefix, handler) {
_processItemNodes: function Blocklist_processItemNodes(itemNodes, prefix, handler) {
var result = [];
var itemName = prefix + "Item";
for (var i = 0; i < itemNodes.length; ++i) {
@ -681,7 +684,7 @@ Blocklist.prototype = {
return result;
},
_handleEmItemNode: function(blocklistElement, result) {
_handleEmItemNode: function Blocklist_handleEmItemNode(blocklistElement, result) {
if (!matchesOSABI(blocklistElement))
return;
@ -704,7 +707,7 @@ Blocklist.prototype = {
result[id].blockID = blocklistElement.getAttribute("blockID");
},
_handlePluginItemNode: function(blocklistElement, result) {
_handlePluginItemNode: function Blocklist_handlePluginItemNode(blocklistElement, result) {
if (!matchesOSABI(blocklistElement))
return;
@ -745,7 +748,8 @@ Blocklist.prototype = {
},
/* See nsIBlocklistService */
getPluginBlocklistState: function(plugin, appVersion, toolkitVersion) {
getPluginBlocklistState: function Blocklist_getPluginBlocklistState(plugin,
appVersion, toolkitVersion) {
if (!this._pluginEntries)
this._loadBlocklist();
return this._getPluginBlocklistState(plugin, this._pluginEntries,
@ -769,7 +773,8 @@ Blocklist.prototype = {
* @returns The blocklist state for the item, one of the STATE constants as
* defined in nsIBlocklistService.
*/
_getPluginBlocklistState: function(plugin, pluginEntries, appVersion, toolkitVersion) {
_getPluginBlocklistState: function Blocklist_getPluginBlocklistState(plugin,
pluginEntries, appVersion, toolkitVersion) {
if (!gBlocklistEnabled)
return Ci.nsIBlocklistService.STATE_NOT_BLOCKED;
@ -814,7 +819,7 @@ Blocklist.prototype = {
},
/* See nsIBlocklistService */
getPluginBlocklistURL: function(plugin) {
getPluginBlocklistURL: function Blocklist_getPluginBlocklistURL(plugin) {
if (!gBlocklistEnabled)
return "";
@ -841,11 +846,12 @@ Blocklist.prototype = {
}
},
_blocklistUpdated: function(oldAddonEntries, oldPluginEntries) {
_blocklistUpdated: function Blocklist_blocklistUpdated(oldAddonEntries, oldPluginEntries) {
var addonList = [];
var self = this;
AddonManager.getAddonsByTypes(["extension", "theme", "locale", "dictionary"], function(addons) {
const types = ["extension", "theme", "locale", "dictionary"]
AddonManager.getAddonsByTypes(types, function blocklistUpdated_getAddonsByTypes(addons) {
for (let addon of addons) {
let oldState = Ci.nsIBlocklistService.STATE_NOTBLOCKED;
@ -969,7 +975,7 @@ Blocklist.prototype = {
Some tests run without UI, so the async code listens to a message
that can be sent programatically
*/
let applyBlocklistChanges = function() {
let applyBlocklistChanges = function blocklistUpdated_applyBlocklistChanges() {
for (let addon of addonList) {
if (!addon.disable)
continue;
@ -1059,7 +1065,7 @@ BlocklistItemData.prototype = {
* @returns True if the version range covers the item version and application
* or toolkit version.
*/
includesItem: function(version, appVersion, toolkitVersion) {
includesItem: function BlocklistItemData_includesItem(version, appVersion, toolkitVersion) {
// Some platforms have no version for plugins, these don't match if there
// was a min/maxVersion provided
if (!version && (this.minVersion || this.maxVersion))
@ -1089,7 +1095,7 @@ BlocklistItemData.prototype = {
* The maximum version. If null it is assumed that version is always
* smaller.
*/
matchesRange: function(version, minVersion, maxVersion) {
matchesRange: function BlocklistItemData_matchesRange(version, minVersion, maxVersion) {
if (minVersion && gVersionChecker.compare(version, minVersion) < 0)
return false;
if (maxVersion && gVersionChecker.compare(version, maxVersion) > 0)
@ -1106,7 +1112,7 @@ BlocklistItemData.prototype = {
* The version of the application to test for.
* @returns True if this version range covers the application version given.
*/
matchesTargetRange: function(appID, appVersion) {
matchesTargetRange: function BlocklistItemData_matchesTargetRange(appID, appVersion) {
var blTargetApp = this.targetApps[appID];
if (!blTargetApp)
return false;
@ -1128,7 +1134,7 @@ BlocklistItemData.prototype = {
* "minVersion" The minimum version in a version range (default = null).
* "maxVersion" The maximum version in a version range (default = null).
*/
getBlocklistAppVersions: function(targetAppElement) {
getBlocklistAppVersions: function BlocklistItemData_getBlocklistAppVersions(targetAppElement) {
var appVersions = [ ];
if (targetAppElement) {
@ -1156,7 +1162,7 @@ BlocklistItemData.prototype = {
* "minVersion" The minimum version in a version range (default = null).
* "maxVersion" The maximum version in a version range (default = null).
*/
getBlocklistVersionRange: function(versionRangeElement) {
getBlocklistVersionRange: function BlocklistItemData_getBlocklistVersionRange(versionRangeElement) {
var minVersion = null;
var maxVersion = null;
if (!versionRangeElement)

View File

@ -88,7 +88,7 @@ function run_update_tests(callback) {
mainURL;
}
AddonUpdateChecker.checkForUpdates("addon1@tests.mozilla.org", "extension",
AddonUpdateChecker.checkForUpdates("addon1@tests.mozilla.org",
null, url, {
onUpdateCheckComplete: function(updates) {
is(updates.length, 1, "Should be the right number of results");

View File

@ -27,7 +27,7 @@ function end_test() {
// Test that a basic update check returns the expected available updates
function run_test_1() {
AddonUpdateChecker.checkForUpdates("updatecheck1@tests.mozilla.org", "extension", null,
AddonUpdateChecker.checkForUpdates("updatecheck1@tests.mozilla.org", null,
"http://localhost:4444/data/test_updatecheck.rdf", {
onUpdateCheckComplete: function(updates) {
check_test_1(updates);
@ -75,7 +75,7 @@ let updateKey = "MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQDK426erD/H3XtsjvaB5+PJqbh
function run_test_2() {
AddonUpdateChecker.checkForUpdates("test_bug378216_5@tests.mozilla.org",
"extension", updateKey,
updateKey,
"http://localhost:4444/data/test_updatecheck.rdf", {
onUpdateCheckComplete: function(updates) {
do_throw("Expected the update check to fail");
@ -89,7 +89,7 @@ function run_test_2() {
function run_test_3() {
AddonUpdateChecker.checkForUpdates("test_bug378216_7@tests.mozilla.org",
"extension", updateKey,
updateKey,
"http://localhost:4444/data/test_updatecheck.rdf", {
onUpdateCheckComplete: function(updates) {
do_throw("Expected the update check to fail");
@ -103,7 +103,7 @@ function run_test_3() {
function run_test_4() {
AddonUpdateChecker.checkForUpdates("test_bug378216_8@tests.mozilla.org",
"extension", updateKey,
updateKey,
"http://localhost:4444/data/test_updatecheck.rdf", {
onUpdateCheckComplete: function(updates) {
do_check_eq(updates.length, 1);
@ -119,7 +119,7 @@ function run_test_4() {
function run_test_5() {
AddonUpdateChecker.checkForUpdates("test_bug378216_9@tests.mozilla.org",
"extension", updateKey,
updateKey,
"http://localhost:4444/data/test_updatecheck.rdf", {
onUpdateCheckComplete: function(updates) {
do_check_eq(updates.length, 1);
@ -136,7 +136,7 @@ function run_test_5() {
function run_test_6() {
AddonUpdateChecker.checkForUpdates("test_bug378216_10@tests.mozilla.org",
"extension", updateKey,
updateKey,
"http://localhost:4444/data/test_updatecheck.rdf", {
onUpdateCheckComplete: function(updates) {
do_check_eq(updates.length, 1);
@ -153,7 +153,7 @@ function run_test_6() {
function run_test_7() {
AddonUpdateChecker.checkForUpdates("test_bug378216_11@tests.mozilla.org",
"extension", updateKey,
updateKey,
"http://localhost:4444/data/test_updatecheck.rdf", {
onUpdateCheckComplete: function(updates) {
do_check_eq(updates.length, 1);
@ -170,7 +170,7 @@ function run_test_7() {
function run_test_8() {
AddonUpdateChecker.checkForUpdates("test_bug378216_12@tests.mozilla.org",
"extension", updateKey,
updateKey,
"http://localhost:4444/data/test_updatecheck.rdf", {
onUpdateCheckComplete: function(updates) {
do_check_eq(updates.length, 1);
@ -186,7 +186,7 @@ function run_test_8() {
function run_test_9() {
AddonUpdateChecker.checkForUpdates("test_bug378216_13@tests.mozilla.org",
"extension", updateKey,
updateKey,
"http://localhost:4444/data/test_updatecheck.rdf", {
onUpdateCheckComplete: function(updates) {
do_check_eq(updates.length, 1);
@ -203,7 +203,7 @@ function run_test_9() {
function run_test_10() {
AddonUpdateChecker.checkForUpdates("test_bug378216_14@tests.mozilla.org",
"extension", null,
null,
"http://localhost:4444/data/test_updatecheck.rdf", {
onUpdateCheckComplete: function(updates) {
do_check_eq(updates.length, 0);
@ -218,7 +218,7 @@ function run_test_10() {
function run_test_11() {
AddonUpdateChecker.checkForUpdates("test_bug378216_15@tests.mozilla.org",
"extension", null,
null,
"http://localhost:4444/data/test_updatecheck.rdf", {
onUpdateCheckComplete: function(updates) {
do_throw("Update check should have failed");
@ -233,7 +233,7 @@ function run_test_11() {
function run_test_12() {
AddonUpdateChecker.checkForUpdates("ignore-compat@tests.mozilla.org",
"extension", null,
null,
"http://localhost:4444/data/test_updatecheck.rdf", {
onUpdateCheckComplete: function(updates) {
do_check_eq(updates.length, 3);
@ -254,7 +254,7 @@ function run_test_12() {
function run_test_13() {
AddonUpdateChecker.checkForUpdates("compat-override@tests.mozilla.org",
"extension", null,
null,
"http://localhost:4444/data/test_updatecheck.rdf", {
onUpdateCheckComplete: function(updates) {
do_check_eq(updates.length, 3);
@ -292,7 +292,7 @@ function run_test_13() {
function run_test_14() {
AddonUpdateChecker.checkForUpdates("compat-strict-optin@tests.mozilla.org",
"extension", null,
null,
"http://localhost:4444/data/test_updatecheck.rdf", {
onUpdateCheckComplete: function(updates) {
do_check_eq(updates.length, 1);