mirror of https://github.com/roytam1/UXP
Browse Source
This removes a ton of tests that are no longer relevant with (un)watch removed (e.g. testing stability/bugs in the watchpoint system itself which has never been the most stable), and updates others that would previously rely on watch/unwatch, so that they don't unexpectedly fail.pull/24/head
141 changed files with 34 additions and 2940 deletions
@ -1,129 +0,0 @@
|
||||
<!DOCTYPE html> |
||||
<html> |
||||
<!-- |
||||
https://bugzilla.mozilla.org/show_bug.cgi?id=903332 |
||||
--> |
||||
<head> |
||||
<meta charset="utf-8"> |
||||
<title>Test for Bug 903332</title> |
||||
<script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script> |
||||
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/> |
||||
<script type="application/javascript"> |
||||
|
||||
/** Test for Bug 903332 **/ |
||||
|
||||
var watch1Called; |
||||
function watch1(prop, oldValue, newValue) |
||||
{ |
||||
is(watch1Called, false, "watch1Called not reset properly?"); |
||||
watch1Called = true; |
||||
|
||||
is(prop, "cookie", "wrong property name passed to watch1"); |
||||
return newValue; |
||||
} |
||||
|
||||
var watch2Called; |
||||
function watch2(prop, oldValue, newValue) |
||||
{ |
||||
is(watch2Called, false, "watch2Called not reset properly?"); |
||||
watch2Called = true; |
||||
|
||||
is(prop, "cookie", "wrong property name passed to watch2"); |
||||
return newValue; |
||||
} |
||||
|
||||
// Just in case subsequent tests depend on a particular value... |
||||
var originalValue = document.cookie; |
||||
ok(true, "originalValue: " + originalValue); |
||||
|
||||
var originalPrefix = originalValue.length > 0 ? originalValue + "; " : ""; |
||||
|
||||
try |
||||
{ |
||||
// trial set (no watch) to verify things work |
||||
document.cookie = "first=set"; |
||||
is(document.cookie, originalPrefix + "first=set", |
||||
"first value correct"); |
||||
|
||||
// add a watch |
||||
document.watch("cookie", watch1); |
||||
|
||||
// set, check for watch invoked |
||||
watch1Called = false; |
||||
document.cookie = "second=set"; |
||||
is(watch1Called, true, "watch1 function should be called"); |
||||
is(document.cookie, originalPrefix + "first=set; second=set", |
||||
"second value correct"); |
||||
|
||||
// and a second time, just in case |
||||
watch1Called = false; |
||||
document.cookie = "third=set"; |
||||
is(watch1Called, true, "watch1 function should be called"); |
||||
is(document.cookie, originalPrefix + "first=set; second=set; third=set", |
||||
"third value correct"); |
||||
|
||||
// overwrite the current watch with a new one |
||||
document.watch("cookie", watch2); |
||||
|
||||
// set, check for watch invoked |
||||
watch1Called = false; |
||||
watch2Called = false; |
||||
document.cookie = "fourth=set"; |
||||
is(watch1Called, false, "watch1 invoked erroneously"); |
||||
is(watch2Called, true, "watch2 function should be called"); |
||||
is(document.cookie, originalPrefix + "first=set; second=set; third=set; fourth=set", |
||||
"fourth value correct"); |
||||
|
||||
// and a second time, just in case |
||||
watch1Called = false; |
||||
watch2Called = false; |
||||
document.cookie = "fifth=set"; |
||||
is(watch1Called, false, "watch1 invoked erroneously"); |
||||
is(watch2Called, true, "watch2 function should be called"); |
||||
is(document.cookie, originalPrefix + "first=set; second=set; third=set; fourth=set; fifth=set", |
||||
"fifth value correct"); |
||||
|
||||
// remove the watch |
||||
document.unwatch("cookie"); |
||||
|
||||
// check for non-invocation now |
||||
watch1Called = false; |
||||
watch2Called = false; |
||||
document.cookie = "sixth=set"; |
||||
is(watch1Called, false, "watch1 shouldn't be called"); |
||||
is(watch2Called, false, "watch2 shouldn't be called"); |
||||
is(document.cookie, originalPrefix + "first=set; second=set; third=set; fourth=set; fifth=set; sixth=set", |
||||
"sixth value correct"); |
||||
} |
||||
finally |
||||
{ |
||||
// reset |
||||
document.unwatch("cookie"); // harmless, should be no-op except if bugs |
||||
|
||||
var d = new Date(); |
||||
d.setTime(0); |
||||
var suffix = "=; expires=" + d.toGMTString(); |
||||
|
||||
document.cookie = "first" + suffix; |
||||
document.cookie = "second" + suffix; |
||||
document.cookie = "third" + suffix; |
||||
document.cookie = "fourth" + suffix; |
||||
document.cookie = "fifth" + suffix; |
||||
document.cookie = "sixth" + suffix; |
||||
} |
||||
|
||||
is(document.cookie, originalValue, |
||||
"document.cookie isn't what it was initially! expect bustage further " + |
||||
"down the line"); |
||||
</script> |
||||
</head> |
||||
<body> |
||||
<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=903332">Mozilla Bug 903332</a> |
||||
<p id="display"></p> |
||||
<div id="content" style="display: none"> |
||||
|
||||
</div> |
||||
<pre id="test"> |
||||
</pre> |
||||
</body> |
||||
</html> |
@ -1,14 +0,0 @@
|
||||
<html> |
||||
<head> |
||||
<title>Iframe test for bug 38959</title> |
||||
</head> |
||||
<body"> |
||||
<script> |
||||
|
||||
x = false; |
||||
window.opener.postMessage(1, "http://mochi.test:8888"); |
||||
window.close(); |
||||
|
||||
</script> |
||||
</body> |
||||
</html> |
@ -1,14 +0,0 @@
|
||||
<html> |
||||
<head> |
||||
<title>Iframe test for bug 38959</title> |
||||
</head> |
||||
<body"> |
||||
<script> |
||||
|
||||
x = true; |
||||
window.opener.postMessage(2, "http://mochi.test:8888"); |
||||
window.close(); |
||||
|
||||
</script> |
||||
</body> |
||||
</html> |
@ -1,57 +0,0 @@
|
||||
<!DOCTYPE HTML> |
||||
<html> |
||||
<!-- |
||||
https://bugzilla.mozilla.org/show_bug.cgi?id=38959 |
||||
--> |
||||
<head> |
||||
<title>Test for Bug 38959</title> |
||||
<script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script> |
||||
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/> |
||||
</head> |
||||
<body> |
||||
<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=38959">Mozilla Bug 38959</a> |
||||
<p id="display"></p> |
||||
<div id="content" style="display: none"> |
||||
<iframe id="frame"></iframe> |
||||
</div> |
||||
<pre id="test"> |
||||
<script type="application/javascript"> |
||||
|
||||
/** Test for Bug 38959 **/ |
||||
|
||||
var newValue; |
||||
|
||||
function watcher(id, ol, ne) |
||||
{ |
||||
newValue = ne; |
||||
return ne; |
||||
} |
||||
|
||||
function openWindow(url, crossOrigin) |
||||
{ |
||||
newValue = true; |
||||
var w = window.open(url); |
||||
w.watch("x", watcher); |
||||
} |
||||
|
||||
function receiveMessage(evt) |
||||
{ |
||||
ok(newValue, "Watchpoints only allowed same-origin."); |
||||
if (evt.data == 1) { |
||||
openWindow("/tests/dom/tests/mochitest/bugs/iframe_bug38959-2.html"); |
||||
} |
||||
else { |
||||
SimpleTest.finish(); |
||||
} |
||||
} |
||||
|
||||
SimpleTest.waitForExplicitFinish(); |
||||
|
||||
window.addEventListener("message", receiveMessage, false); |
||||
|
||||
openWindow("http://example.org/tests/dom/tests/mochitest/bugs/iframe_bug38959-1.html"); |
||||
|
||||
</script> |
||||
</pre> |
||||
</body> |
||||
</html> |
@ -1,8 +0,0 @@
|
||||
// |jit-test| error:TypeError
|
||||
|
||||
// Binary: cache/js-dbg-32-29add08d84ae-linux
|
||||
// Flags: -j
|
||||
//
|
||||
this.watch('y', /x/g ); |
||||
for each (y in ['q', 'q', 'q']) continue; |
||||
gc(); |
@ -1,6 +0,0 @@
|
||||
// Binary: cache/js-dbg-64-38754465ffde-linux
|
||||
// Flags:
|
||||
//
|
||||
this.__defineSetter__("x", gc); |
||||
this.watch("x",function(){return}); |
||||
x = 3; |
@ -1,4 +0,0 @@
|
||||
// Binary: cache/js-dbg-64-9d51f2a931f7-linux
|
||||
// Flags:
|
||||
//
|
||||
({x:function(){}}).watch('x',function(){}); |
@ -1,9 +0,0 @@
|
||||
// Binary: cache/js-dbg-64-a6d7a5677b4c-linux
|
||||
// Flags:
|
||||
//
|
||||
this.__defineSetter__("x", function(){}) |
||||
this.watch("x", "".localeCompare) |
||||
window = x |
||||
Object.defineProperty(this, "x", ({ |
||||
set: window |
||||
})) |
@ -1,9 +0,0 @@
|
||||
// |jit-test| error:TypeError
|
||||
|
||||
// Binary: cache/js-dbg-32-1c8e91b2e3a4-linux
|
||||
// Flags:
|
||||
//
|
||||
a = evalcx("lazy"); |
||||
a.watch("x", function() {}); |
||||
({}).watch("x", function() {}); |
||||
a.__defineGetter__("y", {}); |
@ -1,9 +0,0 @@
|
||||
// Binary: cache/js-dbg-32-f951e9151626-linux
|
||||
// Flags: -m -n
|
||||
//
|
||||
o = evalcx("lazy").__proto__ |
||||
gc() |
||||
try { |
||||
o.watch() |
||||
} catch (e) {} |
||||
o.constructor() |
@ -1,10 +0,0 @@
|
||||
// |jit-test| error:ReferenceError
|
||||
|
||||
// Binary: cache/js-dbg-64-67bf9a4a1f77-linux
|
||||
// Flags: --ion-eager
|
||||
//
|
||||
|
||||
(function () { |
||||
var a = ['x', 'y']; |
||||
obj.watch(a[+("0")], counter); |
||||
})(); |
@ -1,6 +0,0 @@
|
||||
// |jit-test| error:TypeError
|
||||
|
||||
// Binary: cache/js-dbg-64-bf8f2961d0cc-linux
|
||||
// Flags:
|
||||
//
|
||||
Object.watch.call(new Uint8ClampedArray, "length", function() {}); |
@ -1,8 +0,0 @@
|
||||
gczeal(8, 1) |
||||
function recurse(x) { |
||||
recurse; |
||||
if (x < 20) |
||||
recurse(x + 1); |
||||
}; |
||||
this.watch(5, (function () {})) |
||||
recurse(0) |
@ -1,13 +0,0 @@
|
||||
// Don't crash or assert.
|
||||
|
||||
var d; |
||||
this.watch("d", eval); |
||||
(function () { |
||||
(eval("\ |
||||
(function () {\ |
||||
for (let x = 0; x < 2; ++x) {\ |
||||
d = x\ |
||||
}\ |
||||
})\ |
||||
"))() |
||||
})() |
@ -1,9 +0,0 @@
|
||||
// |jit-test| error: TypeError
|
||||
// don't assert
|
||||
|
||||
print(this.watch("x", |
||||
function() { |
||||
Object.defineProperty(this, "x", ({ |
||||
get: (Int8Array) |
||||
})) |
||||
}))(x = /x/) |
@ -1,9 +0,0 @@
|
||||
var n = 0; |
||||
var a = []; |
||||
for (var i = 0; i < 20; i++) |
||||
a[i] = {}; |
||||
a[18].watch("p", function () { n++; }); |
||||
delete a[18].p; |
||||
for (var i = 0; i < 20; i++) |
||||
a[i].p = 0; |
||||
assertEq(n, 1); |
@ -1,6 +0,0 @@
|
||||
// |jit-test| error: TypeError
|
||||
function f(o) { |
||||
o.watch("x", this); |
||||
} |
||||
var c = evalcx(""); |
||||
f(c); |
@ -1,12 +0,0 @@
|
||||
|
||||
done = false; |
||||
try { |
||||
function x() {} |
||||
print(this.watch("d", Object.create)) |
||||
var d = {} |
||||
} catch (e) {} |
||||
try { |
||||
eval("d = ''") |
||||
done = true; |
||||
} catch (e) {} |
||||
assertEq(done, false); |
@ -1,3 +0,0 @@
|
||||
// |jit-test| error:TypeError
|
||||
|
||||
evalcx('').watch("", /()/); |
@ -1,7 +0,0 @@
|
||||
var o = {}; |
||||
o.watch("p", function() { }); |
||||
|
||||
for (var i = 0; i < 10; i++) { |
||||
o.p = 123; |
||||
delete o.p; |
||||
} |
@ -1,9 +0,0 @@
|
||||
var msg = ""; |
||||
try { |
||||
this.__defineSetter__('x', Object.create); |
||||
this.watch('x', function() {}); |
||||
x = 3; |
||||
} catch (e) { |
||||
msg = e.toString(); |
||||
} |
||||
assertEq(msg, "TypeError: undefined is not an object or null"); |
@ -1,13 +0,0 @@
|
||||
this.watch("x", Object.create) |
||||
try { |
||||
(function() { |
||||
this.__defineGetter__("x", |
||||
function() { |
||||
return this |
||||
}) |
||||
})() |
||||
} catch(e) {} |
||||
Object.defineProperty(x, "x", ({ |
||||
set: Uint16Array |
||||
})) |
||||
|
@ -1,9 +0,0 @@
|
||||
if (typeof gczeal != "function") |
||||
gczeal = function() {} |
||||
|
||||
// don't crash
|
||||
x = (evalcx('lazy')) |
||||
x.watch("", function () {}) |
||||
gczeal(1) |
||||
for (w in x) {} |
||||
|
@ -1,20 +0,0 @@
|
||||
s = newGlobal() |
||||
try { |
||||
evalcx("\ |
||||
Object.defineProperty(this,\"i\",{enumerable:true,get:function(){t}});\ |
||||
for each(y in this)true\ |
||||
", s) |
||||
} catch (e) {} |
||||
try { |
||||
evalcx("\ |
||||
for(z=0,(7).watch(\"\",eval);;g){\ |
||||
if(z=1){({t:function(){}})\ |
||||
}\ |
||||
", s) |
||||
} catch (e) {} |
||||
try { |
||||
evalcx("\ |
||||
Object.defineProperty(this,\"g2\",{get:function(){return this}});\ |
||||
g2.y()\ |
||||
", s) |
||||
} catch (e) {} |
@ -1,20 +0,0 @@
|
||||
s = newGlobal() |
||||
try { |
||||
evalcx("\ |
||||
Object.defineProperty(this,\"i\",{enumerable:true,get:function(){t}});\ |
||||
for each(y in this)true\ |
||||
", s) |
||||
} catch (e) {} |
||||
try { |
||||
evalcx("\ |
||||
for(z=0,(7).watch(\"\",eval);;g){\ |
||||
if(z=1){({t:function(){}})\ |
||||
}\ |
||||
", s) |
||||
} catch (e) {} |
||||
try { |
||||
evalcx("\ |
||||
Object.defineProperty(this,\"g2\",{get:function(){return this}});\ |
||||
g2.y(\"\")\ |
||||
", s) |
||||
} catch (e) {} |
@ -1,3 +0,0 @@
|
||||
this.__defineSetter__("x", function(){}); |
||||
this.watch("x", eval); |
||||
x = 0; |
@ -1,7 +0,0 @@
|
||||
function testNonStubGetter() { |
||||
{ let [] = []; (this.watch("x", function(p, o, n) { return /a/g.exec(p, o, n); })); }; |
||||
(function () { (eval("(function(){for each (x in [1, 2, 2]);});"))(); })(); |
||||
this.unwatch("x"); |
||||
return "ok"; |
||||
} |
||||
assertEq(testNonStubGetter(), "ok"); |
@ -1,7 +0,0 @@
|
||||
for (var i = 0; i < 5; ++i) { |
||||
var o = {} |
||||
Object.defineProperty(o, 'x', { value:"cow", writable:false }); |
||||
var r = o.watch('x', function() {}); |
||||
assertEq(r, undefined); |
||||
o.x = 4; |
||||
} |
@ -1,16 +0,0 @@
|
||||
// Test no assert or crash from outer recorders (bug 465145)
|
||||
function testBug465145() { |
||||
this.__defineSetter__("x", function(){}); |
||||
this.watch("x", function(){}); |
||||
y = this; |
||||
for (var z = 0; z < 2; ++z) { x = y }; |
||||
this.__defineSetter__("x", function(){}); |
||||
for (var z = 0; z < 2; ++z) { x = y }; |
||||
} |
||||
|
||||
function testTrueShiftTrue() { |
||||
var a = new Array(5); |
||||
for (var i=0;i<5;++i) a[i] = "" + (true << true); |
||||
return a.join(","); |
||||
} |
||||
assertEq(testTrueShiftTrue(), "2,2,2,2,2"); |
@ -1,63 +0,0 @@
|
||||
// Test that the watch handler is not called recursively for the same object
|
||||
// and property.
|
||||
(function() { |
||||
var obj1 = {}, obj2 = {}; |
||||
var handler_entry_count = 0; |
||||
var handler_exit_count = 0; |
||||
|
||||
obj1.watch('x', handler); |
||||
obj1.watch('y', handler); |
||||
obj2.watch('x', handler); |
||||
obj1.x = 1; |
||||
assertEq(handler_entry_count, 3); |
||||
assertEq(handler_exit_count, 3); |
||||
|
||||
function handler(id) { |
||||
handler_entry_count++; |
||||
assertEq(handler_exit_count, 0); |
||||
switch (true) { |
||||
case this === obj1 && id === "x": |
||||
assertEq(handler_entry_count, 1); |
||||
obj2.x = 3; |
||||
assertEq(handler_exit_count, 2); |
||||
break; |
||||
case this === obj2 && id === "x": |
||||
assertEq(handler_entry_count, 2); |
||||
obj1.y = 4; |
||||
assertEq(handler_exit_count, 1); |
||||
break; |
||||
default: |
||||
assertEq(this, obj1); |
||||
assertEq(id, "y"); |
||||
assertEq(handler_entry_count, 3); |
||||
|
||||
// We expect no more watch handler invocations
|
||||
obj1.x = 5; |
||||
obj1.y = 6; |
||||
obj2.x = 7; |
||||
assertEq(handler_exit_count, 0); |
||||
break; |
||||
} |
||||
++handler_exit_count; |
||||
assertEq(handler_entry_count, 3); |
||||
} |
||||
})(); |
||||
|
||||
|
||||
// Test that run-away recursion in watch handlers is properly handled.
|
||||
(function() { |
||||
var obj = {}; |
||||
var i = 0; |
||||
try { |
||||
handler(); |
||||
throw new Error("Unreachable"); |
||||
} catch(e) { |
||||
assertEq(e instanceof InternalError, true); |
||||
} |
||||
|
||||
function handler() { |
||||
var prop = "a" + ++i; |
||||
obj.watch(prop, handler); |
||||
obj[prop] = 2; |
||||
} |
||||
})(); |
@ -1,3 +0,0 @@
|
||||
(function() { |
||||
[{ "9": [] }.watch([], function(){})] |
||||
})() |
@ -1,5 +0,0 @@
|
||||
// |jit-test| error: InternalError: too much recursion
|
||||
(function f() { |
||||
"".watch(2, function() {}); |
||||
f(); |
||||
})() |
@ -1,8 +0,0 @@
|
||||
// |jit-test| slow
|
||||
function x() {} |
||||
for (var j = 0; j < 9999; ++j) { |
||||
(function() { |
||||
x += x.watch("endsWith", ArrayBuffer); |
||||
return 0 >> Function(x) |
||||
})() |
||||
} |
@ -1,8 +0,0 @@
|
||||
// |jit-test| error: ReferenceError
|
||||
|
||||
eval("(function() { " + "\ |
||||
var o = {};\ |
||||
o.watch('p', function() { });\ |
||||
for (var i = 0; i < 10; \u5ede ++)\ |
||||
o.p = 123;\ |
||||
" + " })();"); |
@ -1,8 +0,0 @@
|
||||
Object.defineProperty(Object.prototype, 'x', {
|
||||
set: function() { evalcx('lazy'); }
|
||||
}); |
||||
var obj = {}; |
||||
obj.watch("x", function (id, oldval, newval) {}); |
||||
for (var str in 'A') { |
||||
obj.x = 1; |
||||
} |
@ -1,10 +0,0 @@
|
||||
Object.defineProperty(Object.prototype, 'x', {
|
||||
set: function() { evalcx('lazy'); }
|
||||
}); |
||||
var obj = {}; |
||||
var prot = {}; |
||||
obj.__proto__ = prot; |
||||
obj.watch("x", function (id, oldval, newval) {}); |
||||
for (var str in 'A') { |
||||
obj.x = 1; |
||||
} |
@ -1,9 +0,0 @@
|
||||
var flag = 0; |
||||
var a = {}; |
||||
Object.defineProperty(a, "value", {set: function(x) {}}); |
||||
a.watch("value", function(){flag++;}); |
||||
|
||||
for(var i = 0; i < 100; i++) { |
||||
a.value = i; |
||||
assertEq(flag, i+1); |
||||
} |
@ -1,8 +0,0 @@
|
||||
(function () { |
||||
var a; |
||||
eval("for(w in ((function(x,y){b:0})())) ;"); |
||||
})(); |
||||
|
||||
this.__defineSetter__("l", function() { gc() }); |
||||
this.watch("l", function(x) { yield {} }); |
||||
l = true; |
@ -1,7 +0,0 @@
|
||||
(function() { |
||||
for (a = 0; a < 2; a++) |
||||
''.watch("", function() {}) |
||||
})() |
||||
|
||||
/* Don't crash or assert. */ |
||||
|
@ -1,10 +0,0 @@
|
||||
// vim: set ts=8 sts=4 et sw=4 tw=99:
|
||||
|
||||
var count = 0; |
||||
this.watch("x", function() { |
||||
count++; |
||||
}); |
||||
for(var i=0; i<10; i++) { |
||||
x = 2; |
||||
} |
||||
assertEq(count, 10); |
@ -1,7 +0,0 @@
|
||||
var o = {}; |
||||
for(var i=0; i<5; i++) { |
||||
o.p = 2; |
||||
o.watch("p", function() { }); |
||||
o.p = 2; |
||||
delete o.p; |
||||
} |
@ -1,4 +0,0 @@
|
||||
(function() { |
||||
for (a = 0; a < 2; a++) |
||||
''.watch("", function() {}) |
||||
})() |
@ -1,3 +0,0 @@
|
||||
for each(let w in [[], 0, [], 0]) { |
||||
w.unwatch() |
||||
} |
@ -1,7 +0,0 @@
|
||||
// assignments to watched objects must not be cached
|
||||
var obj = {x: 0}; |
||||
var hits = 0; |
||||
obj.watch("x", function (id, oldval, newval) { hits++; return newval; }); |
||||
for (var i = 0; i < 10; i++) |
||||
obj.x = i; |
||||
assertEq(hits, 10); |
@ -1,17 +0,0 @@
|
||||
// assignments to watched objects must not be traced
|
||||
var hits = 0; |
||||
function counter(id, oldval, newval) { |
||||
hits++; |
||||
return newval; |
||||
} |
||||
|
||||
(function () { |
||||
var obj = {x: 0, y: 0}; |
||||
var a = ['x', 'y']; |
||||
obj.watch('z', counter); |
||||
for (var i = 0; i < 14; i++) { |
||||
obj.watch(a[+(i > 8)], counter); |
||||
obj.y = i; |
||||
} |
||||
})(); |
||||
assertEq(hits, 5); |
@ -1,8 +0,0 @@
|
||||
// assignments to watched properties via ++ must not be cached
|
||||
var obj = {x: 0}; |
||||
var hits = 0; |
||||
obj.watch("x", function (id, oldval, newval) { hits++; return newval; }); |
||||
for (var i = 0; i < 10; i++) |
||||
obj.x++; |
||||
assertEq(hits, 10); |
||||
|
@ -1,18 +0,0 @@
|
||||
// assignments to watched properties via ++ must not be traced
|
||||
var hits = 0; |
||||
function counter(id, oldval, newval) { |
||||
hits++; |
||||
return newval; |
||||
} |
||||
|
||||
(function () { |
||||
var obj = {x: 0, y: 0}; |
||||
var a = ['x', 'y']; |
||||
obj.watch('z', counter); |
||||
for (var i = 0; i < 14; i++) { |
||||
obj.watch(a[+(i > 8)], counter); |
||||
obj.y++; |
||||
} |
||||
})(); |
||||
assertEq(hits, 5); |
||||
|
@ -1,7 +0,0 @@
|
||||
// assignment to watched global properties must not be cached
|
||||
x = 0; |
||||
var hits = 0; |
||||
this.watch("x", function (id, oldval, newval) { hits++; return newval; }); |
||||
for (var i = 0; i < 10; i++) |
||||
x = i; |
||||
assertEq(hits, 10); |
@ -1,19 +0,0 @@
|
||||
// assignment to watched global properties must not be traced
|
||||
var hits = 0; |
||||
function counter(id, oldval, newval) { |
||||
hits++; |
||||
return newval; |
||||
} |
||||
|
||||
var x = 0; |
||||
var y = 0; |
||||
(function () { |
||||
var a = ['x', 'y']; |
||||
this.watch('z', counter); |
||||
for (var i = 0; i < 14; i++) { |
||||
this.watch(a[+(i > 8)], counter); |
||||
y = 1; |
||||
} |
||||
})(); |
||||
assertEq(hits, 5); |
||||
|
@ -1,20 +0,0 @@
|
||||
// assignment to watched global properties must not be traced
|
||||
var hits = 0; |
||||
function counter(id, oldval, newval) { |
||||
hits++; |
||||
return newval; |
||||
} |
||||
|
||||
var x = 0; |
||||
var y = 0; |
||||
function f() { |
||||
var a = [{}, this]; |
||||
for (var i = 0; i < 14; i++) { |
||||
print(shapeOf(this)); |
||||
Object.prototype.watch.call(a[+(i > 8)], "y", counter); |
||||
y++; |
||||
} |
||||
} |
||||
f(); |
||||
assertEq(hits, 5); |
||||
|
@ -1,9 +0,0 @@
|
||||
// adding assignment + watchpoint vs. caching
|
||||
var hits = 0; |
||||
var obj = {}; |
||||
obj.watch("x", function (id, oldval, newval) { hits++; return newval; }); |
||||
for (var i = 0; i < 10; i++) { |
||||
obj.x = 1; |
||||
delete obj.x; |
||||
} |
||||
assertEq(hits, 10); |
@ -1,27 +0,0 @@
|
||||
// test against future pic support for symbols
|
||||
|
||||
// assignments to watched objects must not be cached
|
||||
var obj = {}; |
||||
var x = Symbol.for("x"); |
||||
obj[x] = 0; |
||||
var hits = 0; |
||||
obj.watch(x, function (id, oldval, newval) { hits++; return newval; }); |
||||
for (var i = 0; i < 10; i++) |
||||
obj[x] = i; |
||||
assertEq(hits, 10); |
||||
|
||||
// assignments to watched properties via ++ must not be cached
|
||||
hits = 0; |
||||
for (var i = 0; i < 10; i++) |
||||
obj[x]++; |
||||
assertEq(hits, 10); |
||||
|
||||
// adding assignment + watchpoint vs. caching
|
||||
hits = 0; |
||||
obj = {}; |
||||
obj.watch(x, function (id, oldval, newval) { hits++; return newval; }); |
||||
for (var i = 0; i < 10; i++) { |
||||
obj[x] = 1; |
||||
delete obj[x]; |
||||
} |
||||
assertEq(hits, 10); |
@ -1,14 +0,0 @@
|
||||
// |jit-test| allow-oom
|
||||
enableSPSProfiling(); |
||||
loadFile('\ |
||||
for (var i = 0; i < 2; i++) {\ |
||||
obj = { m: function () {} };\ |
||||
obj.watch("m", function () { float32 = 0 + obj.foo; });\ |
||||
obj.m = 0;\ |
||||
}\ |
||||
'); |
||||
gcparam("maxBytes", gcparam("gcBytes") + (1)*1024); |
||||
newGlobal("same-compartment"); |
||||
function loadFile(lfVarx) { |
||||
evaluate(lfVarx, { noScriptRval : true, isRunOnce : true });
|
||||
} |