зеркало из https://github.com/mozilla/gecko-dev.git
Change in-tree users of Array.prototype.splice to not rely on non-standard behavior of deleting all elements from |k| onward for |arr.splice(k)|. r=jwalden
--HG-- extra : rebase_source : b2f041ab27c500636598fe6213481c1a5f0989e8
This commit is contained in:
Родитель
69ee1b11ba
Коммит
ca975bca37
|
@ -77,7 +77,7 @@ var gEditItemOverlay = {
|
|||
if (aInfo && aInfo.hiddenRows)
|
||||
this._hiddenRows = aInfo.hiddenRows;
|
||||
else
|
||||
this._hiddenRows.splice(0);
|
||||
this._hiddenRows.splice(0, this._hiddenRows.length);
|
||||
// force-read-only
|
||||
this._readOnly = aInfo && aInfo.forceReadOnly;
|
||||
},
|
||||
|
|
|
@ -77,7 +77,7 @@ var PlacesOrganizer = {
|
|||
|
||||
this.selectLeftPaneQuery(leftPaneSelection);
|
||||
// clear the back-stack
|
||||
this._backHistory.splice(0);
|
||||
this._backHistory.splice(0, this._backHistory.length);
|
||||
document.getElementById("OrganizerCommand:Back").setAttribute("disabled", true);
|
||||
|
||||
var view = this._content.treeBoxObject.view;
|
||||
|
@ -162,7 +162,7 @@ var PlacesOrganizer = {
|
|||
|
||||
if (this.location) {
|
||||
this._backHistory.unshift(this.location);
|
||||
this._forwardHistory.splice(0);
|
||||
this._forwardHistory.splice(0, this._forwardHistory.length);
|
||||
}
|
||||
|
||||
this._location = aLocation;
|
||||
|
|
|
@ -41,7 +41,7 @@ var gTreeUtils = {
|
|||
{
|
||||
for (var i = 0; i < aItems.length; ++i)
|
||||
aDeletedItems.push(aItems[i]);
|
||||
aItems.splice(0);
|
||||
aItems.splice(0, aItems.length);
|
||||
var oldCount = aView.rowCount;
|
||||
aView._rowCount = 0;
|
||||
aTree.treeBoxObject.rowCountChanged(0, -oldCount);
|
||||
|
|
|
@ -629,7 +629,7 @@ SessionStoreService.prototype = {
|
|||
// preserved update our internal states to match that max
|
||||
case "sessionstore.max_tabs_undo":
|
||||
for (let ix in this._windows) {
|
||||
this._windows[ix]._closedTabs.splice(this._prefBranch.getIntPref("sessionstore.max_tabs_undo"));
|
||||
this._windows[ix]._closedTabs.splice(this._prefBranch.getIntPref("sessionstore.max_tabs_undo"), this._windows[ix]._closedTabs.length);
|
||||
}
|
||||
break;
|
||||
case "sessionstore.max_windows_undo":
|
||||
|
@ -1166,7 +1166,7 @@ SessionStoreService.prototype = {
|
|||
// If the tab hasn't been restored yet, move it into the right _tabsToRestore bucket
|
||||
if (aTab.linkedBrowser.__SS_restoreState &&
|
||||
aTab.linkedBrowser.__SS_restoreState == TAB_STATE_NEEDS_RESTORE) {
|
||||
this._tabsToRestore.hidden.splice(this._tabsToRestore.hidden.indexOf(aTab));
|
||||
this._tabsToRestore.hidden.splice(this._tabsToRestore.hidden.indexOf(aTab), this._tabsToRestore.hidden.length);
|
||||
// Just put it at the end of the list of visible tabs;
|
||||
this._tabsToRestore.visible.push(aTab);
|
||||
|
||||
|
@ -1184,7 +1184,7 @@ SessionStoreService.prototype = {
|
|||
// If the tab hasn't been restored yet, move it into the right _tabsToRestore bucket
|
||||
if (aTab.linkedBrowser.__SS_restoreState &&
|
||||
aTab.linkedBrowser.__SS_restoreState == TAB_STATE_NEEDS_RESTORE) {
|
||||
this._tabsToRestore.visible.splice(this._tabsToRestore.visible.indexOf(aTab));
|
||||
this._tabsToRestore.visible.splice(this._tabsToRestore.visible.indexOf(aTab), this._tabsToRestore.visible.length);
|
||||
// Just put it at the end of the list of hidden tabs;
|
||||
this._tabsToRestore.hidden.push(aTab);
|
||||
}
|
||||
|
@ -1550,7 +1550,7 @@ SessionStoreService.prototype = {
|
|||
if (winState._closedTabs && winState._closedTabs.length) {
|
||||
let curWinState = this._windows[windowToUse.__SSi];
|
||||
curWinState._closedTabs = curWinState._closedTabs.concat(winState._closedTabs);
|
||||
curWinState._closedTabs.splice(this._prefBranch.getIntPref("sessionstore.max_tabs_undo"));
|
||||
curWinState._closedTabs.splice(this._prefBranch.getIntPref("sessionstore.max_tabs_undo"), curWinState._closedTabs.length);
|
||||
}
|
||||
|
||||
// Restore into that window - pretend it's a followup since we'll already
|
||||
|
@ -4137,7 +4137,7 @@ SessionStoreService.prototype = {
|
|||
if (normalWindowIndex >= maxWindowsUndo)
|
||||
spliceTo = normalWindowIndex + 1;
|
||||
#endif
|
||||
this._closedWindows.splice(spliceTo);
|
||||
this._closedWindows.splice(spliceTo, this._closedWindows.length);
|
||||
},
|
||||
|
||||
_clearRestoringWindows: function sss__clearRestoringWindows() {
|
||||
|
|
|
@ -82,7 +82,7 @@ function testGroups() {
|
|||
"one group divider exists after the third console message");
|
||||
|
||||
jsterm.clearOutput();
|
||||
jsterm.history.splice(0); // workaround for bug 592552
|
||||
jsterm.history.splice(0, jsterm.history.length); // workaround for bug 592552
|
||||
|
||||
finishTest();
|
||||
}
|
||||
|
|
|
@ -89,7 +89,7 @@ function testCompletion() {
|
|||
is(jsterm.completeNode.value, " entById", "'document.getElem' completion");
|
||||
|
||||
jsterm.clearOutput();
|
||||
jsterm.history.splice(0); // workaround for bug 592552
|
||||
jsterm.history.splice(0, jsterm.history.length); // workaround for bug 592552
|
||||
|
||||
input.value = "docu";
|
||||
jsterm.complete(jsterm.COMPLETE_HINT_ONLY);
|
||||
|
|
|
@ -68,7 +68,7 @@ function testExecutionScope() {
|
|||
"command was executed in the window scope");
|
||||
|
||||
jsterm.clearOutput();
|
||||
jsterm.history.splice(0); // workaround for bug 592552
|
||||
jsterm.history.splice(0, jsterm.history.length); // workaround for bug 592552
|
||||
|
||||
finishTest();
|
||||
}
|
||||
|
|
|
@ -99,7 +99,7 @@ function testHistory() {
|
|||
is (input.value, executeList[idxLast], "check history next idx:" + idxLast);
|
||||
|
||||
jsterm.clearOutput();
|
||||
jsterm.history.splice(0); // workaround for bug 592552
|
||||
jsterm.history.splice(0, jsterm.history.length); // workaround for bug 592552
|
||||
|
||||
finishTest();
|
||||
}
|
||||
|
|
|
@ -75,7 +75,7 @@ function testJSInputAndOutputStyling() {
|
|||
"JS output node is of the CSS class 'webconsole-msg-output'");
|
||||
|
||||
jsterm.clearOutput();
|
||||
jsterm.history.splice(0); // workaround for bug 592552
|
||||
jsterm.history.splice(0, jsterm.history.length); // workaround for bug 592552
|
||||
|
||||
finishTest();
|
||||
}
|
||||
|
|
|
@ -73,7 +73,7 @@ function testNullAndUndefinedOutput() {
|
|||
ok(nodes[1].textContent.indexOf("undefined") > -1, "'undefined' printed to output");
|
||||
|
||||
jsterm.clearOutput();
|
||||
jsterm.history.splice(0); // workaround for bug 592552
|
||||
jsterm.history.splice(0, jsterm.history.length); // workaround for bug 592552
|
||||
|
||||
finishTest();
|
||||
}
|
||||
|
|
|
@ -71,7 +71,7 @@ function testOutputOrder() {
|
|||
ok(executedStringFirst && outputSecond, "executed string comes first");
|
||||
|
||||
jsterm.clearOutput();
|
||||
jsterm.history.splice(0); // workaround for bug 592552
|
||||
jsterm.history.splice(0, jsterm.history.length); // workaround for bug 592552
|
||||
|
||||
finishTest();
|
||||
}
|
||||
|
|
|
@ -26,7 +26,8 @@ var UpdateHelper = Class.create({
|
|||
method = d.methodName;
|
||||
|
||||
namespace[method] = (namespace[method] || function() {}).wrap(function(proceed) {
|
||||
var args = $A(arguments).splice(1);
|
||||
var arr = $A(arguments);
|
||||
var args = arr.splice(1, arr.length);
|
||||
if (!condition || condition.apply(this, args)) notify(message, type);
|
||||
return proceed.apply(proceed, args);
|
||||
});
|
||||
|
@ -403,7 +404,8 @@ var prototypeUpdateHelper = new UpdateHelper([
|
|||
if (!Object.isFunction(method.value) || key == 'initialize') return;
|
||||
Hash.prototype[key] = Hash.prototype[key].wrap(function(proceed) {
|
||||
checkProperties(this);
|
||||
return proceed.apply(proceed, $A(arguments).splice(1));
|
||||
var arr = $A(arguments);
|
||||
return proceed.apply(proceed, arr.splice(1, arr.length));
|
||||
});
|
||||
});
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
var a = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1];
|
||||
a.push(1);
|
||||
a.splice(0);
|
||||
a.splice(0, a.length);
|
||||
a.d = "";
|
||||
|
|
|
@ -456,7 +456,7 @@ function DirectoryEntriesToArray(inDirFile, inRequiredExtension)
|
|||
function BuildTestURLsList(testSourceType)
|
||||
{
|
||||
// clear the array
|
||||
gTestURLs.splice(0);
|
||||
gTestURLs.splice(0, gTestURLs.length);
|
||||
gTestURLsIndex = 0;
|
||||
|
||||
if (testSourceType == kTestSourceSingleFile)
|
||||
|
|
|
@ -531,7 +531,7 @@ MouseModule.prototype = {
|
|||
this._singleClickTimeout.clear();
|
||||
this._mouseOverTimeout.clear();
|
||||
this._longClickTimeout.clear();
|
||||
this._downUpEvents.splice(0);
|
||||
this._downUpEvents.splice(0, this._downUpEvents.length);
|
||||
},
|
||||
|
||||
/* XXXvn this can potentially be moved into ScrollUtils */
|
||||
|
|
|
@ -605,7 +605,7 @@ function filterTree(aTotalBytes, aT)
|
|||
for ( ; i < aT._kids.length; i++) {
|
||||
aggBytes += aT._kids[i]._amount;
|
||||
}
|
||||
aT._kids.splice(i0);
|
||||
aT._kids.splice(i0, aT._kids.length);
|
||||
var n = i - i0;
|
||||
var rSub = new TreeNode("(" + n + " omitted)");
|
||||
rSub._amount = aggBytes;
|
||||
|
|
|
@ -3259,7 +3259,7 @@ PlacesSortFolderByNameTransaction.prototype = {
|
|||
if (preSep.length > 0) {
|
||||
preSep.sort(sortingMethod);
|
||||
newOrder = newOrder.concat(preSep);
|
||||
preSep.splice(0);
|
||||
preSep.splice(0, preSep.length);
|
||||
}
|
||||
newOrder.push(item);
|
||||
}
|
||||
|
|
|
@ -511,7 +511,7 @@ TileManager.TileCache.prototype = {
|
|||
if (!skipEvictionQueueSort)
|
||||
this.sortEvictionQueue();
|
||||
|
||||
rem = this._tilePool.splice(newCap);
|
||||
rem = this._tilePool.splice(newCap, this._tilePool.length);
|
||||
|
||||
} else {
|
||||
// This case is win. Extend our tile pool array with new empty space.
|
||||
|
|
|
@ -499,9 +499,9 @@ var AddonManagerInternal = {
|
|||
callProvider(provider, "shutdown");
|
||||
});
|
||||
|
||||
this.installListeners.splice(0);
|
||||
this.addonListeners.splice(0);
|
||||
this.typeListeners.splice(0);
|
||||
this.installListeners.splice(0, this.installListeners.length);
|
||||
this.addonListeners.splice(0, this.addonListeners.length);
|
||||
this.typeListeners.splice(0, this.typeListeners.length);
|
||||
for (let type in this.startupChanges)
|
||||
delete this.startupChanges[type];
|
||||
gStarted = false;
|
||||
|
|
|
@ -282,7 +282,7 @@ var FakeHistory = {
|
|||
|
||||
pushState: function(aState) {
|
||||
this.pos++;
|
||||
this.states.splice(this.pos);
|
||||
this.states.splice(this.pos, this.states.length);
|
||||
this.states.push(aState);
|
||||
},
|
||||
|
||||
|
@ -294,7 +294,7 @@ var FakeHistory = {
|
|||
if (this.pos == 0)
|
||||
throw new Error("Cannot popState from this view");
|
||||
|
||||
this.states.splice(this.pos);
|
||||
this.states.splice(this.pos, this.states.length);
|
||||
this.pos--;
|
||||
|
||||
gViewController.updateState(this.states[this.pos]);
|
||||
|
|
|
@ -6,12 +6,12 @@ Components.utils.import("resource://gre/modules/NetUtil.jsm");
|
|||
|
||||
var pathParts = gTestPath.split("/");
|
||||
// Drop the test filename
|
||||
pathParts.splice(pathParts.length - 1);
|
||||
pathParts.splice(pathParts.length - 1, pathParts.length);
|
||||
|
||||
var gTestInWindow = /-window$/.test(pathParts[pathParts.length - 1]);
|
||||
|
||||
// Drop the UI type
|
||||
pathParts.splice(pathParts.length - 1);
|
||||
pathParts.splice(pathParts.length - 1, pathParts.length);
|
||||
pathParts.push("browser");
|
||||
|
||||
const RELATIVE_DIR = pathParts.slice(4).join("/") + "/";
|
||||
|
|
Загрузка…
Ссылка в новой задаче