Bug 1001090 - Part 4: Fix errors in chrome code. (r=zombie,gavin,fitzgen,dcamp,bgrins,fabrice,gwagner,margaret,mrbkap,mak,njn,vicamo)

This commit is contained in:
Shu-yu Guo 2014-09-15 16:30:46 -07:00
parent b0dbddedd0
commit 15262d36a9
34 changed files with 44 additions and 50 deletions

View File

@ -180,7 +180,6 @@ const Symbiont = Worker.resolve({
}
let eventName = 'end' == this.contentScriptWhen ? 'load' : 'DOMContentLoaded';
let self = this;
this._loadEvent = eventName;
frame.addEventListener(eventName,
this._loadListener = function _onReady(event) {

View File

@ -648,25 +648,25 @@ exports.close = close;
* Synchronous open(2).
*/
function openSync(path, flags, mode) {
let [ fd, flags, mode, file ] =
let [ fd, flags_, mode_, file ] =
[ { path: path }, Flags(flags), Mode(mode), nsILocalFile(path) ];
nsIFile(fd, file);
// If trying to open file for just read that does not exists
// need to throw exception as node does.
if (!file.exists() && !isWritable(flags))
if (!file.exists() && !isWritable(flags_))
throw FSError("open", "ENOENT", 34, path);
// If we want to open file in read mode we initialize input stream.
if (isReadable(flags)) {
let input = FileInputStream(file, flags, mode, DEFER_OPEN);
if (isReadable(flags_)) {
let input = FileInputStream(file, flags_, mode_, DEFER_OPEN);
nsIFileInputStream(fd, input);
}
// If we want to open file in write mode we initialize output stream for it.
if (isWritable(flags)) {
let output = FileOutputStream(file, flags, mode, DEFER_OPEN);
if (isWritable(flags_)) {
let output = FileOutputStream(file, flags_, mode_, DEFER_OPEN);
nsIFileOutputStream(fd, output);
}

View File

@ -64,7 +64,7 @@ function getBrowserWindow(options) {
return window;
// we don't have a BrowserWindow yet, so create one
var window = BrowserWindow(options);
window = BrowserWindow(options);
addListItem(browserWindows, window);
return window;
}

View File

@ -61,7 +61,7 @@
case "tryAgain":
let urlMatch = queryString.match(/url=([^&]+)/);
let encodedURL = urlMatch && urlMatch[1] ? urlMatch[1] : "";
let url = decodeURIComponent(encodedURL);
url = decodeURIComponent(encodedURL);
config.tryAgainCallback = loadQueryURL;
config.queryURL = url;

View File

@ -1310,8 +1310,8 @@ var gPluginHandler = {
buttons.push(submitButton);
#endif
let notification = notificationBox.appendNotification(messageString, "plugin-crashed",
iconURL, priority, buttons);
notification = notificationBox.appendNotification(messageString, "plugin-crashed",
iconURL, priority, buttons);
// Add the "learn more" link.
let XULNS = "http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul";

View File

@ -740,7 +740,7 @@ nsContextMenu.prototype = {
// if the document is editable, show context menu like in text inputs
if (!this.onEditableArea) {
var win = this.target.ownerDocument.defaultView;
win = this.target.ownerDocument.defaultView;
if (win) {
var isEditable = false;
try {

View File

@ -147,7 +147,7 @@ let PositionHandler = {
},
setXPosition: function(desiredX) {
// Ensure the indicator isn't moved outside the available area of the screen.
let desiredX = Math.max(desiredX, screen.availLeft);
desiredX = Math.max(desiredX, screen.availLeft);
let maxX =
screen.availLeft + screen.availWidth - document.documentElement.clientWidth;
window.moveTo(Math.min(desiredX, maxX), screen.availTop);

View File

@ -2170,9 +2170,9 @@ let DefaultBrowserCheck = {
let neverItem = doc.createElement("menuitem");
neverItem.id = "defaultBrowserNever";
let label = bundle.getString("setDefaultBrowserNever.label");
label = bundle.getString("setDefaultBrowserNever.label");
neverItem.setAttribute("label", label);
let accesskey = bundle.getString("setDefaultBrowserNever.accesskey");
accesskey = bundle.getString("setDefaultBrowserNever.accesskey");
neverItem.setAttribute("accesskey", accesskey);
popup.appendChild(neverItem);

View File

@ -216,7 +216,7 @@ let DebuggerView = {
extraKeys["Esc"] = false;
function bindKey(func, key, modifiers = {}) {
let key = document.getElementById(key).getAttribute("key");
key = document.getElementById(key).getAttribute("key");
let shortcut = Editor.accel(key, modifiers);
extraKeys[shortcut] = () => DebuggerView.Filtering[func]();
}

View File

@ -138,7 +138,7 @@ function quitApp() {
}
function getParameterByName (name) {
let name = name.replace(/[\[]/, "\\\[").replace(/[\]]/, "\\\]");
name = name.replace(/[\[]/, "\\\[").replace(/[\]]/, "\\\]");
let regex = new RegExp("[\\?&]" + name + "=([^&#]*)");
let results = regex.exec(window.location.search);
return results == null ? "" : decodeURIComponent(results[1].replace(/\+/g, " "));

View File

@ -1282,7 +1282,7 @@ MarkupView.prototype = {
let bgSize = ~~width + "px " + ~~height + "px";
this._preview.setAttribute("style", "background-size:" + bgSize);
let height = ~~(win.innerHeight * ratio) + "px";
height = ~~(win.innerHeight * ratio) + "px";
let top = ~~(win.scrollY * ratio) + "px";
this._viewbox.setAttribute("style", "height:" + height +
";transform: translateY(" + top + ")");

View File

@ -25,7 +25,6 @@
}
let oldThemeDef = gDevTools.getThemeDefinition(oldTheme);
let newThemeDef = gDevTools.getThemeDefinition(newTheme);
// Unload all theme stylesheets related to the old theme.
if (oldThemeDef) {

View File

@ -206,7 +206,7 @@ TableWidget.prototype = {
let checked = !!item.getAttribute("checked");
let id = item.getAttribute("data-id");
this.emit(EVENTS.HEADER_CONTEXT_MENU, id, checked);
let checked = this.menupopup.querySelectorAll("menuitem[checked]");
checked = this.menupopup.querySelectorAll("menuitem[checked]");
let disabled = this.menupopup.querySelectorAll("menuitem[disabled]");
if (checked.length == 2) {
checked[checked.length - 1].setAttribute("disabled", "true");

View File

@ -512,7 +512,7 @@ const ContentPanning = {
},
_recvDoubleTap: function(data) {
let data = data.json;
data = data.json;
// We haven't received a metrics update yet; don't do anything.
if (this._viewport == null) {

View File

@ -261,7 +261,7 @@ ContactManager.prototype = {
}
// Create an array with a single nsIContentPermissionType element.
let type = {
type = {
type: "contacts",
access: access,
options: [],

View File

@ -102,6 +102,7 @@ let ContactService = this.ContactService = {
if (DEBUG) debug("receiveMessage " + aMessage.name);
let mm = aMessage.target;
let msg = aMessage.data;
let cursorList;
switch (aMessage.name) {
case "Contacts:Find":
@ -125,7 +126,7 @@ let ContactService = this.ContactService = {
if (!this.assertPermission(aMessage, "contacts-read")) {
return null;
}
let cursorList = this._cursors.get(mm);
cursorList = this._cursors.get(mm);
if (!cursorList) {
cursorList = [];
this._cursors.set(mm, cursorList);

View File

@ -1111,7 +1111,7 @@ MobileMessageDB.prototype = {
return;
}
let threadRecord = {
threadRecord = {
participantIds: participantIds,
participantAddresses: threadParticipants,
lastMessageId: messageRecord.id,

View File

@ -384,7 +384,8 @@ InternalPrompt.prototype = {
nsIAuthPrompt_loginPrompt: function(aTitle, aPasswordRealm, aSavePassword, aUser, aPass) {
let checkMsg = null;
let check = { value: false };
let [hostname, realm, aUser] = PromptUtils.getHostnameAndRealm(aPasswordRealm);
let hostname, realm;
[hostname, realm, aUser] = PromptUtils.getHostnameAndRealm(aPasswordRealm);
let canSave = PromptUtils.canSaveLogin(hostname, aSavePassword);
if (canSave) {

View File

@ -560,7 +560,6 @@ let RootFolder = function (rootId, rootName) {
let processNewFolders = function () {
let newFolderGuids = Object.keys(newFolders);
let newFolderRoots = [];
let promises = [];
for each (let guid in newFolderGuids) {
let item = newFolders[guid];

View File

@ -709,7 +709,7 @@ WeaveCrypto.prototype = {
// Callee picks if SEC_OID_UNKNOWN, but only SHA1 is supported.
let prfAlg = this.nss.SEC_OID_HMAC_SHA1;
let keyLength = keyLength || 0; // 0 = Callee will pick.
keyLength = keyLength || 0; // 0 = Callee will pick.
let iterations = KEY_DERIVATION_ITERATIONS;
let algid, slot, symKey, keyData;

View File

@ -165,7 +165,7 @@ UserAPI10Client.prototype = {
return;
}
let error = new Error("Sync node retrieval failed.");
error = new Error("Sync node retrieval failed.");
switch (response.status) {
case 400:
error.denied = true;
@ -214,7 +214,7 @@ UserAPI10Client.prototype = {
return;
}
let error = new Error("Could not create user.");
error = new Error("Could not create user.");
error.body = response.body;
cb(error, null);

View File

@ -113,7 +113,7 @@ function registerSelf() {
}
function emitTouchEventForIFrame(message) {
let message = message.json;
message = message.json;
let frames = curFrame.document.getElementsByTagName("iframe");
let iframe = frames[message.index];
let identifier = nextTouchId;

View File

@ -966,7 +966,6 @@ MarionetteServerConnection.prototype = {
let curWindow = this.getCurrentWindow();
let original_onerror = curWindow.onerror;
let that = this;
that.timeout = timeout;
let marionette = new Marionette(this, curWindow, "chrome",
this.marionetteLog,

View File

@ -1847,7 +1847,7 @@ SpecialPowersAPI.prototype = {
this._quotaManagerCallbackInfos.push(callbackInfo)
} else {
callbackInfo.listener = function(msg) {
let msg = msg.data;
msg = msg.data;
for (let index in this._quotaManagerCallbackInfos) {
let callbackInfo = this._quotaManagerCallbackInfos[index];
if (callbackInfo.id == msg.id) {

View File

@ -1129,7 +1129,7 @@ TreeNode.prototype = {
maxAbsDescendant: function() {
if (!this._kids) {
// No kids? Just return the absolute value of the amount.
return max = Math.abs(this._amount);
return Math.abs(this._amount);
}
if ('_maxAbsDescendant' in this) {

View File

@ -473,7 +473,7 @@ this.CrashManager.prototype = Object.freeze({
let decoder = new TextDecoder();
data = decoder.decode(data);
let type, time, payload;
let type, time;
let start = 0;
for (let i = 0; i < 2; i++) {
let index = data.indexOf("\n", start);

View File

@ -160,7 +160,6 @@ var LoginManagerParent = {
// Note: previousResult is a regular object, not an
// nsIAutoCompleteResult.
var result;
var matchingLogins;
let searchStringLower = searchString.toLowerCase();
let logins;

View File

@ -1116,7 +1116,7 @@ LoginManagerStorage_mozStorage.prototype = {
// Get a list of IDs for existing logins
let ids = [];
let query = "SELECT id FROM moz_logins WHERE guid isnull";
query = "SELECT id FROM moz_logins WHERE guid isnull";
let stmt;
try {
stmt = this._dbCreateStatement(query);

View File

@ -1188,7 +1188,7 @@ PT.RemoveItem.prototype = {
for (let item of itemsToRestoreOnUndo) {
let parentId = yield PlacesUtils.promiseItemId(item.parentGUID);
let index = "index" in item ?
index : PlacesUtils.bookmarks.DEFAULT_INDEX;
item.index : PlacesUtils.bookmarks.DEFAULT_INDEX;
let itemId;
if (item.itemType == bms.TYPE_SEPARATOR) {
itemId = bms.insertSeparator(parentId, index, item.GUID);

View File

@ -467,7 +467,7 @@ LayoutHelpers.prototype = {
}
// Also take scrolled containers into account
let el = node;
el = node;
while (el && el.parentNode) {
if (el.scrollTop) {
offsetTop -= el.scrollTop;

View File

@ -790,7 +790,7 @@ DebuggerClient.prototype = {
throw Error("'" + request.type + "' bulk packet has no length.");
}
let request = new Request(request);
request = new Request(request);
request.format = "bulk";
this._pendingRequests.push(request);

View File

@ -1480,7 +1480,7 @@ ThreadActor.prototype = {
*/
// Find all innermost scripts matching the given location
let scripts = this.dbg.findScripts({
scripts = this.dbg.findScripts({
url: aLocation.url,
line: aLocation.line,
innermost: true
@ -2466,14 +2466,15 @@ PauseScopedActor.prototype = {
* resolved nsIURI
*/
function resolveURIToLocalPath(aURI) {
let resolved;
switch (aURI.scheme) {
case "jar":
case "file":
return aURI;
case "chrome":
let resolved = Cc["@mozilla.org/chrome/chrome-registry;1"].
getService(Ci.nsIChromeRegistry).convertChromeURL(aURI);
resolved = Cc["@mozilla.org/chrome/chrome-registry;1"].
getService(Ci.nsIChromeRegistry).convertChromeURL(aURI);
return resolveURIToLocalPath(resolved);
case "resource":
@ -4620,9 +4621,10 @@ EnvironmentActor.prototype = {
}
let value = this.obj.getVariable(name);
// The slot is optimized out or arguments on a dead scope.
// The slot is optimized out, arguments on a dead scope, or an
// uninitialized binding.
// FIXME: Need actual UI, bug 941287.
if (value && (value.optimizedOut || value.missingArguments)) {
if (value && (value.optimizedOut || value.missingArguments || value.uninitialized)) {
continue;
}

View File

@ -17,13 +17,9 @@ let { DebuggerTransport, LocalDebuggerTransport, ChildDebuggerTransport } =
require("devtools/toolkit/transport/transport");
let DevToolsUtils = require("devtools/toolkit/DevToolsUtils");
let { dumpn, dumpv, dbg_assert } = DevToolsUtils;
let Services = require("Services");
let EventEmitter = require("devtools/toolkit/event-emitter");
let Debugger = require("Debugger");
// Until all Debugger server code is converted to SDK modules,
// imports Components.* alias from chrome module.
var { Ci, Cc, CC, Cu, Cr } = require("chrome");
// On B2G, `this` != Global scope, so `Ci` won't be binded on `this`
// (i.e. this.Ci is undefined) Then later, when using loadSubScript,
// Ci,... won't be defined for sub scripts.

View File

@ -624,7 +624,7 @@ this.AddonRepository = {
AddonManager.getAllAddons(resolve));
// Filter the hotfix out of our list of add-ons
let allAddons = [a for (a of allAddons) if (a.id != AddonManager.hotfixID)];
allAddons = [a for (a of allAddons) if (a.id != AddonManager.hotfixID)];
// Completely remove cache if caching is not enabled
if (!this.cacheEnabled) {
@ -1327,7 +1327,6 @@ this.AddonRepository = {
}
// Create an AddonInstall for each result
let self = this;
results.forEach(function(aResult) {
let addon = aResult.addon;
let callback = function addonInstallCallback(aInstall) {