mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-10 20:05:49 +00:00
Backout bug 670857, bug 703176
This commit is contained in:
parent
4c301c4cae
commit
d42e9788e4
@ -1,7 +1,6 @@
|
||||
function test()
|
||||
{
|
||||
waitForExplicitFinish();
|
||||
ignoreAllUncaughtExceptions();
|
||||
var frame = document.getElementById("customizeToolbarSheetIFrame");
|
||||
frame.addEventListener("load", testCustomizeFrameLoadedPre, true);
|
||||
|
||||
|
@ -99,5 +99,4 @@ function test() {
|
||||
});
|
||||
|
||||
waitForExplicitFinish();
|
||||
ignoreAllUncaughtExceptions();
|
||||
}
|
||||
|
@ -45,7 +45,6 @@ function test() {
|
||||
let cm = Cc["@mozilla.org/cookiemanager;1"].
|
||||
getService(Ci.nsICookieManager);
|
||||
waitForExplicitFinish();
|
||||
ignoreAllUncaughtExceptions();
|
||||
|
||||
const TEST_URL = "http://mochi.test:8888/browser/browser/components/privatebrowsing/test/browser/title.sjs";
|
||||
|
||||
|
@ -18,7 +18,6 @@
|
||||
|
||||
function test() {
|
||||
waitForExplicitFinish();
|
||||
ignoreAllUncaughtExceptions();
|
||||
|
||||
let blankState = { windows: [{ tabs: [{ entries: [{ url: "about:blank" }] }]}]};
|
||||
let crashState = { windows: [{ tabs: [{ entries: [{ url: "about:mozilla" }] }]}]};
|
||||
|
@ -44,7 +44,6 @@ function observeOneRestore(callback) {
|
||||
|
||||
function test() {
|
||||
waitForExplicitFinish();
|
||||
ignoreAllUncaughtExceptions();
|
||||
|
||||
// There should be one tab when we start the test
|
||||
let [origTab] = gBrowser.visibleTabs;
|
||||
|
@ -52,7 +52,6 @@ function cleanup() {
|
||||
function test() {
|
||||
/** Bug 607016 - If a tab is never restored, attributes (eg. hidden) aren't updated correctly **/
|
||||
waitForExplicitFinish();
|
||||
ignoreAllUncaughtExceptions();
|
||||
|
||||
// Set the pref to true so we know exactly how many tabs should be restoring at
|
||||
// any given time. This guarantees that a finishing load won't start another.
|
||||
|
@ -5,7 +5,6 @@
|
||||
function test()
|
||||
{
|
||||
waitForExplicitFinish();
|
||||
ignoreAllUncaughtExceptions();
|
||||
|
||||
let doc;
|
||||
let objectNode;
|
||||
|
@ -127,7 +127,6 @@ function finishInspectorTests()
|
||||
function test()
|
||||
{
|
||||
waitForExplicitFinish();
|
||||
ignoreAllUncaughtExceptions();
|
||||
gBrowser.selectedTab = gBrowser.addTab();
|
||||
gBrowser.selectedBrowser.addEventListener("load", function() {
|
||||
gBrowser.selectedBrowser.removeEventListener("load", arguments.callee, true);
|
||||
|
@ -111,7 +111,6 @@ function inspectorRuleTrap()
|
||||
function test()
|
||||
{
|
||||
waitForExplicitFinish();
|
||||
ignoreAllUncaughtExceptions();
|
||||
|
||||
tab1 = gBrowser.addTab();
|
||||
gBrowser.selectedTab = tab1;
|
||||
|
@ -4,7 +4,6 @@
|
||||
function test()
|
||||
{
|
||||
waitForExplicitFinish();
|
||||
ignoreAllUncaughtExceptions();
|
||||
|
||||
let doc;
|
||||
let nodes;
|
||||
|
@ -218,7 +218,6 @@ function finishInspectorTests()
|
||||
function test()
|
||||
{
|
||||
waitForExplicitFinish();
|
||||
ignoreAllUncaughtExceptions();
|
||||
gBrowser.selectedTab = gBrowser.addTab();
|
||||
gBrowser.selectedBrowser.addEventListener("load", function() {
|
||||
gBrowser.selectedBrowser.removeEventListener("load", arguments.callee, true);
|
||||
|
@ -213,7 +213,6 @@ function finishUp() {
|
||||
function test()
|
||||
{
|
||||
waitForExplicitFinish();
|
||||
ignoreAllUncaughtExceptions();
|
||||
gBrowser.selectedTab = gBrowser.addTab();
|
||||
gBrowser.selectedBrowser.addEventListener("load", function() {
|
||||
gBrowser.selectedBrowser.removeEventListener("load", arguments.callee, true);
|
||||
|
@ -137,7 +137,6 @@ function ruleViewOpened2()
|
||||
function test()
|
||||
{
|
||||
waitForExplicitFinish();
|
||||
ignoreAllUncaughtExceptions();
|
||||
|
||||
tab1 = gBrowser.addTab();
|
||||
gBrowser.selectedTab = tab1;
|
||||
|
@ -263,7 +263,6 @@ function inspectorTabUnload1(evt)
|
||||
function test()
|
||||
{
|
||||
waitForExplicitFinish();
|
||||
ignoreAllUncaughtExceptions();
|
||||
|
||||
tab1 = gBrowser.addTab();
|
||||
gBrowser.selectedTab = tab1;
|
||||
|
@ -105,7 +105,6 @@ function finishUp() {
|
||||
function test()
|
||||
{
|
||||
waitForExplicitFinish();
|
||||
ignoreAllUncaughtExceptions();
|
||||
gBrowser.selectedTab = gBrowser.addTab();
|
||||
gBrowser.selectedBrowser.addEventListener("load", function() {
|
||||
gBrowser.selectedBrowser.removeEventListener("load", arguments.callee, true);
|
||||
|
@ -14,7 +14,6 @@ Cu.import("resource:///modules/devtools/CssHtmlTree.jsm");
|
||||
function test()
|
||||
{
|
||||
waitForExplicitFinish();
|
||||
ignoreAllUncaughtExceptions();
|
||||
addTab(TEST_URI);
|
||||
browser.addEventListener("load", tabLoaded, true);
|
||||
}
|
||||
|
@ -79,7 +79,6 @@ function finishUp()
|
||||
function test()
|
||||
{
|
||||
waitForExplicitFinish();
|
||||
ignoreAllUncaughtExceptions();
|
||||
gBrowser.selectedTab = gBrowser.addTab();
|
||||
gBrowser.selectedBrowser.addEventListener("load", function(evt) {
|
||||
gBrowser.selectedBrowser.removeEventListener(evt.type, arguments.callee, true);
|
||||
|
@ -43,7 +43,6 @@
|
||||
const TEST_URI = "http://example.com/browser/browser/devtools/webconsole/test//browser/test-error.html";
|
||||
|
||||
function test() {
|
||||
expectUncaughtException();
|
||||
addTab(TEST_URI);
|
||||
browser.addEventListener("load", onLoad, true);
|
||||
}
|
||||
|
@ -44,7 +44,6 @@
|
||||
const TEST_DUPLICATE_ERROR_URI = "http://example.com/browser/browser/devtools/webconsole/test//browser/test-duplicate-error.html";
|
||||
|
||||
function test() {
|
||||
expectUncaughtException();
|
||||
addTab(TEST_DUPLICATE_ERROR_URI);
|
||||
browser.addEventListener("DOMContentLoaded", testDuplicateErrors, false);
|
||||
}
|
||||
@ -58,7 +57,6 @@ function testDuplicateErrors() {
|
||||
|
||||
Services.console.registerListener(consoleObserver);
|
||||
|
||||
expectUncaughtException();
|
||||
content.location.reload();
|
||||
}
|
||||
|
||||
|
@ -29,7 +29,6 @@ function contentLoaded(aEvent) {
|
||||
browser.removeEventListener("load", contentLoaded, true);
|
||||
|
||||
let button = content.document.querySelector("button");
|
||||
expectUncaughtException();
|
||||
EventUtils.sendMouseEvent({ type: "click" }, button, content);
|
||||
executeSoon(buttonClicked);
|
||||
}
|
||||
|
@ -18,7 +18,6 @@ function tabLoaded(aEvent) {
|
||||
HUDService.activateHUDForContext(gBrowser.selectedTab);
|
||||
|
||||
gBrowser.selectedBrowser.addEventListener("load", tabReloaded, true);
|
||||
expectUncaughtException();
|
||||
content.location.reload();
|
||||
}
|
||||
|
||||
@ -44,7 +43,6 @@ function tabReloaded(aEvent) {
|
||||
|
||||
newTabIsOpen = true;
|
||||
gBrowser.selectedBrowser.addEventListener("load", tabLoaded, true);
|
||||
expectUncaughtException();
|
||||
content.location = TEST_URI;
|
||||
});
|
||||
}
|
||||
@ -55,7 +53,6 @@ function testEnd() {
|
||||
}
|
||||
|
||||
function test() {
|
||||
expectUncaughtException();
|
||||
addTab(TEST_URI);
|
||||
browser.addEventListener("load", tabLoaded, true);
|
||||
}
|
||||
|
@ -64,7 +64,6 @@ function test()
|
||||
browser.removeEventListener(aEvent.type, arguments.callee, true);
|
||||
executeSoon(onContentLoaded);
|
||||
}, true);
|
||||
expectUncaughtException();
|
||||
content.location = TEST_URI;
|
||||
}, true);
|
||||
}
|
||||
|
@ -90,7 +90,6 @@ function test()
|
||||
registerCleanupFunction(testEnd);
|
||||
|
||||
executeSoon(function() {
|
||||
expectUncaughtException();
|
||||
content.location = TEST_URI;
|
||||
});
|
||||
}, true);
|
||||
|
@ -25,7 +25,6 @@ function onLoad(aEvent) {
|
||||
|
||||
gHudId = HUDService.getHudIdByWindow(content);
|
||||
browser.addEventListener("load", testWebDevLimits, true);
|
||||
expectUncaughtException();
|
||||
content.location = TEST_URI;
|
||||
}
|
||||
|
||||
@ -71,7 +70,6 @@ function testJsLimits(aEvent) {
|
||||
for (let i = 0; i < 11; i++) {
|
||||
var script = content.document.createElement("script");
|
||||
script.text = "fubar" + i + ".bogus(6);";
|
||||
expectUncaughtException();
|
||||
head.insertBefore(script, head.firstChild);
|
||||
}
|
||||
|
||||
|
@ -417,10 +417,7 @@ function testGen() {
|
||||
networkPanel = HUDService.openNetworkPanel(filterBox, httpActivity);
|
||||
networkPanel.isDoneCallback = function NP_doneCallback() {
|
||||
networkPanel.isDoneCallback = null;
|
||||
try {
|
||||
testDriver.next();
|
||||
} catch (e if e instanceof StopIteration) {
|
||||
}
|
||||
testDriver.next();
|
||||
}
|
||||
|
||||
yield;
|
||||
@ -481,5 +478,5 @@ function testGen() {
|
||||
networkPanel.panel.hidePopup(); */
|
||||
|
||||
// All done!
|
||||
finish();
|
||||
finishTest();
|
||||
}
|
||||
|
@ -7,7 +7,6 @@
|
||||
const TEST_URI = "http://example.com/browser/browser/devtools/webconsole/test//browser/test-error.html";
|
||||
|
||||
function test() {
|
||||
expectUncaughtException();
|
||||
addTab(TEST_URI);
|
||||
browser.addEventListener("DOMContentLoaded", testViewSource, false);
|
||||
}
|
||||
|
@ -187,7 +187,6 @@ function nextTest() {
|
||||
}
|
||||
|
||||
function test() {
|
||||
ignoreAllUncaughtExceptions();
|
||||
nextTest();
|
||||
}
|
||||
|
||||
|
@ -210,10 +210,6 @@ Tester.prototype = {
|
||||
}
|
||||
};
|
||||
|
||||
if (this.SimpleTest.isExpectingUncaughtException()) {
|
||||
this.currentTest.addResult(new testResult(false, "expectUncaughtException was called but no uncaught exception was detected!", "", false));
|
||||
}
|
||||
|
||||
// Clear document.popupNode. The test could have set it to a custom value
|
||||
// for its own purposes, nulling it out it will go back to the default
|
||||
// behavior of returning the last opened popup.
|
||||
@ -254,8 +250,6 @@ Tester.prototype = {
|
||||
execTest: function Tester_execTest() {
|
||||
this.dumper.dump("TEST-START | " + this.currentTest.path + "\n");
|
||||
|
||||
this.SimpleTest.reset();
|
||||
|
||||
// Load the tests into a testscope
|
||||
this.currentTest.scope = new testScope(this, this.currentTest);
|
||||
|
||||
@ -265,7 +259,7 @@ Tester.prototype = {
|
||||
this.currentTest.scope.gTestPath = this.currentTest.path;
|
||||
|
||||
// Override SimpleTest methods with ours.
|
||||
["ok", "is", "isnot", "todo", "todo_is", "todo_isnot", "info"].forEach(function(m) {
|
||||
["ok", "is", "isnot", "todo", "todo_is", "todo_isnot"].forEach(function(m) {
|
||||
this.SimpleTest[m] = this[m];
|
||||
}, this.currentTest.scope);
|
||||
|
||||
@ -302,13 +296,7 @@ Tester.prototype = {
|
||||
this.currentTest.scope.test();
|
||||
}
|
||||
} catch (ex) {
|
||||
var isExpected = !!this.SimpleTest.isExpectingUncaughtException();
|
||||
if (!this.SimpleTest.isIgnoringAllUncaughtExceptions()) {
|
||||
this.currentTest.addResult(new testResult(isExpected, "Exception thrown", ex, false));
|
||||
this.SimpleTest.expectUncaughtException(false);
|
||||
} else {
|
||||
this.currentTest.addResult(new testMessage("Exception thrown: " + ex));
|
||||
}
|
||||
this.currentTest.addResult(new testResult(false, "Exception thrown", ex, false));
|
||||
this.currentTest.scope.finish();
|
||||
}
|
||||
|
||||
@ -391,11 +379,12 @@ function testMessage(aName) {
|
||||
// cannot conflict with global variables used in tests.
|
||||
function testScope(aTester, aTest) {
|
||||
this.__tester = aTester;
|
||||
this.__browserTest = aTest;
|
||||
|
||||
var self = this;
|
||||
this.ok = function test_ok(condition, name, diag, stack) {
|
||||
aTest.addResult(new testResult(condition, name, diag, false,
|
||||
stack ? stack : Components.stack.caller));
|
||||
self.__browserTest.addResult(new testResult(condition, name, diag, false,
|
||||
stack ? stack : Components.stack.caller));
|
||||
};
|
||||
this.is = function test_is(a, b, name) {
|
||||
self.ok(a == b, name, "Got " + a + ", expected " + b, false,
|
||||
@ -406,8 +395,8 @@ function testScope(aTester, aTest) {
|
||||
Components.stack.caller);
|
||||
};
|
||||
this.todo = function test_todo(condition, name, diag, stack) {
|
||||
aTest.addResult(new testResult(!condition, name, diag, true,
|
||||
stack ? stack : Components.stack.caller));
|
||||
self.__browserTest.addResult(new testResult(!condition, name, diag, true,
|
||||
stack ? stack : Components.stack.caller));
|
||||
};
|
||||
this.todo_is = function test_todo_is(a, b, name) {
|
||||
self.todo(a == b, name, "Got " + a + ", expected " + b,
|
||||
@ -418,7 +407,7 @@ function testScope(aTester, aTest) {
|
||||
Components.stack.caller);
|
||||
};
|
||||
this.info = function test_info(name) {
|
||||
aTest.addResult(new testMessage(name));
|
||||
self.__browserTest.addResult(new testMessage(name));
|
||||
};
|
||||
|
||||
this.executeSoon = function test_executeSoon(func) {
|
||||
@ -449,13 +438,7 @@ function testScope(aTester, aTest) {
|
||||
// StopIteration means test is finished.
|
||||
self.finish();
|
||||
} catch (ex) {
|
||||
var isExpected = !!self.SimpleTest.isExpectingUncaughtException();
|
||||
if (!self.SimpleTest.isIgnoringAllUncaughtExceptions()) {
|
||||
aTest.addResult(new testResult(isExpected, "Exception thrown", ex, false));
|
||||
self.SimpleTest.expectUncaughtException(false);
|
||||
} else {
|
||||
aTest.addResult(new testMessage("Exception thrown: " + ex));
|
||||
}
|
||||
aTest.addResult(new testResult(false, "Exception thrown", ex, false));
|
||||
self.finish();
|
||||
}
|
||||
};
|
||||
@ -484,16 +467,19 @@ function testScope(aTester, aTest) {
|
||||
self.SimpleTest.copyToProfile(filename);
|
||||
};
|
||||
|
||||
this.expectUncaughtException = function test_expectUncaughtException(aExpecting) {
|
||||
self.SimpleTest.expectUncaughtException(aExpecting);
|
||||
this.expectUncaughtException = function test_expectUncaughtException() {
|
||||
self.SimpleTest.expectUncaughtException();
|
||||
};
|
||||
|
||||
this.ignoreAllUncaughtExceptions = function test_ignoreAllUncaughtExceptions(aIgnoring) {
|
||||
self.SimpleTest.ignoreAllUncaughtExceptions(aIgnoring);
|
||||
this.ignoreAllUncaughtExceptions = function test_ignoreAllUncaughtExceptions() {
|
||||
self.SimpleTest.ignoreAllUncaughtExceptions();
|
||||
};
|
||||
|
||||
this.finish = function test_finish() {
|
||||
self.__done = true;
|
||||
if (self.SimpleTest._expectingUncaughtException) {
|
||||
self.ok(false, "expectUncaughtException was called but no uncaught exception was detected!");
|
||||
}
|
||||
if (self.__waitTimer) {
|
||||
self.executeSoon(function() {
|
||||
if (self.__done && self.__waitTimer) {
|
||||
|
@ -693,16 +693,8 @@ SimpleTest.expectChildProcessCrash = function () {
|
||||
* Indicates to the test framework that the next uncaught exception during
|
||||
* the test is expected, and should not cause a test failure.
|
||||
*/
|
||||
SimpleTest.expectUncaughtException = function (aExpecting) {
|
||||
SimpleTest._expectingUncaughtException = aExpecting === void 0 || !!aExpecting;
|
||||
};
|
||||
|
||||
/**
|
||||
* Returns whether the test has indicated that it expects an uncaught exception
|
||||
* to occur.
|
||||
*/
|
||||
SimpleTest.isExpectingUncaughtException = function () {
|
||||
return SimpleTest._expectingUncaughtException;
|
||||
SimpleTest.expectUncaughtException = function () {
|
||||
SimpleTest._expectingUncaughtException = true;
|
||||
};
|
||||
|
||||
/**
|
||||
@ -710,26 +702,8 @@ SimpleTest.isExpectingUncaughtException = function () {
|
||||
* during the test are known problems that should be fixed in the future,
|
||||
* but which should not cause the test to fail currently.
|
||||
*/
|
||||
SimpleTest.ignoreAllUncaughtExceptions = function (aIgnoring) {
|
||||
SimpleTest._ignoringAllUncaughtExceptions = aIgnoring === void 0 || !!aIgnoring;
|
||||
};
|
||||
|
||||
/**
|
||||
* Returns whether the test has indicated that all uncaught exceptions should be
|
||||
* ignored.
|
||||
*/
|
||||
SimpleTest.isIgnoringAllUncaughtExceptions = function () {
|
||||
return SimpleTest._ignoringAllUncaughtExceptions;
|
||||
};
|
||||
|
||||
/**
|
||||
* Resets any state this SimpleTest object has. This is important for
|
||||
* browser chrome mochitests, which reuse the same SimpleTest object
|
||||
* across a run.
|
||||
*/
|
||||
SimpleTest.reset = function () {
|
||||
SimpleTest._ignoringAllUncaughtExceptions = false;
|
||||
SimpleTest._expectingUncaughtException = false;
|
||||
SimpleTest.ignoreAllUncaughtExceptions = function () {
|
||||
SimpleTest._ignoringAllUncaughtExceptions = true;
|
||||
};
|
||||
|
||||
if (isPrimaryTestWindow) {
|
||||
@ -950,21 +924,22 @@ var info = SimpleTest.info;
|
||||
|
||||
var gOldOnError = window.onerror;
|
||||
window.onerror = function simpletestOnerror(errorMsg, url, lineNumber) {
|
||||
var funcIdentifier = "[SimpleTest/SimpleTest.js, window.onerror]";
|
||||
|
||||
// Log the message.
|
||||
// XXX Chrome mochitests sometimes trigger this window.onerror handler,
|
||||
// but there are a number of uncaught JS exceptions from those tests.
|
||||
// For now, for tests that self identify as having unintentional uncaught
|
||||
// exceptions, just dump it so that the error is visible but doesn't cause
|
||||
// a test failure. See bug 652494.
|
||||
var message = "An error occurred: " + errorMsg + " at " + url + ":" + lineNumber;
|
||||
var href = SpecialPowers.getPrivilegedProps(window, 'location.href');
|
||||
var isExpected = !!SimpleTest._expectingUncaughtException;
|
||||
var message = "an " + (isExpected ? "" : "un") + "expected uncaught JS exception reported through window.onerror";
|
||||
var error = errorMsg + " at " + url + ":" + lineNumber;
|
||||
if (!SimpleTest._ignoringAllUncaughtExceptions) {
|
||||
SimpleTest.ok(isExpected, message, error);
|
||||
SimpleTest.ok(isExpected, funcIdentifier, message);
|
||||
SimpleTest._expectingUncaughtException = false;
|
||||
} else {
|
||||
SimpleTest.todo(false, message + ": " + error);
|
||||
SimpleTest.todo(false, funcIdentifier, message);
|
||||
}
|
||||
// There is no Components.stack.caller to log. (See bug 511888.)
|
||||
|
||||
|
@ -88,7 +88,6 @@ var Watcher = {
|
||||
|
||||
function test() {
|
||||
waitForExplicitFinish();
|
||||
ignoreAllUncaughtExceptions();
|
||||
|
||||
Services.wm.addListener(Watcher);
|
||||
|
||||
|
@ -3,7 +3,6 @@
|
||||
// exception
|
||||
function test() {
|
||||
waitForExplicitFinish();
|
||||
ignoreAllUncaughtExceptions();
|
||||
|
||||
var triggers = encodeURIComponent(JSON.stringify(TESTROOT + "unsigned.xpi"));
|
||||
gBrowser.selectedTab = gBrowser.addTab();
|
||||
|
@ -3,7 +3,6 @@
|
||||
// exception
|
||||
function test() {
|
||||
waitForExplicitFinish();
|
||||
ignoreAllUncaughtExceptions();
|
||||
|
||||
var triggers = encodeURIComponent(JSON.stringify({
|
||||
"Unsigned XPI": {
|
||||
|
@ -5,7 +5,6 @@
|
||||
// ----------------------------------------------------------------------------
|
||||
// Tests that cancelling multiple installs doesn't fail
|
||||
function test() {
|
||||
ignoreAllUncaughtExceptions();
|
||||
Harness.installConfirmCallback = confirm_install;
|
||||
Harness.installEndedCallback = install_ended;
|
||||
Harness.installsCompletedCallback = finish_test;
|
||||
|
@ -1,7 +1,6 @@
|
||||
// ----------------------------------------------------------------------------
|
||||
// Test whether an InstallTrigger.install call fails when xpinstall is disabled
|
||||
function test() {
|
||||
ignoreAllUncaughtExceptions();
|
||||
Harness.installDisabledCallback = install_disabled;
|
||||
Harness.installBlockedCallback = allow_blocked;
|
||||
Harness.installConfirmCallback = confirm_install;
|
||||
|
@ -3,7 +3,6 @@
|
||||
// web content
|
||||
function test() {
|
||||
waitForExplicitFinish();
|
||||
ignoreAllUncaughtExceptions();
|
||||
|
||||
var cr = Components.classes["@mozilla.org/chrome/chrome-registry;1"]
|
||||
.getService(Components.interfaces.nsIChromeRegistry);
|
||||
|
@ -2,7 +2,6 @@
|
||||
// Tests installing an unsigned add-on through a navigation. Should not be
|
||||
// blocked since the referer is whitelisted.
|
||||
function test() {
|
||||
ignoreAllUncaughtExceptions();
|
||||
Harness.installConfirmCallback = confirm_install;
|
||||
Harness.installsCompletedCallback = finish_test;
|
||||
Harness.setup();
|
||||
|
Loading…
Reference in New Issue
Block a user