Bug 935277 - Fix and reenable browser_webconsole_bug_632347_iterators_generators.js; r=past

This commit is contained in:
Mihai Sucan 2013-11-26 23:39:46 +02:00
parent 17ad56e44c
commit 8b1de41d29
3 changed files with 21 additions and 20 deletions

View File

@ -186,8 +186,6 @@ support-files =
[browser_webconsole_bug_630733_response_redirect_headers.js]
[browser_webconsole_bug_632275_getters_document_width.js]
[browser_webconsole_bug_632347_iterators_generators.js]
# Too many intermittent timeouts (bug 935277)
skip-if = os == "linux"
[browser_webconsole_bug_632817.js]
[browser_webconsole_bug_642108_pruneTest.js]
[browser_webconsole_bug_642615_autocomplete.js]

View File

@ -26,44 +26,45 @@ function consoleOpened(HUD) {
let jsterm = HUD.jsterm;
let win = content.wrappedJSObject;
let dbgWindow = dbg.makeGlobalObjectReference(win);
let container = win._container;
// Make sure autocomplete does not walk through iterators and generators.
let result = win.gen1.next();
let completion = JSPropertyProvider(dbgWindow, null, "gen1.");
let result = container.gen1.next();
let completion = JSPropertyProvider(dbgWindow, null, "_container.gen1.");
isnot(completion.matches.length, 0, "Got matches for gen1");
is(result+1, win.gen1.next(), "gen1.next() did not execute");
is(result+1, container.gen1.next(), "gen1.next() did not execute");
result = win.gen2.next();
result = container.gen2.next();
completion = JSPropertyProvider(dbgWindow, null, "gen2.");
completion = JSPropertyProvider(dbgWindow, null, "_container.gen2.");
isnot(completion.matches.length, 0, "Got matches for gen2");
is((result/2+1)*2, win.gen2.next(),
is((result/2+1)*2, container.gen2.next(),
"gen2.next() did not execute");
result = win.iter1.next();
result = container.iter1.next();
is(result[0], "foo", "iter1.next() [0] is correct");
is(result[1], "bar", "iter1.next() [1] is correct");
completion = JSPropertyProvider(dbgWindow, null, "iter1.");
completion = JSPropertyProvider(dbgWindow, null, "_container.iter1.");
isnot(completion.matches.length, 0, "Got matches for iter1");
result = win.iter1.next();
result = container.iter1.next();
is(result[0], "baz", "iter1.next() [0] is correct");
is(result[1], "baaz", "iter1.next() [1] is correct");
let dbgContent = dbg.makeGlobalObjectReference(content);
completion = JSPropertyProvider(dbgContent, null, "iter2.");
completion = JSPropertyProvider(dbgContent, null, "_container.iter2.");
isnot(completion.matches.length, 0, "Got matches for iter2");
completion = JSPropertyProvider(dbgWindow, null, "window.");
ok(completion, "matches available for window");
completion = JSPropertyProvider(dbgWindow, null, "window._container.");
ok(completion, "matches available for window._container");
ok(completion.matches.length, "matches available for window (length)");
jsterm.clearOutput();
jsterm.execute("window", (msg) => {
jsterm.execute("window._container", (msg) => {
jsterm.once("variablesview-fetched", testVariablesView.bind(null, HUD));
let anchor = msg.querySelector(".body a");
EventUtils.synthesizeMouse(anchor, 2, 2, {}, HUD.iframeWindow);

View File

@ -14,11 +14,13 @@ function genFunc() {
}
}
window.gen1 = genFunc();
gen1.next();
window._container = {};
_container.gen1 = genFunc();
_container.gen1.next();
var obj = { foo: "bar", baz: "baaz", hay: "stack" };
window.iter1 = Iterator(obj);
_container.iter1 = Iterator(obj);
function Range(low, high) {
this.low = low;
@ -42,9 +44,9 @@ Range.prototype.__iterator__ = function() {
return new RangeIterator(this);
}
window.iter2 = new Range(3, 15);
_container.iter2 = new Range(3, 15);
window.gen2 = (i * 2 for (i in iter2));
_container.gen2 = (i * 2 for (i in _container.iter2));
})();
</script>
</head>