mirror of
https://repo.dactyloidae.xyz/Dactyloidae/UXP.git
synced 2026-09-20 23:37:33 +09:00
import FIREFOX_52_6_0esr_RELEASE from mozilla-esr52 hg repo
This commit is contained in:
commit
dcd9973243
150858 changed files with 23884658 additions and 0 deletions
|
|
@ -0,0 +1,93 @@
|
|||
/* -*- indent-tabs-mode: nil; js-indent-level: 2 -*- */
|
||||
/* vim: set ft=javascript ts=2 et sw=2 tw=80: */
|
||||
/* Any copyright is dedicated to the Public Domain.
|
||||
* http://creativecommons.org/publicdomain/zero/1.0/ */
|
||||
|
||||
/**
|
||||
* This test checks that we properly set the frozen, sealed, and non-extensbile
|
||||
* attributes on variables so that the F/S/N is shown in the variables view.
|
||||
*/
|
||||
|
||||
const TAB_URL = EXAMPLE_URL + "doc_frame-parameters.html";
|
||||
|
||||
var gTab, gPanel, gDebugger;
|
||||
|
||||
function test() {
|
||||
let options = {
|
||||
source: TAB_URL,
|
||||
line: 1
|
||||
};
|
||||
initDebugger(TAB_URL, options).then(([aTab,, aPanel]) => {
|
||||
gTab = aTab;
|
||||
gPanel = aPanel;
|
||||
gDebugger = gPanel.panelWin;
|
||||
|
||||
prepareTest();
|
||||
});
|
||||
}
|
||||
|
||||
function prepareTest() {
|
||||
gDebugger.once(gDebugger.EVENTS.FETCHED_SCOPES, runTest);
|
||||
|
||||
evalInTab(gTab, "(" + function () {
|
||||
var frozen = Object.freeze({});
|
||||
var sealed = Object.seal({});
|
||||
var nonExtensible = Object.preventExtensions({});
|
||||
var extensible = {};
|
||||
var string = "foo bar baz";
|
||||
|
||||
debugger;
|
||||
} + "())");
|
||||
}
|
||||
|
||||
function runTest() {
|
||||
let hasNoneTester = function (aVariable) {
|
||||
ok(!aVariable.hasAttribute("frozen"),
|
||||
"The variable should not be frozen.");
|
||||
ok(!aVariable.hasAttribute("sealed"),
|
||||
"The variable should not be sealed.");
|
||||
ok(!aVariable.hasAttribute("non-extensible"),
|
||||
"The variable should be extensible.");
|
||||
};
|
||||
|
||||
let testers = {
|
||||
frozen: function (aVariable) {
|
||||
ok(aVariable.hasAttribute("frozen"),
|
||||
"The variable should be frozen.");
|
||||
},
|
||||
sealed: function (aVariable) {
|
||||
ok(aVariable.hasAttribute("sealed"),
|
||||
"The variable should be sealed.");
|
||||
},
|
||||
nonExtensible: function (aVariable) {
|
||||
ok(aVariable.hasAttribute("non-extensible"),
|
||||
"The variable should be non-extensible.");
|
||||
},
|
||||
extensible: hasNoneTester,
|
||||
string: hasNoneTester,
|
||||
arguments: hasNoneTester,
|
||||
this: hasNoneTester
|
||||
};
|
||||
|
||||
let variables = gDebugger.document.querySelectorAll(".variable-or-property");
|
||||
|
||||
for (let variable of variables) {
|
||||
let name = variable.querySelector(".name").getAttribute("value");
|
||||
let tester = testers[name];
|
||||
delete testers[name];
|
||||
|
||||
ok(tester, "We should have a tester for the '" + name + "' variable.");
|
||||
tester(variable);
|
||||
}
|
||||
|
||||
is(Object.keys(testers).length, 0,
|
||||
"We should have run and removed all the testers.");
|
||||
|
||||
resumeDebuggerThenCloseAndFinish(gPanel);
|
||||
}
|
||||
|
||||
registerCleanupFunction(function () {
|
||||
gTab = null;
|
||||
gPanel = null;
|
||||
gDebugger = null;
|
||||
});
|
||||
Loading…
Add table
Add a link
Reference in a new issue