Bug 1236991 - part 4: fix the tests to run in e10s mode, r?enndeakin
MozReview-Commit-ID: Hp0OK4xTTtx
--- a/browser/base/content/test/general/browser.ini
+++ b/browser/base/content/test/general/browser.ini
@@ -172,19 +172,17 @@ skip-if = os == "mac" # The Fitt's Law b
[browser_bookmark_popup.js]
skip-if = (os == "linux" && debug) # mouseover not reliable on linux debug builds
[browser_bookmark_titles.js]
skip-if = buildapp == 'mulet' || toolkit == "windows" # Disabled on Windows due to frequent failures (bugs 825739, 841341)
[browser_bug304198.js]
[browser_bug321000.js]
skip-if = true # browser_bug321000.js is disabled because newline handling is shaky (bug 592528)
[browser_bug329212.js]
-skip-if = e10s # Bug 1236991 - Update or remove tests that use fillInPageTooltip
[browser_bug331772_xul_tooltiptext_in_html.js]
-skip-if = e10s # Bug 1236991 - Update or remove tests that use fillInPageTooltip
[browser_bug356571.js]
[browser_bug380960.js]
[browser_bug386835.js]
[browser_bug406216.js]
[browser_bug408415.js]
[browser_bug409481.js]
[browser_bug409624.js]
[browser_bug413915.js]
@@ -228,17 +226,16 @@ skip-if = buildapp == 'mulet' || e10s #
[browser_bug550565.js]
[browser_bug553455.js]
skip-if = buildapp == 'mulet' # Bug 1066070 - I don't think either popup notifications nor addon install stuff works on mulet?
[browser_bug555224.js]
[browser_bug555767.js]
[browser_bug556061.js]
[browser_bug559991.js]
[browser_bug561623.js]
-skip-if = e10s # Bug 1236991 - Update or remove tests that use fillInPageTooltip
[browser_bug561636.js]
[browser_bug562649.js]
[browser_bug563588.js]
[browser_bug565575.js]
[browser_bug565667.js]
skip-if = toolkit != "cocoa"
[browser_bug567306.js]
[browser_bug575561.js]
@@ -246,17 +243,16 @@ skip-if = toolkit != "cocoa"
[browser_bug577121.js]
[browser_bug578534.js]
[browser_bug579872.js]
[browser_bug580638.js]
[browser_bug580956.js]
[browser_bug581242.js]
[browser_bug581253.js]
[browser_bug581947.js]
-skip-if = e10s # Bug 1236991 - Update or remove tests that use fillInPageTooltip
[browser_bug585558.js]
[browser_bug585785.js]
[browser_bug585830.js]
[browser_bug590206.js]
[browser_bug592338.js]
[browser_bug594131.js]
[browser_bug595507.js]
[browser_bug596687.js]
@@ -575,9 +571,9 @@ skip-if = !e10s || !crashreporter
skip-if = !e10s || !crashreporter
[browser_aboutTabCrashed_showForm.js]
skip-if = !e10s || !crashreporter
[browser_aboutTabCrashed_withoutDump.js]
skip-if = !e10s
[browser_csp_block_all_mixedcontent.js]
tags = mcb
[browser_newwindow_focus.js]
-skip-if = (os == "linux" && !e10s) # Bug 1263254 - Perma fails on Linux without e10s for some reason.
\ No newline at end of file
+skip-if = (os == "linux" && !e10s) # Bug 1263254 - Perma fails on Linux without e10s for some reason.
--- a/browser/base/content/test/general/browser_bug329212.js
+++ b/browser/base/content/test/general/browser_bug329212.js
@@ -1,42 +1,35 @@
-function test () {
-
- waitForExplicitFinish();
- gBrowser.selectedTab = gBrowser.addTab();
- BrowserTestUtils.browserLoaded(gBrowser.selectedBrowser).then(() => {
- let doc = gBrowser.contentDocument;
- let tooltip = document.getElementById("aHTMLTooltip");
-
- ok(tooltip.fillInPageTooltip(doc.getElementById("svg1")), "should get title");
- is(tooltip.getAttribute("label"), "This is a non-root SVG element title");
-
- ok(tooltip.fillInPageTooltip(doc.getElementById("text1")), "should get title");
- is(tooltip.getAttribute("label"), "\n\n\n This is a title\n\n ");
-
- ok(!tooltip.fillInPageTooltip(doc.getElementById("text2")), "should not get title");
-
- ok(!tooltip.fillInPageTooltip(doc.getElementById("text3")), "should not get title");
+"use strict";
- ok(tooltip.fillInPageTooltip(doc.getElementById("link1")), "should get title");
- is(tooltip.getAttribute("label"), "\n This is a title\n ");
- ok(tooltip.fillInPageTooltip(doc.getElementById("text4")), "should get title");
- is(tooltip.getAttribute("label"), "\n This is a title\n ");
-
- ok(!tooltip.fillInPageTooltip(doc.getElementById("link2")), "should not get title");
-
- ok(tooltip.fillInPageTooltip(doc.getElementById("link3")), "should get title");
- isnot(tooltip.getAttribute("label"), "");
+add_task(function*() {
+ yield BrowserTestUtils.withNewTab({
+ gBrowser,
+ url: "http://mochi.test:8888/browser/browser/base/content/test/general/title_test.svg",
+ }, function*(browser) {
+ yield ContentTask.spawn(browser, "", function() {
+ let tttp = Cc["@mozilla.org/embedcomp/default-tooltiptextprovider;1"]
+ .getService(Ci.nsITooltipTextProvider);
+ function checkElement(id, expectedTooltipText) {
+ let el = content.document.getElementById(id);
+ let textObj = {};
+ let shouldHaveTooltip = expectedTooltipText !== null;
+ is(tttp.getNodeText(el, textObj, {}), shouldHaveTooltip,
+ "element " + id + " should " + (shouldHaveTooltip ? "" : "not ") + "have a tooltip");
+ if (shouldHaveTooltip) {
+ is(textObj.value, expectedTooltipText,
+ "element " + id + " should have the right tooltip text");
+ }
+ }
+ checkElement("svg1", "This is a non-root SVG element title");
+ checkElement("text1", "\n\n\n This is a title\n\n ");
+ checkElement("text2", null);
+ checkElement("text3", null);
+ checkElement("link1", "\n This is a title\n ");
+ checkElement("text4", "\n This is a title\n ");
+ checkElement("link2", null);
+ checkElement("link3", "This is an xlink:title attribute");
+ checkElement("link4", "This is an xlink:title attribute");
+ checkElement("text5", null);
+ });
+ });
+});
- ok(tooltip.fillInPageTooltip(doc.getElementById("link4")), "should get title");
- is(tooltip.getAttribute("label"), "This is an xlink:title attribute");
-
- ok(!tooltip.fillInPageTooltip(doc.getElementById("text5")), "should not get title");
-
- gBrowser.removeCurrentTab();
- finish();
- });
-
- gBrowser.loadURI(
- "http://mochi.test:8888/browser/browser/base/content/test/general/title_test.svg"
- );
-}
-
--- a/browser/base/content/test/general/browser_bug331772_xul_tooltiptext_in_html.js
+++ b/browser/base/content/test/general/browser_bug331772_xul_tooltiptext_in_html.js
@@ -1,22 +1,19 @@
/**
* Tests that the tooltiptext attribute is used for XUL elements in an HTML doc.
*/
-function test () {
- waitForExplicitFinish();
- gBrowser.selectedTab = gBrowser.addTab();
- BrowserTestUtils.browserLoaded(gBrowser.selectedBrowser).then(() => {
- let doc = gBrowser.contentDocument;
- let tooltip = document.getElementById("aHTMLTooltip");
-
- ok(tooltip.fillInPageTooltip(doc.getElementById("xulToolbarButton")), "should get tooltiptext");
- is(tooltip.getAttribute("label"), "XUL tooltiptext");
+add_task(function*() {
+ yield BrowserTestUtils.withNewTab({
+ gBrowser,
+ url: "http://mochi.test:8888/browser/browser/base/content/test/general/xul_tooltiptext.xhtml",
+ }, function*(browser) {
+ yield ContentTask.spawn(browser, "", function() {
+ let textObj = {};
+ let tttp = Cc["@mozilla.org/embedcomp/default-tooltiptextprovider;1"]
+ .getService(Ci.nsITooltipTextProvider);
+ let xulToolbarButton = content.document.getElementById("xulToolbarButton");
+ ok(tttp.getNodeText(xulToolbarButton, textObj, {}), "should get tooltiptext");
+ is(textObj.value, "XUL tooltiptext");
+ });
+ });
+});
- gBrowser.removeCurrentTab();
- finish();
- });
-
- gBrowser.loadURI(
- "http://mochi.test:8888/browser/browser/base/content/test/general/xul_tooltiptext.xhtml"
- );
-}
-
--- a/browser/base/content/test/general/browser_bug561623.js
+++ b/browser/base/content/test/general/browser_bug561623.js
@@ -1,28 +1,24 @@
-function test() {
- waitForExplicitFinish();
- gBrowser.selectedTab = gBrowser.addTab();
- BrowserTestUtils.browserLoaded(gBrowser.selectedBrowser).then(() => {
- let doc = gBrowser.contentDocument;
- let tooltip = document.getElementById("aHTMLTooltip");
- let i = doc.getElementById("i");
-
- ok(!tooltip.fillInPageTooltip(i),
- "No tooltip should be shown when @title is null");
+add_task(function*() {
+ yield BrowserTestUtils.withNewTab({
+ gBrowser,
+ url: "data:text/html,<!DOCTYPE html><html><body><input id='i'></body></html>",
+ }, function*(browser) {
+ yield ContentTask.spawn(browser, "", function() {
+ let tttp = Cc["@mozilla.org/embedcomp/default-tooltiptextprovider;1"]
+ .getService(Ci.nsITooltipTextProvider);
+ let i = content.document.getElementById("i");
- i.title = "foo";
- ok(tooltip.fillInPageTooltip(i),
- "A tooltip should be shown when @title is not the empty string");
+ ok(!tttp.getNodeText(i, {}, {}),
+ "No tooltip should be shown when @title is null");
- i.pattern = "bar";
- ok(tooltip.fillInPageTooltip(i),
- "A tooltip should be shown when @title is not the empty string");
+ i.title = "foo";
+ ok(tttp.getNodeText(i, {}, {}),
+ "A tooltip should be shown when @title is not the empty string");
- gBrowser.removeCurrentTab();
- finish();
+ i.pattern = "bar";
+ ok(tttp.getNodeText(i, {}, {}),
+ "A tooltip should be shown when @title is not the empty string");
+ });
});
+});
- gBrowser.loadURI(
- "data:text/html,<!DOCTYPE html><html><body><input id='i'></body></html>"
- );
-}
-
--- a/browser/base/content/test/general/browser_bug581947.js
+++ b/browser/base/content/test/general/browser_bug581947.js
@@ -1,94 +1,90 @@
-function check(aElementName, aBarred, aType) {
- let doc = gBrowser.contentDocument;
- let tooltip = document.getElementById("aHTMLTooltip");
- let content = doc.getElementById('content');
+function check(aBrowser, aElementName, aBarred, aType) {
+ return ContentTask.spawn(aBrowser, [aElementName, aBarred, aType], function*([aElementName, aBarred, aType]) {
+ let doc = content.document;
+ let e = content.document.createElement(aElementName);
+ let contentElement = content.document.getElementById('content');
+ contentElement.appendChild(e);
+
+ if (aType) {
+ e.type = aType;
+ }
- let e = doc.createElement(aElementName);
- content.appendChild(e);
-
- if (aType) {
- e.type = aType;
- }
-
- ok(!tooltip.fillInPageTooltip(e),
- "No tooltip should be shown when the element is valid");
+ let tttp = Cc["@mozilla.org/embedcomp/default-tooltiptextprovider;1"]
+ .getService(Ci.nsITooltipTextProvider);
+ ok(!tttp.getNodeText(e, {}, {}),
+ "No tooltip should be shown when the element is valid");
- e.setCustomValidity('foo');
- if (aBarred) {
- ok(!tooltip.fillInPageTooltip(e),
- "No tooltip should be shown when the element is barred from constraint validation");
- } else {
- ok(tooltip.fillInPageTooltip(e),
- e.tagName + " " +"A tooltip should be shown when the element isn't valid");
- }
+ e.setCustomValidity('foo');
+ if (aBarred) {
+ ok(!tttp.getNodeText(e, {}, {}),
+ "No tooltip should be shown when the element is barred from constraint validation");
+ } else {
+ ok(tttp.getNodeText(e, {}, {}),
+ e.tagName + " " +"A tooltip should be shown when the element isn't valid");
+ }
- e.setAttribute('title', '');
- ok (!tooltip.fillInPageTooltip(e),
- "No tooltip should be shown if the title attribute is set");
+ e.setAttribute('title', '');
+ ok (!tttp.getNodeText(e, {}, {}),
+ "No tooltip should be shown if the title attribute is set");
- e.removeAttribute('title');
- content.setAttribute('novalidate', '');
- ok (!tooltip.fillInPageTooltip(e),
- "No tooltip should be shown if the novalidate attribute is set on the form owner");
- content.removeAttribute('novalidate');
+ e.removeAttribute('title');
+ contentElement.setAttribute('novalidate', '');
+ ok (!tttp.getNodeText(e, {}, {}),
+ "No tooltip should be shown if the novalidate attribute is set on the form owner");
+ contentElement.removeAttribute('novalidate');
- content.removeChild(e);
+ e.remove();
+ });
}
-function todo_check(aElementName, aBarred) {
- let doc = gBrowser.contentDocument;
- let tooltip = document.getElementById("aHTMLTooltip");
- let content = doc.getElementById('content');
-
- let e = doc.createElement(aElementName);
- content.appendChild(e);
+function todo_check(aBrowser, aElementName, aBarred) {
+ return ContentTask.spawn(aBrowser, [aElementName, aBarred], function*([aElementName, aBarred]) {
+ let doc = content.document;
+ let e = content.document.createElement(aElementName);
+ let contentElement = content.document.getElementById('content');
+ contentElement.appendChild(e);
- let cought = false;
- try {
- e.setCustomValidity('foo');
- } catch (e) {
- cought = true;
- }
+ let caught = false;
+ try {
+ e.setCustomValidity('foo');
+ } catch (e) {
+ caught = true;
+ }
- todo(!cought, "setCustomValidity should exist for " + aElementName);
+ todo(!caught, "setCustomValidity should exist for " + aElementName);
- content.removeChild(e);
+ e.remove();
+ });
}
-function test () {
- waitForExplicitFinish();
- gBrowser.selectedTab = gBrowser.addTab();
- BrowserTestUtils.browserLoaded(gBrowser.selectedBrowser).then(() => {
+add_task(function*() {
+ yield BrowserTestUtils.withNewTab({
+ gBrowser,
+ url: "data:text/html,<!DOCTYPE html><html><body><form id='content'></form></body></html>",
+ }, function*(browser) {
let testData = [
/* element name, barred */
[ 'input', false, null],
[ 'textarea', false, null],
[ 'button', true, 'button'],
[ 'button', false, 'submit'],
[ 'select', false, null],
[ 'output', true, null],
[ 'fieldset', true, null],
[ 'object', true, null],
];
for (let data of testData) {
- check(data[0], data[1], data[2]);
+ yield check(browser, data[0], data[1], data[2]);
}
let todo_testData = [
[ 'keygen', 'false' ],
];
for (let data of todo_testData) {
- todo_check(data[0], data[1]);
+ yield todo_check(browser, data[0], data[1]);
}
-
- gBrowser.removeCurrentTab();
- finish();
});
+});
- gBrowser.loadURI(
- "data:text/html,<!DOCTYPE html><html><body><form id='content'></form></body></html>"
- );
-}
-