Bug 1202902 - Fix the world. (r=ato for marionette, rs=Mossop for rest)

This commit is contained in:
Shu-yu Guo 2015-10-06 14:00:30 -07:00
Родитель 99fd14ce85
Коммит 52e365bb7b
100 изменённых файлов: 502 добавлений и 246 удалений

Просмотреть файл

@ -1,26 +1,26 @@
////////////////////////////////////////////////////////////////////////////////
// Constants
const RELATION_CONTROLLED_BY = nsIAccessibleRelation.RELATION_CONTROLLED_BY;
const RELATION_CONTROLLER_FOR = nsIAccessibleRelation.RELATION_CONTROLLER_FOR;
const RELATION_DEFAULT_BUTTON = nsIAccessibleRelation.RELATION_DEFAULT_BUTTON;
const RELATION_DESCRIBED_BY = nsIAccessibleRelation.RELATION_DESCRIBED_BY;
const RELATION_DESCRIPTION_FOR = nsIAccessibleRelation.RELATION_DESCRIPTION_FOR;
const RELATION_EMBEDDED_BY = nsIAccessibleRelation.RELATION_EMBEDDED_BY;
const RELATION_EMBEDS = nsIAccessibleRelation.RELATION_EMBEDS;
const RELATION_FLOWS_FROM = nsIAccessibleRelation.RELATION_FLOWS_FROM;
const RELATION_FLOWS_TO = nsIAccessibleRelation.RELATION_FLOWS_TO;
const RELATION_LABEL_FOR = nsIAccessibleRelation.RELATION_LABEL_FOR;
const RELATION_LABELLED_BY = nsIAccessibleRelation.RELATION_LABELLED_BY;
const RELATION_MEMBER_OF = nsIAccessibleRelation.RELATION_MEMBER_OF;
const RELATION_NODE_CHILD_OF = nsIAccessibleRelation.RELATION_NODE_CHILD_OF;
const RELATION_NODE_PARENT_OF = nsIAccessibleRelation.RELATION_NODE_PARENT_OF;
const RELATION_PARENT_WINDOW_OF = nsIAccessibleRelation.RELATION_PARENT_WINDOW_OF;
const RELATION_POPUP_FOR = nsIAccessibleRelation.RELATION_POPUP_FOR;
const RELATION_SUBWINDOW_OF = nsIAccessibleRelation.RELATION_SUBWINDOW_OF;
const RELATION_CONTAINING_DOCUMENT = nsIAccessibleRelation.RELATION_CONTAINING_DOCUMENT;
const RELATION_CONTAINING_TAB_PANE = nsIAccessibleRelation.RELATION_CONTAINING_TAB_PANE;
const RELATION_CONTAINING_APPLICATION = nsIAccessibleRelation.RELATION_CONTAINING_APPLICATION;
var RELATION_CONTROLLED_BY = nsIAccessibleRelation.RELATION_CONTROLLED_BY;
var RELATION_CONTROLLER_FOR = nsIAccessibleRelation.RELATION_CONTROLLER_FOR;
var RELATION_DEFAULT_BUTTON = nsIAccessibleRelation.RELATION_DEFAULT_BUTTON;
var RELATION_DESCRIBED_BY = nsIAccessibleRelation.RELATION_DESCRIBED_BY;
var RELATION_DESCRIPTION_FOR = nsIAccessibleRelation.RELATION_DESCRIPTION_FOR;
var RELATION_EMBEDDED_BY = nsIAccessibleRelation.RELATION_EMBEDDED_BY;
var RELATION_EMBEDS = nsIAccessibleRelation.RELATION_EMBEDS;
var RELATION_FLOWS_FROM = nsIAccessibleRelation.RELATION_FLOWS_FROM;
var RELATION_FLOWS_TO = nsIAccessibleRelation.RELATION_FLOWS_TO;
var RELATION_LABEL_FOR = nsIAccessibleRelation.RELATION_LABEL_FOR;
var RELATION_LABELLED_BY = nsIAccessibleRelation.RELATION_LABELLED_BY;
var RELATION_MEMBER_OF = nsIAccessibleRelation.RELATION_MEMBER_OF;
var RELATION_NODE_CHILD_OF = nsIAccessibleRelation.RELATION_NODE_CHILD_OF;
var RELATION_NODE_PARENT_OF = nsIAccessibleRelation.RELATION_NODE_PARENT_OF;
var RELATION_PARENT_WINDOW_OF = nsIAccessibleRelation.RELATION_PARENT_WINDOW_OF;
var RELATION_POPUP_FOR = nsIAccessibleRelation.RELATION_POPUP_FOR;
var RELATION_SUBWINDOW_OF = nsIAccessibleRelation.RELATION_SUBWINDOW_OF;
var RELATION_CONTAINING_DOCUMENT = nsIAccessibleRelation.RELATION_CONTAINING_DOCUMENT;
var RELATION_CONTAINING_TAB_PANE = nsIAccessibleRelation.RELATION_CONTAINING_TAB_PANE;
var RELATION_CONTAINING_APPLICATION = nsIAccessibleRelation.RELATION_CONTAINING_APPLICATION;
////////////////////////////////////////////////////////////////////////////////
// General

Просмотреть файл

@ -6,4 +6,4 @@
const { utils: Cu } = Components;
const {require} = Cu.import(`${ROOT}/toolkit/require.js`, {});
const {Bootstrap} = require(`${ROOT}/sdk/addon/bootstrap.js`);
const {startup, shutdown, install, uninstall} = new Bootstrap();
var {startup, shutdown, install, uninstall} = new Bootstrap();

Просмотреть файл

