mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-28 07:13:20 +00:00
Bug 1172536 - Stop using for each loops in layout; r=roc
These are SpiderMonkey-proprietary legacy feature which has been deprecated and is expected to be removed in due course. This commit also fixes a number of bugs in test_bug708874.xul. In particular, because of the semicolon after the for head, the (alleged) loop body was only executed for the final element of the array ({}), and because each of the functions under test threw an exception, only the first call was executed. I do not know of a way to test the changes in frame-verify.js, so I can't guarantee they actually work. --HG-- extra : commitid : 9WYVkuNzWOA
This commit is contained in:
parent
fe465275e2
commit
98d44fafe9
@ -21,7 +21,7 @@
|
||||
<script type="application/javascript">
|
||||
<![CDATA[
|
||||
var imports = [ "SimpleTest", "is", "isnot", "ok", "SpecialPowers" ];
|
||||
for each (var name in imports) {
|
||||
for (var name of imports) {
|
||||
window[name] = window.opener.wrappedJSObject[name];
|
||||
}
|
||||
|
||||
|
@ -22,7 +22,7 @@
|
||||
<script type="application/javascript">
|
||||
<![CDATA[
|
||||
var imports = [ "SimpleTest", "is", "isnot", "ok", "todo" ];
|
||||
for each (var name in imports) {
|
||||
for (var name of imports) {
|
||||
window[name] = window.opener.wrappedJSObject[name];
|
||||
}
|
||||
|
||||
|
@ -16,7 +16,7 @@
|
||||
SimpleTest.waitForExplicitFinish();
|
||||
|
||||
var imports = [ "SimpleTest", "is", "isnot", "ok" ];
|
||||
for each (var name in imports) {
|
||||
for (var name of imports) {
|
||||
window[name] = window.opener.wrappedJSObject[name];
|
||||
}
|
||||
|
||||
|
@ -28,7 +28,7 @@
|
||||
<script type="application/javascript">
|
||||
<![CDATA[
|
||||
var imports = [ "SimpleTest", "is", "isnot", "ok", "onerror" ];
|
||||
for each (var name in imports) {
|
||||
for (var name of imports) {
|
||||
window[name] = window.opener.wrappedJSObject[name];
|
||||
}
|
||||
|
||||
|
@ -13,7 +13,7 @@ function inheritsFrom(t, baseName)
|
||||
if (name == baseName)
|
||||
return true;
|
||||
|
||||
for each (let base in t.bases)
|
||||
for (let base of t.bases)
|
||||
if (inheritsFrom(base.type, baseName))
|
||||
return true;
|
||||
|
||||
@ -33,7 +33,7 @@ function process_type(t)
|
||||
|
||||
output.push('CLASS-DEF: %s'.format(t.name));
|
||||
|
||||
for each (let base in t.bases) {
|
||||
for (let base of t.bases) {
|
||||
if (inheritsFrom(base.type, 'nsIFrame')) {
|
||||
output.push('%s -> %s;'.format(base.type.name, t.name));
|
||||
}
|
||||
@ -43,7 +43,7 @@ function process_type(t)
|
||||
}
|
||||
|
||||
output.push('%s [label="%s%s"];'.format(t.name, t.name,
|
||||
["\\n(%s)".format(b) for each (b in nonFrameBases)].join('')));
|
||||
nonFrameBases.map(b => "\\n(%s)".format(b)).join('')));
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -83,7 +83,7 @@ function process_cp_pre_genericize(d)
|
||||
|
||||
function input_end()
|
||||
{
|
||||
for each (let [name, loc] in needIDs) {
|
||||
for (let [name, loc] of needIDs) {
|
||||
if (!haveIDs.hasOwnProperty(name)) {
|
||||
error("nsQueryFrame<%s> found, but %s::kFrameIID is not declared".format(name, name), loc);
|
||||
}
|
||||
|
@ -258,16 +258,15 @@ function testInvalid() {
|
||||
}
|
||||
|
||||
function testNotElement() {
|
||||
var values = [null, undefined, {}];
|
||||
try {
|
||||
for each (value in values); {
|
||||
DOMUtils.hasPseudoClassLock(value, ":hover");
|
||||
DOMUtils.addPseudoClassLock(value, ":hover");
|
||||
DOMUtils.removePseudoClassLock(value, ":hover");
|
||||
DOMUtils.clearPseudoClassLocks(value);
|
||||
}
|
||||
} catch(e) {
|
||||
// just make sure we don't crash on non-elements
|
||||
for (var value of [null, undefined, {}]) {
|
||||
SimpleTest.doesThrow(() => DOMUtils.hasPseudoClassLock(value, ":hover"),
|
||||
"hasPseudoClassLock should throw for " + value);
|
||||
SimpleTest.doesThrow(() => DOMUtils.addPseudoClassLock(value, ":hover"),
|
||||
"addPseudoClassLock should throw for " + value);
|
||||
SimpleTest.doesThrow(() => DOMUtils.removePseudoClassLock(value, ":hover"),
|
||||
"removePseudoClassLock should throw for " + value);
|
||||
SimpleTest.doesThrow(() => DOMUtils.clearPseudoClassLocks(value),
|
||||
"clearPseudoClassLocks should throw for " + value);
|
||||
}
|
||||
}
|
||||
]]>
|
||||
|
Loading…
Reference in New Issue
Block a user