@ -727,7 +727,7 @@ exports["test requestAnimationFrame"] = createProxyTest("", function (helper) {
exports["testGlobalScope"] = createProxyTest("", function (helper) {
helper.createWorker(
'let toplevelScope = true;' +
'var toplevelScope = true;' +
'assert(window.toplevelScope, "variables in toplevel scope are set to `window` object");' +
'assert(this.toplevelScope, "variables in toplevel scope are set to `this` object");' +
'done();'

Просмотреть файл

@ -3722,6 +3722,8 @@ const BrowserSearch = {
}
};
XPCOMUtils.defineConstant(this, "BrowserSearch", BrowserSearch);
function FillHistoryMenu(aParent) {
// Lazily add the hover listeners on first showing and never remove them
if (!aParent.hasStatusListener) {

Просмотреть файл

@ -1,4 +1,4 @@
const TEST_PINGS = [
var TEST_PINGS = [
{
type: "test-telemetryArchive-1",
payload: { foo: "bar" },

Просмотреть файл

@ -1594,9 +1594,11 @@ file, You can obtain one at http://mozilla.org/MPL/2.0/.
document.getElementById("addon-progress-notification-progresstext");
</field>
<field name="DownloadUtils" readonly="true">
let utils = {};
Components.utils.import("resource://gre/modules/DownloadUtils.jsm", utils);
utils.DownloadUtils;
{
let utils = {};
Components.utils.import("resource://gre/modules/DownloadUtils.jsm", utils);
utils.DownloadUtils;
}
</field>
<method name="destroy">
@ -2676,11 +2678,13 @@ file, You can obtain one at http://mozilla.org/MPL/2.0/.
]]></destructor>
<field name="_panel" readonly="true"><![CDATA[
let node = this.parentNode;
while(node && node.localName != "panel") {
node = node.parentNode;
{
let node = this.parentNode;
while(node && node.localName != "panel") {
node = node.parentNode;
}
node;
}
node;
]]></field>
<field name="_promomessage" readonly="true">
document.getAnonymousElementByAttribute(this, "anonid", "promo-message");

Просмотреть файл

@ -510,6 +510,8 @@ const PanelUI = {
},
};
XPCOMUtils.defineConstant(this, "PanelUI", PanelUI);
/**
* Gets the currently selected locale for display.
* @return the selected locale or "en-US" if none is selected

Просмотреть файл

@ -9,17 +9,18 @@ add_task(function*() {
defaultArea: CustomizableUI.AREA_NAVBAR
});
const kPrefCustomizationState = "browser.uiCustomization.state";
let bsPass = Cu.import("resource:///modules/CustomizableUI.jsm", {});
ok(bsPass.gSeenWidgets.has(BUTTONID), "Widget should be seen after createWidget is called.");
CustomizableUI.reset();
ok(bsPass.gSeenWidgets.has(BUTTONID), "Widget should still be seen after reset.");
ok(!Services.prefs.prefHasUserValue(bsPass.kPrefCustomizationState), "Pref shouldn't be set right now, because that'd break undo.");
ok(!Services.prefs.prefHasUserValue(kPrefCustomizationState), "Pref shouldn't be set right now, because that'd break undo.");
CustomizableUI.addWidgetToArea(BUTTONID, CustomizableUI.AREA_NAVBAR);
gCustomizeMode.removeFromArea(document.getElementById(BUTTONID));
let hasUserValue = Services.prefs.prefHasUserValue(bsPass.kPrefCustomizationState);
let hasUserValue = Services.prefs.prefHasUserValue(kPrefCustomizationState);
ok(hasUserValue, "Pref should be set right now.");
if (hasUserValue) {
let seenArray = JSON.parse(Services.prefs.getCharPref(bsPass.kPrefCustomizationState)).seen;
let seenArray = JSON.parse(Services.prefs.getCharPref(kPrefCustomizationState)).seen;
isnot(seenArray.indexOf(BUTTONID), -1, "Widget should be in saved 'seen' list.");
}
});

Просмотреть файл

@ -580,6 +580,8 @@ const DownloadsPanel = {
},
};
XPCOMUtils.defineConstant(this, "DownloadsPanel", DownloadsPanel);
////////////////////////////////////////////////////////////////////////////////
//// DownloadsOverlayLoader
@ -658,6 +660,8 @@ const DownloadsOverlayLoader = {
},
};
XPCOMUtils.defineConstant(this, "DownloadsOverlayLoader", DownloadsOverlayLoader);
////////////////////////////////////////////////////////////////////////////////
//// DownloadsView
@ -1004,6 +1008,8 @@ const DownloadsView = {
},
}
XPCOMUtils.defineConstant(this, "DownloadsView", DownloadsView);
////////////////////////////////////////////////////////////////////////////////
//// DownloadsViewItem
@ -1142,6 +1148,8 @@ const DownloadsViewController = {
}
};
XPCOMUtils.defineConstant(this, "DownloadsViewController", DownloadsViewController);
////////////////////////////////////////////////////////////////////////////////
//// DownloadsViewItemController
@ -1488,7 +1496,9 @@ const DownloadsSummary = {
delete this._detailsNode;
return this._detailsNode = node;
}
}
};
XPCOMUtils.defineConstant(this, "DownloadsSummary", DownloadsSummary);
////////////////////////////////////////////////////////////////////////////////
//// DownloadsFooter
@ -1542,3 +1552,5 @@ const DownloadsFooter = {
return this._footerNode = node;
}
};
XPCOMUtils.defineConstant(this, "DownloadsFooter", DownloadsFooter);

Просмотреть файл

@ -577,3 +577,8 @@ const DownloadsIndicatorView = {
},
};
Object.defineProperty(this, "DownloadsIndicatorView", {
value: DownloadsIndicatorView,
enumerable: true,
writable: false
});

Просмотреть файл

@ -17,6 +17,7 @@ XPCOMUtils.defineLazyModuleGetter(this, "OS", "resource://gre/modules/osfile.jsm
this.EXPORTED_SYMBOLS = ["LoopRoomsCache"];
const LOOP_ROOMS_CACHE_FILENAME = "loopRoomsCache.json";
XPCOMUtils.defineConstant(this, "LOOP_ROOMS_CACHE_FILENAME", LOOP_ROOMS_CACHE_FILENAME);
/**
* RoomsCache is a cache for saving simple rooms data to the disk in case we

Просмотреть файл

@ -112,6 +112,14 @@ this.EXPORTED_SYMBOLS = ["MozLoopService", "LOOP_SESSION_TYPE",
"TWO_WAY_MEDIA_CONN_LENGTH", "SHARING_STATE_CHANGE", "SHARING_ROOM_URL",
"ROOM_CREATE", "ROOM_DELETE", "ROOM_CONTEXT_ADD"];
XPCOMUtils.defineConstant(this, "LOOP_SESSION_TYPE", LOOP_SESSION_TYPE);
XPCOMUtils.defineConstant(this, "TWO_WAY_MEDIA_CONN_LENGTH", TWO_WAY_MEDIA_CONN_LENGTH);
XPCOMUtils.defineConstant(this, "SHARING_STATE_CHANGE", SHARING_STATE_CHANGE);
XPCOMUtils.defineConstant(this, "SHARING_ROOM_URL", SHARING_ROOM_URL);
XPCOMUtils.defineConstant(this, "ROOM_CREATE", ROOM_CREATE);
XPCOMUtils.defineConstant(this, "ROOM_DELETE", ROOM_DELETE);
XPCOMUtils.defineConstant(this, "ROOM_CONTEXT_ADD", ROOM_CONTEXT_ADD);
XPCOMUtils.defineLazyModuleGetter(this, "injectLoopAPI",
"resource:///modules/loop/MozLoopAPI.jsm");

Просмотреть файл

@ -1,10 +1,6 @@
/* Any copyright is dedicated to the Public Domain.
* http://creativecommons.org/publicdomain/zero/1.0/ */
var Imports = {};
Cu.import("resource:///modules/sessionstore/SessionSaver.jsm", Imports);
var {SessionSaver} = Imports;
add_task(function cleanup() {
info("Forgetting closed tabs");
while (ss.getClosedTabCount(window)) {

Просмотреть файл

@ -94,6 +94,7 @@ const TELEMETRY_LOG = {
RECHECK: "RECHECK",
},
};
XPCOMUtils.defineConstant(this, "TELEMETRY_LOG", TELEMETRY_LOG);
const gPrefs = new Preferences(PREF_BRANCH);
const gPrefsTelemetry = new Preferences(PREF_BRANCH_TELEMETRY);

Просмотреть файл

@ -11,7 +11,7 @@ Cu.import("resource://gre/modules/Services.jsm");
Cu.import("resource://gre/modules/XPCOMUtils.jsm");
var Registry = Cu.import("resource://gre/modules/WindowsRegistry.jsm").WindowsRegistry;
const Windows8WindowFrameColor = {
var Windows8WindowFrameColor = {
_windowFrameColor: null,
get: function() {

Просмотреть файл

@ -77,6 +77,7 @@ const EVENTS = {
SOURCE_SHOWN_IN_JS_DEBUGGER: "CanvasDebugger:SourceShownInJsDebugger",
SOURCE_NOT_FOUND_IN_JS_DEBUGGER: "CanvasDebugger:SourceNotFoundInJsDebugger"
};
XPCOMUtils.defineConstant(this, "EVENTS", EVENTS);
const HTML_NS = "http://www.w3.org/1999/xhtml";
const STRINGS_URI = "chrome://browser/locale/devtools/canvasdebugger.properties";

Просмотреть файл

@ -104,6 +104,7 @@ Cu.import("resource:///modules/devtools/client/shared/widgets/ViewHelpers.jsm");
Cu.import("resource:///modules/devtools/client/shared/browser-loader.js");
const require = BrowserLoader("resource:///modules/devtools/client/debugger/", this).require;
XPCOMUtils.defineConstant(this, "require", require);
const {TargetFactory} = require("devtools/client/framework/target");
const {Toolbox} = require("devtools/client/framework/toolbox");
@ -114,6 +115,8 @@ const DebuggerEditor = require("devtools/client/sourceeditor/debugger");
const {Tooltip} = require("devtools/client/shared/widgets/Tooltip");
const FastListWidget = require("devtools/client/shared/widgets/FastListWidget");
XPCOMUtils.defineConstant(this, "EVENTS", EVENTS);
XPCOMUtils.defineLazyModuleGetter(this, "Task",
"resource://gre/modules/Task.jsm");

Просмотреть файл

@ -49,6 +49,19 @@ const services = {
const EventListenersView = require('./content/views/event-listeners-view');
const actions = require('./content/actions/event-listeners');
Object.defineProperties(this, {
"store": {
value: store,
enumerable: true,
writable: false
},
"services": {
value: services,
enumerable: true,
writable: false
}
});
/**
* Object defining the debugger view components.
*/

Просмотреть файл

@ -40,11 +40,13 @@ function test() {
let updatedFrame = yield waitForDebuggerEvents(gPanel, gDebugger.EVENTS.FETCHED_SCOPES);
let variables = gDebugger.DebuggerView.Variables;
is(variables._store.length, 2, "Correct number of scopes available");
is(variables._store.length, 3, "Correct number of scopes available");
is(variables.getScopeAtIndex(0).name, "With scope [Object]",
"Paused with correct scope (0)");
is(variables.getScopeAtIndex(1).name, "Global scope [Window]",
is(variables.getScopeAtIndex(1).name, "Block scope",
"Paused with correct scope (1)");
is(variables.getScopeAtIndex(2).name, "Global scope [Window]",
"Paused with correct scope (2)");
let onceResumed = gTarget.once("thread-resumed");
EventUtils.sendMouseEvent({ type: "mousedown" }, gResumeButton, gDebugger);

Просмотреть файл

@ -49,13 +49,15 @@ function test() {
let updatedFrame = yield waitForDebuggerEvents(gPanel, gDebugger.EVENTS.FETCHED_SCOPES);
let variables = gDebugger.DebuggerView.Variables;
is(variables._store.length, 3, "Correct number of scopes available");
is(variables._store.length, 4, "Correct number of scopes available");
is(variables.getScopeAtIndex(0).name, "Function scope [interval<]",
"Paused with correct scope (0)");
is(variables.getScopeAtIndex(1).name, "Block scope",
"Paused with correct scope (1)");
is(variables.getScopeAtIndex(2).name, "Global scope [Window]",
is(variables.getScopeAtIndex(2).name, "Block scope",
"Paused with correct scope (2)");
is(variables.getScopeAtIndex(3).name, "Global scope [Window]",
"Paused with correct scope (3)");
yield evalInTab(gTab, "clearInterval(interval)");
let onceResumed = gTarget.once("thread-resumed");
@ -76,15 +78,21 @@ function test() {
let updatedFrame = yield waitForDebuggerEvents(gPanel, gDebugger.EVENTS.FETCHED_SCOPES);
let variables = gDebugger.DebuggerView.Variables;
is(variables._store.length, 4, "Correct number of scopes available");
is(variables._store.length, 6, "Correct number of scopes available");
is(variables.getScopeAtIndex(0).name, "Function scope [onclick]",
"Paused with correct scope (0)");
is(variables.getScopeAtIndex(1).name, "With scope [HTMLButtonElement]",
// Non-syntactic lexical scope introduced by non-syntactic scope chain.
is(variables.getScopeAtIndex(1).name, "Block scope",
"Paused with correct scope (1)");
is(variables.getScopeAtIndex(2).name, "With scope [HTMLDocument]",
is(variables.getScopeAtIndex(2).name, "With scope [HTMLButtonElement]",
"Paused with correct scope (2)");
is(variables.getScopeAtIndex(3).name, "Global scope [Window]",
is(variables.getScopeAtIndex(3).name, "With scope [HTMLDocument]",
"Paused with correct scope (3)");
// Global lexical scope.
is(variables.getScopeAtIndex(4).name, "Block scope",
"Paused with correct scope (4)");
is(variables.getScopeAtIndex(5).name, "Global scope [Window]",
"Paused with correct scope (5)");
let onceResumed = gTarget.once("thread-resumed");
EventUtils.sendMouseEvent({ type: "mousedown" }, gResumeButton, gDebugger);

Просмотреть файл

@ -53,8 +53,8 @@ function testPauseOnExceptionsDisabled() {
is(gFrames.itemCount, 1,
"Should have one frame.");
is(gVariables._store.length, 3,
"Should have three scopes.");
is(gVariables._store.length, 4,
"Should have four scopes.");
is(innerNodes[0].querySelector(".name").getAttribute("value"), "this",
"Should have the right property name for 'this'.");
@ -96,8 +96,8 @@ function testPauseOnExceptionsEnabled() {
is(gFrames.itemCount, 1,
"Should have one frame.");
is(gVariables._store.length, 3,
"Should have three scopes.");
is(gVariables._store.length, 4,
"Should have four scopes.");
is(innerNodes[0].querySelector(".name").getAttribute("value"), "<exception>",
"Should have the right property name for <exception>.");
@ -117,8 +117,8 @@ function testPauseOnExceptionsEnabled() {
is(gFrames.itemCount, 1,
"Should have one frame.");
is(gVariables._store.length, 3,
"Should have three scopes.");
is(gVariables._store.length, 4,
"Should have four scopes.");
is(innerNodes[0].querySelector(".name").getAttribute("value"), "this",
"Should have the right property name for 'this'.");

Просмотреть файл

@ -52,8 +52,8 @@ function testPauseOnExceptionsAfterReload() {
is(gFrames.itemCount, 1,
"Should have one frame.");
is(gVariables._store.length, 3,
"Should have three scopes.");
is(gVariables._store.length, 4,
"Should have four scopes.");
is(innerNodes[0].querySelector(".name").getAttribute("value"), "<exception>",
"Should have the right property name for <exception>.");
@ -73,8 +73,8 @@ function testPauseOnExceptionsAfterReload() {
is(gFrames.itemCount, 1,
"Should have one frame.");
is(gVariables._store.length, 3,
"Should have three scopes.");
is(gVariables._store.length, 4,
"Should have four scopes.");
is(innerNodes[0].querySelector(".name").getAttribute("value"), "this",
"Should have the right property name for 'this'.");

Просмотреть файл

@ -7,7 +7,7 @@
const TAB_URL = EXAMPLE_URL + "doc_promise.html";
const test = Task.async(function* () {
var test = Task.async(function* () {
const [tab,, panel] = yield initDebugger(TAB_URL);
yield ensureSourceIs(panel, "doc_promise.html", true);

Просмотреть файл

@ -44,7 +44,8 @@ function testVariablesAndPropertiesFiltering() {
let localScope = gVariables.getScopeAtIndex(0);
let withScope = gVariables.getScopeAtIndex(1);
let functionScope = gVariables.getScopeAtIndex(2);
let globalScope = gVariables.getScopeAtIndex(3);
let globalLexicalScope = gVariables.getScopeAtIndex(3);
let globalScope = gVariables.getScopeAtIndex(4);
let protoVar = localScope.get("__proto__");
let constrVar = protoVar.get("constructor");
let proto2Var = constrVar.get("__proto__");
@ -57,6 +58,8 @@ function testVariablesAndPropertiesFiltering() {
"The withScope should be expanded.");
is(functionScope.expanded, true,
"The functionScope should be expanded.");
is(globalLexicalScope.expanded, true,
"The globalLexicalScope should be expanded.");
is(globalScope.expanded, true,
"The globalScope should be expanded.");
@ -75,6 +78,8 @@ function testVariablesAndPropertiesFiltering() {
"There should be 0 variables displayed in the with scope.");
is(functionScope.target.querySelectorAll(".variables-view-variable:not([unmatched])").length, 0,
"There should be 0 variables displayed in the function scope.");
is(globalLexicalScope.target.querySelectorAll(".variables-view-variable:not([unmatched])").length, 0,
"There should be 0 variables displayed in the global lexical scope.");
is(globalScope.target.querySelectorAll(".variables-view-variable:not([unmatched])").length, 0,
"There should be 0 variables displayed in the global scope.");
@ -82,6 +87,8 @@ function testVariablesAndPropertiesFiltering() {
"There should be 0 properties displayed in the with scope.");
is(functionScope.target.querySelectorAll(".variables-view-property:not([unmatched])").length, 0,
"There should be 0 properties displayed in the function scope.");
is(globalLexicalScope.target.querySelectorAll(".variables-view-property:not([unmatched])").length, 0,
"There should be 0 properties displayed in the global lexical scope.");
is(globalScope.target.querySelectorAll(".variables-view-property:not([unmatched])").length, 0,
"There should be 0 properties displayed in the global scope.");
@ -106,6 +113,7 @@ function testVariablesAndPropertiesFiltering() {
localScope.collapse();
withScope.collapse();
functionScope.collapse();
globalLexicalScope.collapse();
globalScope.collapse();
protoVar.collapse();
constrVar.collapse();
@ -118,6 +126,8 @@ function testVariablesAndPropertiesFiltering() {
"The withScope should not be expanded.");
is(functionScope.expanded, false,
"The functionScope should not be expanded.");
is(globalLexicalScope.expanded, false,
"The globalLexicalScope should not be expanded.");
is(globalScope.expanded, false,
"The globalScope should not be expanded.");
@ -145,14 +155,17 @@ function prepareVariablesAndProperties() {
let localScope = gVariables.getScopeAtIndex(0);
let withScope = gVariables.getScopeAtIndex(1);
let functionScope = gVariables.getScopeAtIndex(2);
let globalScope = gVariables.getScopeAtIndex(3);
let globalLexicalScope = gVariables.getScopeAtIndex(3);
let globalScope = gVariables.getScopeAtIndex(4);
is(localScope.expanded, true,
"The localScope should be expanded.");
is(withScope.expanded, false,
"The withScope should not be expanded yet.");
is(functionScope.expanded, false,
"The functionScope should not be expanded yet.");
"The functionScope should not be expanded yet.");
is(globalLexicalScope.expanded, false,
"The globalLexicalScope should not be expanded yet.");
is(globalScope.expanded, false,
"The globalScope should not be expanded yet.");
@ -164,7 +177,9 @@ function prepareVariablesAndProperties() {
is(withScope.expanded, true,
"The withScope should now be expanded.");
is(functionScope.expanded, true,
"The functionScope should now be expanded.");
"The functionScope should now be expanded.");
is(globalLexicalScope.expanded, true,
"The globalLexicalScope should be expanded.");
is(globalScope.expanded, true,
"The globalScope should now be expanded.");
@ -206,6 +221,7 @@ function prepareVariablesAndProperties() {
withScope.expand();
functionScope.expand();
globalLexicalScope.expand();
globalScope.expand();
return deferred.promise;

Просмотреть файл

@ -44,7 +44,8 @@ function testVariablesAndPropertiesFiltering() {
let localScope = gVariables.getScopeAtIndex(0);
let withScope = gVariables.getScopeAtIndex(1);
let functionScope = gVariables.getScopeAtIndex(2);
let globalScope = gVariables.getScopeAtIndex(3);
let globalLexicalScope = gVariables.getScopeAtIndex(3);
let globalScope = gVariables.getScopeAtIndex(4);
let protoVar = localScope.get("__proto__");
let constrVar = protoVar.get("constructor");
let proto2Var = constrVar.get("__proto__");
@ -57,6 +58,8 @@ function testVariablesAndPropertiesFiltering() {
"The withScope should be expanded.");
is(functionScope.expanded, true,
"The functionScope should be expanded.");
is(globalLexicalScope.expanded, true,
"The globalScope should be expanded.");
is(globalScope.expanded, true,
"The globalScope should be expanded.");
@ -75,6 +78,8 @@ function testVariablesAndPropertiesFiltering() {
"There should be 0 variables displayed in the with scope.");
is(functionScope.target.querySelectorAll(".variables-view-variable:not([unmatched])").length, 0,
"There should be 0 variables displayed in the function scope.");
is(globalLexicalScope.target.querySelectorAll(".variables-view-variable:not([unmatched])").length, 0,
"There should be no variables displayed in the global lexical scope.");
is(globalScope.target.querySelectorAll(".variables-view-variable:not([unmatched])").length, 0,
"There should be no variables displayed in the global scope.");
@ -84,6 +89,8 @@ function testVariablesAndPropertiesFiltering() {
"There should be 0 properties displayed in the with scope.");
is(functionScope.target.querySelectorAll(".variables-view-property:not([unmatched])").length, 0,
"There should be 0 properties displayed in the function scope.");
is(globalLexicalScope.target.querySelectorAll(".variables-view-property:not([unmatched])").length, 0,
"There should be 0 properties displayed in the global lexical scope.");
is(globalScope.target.querySelectorAll(".variables-view-property:not([unmatched])").length, 0,
"There should be 0 properties displayed in the global scope.");
@ -113,6 +120,7 @@ function testVariablesAndPropertiesFiltering() {
localScope.collapse();
withScope.collapse();
functionScope.collapse();
globalLexicalScope.collapse();
globalScope.collapse();
protoVar.collapse();
constrVar.collapse();
@ -125,6 +133,8 @@ function testVariablesAndPropertiesFiltering() {
"The withScope should not be expanded.");
is(functionScope.expanded, false,
"The functionScope should not be expanded.");
is(globalLexicalScope.expanded, false,
"The globalScope should not be expanded.");
is(globalScope.expanded, false,
"The globalScope should not be expanded.");
@ -153,7 +163,8 @@ function prepareVariablesAndProperties() {
let localScope = gVariables.getScopeAtIndex(0);
let withScope = gVariables.getScopeAtIndex(1);
let functionScope = gVariables.getScopeAtIndex(2);
let globalScope = gVariables.getScopeAtIndex(3);
let globalLexicalScope = gVariables.getScopeAtIndex(3);
let globalScope = gVariables.getScopeAtIndex(4);
is(localScope.expanded, true,
"The localScope should be expanded.");
@ -161,6 +172,8 @@ function prepareVariablesAndProperties() {
"The withScope should not be expanded yet.");
is(functionScope.expanded, false,
"The functionScope should not be expanded yet.");
is(globalLexicalScope.expanded, false,
"The globalScope should not be expanded yet.");
is(globalScope.expanded, false,
"The globalScope should not be expanded yet.");
@ -173,6 +186,8 @@ function prepareVariablesAndProperties() {
"The withScope should now be expanded.");
is(functionScope.expanded, true,
"The functionScope should now be expanded.");
is(globalLexicalScope.expanded, true,
"The globalScope should now be expanded.");
is(globalScope.expanded, true,
"The globalScope should now be expanded.");
@ -214,6 +229,7 @@ function prepareVariablesAndProperties() {
withScope.expand();
functionScope.expand();
globalLexicalScope.expand();
globalScope.expand();
return deferred.promise;

Просмотреть файл

@ -43,7 +43,8 @@ function testVariablesAndPropertiesFiltering() {
let localScope = gVariables.getScopeAtIndex(0);
let withScope = gVariables.getScopeAtIndex(1);
let functionScope = gVariables.getScopeAtIndex(2);
let globalScope = gVariables.getScopeAtIndex(3);
let globalLexicalScope = gVariables.getScopeAtIndex(3);
let globalScope = gVariables.getScopeAtIndex(4);
function testFiltered() {
is(localScope.expanded, true,
@ -52,6 +53,8 @@ function testVariablesAndPropertiesFiltering() {
"The withScope should be expanded.");
is(functionScope.expanded, true,
"The functionScope should be expanded.");
is(globalLexicalScope.expanded, true,
"The globalScope should be expanded.");
is(globalScope.expanded, true,
"The globalScope should be expanded.");
@ -61,6 +64,8 @@ function testVariablesAndPropertiesFiltering() {
"There should be 0 variables displayed in the with scope.");
is(functionScope.target.querySelectorAll(".variables-view-variable:not([unmatched])").length, 0,
"There should be 0 variables displayed in the function scope.");
is(globalLexicalScope.target.querySelectorAll(".variables-view-variable:not([unmatched])").length, 0,
"There should be 0 variables displayed in the global scope.");
is(globalScope.target.querySelectorAll(".variables-view-variable:not([unmatched])").length, 0,
"There should be 0 variables displayed in the global scope.");
@ -70,6 +75,8 @@ function testVariablesAndPropertiesFiltering() {
"There should be 0 properties displayed in the with scope.");
is(functionScope.target.querySelectorAll(".variables-view-property:not([unmatched])").length, 0,
"There should be 0 properties displayed in the function scope.");
is(globalLexicalScope.target.querySelectorAll(".variables-view-property:not([unmatched])").length, 0,
"There should be 0 properties displayed in the global scope.");
is(globalScope.target.querySelectorAll(".variables-view-property:not([unmatched])").length, 0,
"There should be 0 properties displayed in the global scope.");
}
@ -86,6 +93,7 @@ function testVariablesAndPropertiesFiltering() {
localScope.collapse();
withScope.collapse();
functionScope.collapse();
globalLexicalScope.collapse();
globalScope.collapse();
is(localScope.expanded, false,
@ -94,6 +102,8 @@ function testVariablesAndPropertiesFiltering() {
"The withScope should not be expanded.");
is(functionScope.expanded, false,
"The functionScope should not be expanded.");
is(globalLexicalScope.expanded, false,
"The globalScope should not be expanded.");
is(globalScope.expanded, false,
"The globalScope should not be expanded.");
@ -115,7 +125,8 @@ function prepareVariablesAndProperties() {
let localScope = gVariables.getScopeAtIndex(0);
let withScope = gVariables.getScopeAtIndex(1);
let functionScope = gVariables.getScopeAtIndex(2);
let globalScope = gVariables.getScopeAtIndex(3);
let globalLexicalScope = gVariables.getScopeAtIndex(3);
let globalScope = gVariables.getScopeAtIndex(4);
is(localScope.expanded, true,
"The localScope should be expanded.");
@ -123,6 +134,8 @@ function prepareVariablesAndProperties() {
"The withScope should not be expanded yet.");
is(functionScope.expanded, false,
"The functionScope should not be expanded yet.");
is(globalLexicalScope.expanded, false,
"The globalScope should not be expanded yet.");
is(globalScope.expanded, false,
"The globalScope should not be expanded yet.");
@ -135,6 +148,8 @@ function prepareVariablesAndProperties() {
"The withScope should now be expanded.");
is(functionScope.expanded, true,
"The functionScope should now be expanded.");
is(globalLexicalScope.expanded, true,
"The globalScope should now be expanded.");
is(globalScope.expanded, true,
"The globalScope should now be expanded.");
@ -143,6 +158,7 @@ function prepareVariablesAndProperties() {
withScope.expand();
functionScope.expand();
globalLexicalScope.expand();
globalScope.expand();
return deferred.promise;

Просмотреть файл

@ -44,108 +44,110 @@ function testVariablesAndPropertiesFiltering() {
let localScope = gVariables.getScopeAtIndex(0);
let withScope = gVariables.getScopeAtIndex(1);
let functionScope = gVariables.getScopeAtIndex(2);
let globalScope = gVariables.getScopeAtIndex(3);
let globalLexicalScope = gVariables.getScopeAtIndex(3);
let globalScope = gVariables.getScopeAtIndex(4);
let step = 0;
let tests = [
function() {
assertExpansion([true, false, false, false]);
assertExpansion([true, false, false, false, false]);
EventUtils.sendKey("RETURN", gDebugger);
},
function() {
assertExpansion([true, false, false, false]);
assertExpansion([true, false, false, false, false]);
EventUtils.sendKey("RETURN", gDebugger);
},
function() {
assertExpansion([true, false, false, false]);
assertExpansion([true, false, false, false, false]);
gEditor.focus();
},
function() {
assertExpansion([true, false, false, false]);
assertExpansion([true, false, false, false, false]);
typeText(gSearchBox, "*");
},
function() {
assertExpansion([true, true, true, true]);
assertExpansion([true, true, true, true, true]);
EventUtils.sendKey("RETURN", gDebugger);
},
function() {
assertExpansion([true, true, true, true]);
assertExpansion([true, true, true, true, true]);
EventUtils.sendKey("RETURN", gDebugger);
},
function() {
assertExpansion([true, true, true, true]);
assertExpansion([true, true, true, true, true]);
gEditor.focus();
},
function() {
assertExpansion([true, true, true, true]);
assertExpansion([true, true, true, true, true]);
backspaceText(gSearchBox, 1);
},
function() {
assertExpansion([true, true, true, true]);
assertExpansion([true, true, true, true, true]);
EventUtils.sendKey("RETURN", gDebugger);
},
function() {
assertExpansion([true, true, true, true]);
assertExpansion([true, true, true, true, true]);
EventUtils.sendKey("RETURN", gDebugger);
},
function() {
assertExpansion([true, true, true, true]);
assertExpansion([true, true, true, true, true]);
gEditor.focus();
},
function() {
assertExpansion([true, true, true, true]);
assertExpansion([true, true, true, true, true]);
localScope.collapse();
withScope.collapse();
functionScope.collapse();
globalLexicalScope.collapse();
globalScope.collapse();
},
function() {
assertExpansion([false, false, false, false]);
assertExpansion([false, false, false, false, false]);
EventUtils.sendKey("RETURN", gDebugger);
},
function() {
assertExpansion([false, false, false, false]);
assertExpansion([false, false, false, false, false]);
EventUtils.sendKey("RETURN", gDebugger);
},
function() {
assertExpansion([false, false, false, false]);
assertExpansion([false, false, false, false, false]);
gEditor.focus();
},
function() {
assertExpansion([false, false, false, false]);
assertExpansion([false, false, false, false, false]);
clearText(gSearchBox);
typeText(gSearchBox, "*");
},
function() {
assertExpansion([true, true, true, true]);
assertExpansion([true, true, true, true, true]);
EventUtils.sendKey("RETURN", gDebugger);
},
function() {
assertExpansion([true, true, true, true]);
assertExpansion([true, true, true, true, true]);
EventUtils.sendKey("RETURN", gDebugger);
},
function() {
assertExpansion([true, true, true, true]);
assertExpansion([true, true, true, true, true]);
gEditor.focus();
},
function() {
assertExpansion([true, true, true, true]);
assertExpansion([true, true, true, true, true]);
backspaceText(gSearchBox, 1);
},
function() {
assertExpansion([true, true, true, true]);
assertExpansion([true, true, true, true, true]);
EventUtils.sendKey("RETURN", gDebugger);
},
function() {
assertExpansion([true, true, true, true]);
assertExpansion([true, true, true, true, true]);
EventUtils.sendKey("RETURN", gDebugger);
},
function() {
assertExpansion([true, true, true, true]);
assertExpansion([true, true, true, true, true]);
gEditor.focus();
},
function() {
assertExpansion([true, true, true, true]);
assertExpansion([true, true, true, true, true]);
}
];
@ -162,8 +164,12 @@ function testVariablesAndPropertiesFiltering() {
"The functionScope should " + (aFlags[2] ? "" : "not ") +
"be expanded at this point (" + step + ").");
is(globalScope.expanded, aFlags[3],
"The globalScope should " + (aFlags[3] ? "" : "not ") +
is(globalLexicalScope.expanded, aFlags[3],
"The globalLexicalScope should " + (aFlags[3] ? "" : "not ") +
"be expanded at this point (" + step + ").");
is(globalScope.expanded, aFlags[4],
"The globalScope should " + (aFlags[4] ? "" : "not ") +
"be expanded at this point (" + step + ").");
step++;
@ -178,7 +184,8 @@ function prepareVariablesAndProperties() {
let localScope = gVariables.getScopeAtIndex(0);
let withScope = gVariables.getScopeAtIndex(1);
let functionScope = gVariables.getScopeAtIndex(2);
let globalScope = gVariables.getScopeAtIndex(3);
let globalLexicalScope = gVariables.getScopeAtIndex(3);
let globalScope = gVariables.getScopeAtIndex(4);
is(localScope.expanded, true,
"The localScope should be expanded.");
@ -186,6 +193,8 @@ function prepareVariablesAndProperties() {
"The withScope should not be expanded yet.");
is(functionScope.expanded, false,
"The functionScope should not be expanded yet.");
is(globalLexicalScope.expanded, false,
"The globalLexicalScope should not be expanded yet.");
is(globalScope.expanded, false,
"The globalScope should not be expanded yet.");
@ -198,11 +207,14 @@ function prepareVariablesAndProperties() {
"The withScope should now be expanded.");
is(functionScope.expanded, true,
"The functionScope should now be expanded.");
is(globalLexicalScope.expanded, true,
"The globalLexicalScope should now be expanded.");
is(globalScope.expanded, true,
"The globalScope should now be expanded.");
withScope.collapse();
functionScope.collapse();
globalLexicalScope.collapse();
globalScope.collapse();
deferred.resolve();
@ -210,6 +222,7 @@ function prepareVariablesAndProperties() {
withScope.expand();
functionScope.expand();
globalLexicalScope.expand();
globalScope.expand();
return deferred.promise;

Просмотреть файл

@ -43,17 +43,18 @@ function testVariablesAndPropertiesFiltering() {
let localScope = gVariables.getScopeAtIndex(0);
let withScope = gVariables.getScopeAtIndex(1);
let functionScope = gVariables.getScopeAtIndex(2);
let globalScope = gVariables.getScopeAtIndex(3);
let globalLexicalScope = gVariables.getScopeAtIndex(3);
let globalScope = gVariables.getScopeAtIndex(4);
let step = 0;
let tests = [
function() {
assertScopeExpansion([true, false, false, false]);
assertScopeExpansion([true, false, false, false, false]);
typeText(gSearchBox, "*arguments");
},
function() {
assertScopeExpansion([true, true, true, true]);
assertVariablesCountAtLeast([0, 0, 1, 0]);
assertScopeExpansion([true, true, true, true, true]);
assertVariablesCountAtLeast([0, 0, 1, 0, 0]);
is(functionScope.target.querySelectorAll(".variables-view-variable:not([unmatched]) > .title > .name")[0].getAttribute("value"),
"arguments", "The arguments pseudoarray should be visible.");
@ -63,8 +64,8 @@ function testVariablesAndPropertiesFiltering() {
backspaceText(gSearchBox, 6);
},
function() {
assertScopeExpansion([true, true, true, true]);
assertVariablesCountAtLeast([0, 0, 1, 1]);
assertScopeExpansion([true, true, true, true, true]);
assertVariablesCountAtLeast([0, 0, 1, 0, 1]);
is(functionScope.target.querySelectorAll(".variables-view-variable:not([unmatched]) > .title > .name")[0].getAttribute("value"),
"arguments", "The arguments pseudoarray should be visible.");
@ -79,8 +80,8 @@ function testVariablesAndPropertiesFiltering() {
backspaceText(gSearchBox, 2);
},
function() {
assertScopeExpansion([true, true, true, true]);
assertVariablesCountAtLeast([0, 1, 3, 1]);
assertScopeExpansion([true, true, true, true, true]);
assertVariablesCountAtLeast([0, 1, 3, 0, 1]);
is(functionScope.target.querySelectorAll(".variables-view-variable:not([unmatched]) > .title > .name")[0].getAttribute("value"),
"aNumber", "The aNumber param should be visible.");
@ -100,8 +101,8 @@ function testVariablesAndPropertiesFiltering() {
backspaceText(gSearchBox, 1);
},
function() {
assertScopeExpansion([true, true, true, true]);
assertVariablesCountAtLeast([4, 1, 3, 1]);
assertScopeExpansion([true, true, true, true, true]);
assertVariablesCountAtLeast([4, 1, 3, 0, 1]);
is(localScope.target.querySelectorAll(".variables-view-variable:not([unmatched]) > .title > .name")[0].getAttribute("value"),
"this", "The this reference should be visible.");
@ -153,8 +154,12 @@ function testVariablesAndPropertiesFiltering() {
"The functionScope should " + (aFlags[2] ? "" : "not ") +
"be expanded at this point (" + step + ").");
is(globalScope.expanded, aFlags[3],
"The globalScope should " + (aFlags[3] ? "" : "not ") +
is(globalLexicalScope.expanded, aFlags[3],
"The globalLexicalScope should " + (aFlags[3] ? "" : "not ") +
"be expanded at this point (" + step + ").");
is(globalScope.expanded, aFlags[4],
"The globalScope should " + (aFlags[4] ? "" : "not ") +
"be expanded at this point (" + step + ").");
}
@ -171,8 +176,12 @@ function testVariablesAndPropertiesFiltering() {
"There should be " + aCounts[2] +
" variable displayed in the function scope (" + step + ").");
ok(globalScope.target.querySelectorAll(".variables-view-variable:not([unmatched])").length >= aCounts[3],
ok(globalLexicalScope.target.querySelectorAll(".variables-view-variable:not([unmatched])").length >= aCounts[3],
"There should be " + aCounts[3] +
" variable displayed in the global scope (" + step + ").");
ok(globalScope.target.querySelectorAll(".variables-view-variable:not([unmatched])").length >= aCounts[4],
"There should be " + aCounts[4] +
" variable displayed in the global scope (" + step + ").");
step++;
@ -187,7 +196,8 @@ function prepareVariablesAndProperties() {
let localScope = gVariables.getScopeAtIndex(0);
let withScope = gVariables.getScopeAtIndex(1);
let functionScope = gVariables.getScopeAtIndex(2);
let globalScope = gVariables.getScopeAtIndex(3);
let globalLexicalScope = gVariables.getScopeAtIndex(3);
let globalScope = gVariables.getScopeAtIndex(4);
is(localScope.expanded, true,
"The localScope should be expanded.");
@ -195,6 +205,8 @@ function prepareVariablesAndProperties() {
"The withScope should not be expanded yet.");
is(functionScope.expanded, false,
"The functionScope should not be expanded yet.");
is(globalLexicalScope.expanded, false,
"The globalScope should not be expanded yet.");
is(globalScope.expanded, false,
"The globalScope should not be expanded yet.");
@ -207,11 +219,14 @@ function prepareVariablesAndProperties() {
"The withScope should now be expanded.");
is(functionScope.expanded, true,
"The functionScope should now be expanded.");
is(globalLexicalScope.expanded, true,
"The globalScope should now be expanded.");
is(globalScope.expanded, true,
"The globalScope should now be expanded.");
withScope.collapse();
functionScope.collapse();
globalLexicalScope.collapse();
globalScope.collapse();
deferred.resolve();
@ -219,6 +234,7 @@ function prepareVariablesAndProperties() {
withScope.expand();
functionScope.expand();
globalLexicalScope.expand();
globalScope.expand();
return deferred.promise;

Просмотреть файл

@ -35,27 +35,35 @@ function test() {
function initialChecks() {
let scopeNodes = gDebugger.document.querySelectorAll(".variables-view-scope");
is(scopeNodes.length, 2,
"There should be 2 scopes available.");
is(scopeNodes.length, 3,
"There should be 3 scopes available.");
ok(scopeNodes[0].querySelector(".name").getAttribute("value").includes("[test]"),
"The local scope should be properly identified.");
ok(scopeNodes[1].querySelector(".name").getAttribute("value").includes("[Window]"),
ok(scopeNodes[1].querySelector(".name").getAttribute("value").includes("Block"),
"The global lexical scope should be properly identified.");
ok(scopeNodes[2].querySelector(".name").getAttribute("value").includes("[Window]"),
"The global scope should be properly identified.");
is(gVariables.getScopeAtIndex(0).target, scopeNodes[0],
"getScopeAtIndex(0) didn't return the expected scope.");
is(gVariables.getScopeAtIndex(1).target, scopeNodes[1],
"getScopeAtIndex(1) didn't return the expected scope.");
is(gVariables.getScopeAtIndex(2).target, scopeNodes[2],
"getScopeAtIndex(2) didn't return the expected scope.");
is(gVariables.getItemForNode(scopeNodes[0]).target, scopeNodes[0],
"getItemForNode([0]) didn't return the expected scope.");
is(gVariables.getItemForNode(scopeNodes[1]).target, scopeNodes[1],
"getItemForNode([1]) didn't return the expected scope.");
is(gVariables.getItemForNode(scopeNodes[2]).target, scopeNodes[2],
"getItemForNode([2]) didn't return the expected scope.");
is(gVariables.getItemForNode(scopeNodes[0]).expanded, true,
"The local scope should be expanded by default.");
is(gVariables.getItemForNode(scopeNodes[1]).expanded, false,
"The global lexical scope should not be collapsed by default.");
is(gVariables.getItemForNode(scopeNodes[2]).expanded, false,
"The global scope should not be collapsed by default.");
}

Просмотреть файл

@ -38,7 +38,7 @@ function test() {
function expandGlobalScope() {
let deferred = promise.defer();
let globalScope = gVariables.getScopeAtIndex(1);
let globalScope = gVariables.getScopeAtIndex(2);
is(globalScope.expanded, false,
"The global scope should not be expanded by default.");
@ -52,7 +52,7 @@ function expandGlobalScope() {
}
function testGlobalScope() {
let globalScope = gVariables.getScopeAtIndex(1);
let globalScope = gVariables.getScopeAtIndex(2);
is(globalScope.expanded, true,
"The global scope should now be expanded.");
@ -92,7 +92,7 @@ function testGlobalScope() {
function expandWindowVariable() {
let deferred = promise.defer();
let windowVar = gVariables.getScopeAtIndex(1).get("window");
let windowVar = gVariables.getScopeAtIndex(2).get("window");
is(windowVar.expanded, false,
"The window variable should not be expanded by default.");
@ -106,7 +106,7 @@ function expandWindowVariable() {
}
function testWindowVariable() {
let windowVar = gVariables.getScopeAtIndex(1).get("window");
let windowVar = gVariables.getScopeAtIndex(2).get("window");
is(windowVar.expanded, true,
"The window variable should now be expanded.");

Просмотреть файл

@ -21,11 +21,13 @@ function test() {
let firstScope = variables.getScopeAtIndex(0);
let secondScope = variables.getScopeAtIndex(1);
let thirdScope = variables.getScopeAtIndex(2);
let globalScope = variables.getScopeAtIndex(3);
let globalLexicalScope = variables.getScopeAtIndex(3);
let globalScope = variables.getScopeAtIndex(4);
ok(firstScope, "The first scope is available.");
ok(secondScope, "The second scope is available.");
ok(thirdScope, "The third scope is available.");
ok(globalLexicalScope, "The global lexical scope is available.");
ok(globalScope, "The global scope is available.");
is(firstScope.name, "Function scope [secondNest]",
@ -34,6 +36,8 @@ function test() {
"The second scope's name is correct.");
is(thirdScope.name, "Function scope [test]",
"The third scope's name is correct.");
is(globalLexicalScope.name, "Block scope",
"The global lexical scope's name is correct.");
is(globalScope.name, "Global scope [Window]",
"The global scope's name is correct.");
@ -43,6 +47,8 @@ function test() {
"The second scope's expansion state is correct.");
is(thirdScope.expanded, false,
"The third scope's expansion state is correct.");
is(globalLexicalScope.expanded, false,
"The global lexical scope's expansion state is correct.");
is(globalScope.expanded, false,
"The global scope's expansion state is correct.");
@ -52,6 +58,8 @@ function test() {
"The second scope should have no variables available yet.");
is(thirdScope._store.size, 0,
"The third scope should have no variables available yet.");
is(globalLexicalScope._store.size, 0,
"The global scope should have no variables available yet.");
is(globalScope._store.size, 0,
"The global scope should have no variables available yet.");
@ -100,6 +108,7 @@ function test() {
fetched = waitForDebuggerEvents(panel, events.FETCHED_VARIABLES);
secondScope.expand();
thirdScope.expand();
globalLexicalScope.expand();
globalScope.expand();
yield fetched;

Просмотреть файл

@ -42,7 +42,7 @@ function test() {
}
function expandGlobalScope() {
let globalScope = variables.getScopeAtIndex(1);
let globalScope = variables.getScopeAtIndex(2);
is(globalScope.expanded, false,
"The globalScope should not be expanded yet.");

Просмотреть файл

@ -74,7 +74,8 @@ function testVariablesExpand() {
let localScope = gVariables.getScopeAtIndex(0);
let withScope = gVariables.getScopeAtIndex(1);
let functionScope = gVariables.getScopeAtIndex(2);
let globalScope = gVariables.getScopeAtIndex(3);
let globalLexicalScope = gVariables.getScopeAtIndex(3);
let globalScope = gVariables.getScopeAtIndex(4);
let thisVar = localScope.get("this");
let windowVar = thisVar.get("window");
@ -85,6 +86,8 @@ function testVariablesExpand() {
"The withScope arrow should still be expanded.");
is(functionScope.target.querySelector(".arrow").hasAttribute("open"), true,
"The functionScope arrow should still be expanded.");
is(globalLexicalScope.target.querySelector(".arrow").hasAttribute("open"), true,
"The globalLexicalScope arrow should still be expanded.");
is(globalScope.target.querySelector(".arrow").hasAttribute("open"), true,
"The globalScope arrow should still be expanded.");
is(thisVar.target.querySelector(".arrow").hasAttribute("open"), true,
@ -98,6 +101,8 @@ function testVariablesExpand() {
"The withScope enumerables should still be expanded.");
is(functionScope.target.querySelector(".variables-view-element-details").hasAttribute("open"), true,
"The functionScope enumerables should still be expanded.");
is(globalLexicalScope.target.querySelector(".variables-view-element-details").hasAttribute("open"), true,
"The globalLexicalScope enumerables should still be expanded.");
is(globalScope.target.querySelector(".variables-view-element-details").hasAttribute("open"), true,
"The globalScope enumerables should still be expanded.");
is(thisVar.target.querySelector(".variables-view-element-details").hasAttribute("open"), true,
@ -111,6 +116,8 @@ function testVariablesExpand() {
"The withScope expanded getter should return true.");
is(functionScope.expanded, true,
"The functionScope expanded getter should return true.");
is(globalLexicalScope.expanded, true,
"The globalScope expanded getter should return true.");
is(globalScope.expanded, true,
"The globalScope expanded getter should return true.");
is(thisVar.expanded, true,
@ -125,7 +132,8 @@ function prepareVariablesAndProperties() {
let localScope = gVariables.getScopeAtIndex(0);
let withScope = gVariables.getScopeAtIndex(1);
let functionScope = gVariables.getScopeAtIndex(2);
let globalScope = gVariables.getScopeAtIndex(3);
let globalLexicalScope = gVariables.getScopeAtIndex(3);
let globalScope = gVariables.getScopeAtIndex(4);
is(localScope.expanded, true,
"The localScope should be expanded.");
@ -133,6 +141,8 @@ function prepareVariablesAndProperties() {
"The withScope should not be expanded yet.");
is(functionScope.expanded, false,
"The functionScope should not be expanded yet.");
is(globalLexicalScope.expanded, false,
"The globalLexicalScope should not be expanded yet.");
is(globalScope.expanded, false,
"The globalScope should not be expanded yet.");
@ -145,6 +155,8 @@ function prepareVariablesAndProperties() {
"The withScope should now be expanded.");
is(functionScope.expanded, true,
"The functionScope should now be expanded.");
is(globalLexicalScope.expanded, true,
"The globalLexicalScope should now be expanded.");
is(globalScope.expanded, true,
"The globalScope should now be expanded.");
@ -186,6 +198,7 @@ function prepareVariablesAndProperties() {
withScope.expand();
functionScope.expand();
globalLexicalScope.expand();
globalScope.expand();
return deferred.promise;

Просмотреть файл

@ -75,7 +75,8 @@ function testVariablesExpand() {
let localScope = gVariables.getScopeAtIndex(0);
let withScope = gVariables.getScopeAtIndex(1);
let functionScope = gVariables.getScopeAtIndex(2);
let globalScope = gVariables.getScopeAtIndex(3);
let globalLexicalScope = gVariables.getScopeAtIndex(3);
let globalScope = gVariables.getScopeAtIndex(4);
let thisVar = localScope.get("this");
let windowVar = thisVar.get("window");
@ -88,6 +89,8 @@ function testVariablesExpand() {
"The withScope arrow should still be expanded.");
is(functionScope.target.querySelector(".arrow").hasAttribute("open"), true,
"The functionScope arrow should still be expanded.");
is(globalLexicalScope.target.querySelector(".arrow").hasAttribute("open"), true,
"The globalLexicalScope arrow should still be expanded.");
is(globalScope.target.querySelector(".arrow").hasAttribute("open"), true,
"The globalScope arrow should still be expanded.");
is(thisVar.target.querySelector(".arrow").hasAttribute("open"), true,
@ -105,6 +108,8 @@ function testVariablesExpand() {
"The withScope enumerables should still be expanded.");
is(functionScope.target.querySelector(".variables-view-element-details").hasAttribute("open"), true,
"The functionScope enumerables should still be expanded.");
is(globalLexicalScope.target.querySelector(".variables-view-element-details").hasAttribute("open"), true,
"The globalLexicalScope enumerables should still be expanded.");
is(globalScope.target.querySelector(".variables-view-element-details").hasAttribute("open"), true,
"The globalScope enumerables should still be expanded.");
is(thisVar.target.querySelector(".variables-view-element-details").hasAttribute("open"), true,
@ -122,6 +127,8 @@ function testVariablesExpand() {
"The withScope expanded getter should return true.");
is(functionScope.expanded, true,
"The functionScope expanded getter should return true.");
is(globalLexicalScope.expanded, true,
"The globalLexicalScope expanded getter should return true.");
is(globalScope.expanded, true,
"The globalScope expanded getter should return true.");
is(thisVar.expanded, true,
@ -140,7 +147,8 @@ function prepareVariablesAndProperties() {
let localScope = gVariables.getScopeAtIndex(0);
let withScope = gVariables.getScopeAtIndex(1);
let functionScope = gVariables.getScopeAtIndex(2);
let globalScope = gVariables.getScopeAtIndex(3);
let globalLexicalScope = gVariables.getScopeAtIndex(3);
let globalScope = gVariables.getScopeAtIndex(4);
is(localScope.expanded, true,
"The localScope should be expanded.");
@ -148,6 +156,8 @@ function prepareVariablesAndProperties() {
"The withScope should not be expanded yet.");
is(functionScope.expanded, false,
"The functionScope should not be expanded yet.");
is(globalLexicalScope.expanded, false,
"The globalLexicalScope should not be expanded yet.");
is(globalScope.expanded, false,
"The globalScope should not be expanded yet.");
@ -160,6 +170,8 @@ function prepareVariablesAndProperties() {
"The withScope should now be expanded.");
is(functionScope.expanded, true,
"The functionScope should now be expanded.");
is(globalLexicalScope.expanded, true,
"The globalLexicalScope should now be expanded.");
is(globalScope.expanded, true,
"The globalScope should now be expanded.");
@ -201,6 +213,7 @@ function prepareVariablesAndProperties() {
withScope.expand();
functionScope.expand();
globalLexicalScope.expand();
globalScope.expand();
return deferred.promise;

Просмотреть файл

@ -36,7 +36,7 @@ function test() {
function expandGlobalScope() {
let deferred = promise.defer();
let globalScope = gVariables.getScopeAtIndex(1);
let globalScope = gVariables.getScopeAtIndex(2);
is(globalScope.expanded, false,
"The global scope should not be expanded by default.");
@ -51,7 +51,7 @@ function expandGlobalScope() {
function performTest() {
let deferred = promise.defer();
let globalScope = gVariables.getScopeAtIndex(1);
let globalScope = gVariables.getScopeAtIndex(2);
let buttonVar = globalScope.get("button");
let buttonAsProtoVar = globalScope.get("buttonAsProto");

Просмотреть файл

@ -17,10 +17,10 @@
<script type="text/javascript;version=1.8">
function inline() {}
let arrow = () => {}
var arrow = () => {}
let foo = bar => {}
let foo2 = bar2 = baz2 => 42;
var foo = bar => {}
var foo2 = bar2 = baz2 => 42;
setTimeout((foo, bar, baz) => {});
setTimeout((foo, bar, baz) => 42);

Просмотреть файл

@ -3,7 +3,7 @@
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
"use strict";
const XULUtils = {
var XULUtils = {
/**
* Create <command> elements within `commandset` with event handlers
* bound to the `command` event
@ -35,7 +35,7 @@ const CHARACTER_LIMIT = 250; // line character limit
/**
* Utility functions for handling sources.
*/
const SourceUtils = {
var SourceUtils = {
_labelsCache: new Map(), // Can't use WeakMaps because keys are strings.
_groupsCache: new Map(),
_minifiedCache: new WeakMap(),

Просмотреть файл

@ -988,13 +988,13 @@ InspectorPanel.prototype = {
let panel = this._toolbox.getPanel("webconsole");
let jsterm = panel.hud.jsterm;
let evalString = `let i = 0;
let evalString = `{ let i = 0;
while (window.hasOwnProperty("temp" + i) && i < 1000) {
i++;
}
window["temp" + i] = $0;
"temp" + i;
`;
}`;
let options = {
selectedNodeActor: this.selection.nodeFront.actorID,

Просмотреть файл

@ -14,7 +14,7 @@ const {ActorClass, Actor, FrontClass, Front, method} =
const {Cu} = require("chrome");
const {NodeActor} = require("devtools/server/actors/inspector");
const EventsFormActor = ActorClass({
var EventsFormActor = ActorClass({
typeName: "eventsFormActor",
initialize: function() {
@ -44,7 +44,7 @@ const EventsFormActor = ActorClass({
}
});
const EventsFormFront = FrontClass(EventsFormActor, {
var EventsFormFront = FrontClass(EventsFormActor, {
initialize: function(client, form) {
Front.prototype.initialize.apply(this, arguments);

Просмотреть файл

@ -125,6 +125,10 @@ const {Tooltip} = require("devtools/client/shared/widgets/Tooltip");
const {ToolSidebar} = require("devtools/client/framework/sidebar");
const DevToolsUtils = require("devtools/shared/DevToolsUtils");
XPCOMUtils.defineConstant(this, "EVENTS", EVENTS);
XPCOMUtils.defineConstant(this, "ACTIVITY_TYPE", ACTIVITY_TYPE);
XPCOMUtils.defineConstant(this, "Editor", Editor);
XPCOMUtils.defineLazyModuleGetter(this, "Chart",
"resource:///modules/devtools/client/shared/widgets/Chart.jsm");

Просмотреть файл

@ -11,6 +11,11 @@ const { Heritage, ViewHelpers, WidgetMethods } = require("resource:///modules/de
// Events emitted by various objects in the panel.
const EVENTS = require("devtools/client/performance/events");
Object.defineProperty(this, "EVENTS", {
value: EVENTS,
enumerable: true,
writable: false
});
loader.lazyRequireGetter(this, "Services");
loader.lazyRequireGetter(this, "promise");

Просмотреть файл

@ -47,6 +47,9 @@ const FLATTEN_PREF = "devtools.performance.ui.flatten-tree-recursion";
const JIT_PREF = "devtools.performance.ui.enable-jit-optimizations";
const EXPERIMENTAL_PREF = "devtools.performance.ui.experimental";
// Keep in sync with FRAMERATE_GRAPH_HIGH_RES_INTERVAL in views/overview.js
const FRAMERATE_GRAPH_HIGH_RES_INTERVAL = 16; // ms
// All tests are asynchronous.
waitForExplicitFinish();
@ -423,7 +426,7 @@ function* stopRecording(panel, options = {
// incremental rendering and less likely to be from another rendering that was selected
while (!overviewRendered && options.waitForOverview) {
let [_, res] = yield onceSpread(win.OverviewView, win.EVENTS.OVERVIEW_RENDERED);
if (res === win.FRAMERATE_GRAPH_HIGH_RES_INTERVAL) {
if (res === FRAMERATE_GRAPH_HIGH_RES_INTERVAL) {
overviewRendered = true;
}
}

Просмотреть файл

@ -19,7 +19,7 @@ const GRAPH_REQUIREMENTS = {
memory: {
features: ["withMemory"]
},
}
};
/**
* View handler for the overview panel's time view, displaying

Просмотреть файл

@ -3,7 +3,7 @@
"use strict";
var {require} = Cu.import("resource:///modules/devtools/client/framework/gDevTools.jsm", {});
var {require} = Cu.import("resource://gre/modules/devtools/shared/Loader.jsm", {});
var {TargetFactory} = require("devtools/client/framework/target");
var DevToolsUtils = require("devtools/shared/DevToolsUtils");
var promise = require("promise");

Просмотреть файл

@ -63,6 +63,13 @@ Cu.import("resource://gre/modules/osfile.jsm");
Cu.import("resource:///modules/devtools/client/shared/widgets/ViewHelpers.jsm");
Cu.import("resource://gre/modules/reflect.jsm");
XPCOMUtils.defineConstant(this, "SCRATCHPAD_CONTEXT_CONTENT", SCRATCHPAD_CONTEXT_CONTENT);
XPCOMUtils.defineConstant(this, "SCRATCHPAD_CONTEXT_BROWSER", SCRATCHPAD_CONTEXT_BROWSER);
XPCOMUtils.defineConstant(this, "BUTTON_POSITION_SAVE", BUTTON_POSITION_SAVE);
XPCOMUtils.defineConstant(this, "BUTTON_POSITION_CANCEL", BUTTON_POSITION_CANCEL);
XPCOMUtils.defineConstant(this, "BUTTON_POSITION_DONT_SAVE", BUTTON_POSITION_DONT_SAVE);
XPCOMUtils.defineConstant(this, "BUTTON_POSITION_REVERT", BUTTON_POSITION_REVERT);
XPCOMUtils.defineLazyModuleGetter(this, "VariablesView",
"resource:///modules/devtools/client/shared/widgets/VariablesView.jsm");

Просмотреть файл

@ -2,10 +2,6 @@
/* Any copyright is dedicated to the Public Domain.
http://creativecommons.org/publicdomain/zero/1.0/ */
var tempScope = {};
Cu.import("resource://gre/modules/NetUtil.jsm", tempScope);
var NetUtil = tempScope.NetUtil;
// Reference to the Scratchpad object.
var gScratchpad;

Просмотреть файл

@ -3,13 +3,6 @@
http://creativecommons.org/publicdomain/zero/1.0/ */
/* Bug 644413 */
var tempScope = {};
Cu.import("resource://gre/modules/NetUtil.jsm", tempScope);
Cu.import("resource://gre/modules/FileUtils.jsm", tempScope);
var NetUtil = tempScope.NetUtil;
var FileUtils = tempScope.FileUtils;
var gScratchpad; // Reference to the Scratchpad object.
var gFile; // Reference to the temporary nsIFile we will work with.
var DEVTOOLS_CHROME_ENABLED = "devtools.chrome.enabled";

Просмотреть файл

@ -3,12 +3,6 @@
http://creativecommons.org/publicdomain/zero/1.0/ */
/* Bug 651942 */
var tempScope = {};
Cu.import("resource://gre/modules/NetUtil.jsm", tempScope);
Cu.import("resource://gre/modules/FileUtils.jsm", tempScope);
var NetUtil = tempScope.NetUtil;
var FileUtils = tempScope.FileUtils;
// Reference to the Scratchpad object.
var gScratchpad;

Просмотреть файл

@ -3,12 +3,6 @@
http://creativecommons.org/publicdomain/zero/1.0/ */
/* Bug 684546 */
var tempScope = {};
Cu.import("resource://gre/modules/NetUtil.jsm", tempScope);
Cu.import("resource://gre/modules/FileUtils.jsm", tempScope);
var NetUtil = tempScope.NetUtil;
var FileUtils = tempScope.FileUtils;
// Reference to the Scratchpad chrome window object.
var gScratchpadWindow;

Просмотреть файл

@ -3,12 +3,6 @@
http://creativecommons.org/publicdomain/zero/1.0/ */
/* Bug 751744 */
var tempScope = {};
Cu.import("resource://gre/modules/NetUtil.jsm", tempScope);
Cu.import("resource://gre/modules/FileUtils.jsm", tempScope);
var NetUtil = tempScope.NetUtil;
var FileUtils = tempScope.FileUtils;
// Reference to the Scratchpad object.
var gScratchpad;

Просмотреть файл

@ -38,6 +38,7 @@ const EVENTS = {
// When the editor's error markers are all removed
EDITOR_ERROR_MARKERS_REMOVED: "ShaderEditor:EditorCleaned"
};
XPCOMUtils.defineConstant(this, "EVENTS", EVENTS);
const STRINGS_URI = "chrome://browser/locale/devtools/shadereditor.properties"
const HIGHLIGHT_TINT = [1, 0, 0.25, 1]; // rgba

Просмотреть файл

@ -38,7 +38,7 @@ function getHighlighterCanvasFrameHelper(conn, actorID) {
}
}
const TestActor = exports.TestActor = protocol.ActorClass({
var TestActor = exports.TestActor = protocol.ActorClass({
typeName: "testActor",
initialize: function(conn, tabActor, options) {
@ -525,7 +525,7 @@ const TestActor = exports.TestActor = protocol.ActorClass({
}),
});
const TestActorFront = exports.TestActorFront = protocol.FrontClass(TestActor, {
var TestActorFront = exports.TestActorFront = protocol.FrontClass(TestActor, {
initialize: function(client, { testActor }, toolbox) {
protocol.Front.prototype.initialize.call(this, client, { actor: testActor });
this.manage(this);

Просмотреть файл

@ -20,6 +20,11 @@ const EVENTS = {
HEADER_CONTEXT_MENU: "header-context-menu",
ROW_CONTEXT_MENU: "row-context-menu"
};
Object.defineProperty(this, "EVENTS", {
value: EVENTS,
enumerable: true,
writable: false
});
// Maximum number of character visible in any cell in the table. This is to avoid
// making the cell take up all the space in a row.

Просмотреть файл

@ -74,6 +74,7 @@ const EVENTS = {
// Called when the inspector splitter is moved and resized.
UI_INSPECTOR_RESIZE: "WebAudioEditor:UIInspectorResize"
};
XPCOMUtils.defineConstant(this, "EVENTS", EVENTS);
/**
* The current target and the Web Audio Editor front, set by this tool's host.

Просмотреть файл

@ -21,6 +21,11 @@ const MARKER_STYLING = {
light: "#AAA",
dark: "#CED3D9"
};
Object.defineProperty(this, "MARKER_STYLING", {
value: MARKER_STYLING,
enumerable: true,
writable: false
});
const GRAPH_DEBOUNCE_TIMER = 100;

Просмотреть файл

@ -28,7 +28,11 @@ var test = asyncTest(function*() {
let { jsterm } = yield openConsole();
let popup = jsterm.autocompletePopup;
yield jsterm.execute("let testObject = {$$aaab: '', $$aaac: ''}");
yield jsterm.execute("var testObject = {$$aaab: '', $$aaac: ''}");
// FIXMEshu: global lexicals can't be autocompleted without extra platform
// support. See bug 1207868.
//yield jsterm.execute("let testObject = {$$aaab: '', $$aaac: ''}");
// Should work with bug 967468.
yield autocomplete("Object.__d");

Просмотреть файл

@ -38,6 +38,16 @@ const MIN_ZOOM = 0.6;
const MS_PER_DAY = 86400000;
[["AppManager", AppManager],
["AppProjects", AppProjects],
["Connection", Connection]].forEach(([key, value]) => {
Object.defineProperty(this, key, {
value: value,
enumerable: true,
writable: false
});
});
// Download remote resources early
getJSON("devtools.webide.addonsURL", true);
getJSON("devtools.webide.templatesURL", true);

Просмотреть файл

@ -3,7 +3,7 @@
const protocol = require("devtools/server/protocol");
const HelloActor = protocol.ActorClass({
var HelloActor = protocol.ActorClass({
typeName: "helloActor",
initialize: function() {

Просмотреть файл

@ -67,7 +67,7 @@ window.onload = function() {
}
function checkActorState(helloActor, callback) {
getCount(helloActor, response => {
getCount(helloActor, response => {
ok(!response.error, "No error");
is(response.count, 1, "The counter must be valid");

Просмотреть файл

@ -3,7 +3,7 @@
const protocol = require("devtools/server/protocol");
const HelloActor = protocol.ActorClass({
var HelloActor = protocol.ActorClass({
typeName: "helloActor",
hello: protocol.method(function () {

Просмотреть файл

@ -36,7 +36,8 @@ function test_pause_frame()
do_check_eq(vars.stopMe.value.class, "Function");
do_check_true(!!vars.stopMe.value.actor);
parentEnv = parentEnv.parent.parent;
// Skip both the eval lexical scope and the global lexical scope.
parentEnv = parentEnv.parent.parent.parent;
do_check_neq(parentEnv, undefined);
let objClient = gThreadClient.pauseGrip(parentEnv.object);
objClient.getPrototypeAndProperties(function(aResponse) {

Просмотреть файл

@ -36,7 +36,8 @@ function test_pause_frame()
do_check_eq(aResponse.ownProperties.cos.value.class, "Function");
do_check_true(!!aResponse.ownProperties.cos.value.actor);
let parentEnv = env.parent.parent;
// Skip both the eval lexical scope and the global lexical scope.
let parentEnv = env.parent.parent.parent;
do_check_neq(parentEnv, undefined);
let parentClient = gThreadClient.pauseGrip(parentEnv.object);

Просмотреть файл

@ -44,5 +44,10 @@ const Devices = {
return this._devices[name];
}
};
Object.defineProperty(this, "Devices", {
value: Devices,
enumerable: true,
writable: false
});
EventEmitter.decorate(Devices);

Просмотреть файл

@ -18,7 +18,6 @@ SimpleTest.waitForExplicitFinish();
let gState;
let tests;
let {require} = Cu.import("resource://gre/modules/devtools/shared/Loader.jsm", {});
let {WebConsoleCommands} = require("devtools/shared/webconsole/utils");
function evaluateJS(input) {

Просмотреть файл

@ -16,7 +16,6 @@ SimpleTest.waitForExplicitFinish();
let gState;
let {require} = Cu.import("resource://gre/modules/devtools/shared/Loader.jsm", {});
let {MAX_AUTOCOMPLETE_ATTEMPTS,MAX_AUTOCOMPLETIONS} = require("devtools/shared/webconsole/utils");
// This test runs all of its assertions twice - once with

Просмотреть файл

@ -429,7 +429,7 @@ var {
return {
Debugger,
createSandbox,
dump,
dump: this.dump,
rpc,
loadSubScript,
reportError,

Просмотреть файл

@ -30,7 +30,7 @@
forceFlush = document.documentElement.offsetHeight;
info("Checking that the anonymous content can be retrieved still");
let style = anonymousContent.getAttributeForElement("test-element", "style");
style = anonymousContent.getAttributeForElement("test-element", "style");
is(style, "color:green;", "The anonymous content still exists after reflow");
info("Removing the anonymous content");

Просмотреть файл

@ -19,7 +19,7 @@
let style = anonymousContent.setAttributeForElement("test-element",
"style", "color:green;");
let style = anonymousContent.getAttributeForElement("test-element", "style");
style = anonymousContent.getAttributeForElement("test-element", "style");
is(style, "color:green;", "The anonymous content exists with CSP");
chromeDocument.removeAnonymousContent(anonymousContent);

Просмотреть файл

@ -161,7 +161,7 @@ function testNextRemove() {
ok(navigator.getDeviceStorage, "Should have getDeviceStorage.");
let gStorage = navigator.getDeviceStorage("pictures");
gStorage = navigator.getDeviceStorage("pictures");
ok(gStorage, "Should have gotten a storage.");
// Test "removeDeep" first.

Просмотреть файл

@ -29,11 +29,11 @@ and
<script class="testbody" type="text/javascript; version=1.7">
/** Test for Bug 418756 and 617528 **/
let group1;
let group2;
let group3;
var group1;
var group2;
var group3;
let tags = ["input", "menuitem"];
var tags = ["input", "menuitem"];
for each (let tag in tags) {
function bounce(node) {
@ -43,7 +43,7 @@ function bounce(node) {
p.insertBefore(node, n);
}
let createdNodes = [];
var createdNodes = [];
function cleanup() {
for each (let node in createdNodes) {
@ -55,12 +55,12 @@ function cleanup() {
createdNodes = [];
}
let typeMapper = {
var typeMapper = {
'c': 'checkbox',
'r': 'radio'
};
let id = 0;
var id = 0;
// type can be 'c' for 'checkbox' and 'r' for 'radio'
function createNode(type, name, checked) {
@ -75,7 +75,7 @@ function createNode(type, name, checked) {
return node;
}
let types = ['c', 'r'];
var types = ['c', 'r'];
// First make sure that setting .checked makes .defaultChecked changes no
// longer affect .checked.

Просмотреть файл

@ -7,9 +7,9 @@
// This script is run when the preallocated process starts. It is injected as
// a frame script.
const BrowserElementIsPreloaded = true;
var BrowserElementIsPreloaded = true;
const DoPreloadPostfork = function(aCallback) {
var DoPreloadPostfork = function(aCallback) {
Services.obs.addObserver({
_callback: aCallback,

Просмотреть файл

@ -7,6 +7,7 @@
const {classes: Cc, interfaces: Ci, utils: Cu, results: Cr} = Components;
Cu.importGlobalProperties(['Blob']);
Cu.import("resource://gre/modules/XPCOMUtils.jsm");
Cu.import("resource://gre/modules/wap_consts.js", this);
var DEBUG; // set to true to see debug messages
@ -20,10 +21,21 @@ const HT = 9;
const DQUOTE = 34;
const DEL = 127;
XPCOMUtils.defineConstant(this, "NUL", NUL);
XPCOMUtils.defineConstant(this, "CR", CR);
XPCOMUtils.defineConstant(this, "LF", LF);
XPCOMUtils.defineConstant(this, "SP", SP);
XPCOMUtils.defineConstant(this, "HT", HT);
XPCOMUtils.defineConstant(this, "DQUOTE", DQUOTE);
XPCOMUtils.defineConstant(this, "DEL", DEL);
// Special ASCII character ranges
const CTLS = 32;
const ASCIIS = 128;
XPCOMUtils.defineConstant(this, "CTLS", CTLS);
XPCOMUtils.defineConstant(this, "ASCIIS", ASCIIS);
/**
* Error class for generic encoding/decoding failures.
*/

Просмотреть файл

@ -11,8 +11,6 @@ if ("@mozilla.org/windows-registry-key;1" in Components.classes)
DELIM = "|";
var gProfD = do_get_profile_startup();
var gDirSvc = Cc["@mozilla.org/file/directory_service;1"].
getService(Ci.nsIProperties);
// Writes out some plugin registry to the profile
function write_registry(version, info) {

Просмотреть файл

@ -11,8 +11,6 @@ if ("@mozilla.org/windows-registry-key;1" in Components.classes)
DELIM = "|";
var gProfD = do_get_profile_startup();
var gDirSvc = Cc["@mozilla.org/file/directory_service;1"].
getService(Ci.nsIProperties);
// Writes out some plugin registry to the profile
function write_registry(version, info) {

Просмотреть файл

@ -56,9 +56,6 @@ function createAppInfo(id, name, version, platformVersion) {
XULAPPINFO_CONTRACTID, XULAppInfoFactory);
}
var gDirSvc = Cc["@mozilla.org/file/directory_service;1"]
.getService(Ci.nsIProperties);
var gPluginHost = null;
function test_expected_permission_string(aPermString) {

Просмотреть файл

@ -11,8 +11,6 @@ if ("@mozilla.org/windows-registry-key;1" in Components.classes)
DELIM = "|";
var gProfD = do_get_profile_startup();
var gDirSvc = Cc["@mozilla.org/file/directory_service;1"].
getService(Ci.nsIProperties);
// Writes out some plugin registry to the profile
function write_registry(version, info) {

Просмотреть файл

@ -60,6 +60,12 @@ const MMI_PROCEDURE_INTERROGATION = "*#";
const MMI_PROCEDURE_REGISTRATION = "**";
const MMI_PROCEDURE_ERASURE = "##";
XPCOMUtils.defineConstant(this, "MMI_PROCEDURE_ACTIVATION", MMI_PROCEDURE_ACTIVATION);
XPCOMUtils.defineConstant(this, "MMI_PROCEDURE_DEACTIVATION", MMI_PROCEDURE_DEACTIVATION);
XPCOMUtils.defineConstant(this, "MMI_PROCEDURE_INTERROGATION", MMI_PROCEDURE_INTERROGATION);
XPCOMUtils.defineConstant(this, "MMI_PROCEDURE_REGISTRATION", MMI_PROCEDURE_REGISTRATION);
XPCOMUtils.defineConstant(this, "MMI_PROCEDURE_ERASURE", MMI_PROCEDURE_ERASURE);
// MMI call forwarding service codes as defined in TS.22.030 Annex B
const MMI_SC_CFU = "21";
const MMI_SC_CF_BUSY = "67";

Просмотреть файл

@ -6,7 +6,7 @@
<link rel="stylesheet" type="text/css" href="chrome://mochikit/content/tests/SimpleTest/test.css">
<script type="application/javascript;version=1.8">
let SimpleTest = window.opener.SimpleTest;
var SimpleTest = window.opener.SimpleTest;
function ok() { window.opener.ok.apply(window.opener, arguments); }
function done() { window.opener.done.apply(window.opener, arguments); }
let e = {};

Просмотреть файл

@ -36,8 +36,8 @@
</style>
<script type="application/javascript;version=1.8">
let SimpleTest = window.opener.SimpleTest;
let Ci = Components.interfaces;
var SimpleTest = window.opener.SimpleTest;
var Ci = Components.interfaces;
function ok() { window.opener.ok.apply(window.opener, arguments); }
function done() { window.opener.done.apply(window.opener, arguments); }

Просмотреть файл

@ -45,8 +45,8 @@
</style>
<script type="application/javascript;version=1.8">
let SimpleTest = window.opener.SimpleTest;
let Ci = Components.interfaces;
var SimpleTest = window.opener.SimpleTest;
var Ci = Components.interfaces;
function ok() { window.opener.ok.apply(window.opener, arguments); }
function done() { window.opener.done.apply(window.opener, arguments); }

Просмотреть файл

@ -6,8 +6,8 @@
<link rel="stylesheet" type="text/css" href="chrome://mochikit/content/tests/SimpleTest/test.css">
<script type="application/javascript;version=1.8">
let SimpleTest = window.opener.SimpleTest;
let Ci = Components.interfaces;
var SimpleTest = window.opener.SimpleTest;
var Ci = Components.interfaces;
function ok() { window.opener.ok.apply(window.opener, arguments); }
function done() { window.opener.done.apply(window.opener, arguments); }

Просмотреть файл

@ -367,6 +367,17 @@ this.XPCOMUtils = {
QueryInterface: XPCOMUtils.generateQI([Ci.nsIFactory])
};
},
/**
* Defines a non-writable property on an object.
*/
defineConstant: function XPCOMUtils__defineConstant(aObj, aName, aValue) {
Object.defineProperty(aObj, aName, {
value: aValue,
enumerable: true,
writable: false
});
},
};
/**

Просмотреть файл

@ -20,7 +20,7 @@ function run_test()
do_check_eq(a, 3);
do_check_eq(b, 3);
do_check_eq(c, 3);
// c is a lexical binding and does not write to the global prototype
do_check_eq(d, 3);
do_check_eq(e(), 3);

Просмотреть файл

@ -22,6 +22,9 @@ Cu.import("resource://gre/modules/XPCOMUtils.jsm");
Cu.import("resource://gre/modules/Services.jsm");
Cu.import("resource://gre/modules/Task.jsm");
let gChromeWin;
let gBrowserApp;
setup_browser();
// Make the timer global so it doesn't get GC'd
@ -82,9 +85,6 @@ function getInputValue(browser, data) {
let ss = Cc["@mozilla.org/browser/sessionstore;1"].getService(Ci.nsISessionStore);
let gChromeWin;
let gBrowserApp;
// Wait 2 seconds for the async Java/JS messsaging dance to settle down. We don't have
// enough pre/post events, messages or notifications to handle this without a delay.
const CLOSE_TAB_WAIT = 2000;

Просмотреть файл

@ -6,7 +6,7 @@
const {classes: Cc, interfaces: Ci, utils: Cu, results: Cr} = Components;
const loader = Cc["@mozilla.org/moz/jssubscript-loader;1"]
var loader = Cc["@mozilla.org/moz/jssubscript-loader;1"]
.getService(Ci.mozIJSSubScriptLoader);
Cu.import("resource://gre/modules/FileUtils.jsm");
@ -42,7 +42,7 @@ loader.loadSubScript("chrome://marionette/content/frame-manager.js");
this.EXPORTED_SYMBOLS = ["GeckoDriver", "Context"];
const FRAME_SCRIPT = "chrome://marionette/content/listener.js";
var FRAME_SCRIPT = "chrome://marionette/content/listener.js";
const BROWSER_STARTUP_FINISHED = "browser-delayed-startup-finished";
const XUL_NS = "http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul";
const CLICK_TO_START_PREF = "marionette.debugging.clicktostart";
@ -941,7 +941,7 @@ GeckoDriver.prototype.execute = function(cmd, resp, directInject) {
};
if (!directInject) {
script = "let func = function() { " + script + " }; func.apply(null, __marionetteParams);";
script = "var func = function() { " + script + " }; func.apply(null, __marionetteParams);";
}
this.executeScriptInSandbox(
resp,
@ -1174,8 +1174,8 @@ GeckoDriver.prototype.executeWithCallback = function(cmd, resp, directInject) {
if (!directInject) {
script = "__marionetteParams.push(returnFunc);" +
"let marionetteScriptFinished = returnFunc;" +
"let __marionetteFunc = function() {" + script + "};" +
"var marionetteScriptFinished = returnFunc;" +
"var __marionetteFunc = function() {" + script + "};" +
"__marionetteFunc.apply(null, __marionetteParams);";
}

Просмотреть файл

@ -624,7 +624,7 @@ function executeScript(msg, directInject) {
return;
}
script = "let __marionetteFunc = function(){" + script + "};" +
script = "var __marionetteFunc = function(){" + script + "};" +
"__marionetteFunc.apply(null, __marionetteParams);";
if (importedScripts.exists()) {
let stream = Components.classes["@mozilla.org/network/file-input-stream;1"].
@ -776,7 +776,7 @@ function executeWithCallback(msg, useFinish) {
}
scriptSrc = "__marionetteParams.push(marionetteScriptFinished);" +
"let __marionetteFunc = function() { " + script + "};" +
"var __marionetteFunc = function() { " + script + "};" +
"__marionetteFunc.apply(null, __marionetteParams); ";
}

Просмотреть файл

@ -6,7 +6,7 @@
const {Constructor: CC, classes: Cc, interfaces: Ci, utils: Cu} = Components;
const loader = Cc["@mozilla.org/moz/jssubscript-loader;1"].getService(Ci.mozIJSSubScriptLoader);
var loader = Cc["@mozilla.org/moz/jssubscript-loader;1"].getService(Ci.mozIJSSubScriptLoader);
const ServerSocket = CC("@mozilla.org/network/server-socket;1", "nsIServerSocket", "initSpecialConnection");
Cu.import("resource://gre/modules/Log.jsm");

Просмотреть файл

@ -84,7 +84,7 @@ container.addEventListener('mozbrowsershowmodalprompt', function (e) {
if (outOfProcess) {
let specialpowers = {};
let loader = Cc["@mozilla.org/moz/jssubscript-loader;1"].getService(Ci.mozIJSSubScriptLoader);
let loader = Components.classes["@mozilla.org/moz/jssubscript-loader;1"].getService(Ci.mozIJSSubScriptLoader);
loader.loadSubScript("chrome://specialpowers/content/SpecialPowersObserver.js", specialpowers);
let specialPowersObserver = new specialpowers.SpecialPowersObserver();
@ -103,7 +103,7 @@ if (outOfProcess) {
}
if (chrome) {
let loader = Cc["@mozilla.org/moz/jssubscript-loader;1"].getService(Ci.mozIJSSubScriptLoader);
let loader = Components.classes["@mozilla.org/moz/jssubscript-loader;1"].getService(Ci.mozIJSSubScriptLoader);
if (typeof(SpecialPowers) == 'undefined') {
loader.loadSubScript("chrome://specialpowers/content/specialpowersAPI.js");
loader.loadSubScript("chrome://specialpowers/content/SpecialPowersObserverAPI.js");
@ -114,7 +114,7 @@ if (chrome) {
}
if (onDevice) {
var cpuLock = Cc["@mozilla.org/power/powermanagerservice;1"]
var cpuLock = Components.classes["@mozilla.org/power/powermanagerservice;1"]
.getService(Ci.nsIPowerManagerService)
.newWakeLock("cpu");

Просмотреть файл

@ -958,14 +958,26 @@ function _getDOMWindowUtils(aWindow)
getInterface(_EU_Ci.nsIDOMWindowUtils);
}
function _defineConstant(name, value) {
Object.defineProperty(this, name, {
value: value,
enumerable: true,
writable: false
});
}
const COMPOSITION_ATTR_RAW_CLAUSE =
_EU_Ci.nsITextInputProcessor.ATTR_RAW_CLAUSE;
_defineConstant("COMPOSITION_ATTR_RAW_CLAUSE", COMPOSITION_ATTR_RAW_CLAUSE);
const COMPOSITION_ATTR_SELECTED_RAW_CLAUSE =
_EU_Ci.nsITextInputProcessor.ATTR_SELECTED_RAW_CLAUSE;
_defineConstant("COMPOSITION_ATTR_SELECTED_RAW_CLAUSE", COMPOSITION_ATTR_SELECTED_RAW_CLAUSE);
const COMPOSITION_ATTR_CONVERTED_CLAUSE =
_EU_Ci.nsITextInputProcessor.ATTR_CONVERTED_CLAUSE;
_defineConstant("COMPOSITION_ATTR_CONVERTED_CLAUSE", COMPOSITION_ATTR_CONVERTED_CLAUSE);
const COMPOSITION_ATTR_SELECTED_CLAUSE =
_EU_Ci.nsITextInputProcessor.ATTR_SELECTED_CLAUSE;
_defineConstant("COMPOSITION_ATTR_SELECTED_CLAUSE", COMPOSITION_ATTR_SELECTED_CLAUSE);
var TIPMap = new WeakMap();

Просмотреть файл

@ -72,4 +72,4 @@ TalosPowersService.prototype = {
},
};
const NSGetFactory = XPCOMUtils.generateNSGetFactory([TalosPowersService]);
this.NSGetFactory = XPCOMUtils.generateNSGetFactory([TalosPowersService]);

Просмотреть файл

@ -11,6 +11,14 @@
const { classes: Cc, interfaces: Ci, results: Cr, utils: Cu } = Components;
// Match type constants.
// These indicate what type of search function we should be using.
const MATCH_ANYWHERE = Ci.mozIPlacesAutoComplete.MATCH_ANYWHERE;
const MATCH_BOUNDARY_ANYWHERE = Ci.mozIPlacesAutoComplete.MATCH_BOUNDARY_ANYWHERE;
const MATCH_BOUNDARY = Ci.mozIPlacesAutoComplete.MATCH_BOUNDARY;
const MATCH_BEGINNING = Ci.mozIPlacesAutoComplete.MATCH_BEGINNING;
const MATCH_BEGINNING_CASE_SENSITIVE = Ci.mozIPlacesAutoComplete.MATCH_BEGINNING_CASE_SENSITIVE;
const PREF_BRANCH = "browser.urlbar.";
// Prefs are defined as [pref name, default value].
@ -40,14 +48,6 @@ const PREF_SUGGEST_SEARCHES = [ "suggest.searches", false ];
const PREF_MAX_CHARS_FOR_SUGGEST = [ "maxCharsForSearchSuggestions", 20];
// Match type constants.
// These indicate what type of search function we should be using.
const MATCH_ANYWHERE = Ci.mozIPlacesAutoComplete.MATCH_ANYWHERE;
const MATCH_BOUNDARY_ANYWHERE = Ci.mozIPlacesAutoComplete.MATCH_BOUNDARY_ANYWHERE;
const MATCH_BOUNDARY = Ci.mozIPlacesAutoComplete.MATCH_BOUNDARY;
const MATCH_BEGINNING = Ci.mozIPlacesAutoComplete.MATCH_BEGINNING;
const MATCH_BEGINNING_CASE_SENSITIVE = Ci.mozIPlacesAutoComplete.MATCH_BEGINNING_CASE_SENSITIVE;
// AutoComplete query type constants.
// Describes the various types of queries that we can process rows for.
const QUERYTYPE_FILTERED = 0;

Просмотреть файл

@ -6,8 +6,6 @@
* Test bug 489872 to make sure passing nulls to nsNavHistory doesn't crash.
*/
var Cr = Components.results;
// Make an array of services to test, each specifying a class id, interface
// and an array of function names that don't throw when passed nulls
var testServices = [

Просмотреть файл

@ -12,6 +12,15 @@ const FRAME_SCRIPT_URL = "chrome://global/content/backgroundPageThumbsContent.js
const TELEMETRY_HISTOGRAM_ID_PREFIX = "FX_THUMBNAILS_BG_";
const XUL_NS = "http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul";
const HTML_NS = "http://www.w3.org/1999/xhtml";
const { classes: Cc, interfaces: Ci, utils: Cu } = Components;
Cu.import("resource://gre/modules/XPCOMUtils.jsm", this);
Cu.import("resource://gre/modules/PageThumbs.jsm");
Cu.import("resource://gre/modules/Services.jsm");
// possible FX_THUMBNAILS_BG_CAPTURE_DONE_REASON_2 telemetry values
const TEL_CAPTURE_DONE_OK = 0;
const TEL_CAPTURE_DONE_TIMEOUT = 1;
@ -19,13 +28,11 @@ const TEL_CAPTURE_DONE_TIMEOUT = 1;
const TEL_CAPTURE_DONE_CRASHED = 4;
const TEL_CAPTURE_DONE_BAD_URI = 5;
const XUL_NS = "http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul";
const HTML_NS = "http://www.w3.org/1999/xhtml";
const { classes: Cc, interfaces: Ci, utils: Cu } = Components;
Cu.import("resource://gre/modules/PageThumbs.jsm");
Cu.import("resource://gre/modules/Services.jsm");
// These are looked up on the global as properties below.
XPCOMUtils.defineConstant(this, "TEL_CAPTURE_DONE_OK", TEL_CAPTURE_DONE_OK);
XPCOMUtils.defineConstant(this, "TEL_CAPTURE_DONE_TIMEOUT", TEL_CAPTURE_DONE_TIMEOUT);
XPCOMUtils.defineConstant(this, "TEL_CAPTURE_DONE_CRASHED", TEL_CAPTURE_DONE_CRASHED);
XPCOMUtils.defineConstant(this, "TEL_CAPTURE_DONE_BAD_URI", TEL_CAPTURE_DONE_BAD_URI);
const global = this;
@ -251,6 +258,12 @@ const BackgroundPageThumbs = {
_destroyBrowserTimeout: DESTROY_BROWSER_TIMEOUT,
};
Object.defineProperty(this, "BackgroundPageThumbs", {
value: BackgroundPageThumbs,
enumerable: true,
writable: false
});
/**
* Represents a single capture request in the capture queue.
*
@ -353,8 +366,9 @@ Capture.prototype = {
let { captureCallback, doneCallbacks, options } = this;
this.destroy();
if (typeof(reason) != "number")
if (typeof(reason) != "number") {
throw new Error("A done reason must be given.");
}
tel("CAPTURE_DONE_REASON_2", reason);
if (data && data.telemetry) {
// Telemetry is currently disabled in the content process (bug 680508).

Просмотреть файл

@ -11,7 +11,8 @@ Cc["@mozilla.org/moz/jssubscript-loader;1"]
.getService(Ci.mozIJSSubScriptLoader)
.loadSubScript("resource://gre/modules/PageThumbs.jsm", tmp);
const {EXPIRATION_MIN_CHUNK_SIZE, PageThumbsExpiration} = tmp;
const EXPIRATION_MIN_CHUNK_SIZE = 50;
const {PageThumbsExpiration} = tmp;
function runTests() {
// Create dummy URLs.

Просмотреть файл

@ -260,8 +260,10 @@ DownloadListener.prototype = {
}
const kSaveAsType_Complete = 0; // Save document with attached objects.
XPCOMUtils.defineConstant(this, "kSaveAsType_Complete", 0);
// const kSaveAsType_URL = 1; // Save document or URL by itself.
const kSaveAsType_Text = 2; // Save document, converting to plain text.
XPCOMUtils.defineConstant(this, "kSaveAsType_Text", kSaveAsType_Text);
/**
* internalSave: Used when saving a document or URL.
@ -787,10 +789,13 @@ function DownloadURL(aURL, aFileName, aInitiatingDocument) {
// We have no DOM, and can only save the URL as is.
const SAVEMODE_FILEONLY = 0x00;
XPCOMUtils.defineConstant(this, "SAVEMODE_FILEONLY", SAVEMODE_FILEONLY);
// We have a DOM and can save as complete.
const SAVEMODE_COMPLETE_DOM = 0x01;
XPCOMUtils.defineConstant(this, "SAVEMODE_COMPLETE_DOM", SAVEMODE_COMPLETE_DOM);
// We have a DOM which we can serialize as text.
const SAVEMODE_COMPLETE_TEXT = 0x02;
XPCOMUtils.defineConstant(this, "SAVEMODE_COMPLETE_TEXT", SAVEMODE_COMPLETE_TEXT);
// If we are able to save a complete DOM, the 'save as complete' filter
// must be the first filter appended. The 'save page only' counterpart

Просмотреть файл

@ -153,9 +153,11 @@
</field>
<field name="PrivateBrowsingUtils" readonly="true">
let utils = {};
Components.utils.import("resource://gre/modules/PrivateBrowsingUtils.jsm", utils);
utils.PrivateBrowsingUtils
{
let utils = {};
Components.utils.import("resource://gre/modules/PrivateBrowsingUtils.jsm", utils);
utils.PrivateBrowsingUtils
}
</field>
<property name="inPrivateContext" readonly="true"

Просмотреть файл

@ -779,9 +779,11 @@
#endif
</field>
<field name="TelemetryStopwatch" readonly="true">
let tmp = {};
Cu.import("resource://gre/modules/TelemetryStopwatch.jsm", tmp);
tmp.TelemetryStopwatch;
{
let tmp = {};
Cu.import("resource://gre/modules/TelemetryStopwatch.jsm", tmp);
tmp.TelemetryStopwatch;
}
</field>
</implementation>

Просмотреть файл

@ -7,7 +7,7 @@ const {classes: Cc, interfaces: Ci, utils: Cu, results: Cr} = Components;
this.EXPORTED_SYMBOLS = ["WindowsRegistry"];
const WindowsRegistry = {
var WindowsRegistry = {
/**
* Safely reads a value from the registry.
*

Просмотреть файл

@ -70,6 +70,7 @@ const GMP_PLUGINS = [
missingKey: "VIDEO_ADOBE_GMP_DISAPPEARED",
missingFilesKey: "VIDEO_ADOBE_GMP_MISSING_FILES",
}];
XPCOMUtils.defineConstant(this, "GMP_PLUGINS", GMP_PLUGINS);
XPCOMUtils.defineLazyGetter(this, "pluginsBundle",
() => Services.strings.createBundle("chrome://global/locale/plugins.properties"));

Просмотреть файл

@ -157,6 +157,7 @@ const XPI_SIGNATURE_CHECK_PERIOD = 24 * 60 * 60;
// The value for this is in Makefile.in
#expand const DB_SCHEMA = __MOZ_EXTENSIONS_DB_SCHEMA__;
XPCOMUtils.defineConstant(this, "DB_SCHEMA", DB_SCHEMA);
const NOTIFICATION_TOOLBOXPROCESS_LOADED = "ToolboxProcessLoaded";
// Properties that exist in the install manifest