From 2ffd074fe07339f9bab60d7bbea66b462368e87e Mon Sep 17 00:00:00 2001 From: Anne van Kesteren Date: Sat, 1 Sep 2018 00:39:11 +0000 Subject: [PATCH 01/23] Bug 1457434 [wpt PR 10679] - HTML: document.open() and quirks mode, a=testonly Automatic update from web-platform-testsHTML: document.open() and quirks mode For https://github.com/whatwg/html/pull/3966. -- wpt-commits: 5c0f55eea08d3f00dc761cff4ef1dbb9864bee29 wpt-pr: 10679 --- testing/web-platform/meta/MANIFEST.json | 10 +++ .../opening-the-input-stream/quirks.window.js | 74 +++++++++++++++++++ 2 files changed, 84 insertions(+) create mode 100644 testing/web-platform/tests/html/webappapis/dynamic-markup-insertion/opening-the-input-stream/quirks.window.js diff --git a/testing/web-platform/meta/MANIFEST.json b/testing/web-platform/meta/MANIFEST.json index b90539166ac7..5a35b4a26dc9 100644 --- a/testing/web-platform/meta/MANIFEST.json +++ b/testing/web-platform/meta/MANIFEST.json @@ -365856,6 +365856,12 @@ {} ] ], + "html/webappapis/dynamic-markup-insertion/opening-the-input-stream/quirks.window.js": [ + [ + "/html/webappapis/dynamic-markup-insertion/opening-the-input-stream/quirks.window.html", + {} + ] + ], "html/webappapis/dynamic-markup-insertion/opening-the-input-stream/reload.window.js": [ [ "/html/webappapis/dynamic-markup-insertion/opening-the-input-stream/reload.window.html", @@ -608321,6 +608327,10 @@ "5e5ca80781809cc509a8eade7ea91e74de92f9a8", "testharness" ], + "html/webappapis/dynamic-markup-insertion/opening-the-input-stream/quirks.window.js": [ + "0ff0bb99443677b8f8844c8ecedef22c408f2bac", + "testharness" + ], "html/webappapis/dynamic-markup-insertion/opening-the-input-stream/reload.window.js": [ "d6ff9dc7a45425cb688ed4b6c9ea2ab5c1c3ae5c", "testharness" diff --git a/testing/web-platform/tests/html/webappapis/dynamic-markup-insertion/opening-the-input-stream/quirks.window.js b/testing/web-platform/tests/html/webappapis/dynamic-markup-insertion/opening-the-input-stream/quirks.window.js new file mode 100644 index 000000000000..0ff0bb994436 --- /dev/null +++ b/testing/web-platform/tests/html/webappapis/dynamic-markup-insertion/opening-the-input-stream/quirks.window.js @@ -0,0 +1,74 @@ +test(t => { + const frame = document.body.appendChild(document.createElement("iframe")); + t.add_cleanup(() => frame.contentDocument.close()); + assert_equals(frame.contentDocument.compatMode, "BackCompat"); + frame.contentDocument.open(); + assert_equals(frame.contentDocument.compatMode, "CSS1Compat"); + frame.contentDocument.close(); + assert_equals(frame.contentDocument.compatMode, "BackCompat"); +}, "document.open() sets document to no-quirks mode (write no doctype)"); + +test(t => { + const frame = document.body.appendChild(document.createElement("iframe")); + t.add_cleanup(() => frame.contentDocument.close()); + assert_equals(frame.contentDocument.compatMode, "BackCompat"); + frame.contentDocument.open(); + assert_equals(frame.contentDocument.compatMode, "CSS1Compat"); + frame.contentDocument.write(""); + assert_equals(frame.contentDocument.compatMode, "BackCompat"); + frame.contentDocument.close(); + assert_equals(frame.contentDocument.compatMode, "BackCompat"); +}, "document.open() sets document to no-quirks mode (write old doctype)"); + +test(t => { + const frame = document.body.appendChild(document.createElement("iframe")); + t.add_cleanup(() => frame.contentDocument.close()); + assert_equals(frame.contentDocument.compatMode, "BackCompat"); + frame.contentDocument.open(); + assert_equals(frame.contentDocument.compatMode, "CSS1Compat"); + frame.contentDocument.write(""); + assert_equals(frame.contentDocument.compatMode, "CSS1Compat"); + frame.contentDocument.close(); + assert_equals(frame.contentDocument.compatMode, "CSS1Compat"); +}, "document.open() sets document to no-quirks mode (write new doctype)"); + +// This tests the document.open() call in fact sets the document to no-quirks +// mode, not limited-quirks mode. It is derived from +// quirks/blocks-ignore-line-height.html in WPT, as there is no direct way to +// distinguish between a no-quirks document and a limited-quirks document. It +// assumes that the user agent passes the linked test, which at the time of +// writing is all major web browsers. +test(t => { + const frame = document.body.appendChild(document.createElement("iframe")); + t.add_cleanup(() => frame.contentDocument.close()); + assert_equals(frame.contentDocument.compatMode, "BackCompat"); + frame.contentDocument.open(); + assert_equals(frame.contentDocument.compatMode, "CSS1Compat"); + + // Create the DOM tree manually rather than going through document.write() to + // bypass the parser, which resets the document mode. + const html = frame.contentDocument.appendChild(frame.contentDocument.createElement("html")); + const body = html.appendChild(frame.contentDocument.createElement("body")); + assert_equals(frame.contentDocument.body, body); + body.innerHTML = ` + +
x
+ x +
x
+ `; + assert_equals(frame.contentDocument.compatMode, "CSS1Compat"); + + const idTest = frame.contentDocument.getElementById("test"); + const idRef = frame.contentDocument.getElementById("ref"); + const idSRef = frame.contentDocument.getElementById("s_ref"); + assert_equals(frame.contentWindow.getComputedStyle(idTest).height, + frame.contentWindow.getComputedStyle(idSRef).height); + assert_not_equals(frame.contentWindow.getComputedStyle(idTest).height, + frame.contentWindow.getComputedStyle(idRef).height); +}, "document.open() sets document to no-quirks mode, not limited-quirks mode"); From aeda3ddadf6d93cd0cad8dbb98bf443f024e28a0 Mon Sep 17 00:00:00 2001 From: moz-wptsync-bot Date: Wed, 29 Aug 2018 15:57:15 +0000 Subject: [PATCH 02/23] Bug 1457434 [wpt PR 10679] - Update wpt metadata, a=testonly wpt-pr: 10679 wpt-type: metadata --- .../opening-the-input-stream/quirks.window.js.ini | 13 +++++++++++++ 1 file changed, 13 insertions(+) create mode 100644 testing/web-platform/meta/html/webappapis/dynamic-markup-insertion/opening-the-input-stream/quirks.window.js.ini diff --git a/testing/web-platform/meta/html/webappapis/dynamic-markup-insertion/opening-the-input-stream/quirks.window.js.ini b/testing/web-platform/meta/html/webappapis/dynamic-markup-insertion/opening-the-input-stream/quirks.window.js.ini new file mode 100644 index 000000000000..4972d776486a --- /dev/null +++ b/testing/web-platform/meta/html/webappapis/dynamic-markup-insertion/opening-the-input-stream/quirks.window.js.ini @@ -0,0 +1,13 @@ +[quirks.window.html] + [document.open() sets document to no-quirks mode (write no doctype)] + expected: FAIL + + [document.open() sets document to no-quirks mode (write old doctype)] + expected: FAIL + + [document.open() sets document to no-quirks mode (write new doctype)] + expected: FAIL + + [document.open() sets document to no-quirks mode, not limited-quirks mode] + expected: FAIL + From 70e35fed849526d6da50aa01512ec4c659713d16 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marcos=20C=C3=A1ceres?= Date: Sat, 1 Sep 2018 00:39:40 +0000 Subject: [PATCH 03/23] Bug 1486663 [wpt PR 12713] - Give more details when exception, a=testonly Automatic update from web-platform-testsGive more details when exception (#12713) -- wpt-commits: eed07b8c0de42c2e42432febae2cd31a61a3d2b1 wpt-pr: 12713 --- testing/web-platform/meta/MANIFEST.json | 4 +- .../allowpaymentrequest/common.sub.js | 46 +++++++++++++------ .../echo-PaymentRequest.html | 4 +- 3 files changed, 36 insertions(+), 18 deletions(-) diff --git a/testing/web-platform/meta/MANIFEST.json b/testing/web-platform/meta/MANIFEST.json index 5a35b4a26dc9..3cf1c1e2d96b 100644 --- a/testing/web-platform/meta/MANIFEST.json +++ b/testing/web-platform/meta/MANIFEST.json @@ -620552,11 +620552,11 @@ "testharness" ], "payment-request/allowpaymentrequest/common.sub.js": [ - "85a08461fcb0197ed2259d77035e696c1c69d6d8", + "a94bac064c9432980d437a98b72d4843f1b40bbe", "support" ], "payment-request/allowpaymentrequest/echo-PaymentRequest.html": [ - "f18b16ee31bf7e3eb868d073ab5e0fb0061bbd88", + "5211c7e5ce78c0621036578fef79aeb2c98f2a27", "support" ], "payment-request/allowpaymentrequest/no-attribute-cross-origin-bc-containers.https.html": [ diff --git a/testing/web-platform/tests/payment-request/allowpaymentrequest/common.sub.js b/testing/web-platform/tests/payment-request/allowpaymentrequest/common.sub.js index 85a08461fcb0..a94bac064c94 100644 --- a/testing/web-platform/tests/payment-request/allowpaymentrequest/common.sub.js +++ b/testing/web-platform/tests/payment-request/allowpaymentrequest/common.sub.js @@ -5,41 +5,57 @@ const tests = {}; -window.onmessage = (e) => { +window.onmessage = e => { const result = e.data; const tagName = result.urlQuery; const t = tests[tagName]; t.step(() => { if (expectSuccess[tagName]) { - assert_equals(result.message, 'Success'); + assert_equals(result.message, "Success"); + if (result.message === "Exception") { + const [, code, name, stack] = result.details; + assert_unreached(`Unexpected exception "${name}" (${code}) ${stack}`); + } } else { - assert_equals(result.message, 'Exception'); - assert_array_equals(result.details, [true /*ex instanceof DOMException*/, - DOMException.SECURITY_ERR /*ex.code*/, - 'SecurityError' /*ex.name*/]); + assert_equals(result.message, "Exception"); + const detailsArray = result.details.slice(0,3); + assert_array_equals(detailsArray, [ + true /*ex instanceof DOMException*/, + DOMException.SECURITY_ERR /*ex.code*/, + "SecurityError" /*ex.name*/, + ]); } t.done(); }); }; -['iframe', 'frame', 'object', 'embed'].forEach((tagName, i) => { - tests[tagName] = async_test((t) => { +["iframe", "frame", "object", "embed"].forEach((tagName, i) => { + tests[tagName] = async_test(t => { const elm = document.createElement(tagName); if (setAllowPaymentRequest) { - elm.setAttribute('allowpaymentrequest', ''); + elm.setAttribute("allowpaymentrequest", ""); } - const path = location.pathname.substring(0, location.pathname.lastIndexOf('/') + 1); - const url = (testCrossOrigin ? "https://{{domains[www1]}}:{{ports[https][0]}}" : "") + - path + "echo-PaymentRequest.html?" + tagName; - if (tagName === 'object') { + const path = location.pathname.substring( + 0, + location.pathname.lastIndexOf("/") + 1 + ); + const url = + (testCrossOrigin ? "https://{{domains[www1]}}:{{ports[https][0]}}" : "") + + path + + "echo-PaymentRequest.html?" + + tagName; + if (tagName === "object") { elm.data = url; } else { elm.src = url; } elm.onload = t.step_func(() => { - window[i].postMessage('What is the result of new PaymentRequest(...)?', '*'); + window[i].postMessage( + "What is the result of new PaymentRequest(...)?", + "*" + ); }); - elm.onerror = t.unreached_func('elm.onerror'); + elm.onerror = t.unreached_func("elm.onerror"); document.body.appendChild(elm); }, tagName); }); diff --git a/testing/web-platform/tests/payment-request/allowpaymentrequest/echo-PaymentRequest.html b/testing/web-platform/tests/payment-request/allowpaymentrequest/echo-PaymentRequest.html index f18b16ee31bf..5211c7e5ce78 100644 --- a/testing/web-platform/tests/payment-request/allowpaymentrequest/echo-PaymentRequest.html +++ b/testing/web-platform/tests/payment-request/allowpaymentrequest/echo-PaymentRequest.html @@ -11,7 +11,9 @@ window.onmessage = (e) => { e.source.postMessage(result, '*'); } catch(ex) { result.message = 'Exception'; - result.details = [ex instanceof DOMException, ex.code, ex.name]; + const isDomException = ex instanceof DOMException; + const stack = "stack" in ex ? ex.stack : ""; + result.details = [ isDomException, ex.code, ex.name, stack ]; e.source.postMessage(result, '*'); } } else { From c63f619623b56dcc65174efffd1a12b05e0fbd81 Mon Sep 17 00:00:00 2001 From: Adam Rice Date: Sat, 1 Sep 2018 00:39:58 +0000 Subject: [PATCH 04/23] Bug 1483180 [wpt PR 12474] - Deflake timeout-multiple-fetches.html, a=testonly Automatic update from web-platform-testsDeflake timeout-multiple-fetches.html The external/wpt/xhr/timeout-multiple-fetches.html layout test was flaky due to a race condition. Adjust the timeout to improve the probability of the right side winning the race. Also add a uuid to the URL to stop preflight caching from breaking the test. BUG=871578 Change-Id: I76056f7dadc789289755c35f6b6b9d8ae86c1441 Reviewed-on: https://chromium-review.googlesource.com/1174209 Commit-Queue: Adam Rice Reviewed-by: Yutaka Hirano Cr-Commit-Position: refs/heads/master@{#586610} -- wpt-commits: e6116f91471b4b5eb7fa3de7bd693018e418bb54 wpt-pr: 12474 --- testing/web-platform/meta/MANIFEST.json | 2 +- .../web-platform/tests/xhr/timeout-multiple-fetches.html | 9 ++++++--- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/testing/web-platform/meta/MANIFEST.json b/testing/web-platform/meta/MANIFEST.json index 3cf1c1e2d96b..a77d2b8d6cec 100644 --- a/testing/web-platform/meta/MANIFEST.json +++ b/testing/web-platform/meta/MANIFEST.json @@ -659880,7 +659880,7 @@ "testharness" ], "xhr/timeout-multiple-fetches.html": [ - "30d6b736c56d5576483c12a7413dd809d27d89e8", + "4f4998c4285222bf4bdf41c3e0c1c27e913d2149", "testharness" ], "xhr/timeout-sync.htm": [ diff --git a/testing/web-platform/tests/xhr/timeout-multiple-fetches.html b/testing/web-platform/tests/xhr/timeout-multiple-fetches.html index 30d6b736c56d..4f4998c42852 100644 --- a/testing/web-platform/tests/xhr/timeout-multiple-fetches.html +++ b/testing/web-platform/tests/xhr/timeout-multiple-fetches.html @@ -3,12 +3,13 @@ +
diff --git a/testing/web-platform/tests/trusted-types/Element-insertAdjacentHTML.tentative.html b/testing/web-platform/tests/trusted-types/Element-insertAdjacentHTML.tentative.html index 599ade44ec11..d5db7936b1f9 100644 --- a/testing/web-platform/tests/trusted-types/Element-insertAdjacentHTML.tentative.html +++ b/testing/web-platform/tests/trusted-types/Element-insertAdjacentHTML.tentative.html @@ -7,32 +7,30 @@ diff --git a/testing/web-platform/tests/trusted-types/Element-outerHTML.tentative.html b/testing/web-platform/tests/trusted-types/Element-outerHTML.tentative.html index a0bb6c1a5e3f..c8daddfe9955 100644 --- a/testing/web-platform/tests/trusted-types/Element-outerHTML.tentative.html +++ b/testing/web-platform/tests/trusted-types/Element-outerHTML.tentative.html @@ -5,20 +5,18 @@
diff --git a/testing/web-platform/tests/trusted-types/HTMLElement-generic.tentative.html b/testing/web-platform/tests/trusted-types/HTMLElement-generic.tentative.html index cea32a5a2df1..08d165a75d41 100644 --- a/testing/web-platform/tests/trusted-types/HTMLElement-generic.tentative.html +++ b/testing/web-platform/tests/trusted-types/HTMLElement-generic.tentative.html @@ -24,8 +24,8 @@ ]; testCases.forEach(c => { - async_test(t => { - assert_element_accepts_trusted_url(window, t, c[0], c[1], RESULTS.URL); + test(t => { + assert_element_accepts_trusted_url(window, c, t, c[0], c[1], RESULTS.URL); }, c[0] + "." + c[1] + " assigned via policy (successful URL transformation)"); }); @@ -36,8 +36,8 @@ ]; scriptTestCases.forEach(c => { - async_test(t => { - assert_element_accepts_trusted_script_url(window, t, c[0], c[1], RESULTS.SCRIPTURL); + test(t => { + assert_element_accepts_trusted_script_url(window, c, t, c[0], c[1], RESULTS.SCRIPTURL); }, c[0] + "." + c[1] + " assigned via policy (successful ScriptURL transformation)"); }); @@ -48,8 +48,8 @@ ]; HTMLTestCases.forEach(c => { - async_test(t => { - assert_element_accepts_trusted_html(window, t, c[0], c[1], RESULTS.HTML); + test(t => { + assert_element_accepts_trusted_html(window, c, t, c[0], c[1], RESULTS.HTML); }, c[0] + "." + c[1] + " assigned via policy (successful HTML transformation)"); }); diff --git a/testing/web-platform/tests/trusted-types/Location-assign.tentative.html b/testing/web-platform/tests/trusted-types/Location-assign.tentative.html index 13cca5679488..62f98e96d7fe 100644 --- a/testing/web-platform/tests/trusted-types/Location-assign.tentative.html +++ b/testing/web-platform/tests/trusted-types/Location-assign.tentative.html @@ -4,12 +4,10 @@ diff --git a/testing/web-platform/tests/trusted-types/Location-href.tentative.html b/testing/web-platform/tests/trusted-types/Location-href.tentative.html index d759d28593e6..bacadf6a91b1 100644 --- a/testing/web-platform/tests/trusted-types/Location-href.tentative.html +++ b/testing/web-platform/tests/trusted-types/Location-href.tentative.html @@ -4,12 +4,10 @@ diff --git a/testing/web-platform/tests/trusted-types/Location-replace.tentative.html b/testing/web-platform/tests/trusted-types/Location-replace.tentative.html index 7d84905d1987..4fb53d026097 100644 --- a/testing/web-platform/tests/trusted-types/Location-replace.tentative.html +++ b/testing/web-platform/tests/trusted-types/Location-replace.tentative.html @@ -4,12 +4,10 @@ diff --git a/testing/web-platform/tests/trusted-types/Range-createContextualFragment.tentative.html b/testing/web-platform/tests/trusted-types/Range-createContextualFragment.tentative.html index 3d45b33486d3..3a880a53778a 100644 --- a/testing/web-platform/tests/trusted-types/Range-createContextualFragment.tentative.html +++ b/testing/web-platform/tests/trusted-types/Range-createContextualFragment.tentative.html @@ -4,14 +4,12 @@ diff --git a/testing/web-platform/tests/trusted-types/TrustedTypePolicyFactory-createPolicy-createXYZTests.tentative.html b/testing/web-platform/tests/trusted-types/TrustedTypePolicyFactory-createPolicy-createXYZTests.tentative.html new file mode 100644 index 000000000000..b20fcf2436ea --- /dev/null +++ b/testing/web-platform/tests/trusted-types/TrustedTypePolicyFactory-createPolicy-createXYZTests.tentative.html @@ -0,0 +1,294 @@ + + + + + + diff --git a/testing/web-platform/tests/trusted-types/TrustedTypePolicyFactory-createPolicy-nameTests.tentative.html b/testing/web-platform/tests/trusted-types/TrustedTypePolicyFactory-createPolicy-nameTests.tentative.html new file mode 100644 index 000000000000..6d43e0bafc61 --- /dev/null +++ b/testing/web-platform/tests/trusted-types/TrustedTypePolicyFactory-createPolicy-nameTests.tentative.html @@ -0,0 +1,28 @@ + + + + + + diff --git a/testing/web-platform/tests/trusted-types/TrustedTypePolicyFactory-createPolicy.tentative.html b/testing/web-platform/tests/trusted-types/TrustedTypePolicyFactory-createPolicy.tentative.html deleted file mode 100644 index 76e6d130b05d..000000000000 --- a/testing/web-platform/tests/trusted-types/TrustedTypePolicyFactory-createPolicy.tentative.html +++ /dev/null @@ -1,299 +0,0 @@ - - - - - - diff --git a/testing/web-platform/tests/trusted-types/Window-trustedTypes.tentative.html b/testing/web-platform/tests/trusted-types/Window-TrustedTypes.tentative.html similarity index 77% rename from testing/web-platform/tests/trusted-types/Window-trustedTypes.tentative.html rename to testing/web-platform/tests/trusted-types/Window-TrustedTypes.tentative.html index ef4487749dd0..8e20e492e6a8 100644 --- a/testing/web-platform/tests/trusted-types/Window-trustedTypes.tentative.html +++ b/testing/web-platform/tests/trusted-types/Window-TrustedTypes.tentative.html @@ -5,7 +5,7 @@ diff --git a/testing/web-platform/tests/trusted-types/Window-open.tentative.html b/testing/web-platform/tests/trusted-types/Window-open.tentative.html index c005fbba143f..172d566e57fc 100644 --- a/testing/web-platform/tests/trusted-types/Window-open.tentative.html +++ b/testing/web-platform/tests/trusted-types/Window-open.tentative.html @@ -5,23 +5,21 @@ diff --git a/testing/web-platform/tests/trusted-types/block-string-assignment-to-DOMParser-parseFromString.tentative.html b/testing/web-platform/tests/trusted-types/block-string-assignment-to-DOMParser-parseFromString.tentative.html index cc575dc0085b..e5959a425a2f 100644 --- a/testing/web-platform/tests/trusted-types/block-string-assignment-to-DOMParser-parseFromString.tentative.html +++ b/testing/web-platform/tests/trusted-types/block-string-assignment-to-DOMParser-parseFromString.tentative.html @@ -7,14 +7,12 @@ diff --git a/testing/web-platform/tests/trusted-types/support/helper.sub.js b/testing/web-platform/tests/trusted-types/support/helper.sub.js index b5435917bec6..617e02aa6bad 100644 --- a/testing/web-platform/tests/trusted-types/support/helper.sub.js +++ b/testing/web-platform/tests/trusted-types/support/helper.sub.js @@ -31,52 +31,44 @@ function createURLJS(url) { .replace("an.url", "successfully.transformed"); } -function createHTML_policy(win) { - return win.trustedTypes.createPolicy('SomeName', { createHTML: createHTMLJS }); +function createHTML_policy(win, c) { + return win.TrustedTypes.createPolicy('SomeHTMLPolicyName' + c, { createHTML: createHTMLJS }); } -function createScript_policy(win) { - return win.trustedTypes.createPolicy('SomeName', { createScript: createScriptJS }); +function createScript_policy(win, c) { + return win.TrustedTypes.createPolicy('SomeScriptPolicyName' + c, { createScript: createScriptJS }); } -function createScriptURL_policy(win) { - return win.trustedTypes.createPolicy('SomeName', { createScriptURL: createScriptURLJS }); +function createScriptURL_policy(win, c) { + return win.TrustedTypes.createPolicy('SomeScriptURLPolicyName' + c, { createScriptURL: createScriptURLJS }); } -function createURL_policy(win) { - return win.trustedTypes.createPolicy('SomeName', { createURL: createURLJS }); +function createURL_policy(win, c) { + return win.TrustedTypes.createPolicy('SomeURLPolicyName' + c, { createURL: createURLJS }); } -function assert_element_accepts_trusted_html(win, t, tag, attribute, expected) { - createHTML_policy(win) - .then(t.step_func_done(p => { - let html = p.createHTML(INPUTS.HTML); - assert_element_accepts_trusted_type(tag, attribute, html, expected); - })); +function assert_element_accepts_trusted_html(win, c, t, tag, attribute, expected) { + let p = createHTML_policy(win, c); + let html = p.createHTML(INPUTS.HTML); + assert_element_accepts_trusted_type(tag, attribute, html, expected); } -function assert_element_accepts_trusted_script(win, t, tag, attribute, expected) { - createScript_policy(win) - .then(t.step_func_done(p => { - let script = p.createScript(INPUTS.SCRIPT); - assert_element_accepts_trusted_type(tag, attribute, script, expected); - })); +function assert_element_accepts_trusted_script(win, c, t, tag, attribute, expected) { + let p = createScript_policy(win, c); + let script = p.createScript(INPUTS.SCRIPT); + assert_element_accepts_trusted_type(tag, attribute, script, expected); } -function assert_element_accepts_trusted_script_url(win, t, tag, attribute, expected) { - createScriptURL_policy(win) - .then(t.step_func_done(p => { - let scripturl = p.createScriptURL(INPUTS.SCRIPTURL); - assert_element_accepts_trusted_type(tag, attribute, scripturl, expected); - })); +function assert_element_accepts_trusted_script_url(win, c, t, tag, attribute, expected) { + let p = createScriptURL_policy(win, c); + let scripturl = p.createScriptURL(INPUTS.SCRIPTURL); + assert_element_accepts_trusted_type(tag, attribute, scripturl, expected); } -function assert_element_accepts_trusted_url(win, t, tag, attribute, expected) { - createURL_policy(win) - .then(t.step_func_done(p => { - let url = p.createURL(INPUTS.URL); - assert_element_accepts_trusted_type(tag, attribute, url, expected); - })); +function assert_element_accepts_trusted_url(win, c, t, tag, attribute, expected) { + let p = createURL_policy(win, c); + let url = p.createURL(INPUTS.URL); + assert_element_accepts_trusted_type(tag, attribute, url, expected); } function assert_element_accepts_trusted_type(tag, attribute, value, expected) { From edeffea4981c929fadf6f67f6d3a27b7310806af Mon Sep 17 00:00:00 2001 From: moz-wptsync-bot Date: Tue, 21 Aug 2018 19:53:18 +0000 Subject: [PATCH 06/23] Bug 1485131 [wpt PR 12602] - Update wpt metadata, a=testonly wpt-pr: 12602 wpt-type: metadata --- ...tePolicy-createXYZTests.tentative.html.ini | 124 ++++++++++++++++++ ...-createPolicy-nameTests.tentative.html.ini | 7 + .../Window-TrustedTypes.tentative.html.ini | 4 + 3 files changed, 135 insertions(+) create mode 100644 testing/web-platform/meta/trusted-types/TrustedTypePolicyFactory-createPolicy-createXYZTests.tentative.html.ini create mode 100644 testing/web-platform/meta/trusted-types/TrustedTypePolicyFactory-createPolicy-nameTests.tentative.html.ini create mode 100644 testing/web-platform/meta/trusted-types/Window-TrustedTypes.tentative.html.ini diff --git a/testing/web-platform/meta/trusted-types/TrustedTypePolicyFactory-createPolicy-createXYZTests.tentative.html.ini b/testing/web-platform/meta/trusted-types/TrustedTypePolicyFactory-createPolicy-createXYZTests.tentative.html.ini new file mode 100644 index 000000000000..fc9d012d050f --- /dev/null +++ b/testing/web-platform/meta/trusted-types/TrustedTypePolicyFactory-createPolicy-createXYZTests.tentative.html.ini @@ -0,0 +1,124 @@ +[TrustedTypePolicyFactory-createPolicy-createXYZTests.tentative.html] + [script = identity function] + expected: FAIL + + [html = callback that throws] + expected: FAIL + + [script_url - calling undefined callback] + expected: FAIL + + [script_url = identity function] + expected: FAIL + + [script = identity function, global string changed] + expected: FAIL + + [url = this without bind] + expected: FAIL + + [script = this without bind] + expected: FAIL + + [html = this bound to an object] + expected: FAIL + + [url = identity function, global string changed] + expected: FAIL + + [url = this bound to an object] + expected: FAIL + + [url = identity function] + expected: FAIL + + [script_url = identity function, global string changed] + expected: FAIL + + [script_url = this bound to an object] + expected: FAIL + + [script_url = this without bind] + expected: FAIL + + [html = identity function, global string changed] + expected: FAIL + + [url = callback that throws] + expected: FAIL + + [html = string + global string] + expected: FAIL + + [script = this bound to an object] + expected: FAIL + + [html = identity function] + expected: FAIL + + [script = callback that throws] + expected: FAIL + + [html - calling undefined callback] + expected: FAIL + + [url - calling undefined callback] + expected: FAIL + + [script_url = callback that throws] + expected: FAIL + + [script - calling undefined callback] + expected: FAIL + + [html = this without bind] + expected: FAIL + + [script_url = string + global string] + expected: FAIL + + [script = null] + expected: FAIL + + [script_url = null] + expected: FAIL + + [html = null] + expected: FAIL + + [script = string + global string] + expected: FAIL + + [url = string + global string] + expected: FAIL + + [url = null] + expected: FAIL + + [script_url - calling undefined callback throws] + expected: FAIL + + [url - calling undefined callback throws] + expected: FAIL + + [script - calling undefined callback throws] + expected: FAIL + + [policy has createScript, throws when called with createHTML] + expected: FAIL + + [html - calling undefined callback throws] + expected: FAIL + + [createScript defined - calling undefined callbacks throws] + expected: FAIL + + [createScriptURL defined - calling undefined callbacks throws] + expected: FAIL + + [createHTML defined - calling undefined callbacks throws] + expected: FAIL + + [createURL defined - calling undefined callbacks throws] + expected: FAIL + diff --git a/testing/web-platform/meta/trusted-types/TrustedTypePolicyFactory-createPolicy-nameTests.tentative.html.ini b/testing/web-platform/meta/trusted-types/TrustedTypePolicyFactory-createPolicy-nameTests.tentative.html.ini new file mode 100644 index 000000000000..4bf5c0de710c --- /dev/null +++ b/testing/web-platform/meta/trusted-types/TrustedTypePolicyFactory-createPolicy-nameTests.tentative.html.ini @@ -0,0 +1,7 @@ +[TrustedTypePolicyFactory-createPolicy-nameTests.tentative.html] + [Retrieving policy names] + expected: FAIL + + [policy.name = name] + expected: FAIL + diff --git a/testing/web-platform/meta/trusted-types/Window-TrustedTypes.tentative.html.ini b/testing/web-platform/meta/trusted-types/Window-TrustedTypes.tentative.html.ini new file mode 100644 index 000000000000..1228b58186a8 --- /dev/null +++ b/testing/web-platform/meta/trusted-types/Window-TrustedTypes.tentative.html.ini @@ -0,0 +1,4 @@ +[Window-TrustedTypes.tentative.html] + [factory = window.TrustedTypes] + expected: FAIL + From 0965b8dffec612911800405397e01046234b92c8 Mon Sep 17 00:00:00 2001 From: Simon Pieters Date: Sat, 1 Sep 2018 00:40:38 +0000 Subject: [PATCH 07/23] Bug 1486725 [wpt PR 12717] - HTML: test legend and display: none, a=testonly Automatic update from web-platform-testsHTML: test legend and display: none -- wpt-commits: 6a9c5cbeae3571ee7ecd056e34c4cfe31eaa3223 wpt-pr: 12717 --- testing/web-platform/meta/MANIFEST.json | 35 +++++++++++++++++++ .../legend-display-none-rendering-ref.html | 7 ++++ .../legend-display-none-rendering.html | 11 ++++++ .../legend-display-none.html | 16 +++++++++ 4 files changed, 69 insertions(+) create mode 100644 testing/web-platform/tests/html/rendering/non-replaced-elements/the-fieldset-and-legend-elements/legend-display-none-rendering-ref.html create mode 100644 testing/web-platform/tests/html/rendering/non-replaced-elements/the-fieldset-and-legend-elements/legend-display-none-rendering.html create mode 100644 testing/web-platform/tests/html/rendering/non-replaced-elements/the-fieldset-and-legend-elements/legend-display-none.html diff --git a/testing/web-platform/meta/MANIFEST.json b/testing/web-platform/meta/MANIFEST.json index 9ac3d083087b..330b08065329 100644 --- a/testing/web-platform/meta/MANIFEST.json +++ b/testing/web-platform/meta/MANIFEST.json @@ -185107,6 +185107,18 @@ {} ] ], + "html/rendering/non-replaced-elements/the-fieldset-and-legend-elements/legend-display-none-rendering.html": [ + [ + "/html/rendering/non-replaced-elements/the-fieldset-and-legend-elements/legend-display-none-rendering.html", + [ + [ + "/html/rendering/non-replaced-elements/the-fieldset-and-legend-elements/legend-display-none-rendering-ref.html", + "==" + ] + ], + {} + ] + ], "html/rendering/non-replaced-elements/the-fieldset-and-legend-elements/legend-float.html": [ [ "/html/rendering/non-replaced-elements/the-fieldset-and-legend-elements/legend-float.html", @@ -285839,6 +285851,11 @@ {} ] ], + "html/rendering/non-replaced-elements/the-fieldset-and-legend-elements/legend-display-none-rendering-ref.html": [ + [ + {} + ] + ], "html/rendering/non-replaced-elements/the-fieldset-and-legend-elements/legend-dynamic-update.html": [ [ {} @@ -356684,6 +356701,12 @@ {} ] ], + "html/rendering/non-replaced-elements/the-fieldset-and-legend-elements/legend-display-none.html": [ + [ + "/html/rendering/non-replaced-elements/the-fieldset-and-legend-elements/legend-display-none.html", + {} + ] + ], "html/rendering/non-replaced-elements/the-fieldset-and-legend-elements/legend-display.html": [ [ "/html/rendering/non-replaced-elements/the-fieldset-and-legend-elements/legend-display.html", @@ -599465,6 +599488,18 @@ "4e9539179739a3690aab276f2ba98c25bd4dfe9b", "testharness" ], + "html/rendering/non-replaced-elements/the-fieldset-and-legend-elements/legend-display-none-rendering-ref.html": [ + "e6eff47e53c7a40e973b7f9dc298af2343f59941", + "support" + ], + "html/rendering/non-replaced-elements/the-fieldset-and-legend-elements/legend-display-none-rendering.html": [ + "abf3c45df71ee6617ddb8b6d402a103f54624820", + "reftest" + ], + "html/rendering/non-replaced-elements/the-fieldset-and-legend-elements/legend-display-none.html": [ + "689454ac493a05b28658edf549d71c6aa1c7be0e", + "testharness" + ], "html/rendering/non-replaced-elements/the-fieldset-and-legend-elements/legend-display.html": [ "914547fc6cdde3e464b28eb7cc9737d17305f9af", "testharness" diff --git a/testing/web-platform/tests/html/rendering/non-replaced-elements/the-fieldset-and-legend-elements/legend-display-none-rendering-ref.html b/testing/web-platform/tests/html/rendering/non-replaced-elements/the-fieldset-and-legend-elements/legend-display-none-rendering-ref.html new file mode 100644 index 000000000000..e6eff47e53c7 --- /dev/null +++ b/testing/web-platform/tests/html/rendering/non-replaced-elements/the-fieldset-and-legend-elements/legend-display-none-rendering-ref.html @@ -0,0 +1,7 @@ + +Reference for Rendering of display: none legend + +

There should be a green box below.

+
diff --git a/testing/web-platform/tests/html/rendering/non-replaced-elements/the-fieldset-and-legend-elements/legend-display-none-rendering.html b/testing/web-platform/tests/html/rendering/non-replaced-elements/the-fieldset-and-legend-elements/legend-display-none-rendering.html new file mode 100644 index 000000000000..abf3c45df71e --- /dev/null +++ b/testing/web-platform/tests/html/rendering/non-replaced-elements/the-fieldset-and-legend-elements/legend-display-none-rendering.html @@ -0,0 +1,11 @@ + +Rendering of display: none legend + + +

There should be a green box below.

+
+ FAIL +
diff --git a/testing/web-platform/tests/html/rendering/non-replaced-elements/the-fieldset-and-legend-elements/legend-display-none.html b/testing/web-platform/tests/html/rendering/non-replaced-elements/the-fieldset-and-legend-elements/legend-display-none.html new file mode 100644 index 000000000000..689454ac493a --- /dev/null +++ b/testing/web-platform/tests/html/rendering/non-replaced-elements/the-fieldset-and-legend-elements/legend-display-none.html @@ -0,0 +1,16 @@ + +legend display: none + + + +
+ Foo +
+ From 1d01550bf2005cd5fefcb5233c4c098ae84b8c52 Mon Sep 17 00:00:00 2001 From: moz-wptsync-bot Date: Sat, 1 Sep 2018 00:41:07 +0000 Subject: [PATCH 08/23] Bug 1487940 - [wpt-sync] Update web-platform-tests to 128c48e50cea769df396af8c90c38bc49b620939, a=testonly wpt-head: 128c48e50cea769df396af8c90c38bc49b620939 wpt-type: landing --- testing/web-platform/meta/mozilla-sync | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/testing/web-platform/meta/mozilla-sync b/testing/web-platform/meta/mozilla-sync index f5c2fd318409..d36950b24160 100644 --- a/testing/web-platform/meta/mozilla-sync +++ b/testing/web-platform/meta/mozilla-sync @@ -1,2 +1,2 @@ -local: a3acca752946dcc6b1196f588815e8d89dd2a047 -upstream: 3d172bc612e03a896b5611d9e9652f860995feef +local: c6fdb0456dcc9f12ac413c063f48f36493401dbd +upstream: 128c48e50cea769df396af8c90c38bc49b620939 From 910cc77cadf9847a7ee3334d565716364996f7b6 Mon Sep 17 00:00:00 2001 From: moz-wptsync-bot Date: Sat, 1 Sep 2018 00:41:07 +0000 Subject: [PATCH 09/23] Bug 1487940 - Remove case-insensitive duplicate metadata files, a=testonly ON A CLOSED TREE --- ...icyFactory-createPolicy.tentative.html.ini | 103 ------------------ .../Window-trustedTypes.tentative.html.ini | 7 -- 2 files changed, 110 deletions(-) delete mode 100644 testing/web-platform/meta/trusted-types/TrustedTypePolicyFactory-createPolicy.tentative.html.ini delete mode 100644 testing/web-platform/meta/trusted-types/Window-trustedTypes.tentative.html.ini diff --git a/testing/web-platform/meta/trusted-types/TrustedTypePolicyFactory-createPolicy.tentative.html.ini b/testing/web-platform/meta/trusted-types/TrustedTypePolicyFactory-createPolicy.tentative.html.ini deleted file mode 100644 index 52b8d7a81c5d..000000000000 --- a/testing/web-platform/meta/trusted-types/TrustedTypePolicyFactory-createPolicy.tentative.html.ini +++ /dev/null @@ -1,103 +0,0 @@ -[TrustedTypePolicyFactory-createPolicy.tentative.html] - [policy.name = name] - expected: FAIL - - [TrustedTypePolicyFactory-createPolicy] - expected: FAIL - - [html = callback that throws] - expected: FAIL - - [script_url - calling undefined callback] - expected: FAIL - - [html - calling undefined callback] - expected: FAIL - - [script_url = identity function] - expected: FAIL - - [url = this without bind] - expected: FAIL - - [html = this bound to an object] - expected: FAIL - - [url = identity function, global string changed] - expected: FAIL - - [url = this bound to an object] - expected: FAIL - - [script_url = identity function, global string changed] - expected: FAIL - - [script_url = this bound to an object] - expected: FAIL - - [html = identity function, global string changed] - expected: FAIL - - [url = callback that throws] - expected: FAIL - - [url = identity function] - expected: FAIL - - [html = identity function] - expected: FAIL - - [script_url = this without bind] - expected: FAIL - - [url - calling undefined callback] - expected: FAIL - - [script_url = callback that throws] - expected: FAIL - - [html = this without bind] - expected: FAIL - - [html = string + global string] - expected: FAIL - - [script_url = string + global string] - expected: FAIL - - [script_url = null] - expected: FAIL - - [html = null] - expected: FAIL - - [url = string + global string] - expected: FAIL - - [url = null] - expected: FAIL - - [script = identity function] - expected: FAIL - - [script = identity function, global string changed] - expected: FAIL - - [script = this without bind] - expected: FAIL - - [script = this bound to an object] - expected: FAIL - - [script = callback that throws] - expected: FAIL - - [script - calling undefined callback] - expected: FAIL - - [script = null] - expected: FAIL - - [script = string + global string] - expected: FAIL - diff --git a/testing/web-platform/meta/trusted-types/Window-trustedTypes.tentative.html.ini b/testing/web-platform/meta/trusted-types/Window-trustedTypes.tentative.html.ini deleted file mode 100644 index 3f502b070b12..000000000000 --- a/testing/web-platform/meta/trusted-types/Window-trustedTypes.tentative.html.ini +++ /dev/null @@ -1,7 +0,0 @@ -[Window-trustedTypes.tentative.html] - [factory = window.trustedTypes] - expected: FAIL - - [Window-trustedTypes] - expected: FAIL - From ef7146a4be3127040bff123d00d635e074508bda Mon Sep 17 00:00:00 2001 From: Gijs Kruitbosch Date: Mon, 3 Sep 2018 14:43:38 +0100 Subject: [PATCH 10/23] Bug 1486824 - change BrowserTestUtils to just call OpenBrowserWindow so it does the same thing as opening a window normally, r=mconley,nhnt11 Differential Revision: https://phabricator.services.mozilla.com/D4466 --HG-- extra : rebase_source : e51b66bb18d0e600814b48d5cd3ec9d5dea3028a extra : source : 96b5a88ac0041a1bd382a731749e1fca9aa911ed --- .../browser/events/browser_test_textcaret.js | 15 ++-- browser/base/content/browser-captivePortal.js | 12 ++++ browser/base/content/browser.js | 13 ++++ .../base/content/test/captivePortal/head.js | 15 +--- .../content/test/forms/browser_selectpopup.js | 18 +++-- .../plugins/browser_private_clicktoplay.js | 3 +- .../test/sidebar/browser_sidebar_adopt.js | 6 +- .../test/browser_editcontrols_update.js | 5 ++ .../test/browser_sidebar_toggle.js | 2 +- .../browser_ext_sidebarAction_windows.js | 2 +- .../browser/browser_privatebrowsing_about.js | 7 +- .../test/browser_394759_perwindowpb.js | 3 +- dom/tests/browser/browser_bug1236512.js | 12 ++-- .../BrowserTestUtils/BrowserTestUtils.jsm | 69 +++++-------------- 14 files changed, 90 insertions(+), 92 deletions(-) diff --git a/accessible/tests/browser/events/browser_test_textcaret.js b/accessible/tests/browser/events/browser_test_textcaret.js index a468dc0227b0..8fb3f08925f7 100644 --- a/accessible/tests/browser/events/browser_test_textcaret.js +++ b/accessible/tests/browser/events/browser_test_textcaret.js @@ -14,28 +14,27 @@ function caretMoveChecker(target, caretOffset) { } async function checkURLBarCaretEvents() { - let url = "about:mozilla"; + const kURL = "about:mozilla"; + let newWin = await BrowserTestUtils.openNewBrowserWindow(); + newWin.gBrowser.selectedBrowser.loadURI(kURL); - let onDocLoad = waitForEvent( + await waitForEvent( EVENT_DOCUMENT_LOAD_COMPLETE, event => { try { - return event.accessible.QueryInterface(nsIAccessibleDocument).URL == url; + return event.accessible.QueryInterface(nsIAccessibleDocument).URL == kURL; } catch (e) { return false; } } ); - let [ newWin ] = await Promise.all([ - BrowserTestUtils.openNewBrowserWindow({ url }), - onDocLoad - ]); + info("Loaded " + kURL); let urlbarInputEl = newWin.document.getElementById("urlbar").inputField; let urlbarInput = getAccessible(urlbarInputEl, [ nsIAccessibleText ]); let onCaretMove = waitForEvents([ - [ EVENT_TEXT_CARET_MOVED, caretMoveChecker(urlbarInput, url.length) ], + [ EVENT_TEXT_CARET_MOVED, caretMoveChecker(urlbarInput, kURL.length) ], [ EVENT_FOCUS, urlbarInput ] ]); diff --git a/browser/base/content/browser-captivePortal.js b/browser/base/content/browser-captivePortal.js index 6de93c7f127d..b8bfca9cc05b 100644 --- a/browser/base/content/browser-captivePortal.js +++ b/browser/base/content/browser-captivePortal.js @@ -113,6 +113,12 @@ var CaptivePortalWatcher = { } let win = BrowserWindowTracker.getTopWindow(); + // Used by tests: ignore the main test window in order to enable testing of + // the case where we have no open windows. + if (win && win.document.documentElement.getAttribute("ignorecaptiveportal")) { + win = null; + } + // If no browser window has focus, open and show the tab when we regain focus. // This is so that if a different application was focused, when the user // (re-)focuses a browser window, we open the tab immediately in that window @@ -136,6 +142,12 @@ var CaptivePortalWatcher = { } let win = BrowserWindowTracker.getTopWindow(); + // Used by tests: ignore the main test window in order to enable testing of + // the case where we have no open windows. + if (win && win.document.documentElement.getAttribute("ignorecaptiveportal")) { + win = null; + } + if (win != Services.ww.activeWindow) { // The window that got focused was not a browser window. return; diff --git a/browser/base/content/browser.js b/browser/base/content/browser.js index ea5d21d57b92..4fbd988b85e7 100644 --- a/browser/base/content/browser.js +++ b/browser/base/content/browser.js @@ -4292,6 +4292,19 @@ function toOpenWindowByType(inType, uri, features) { window.open(uri, "_blank", "chrome,extrachrome,menubar,resizable,scrollbars,status,toolbar"); } +/** + * Open a new browser window. + * + * @param {Object} options + * { + * private: A boolean indicating if the window should be + * private + * remote: A boolean indicating if the window should run + * remote browser tabs or not. If omitted, the window + * will choose the profile default state. + * } + * @return a reference to the new window. + */ function OpenBrowserWindow(options) { var telemetryObj = {}; TelemetryStopwatch.start("FX_NEW_WINDOW_MS", telemetryObj); diff --git a/browser/base/content/test/captivePortal/head.js b/browser/base/content/test/captivePortal/head.js index 58a23c9770b0..dab6cb1ce037 100644 --- a/browser/base/content/test/captivePortal/head.js +++ b/browser/base/content/test/captivePortal/head.js @@ -20,22 +20,13 @@ async function setupPrefsAndRecentWindowBehavior() { // We need to test behavior when a portal is detected when there is no browser // window, but we can't close the default window opened by the test harness. // Instead, we deactivate CaptivePortalWatcher in the default window and - // exclude it from BrowserWindowTracker.getTopWindow in an attempt to - // mask its presence. + // exclude it using an attribute to mask its presence. window.CaptivePortalWatcher.uninit(); - let getTopWindowCopy = BrowserWindowTracker.getTopWindow; - let defaultWindow = window; - BrowserWindowTracker.getTopWindow = () => { - let win = getTopWindowCopy(); - if (win == defaultWindow) { - return null; - } - return win; - }; + window.document.documentElement.setAttribute("ignorecaptiveportal", "true"); registerCleanupFunction(function cleanUp() { - BrowserWindowTracker.getTopWindow = getTopWindowCopy; window.CaptivePortalWatcher.init(); + window.document.documentElement.removeAttribute("ignorecaptiveportal"); }); } diff --git a/browser/base/content/test/forms/browser_selectpopup.js b/browser/base/content/test/forms/browser_selectpopup.js index ad10b85fe425..560ebb043691 100644 --- a/browser/base/content/test/forms/browser_selectpopup.js +++ b/browser/base/content/test/forms/browser_selectpopup.js @@ -590,18 +590,24 @@ add_task(async function test_large_popup() { // This test checks the same as the previous test but in a new smaller window. add_task(async function test_large_popup_in_small_window() { - let newwin = await BrowserTestUtils.openNewBrowserWindow({ width: 400, height: 400 }); + let newWin = await BrowserTestUtils.openNewBrowserWindow(); + + let resizePromise = BrowserTestUtils.waitForEvent(newWin, "resize", false, e => { + return newWin.innerHeight <= 400 && newWin.innerWidth <= 400; + }); + newWin.resizeTo(400, 400); + await resizePromise; const pageUrl = "data:text/html," + escape(PAGECONTENT_SMALL); - let browserLoadedPromise = BrowserTestUtils.browserLoaded(newwin.gBrowser.selectedBrowser); - await BrowserTestUtils.loadURI(newwin.gBrowser.selectedBrowser, pageUrl); + let browserLoadedPromise = BrowserTestUtils.browserLoaded(newWin.gBrowser.selectedBrowser); + await BrowserTestUtils.loadURI(newWin.gBrowser.selectedBrowser, pageUrl); await browserLoadedPromise; - newwin.gBrowser.selectedBrowser.focus(); + newWin.gBrowser.selectedBrowser.focus(); - await performLargePopupTests(newwin); + await performLargePopupTests(newWin); - await BrowserTestUtils.closeWindow(newwin); + await BrowserTestUtils.closeWindow(newWin); }); async function performSelectSearchTests(win) { diff --git a/browser/base/content/test/plugins/browser_private_clicktoplay.js b/browser/base/content/test/plugins/browser_private_clicktoplay.js index b94d441bffaf..f7b9fcfcccc4 100644 --- a/browser/base/content/test/plugins/browser_private_clicktoplay.js +++ b/browser/base/content/test/plugins/browser_private_clicktoplay.js @@ -26,7 +26,8 @@ let createPrivateWindow = async function createPrivateWindow(url) { gPrivateBrowser = gPrivateWindow.getBrowser().selectedBrowser; BrowserTestUtils.loadURI(gPrivateBrowser, url); - await BrowserTestUtils.browserLoaded(gPrivateBrowser); + await BrowserTestUtils.browserLoaded(gPrivateBrowser, false, url); + info("loaded " + url); }; add_task(async function test() { diff --git a/browser/base/content/test/sidebar/browser_sidebar_adopt.js b/browser/base/content/test/sidebar/browser_sidebar_adopt.js index 93ffa5f7dcd1..c007c82b759a 100644 --- a/browser/base/content/test/sidebar/browser_sidebar_adopt.js +++ b/browser/base/content/test/sidebar/browser_sidebar_adopt.js @@ -19,11 +19,11 @@ add_task(async function testAdoptedTwoWindows() { // being adopted from the main window which doesn't have a shown sidebar. See Bug 1407737. info("Ensure that sidebar state is adopted only from the opener"); - let win1 = await BrowserTestUtils.openNewBrowserWindow({opener: window}); + let win1 = await BrowserTestUtils.openNewBrowserWindow(); await win1.SidebarUI.show("viewBookmarksSidebar"); await BrowserTestUtils.closeWindow(win1); - let win2 = await BrowserTestUtils.openNewBrowserWindow({opener: window}); + let win2 = await BrowserTestUtils.openNewBrowserWindow(); ok(!win2.document.getElementById("sidebar-button").hasAttribute("checked"), "Sidebar button isn't checked"); ok(!win2.SidebarUI.isOpen, "Sidebar is closed"); await BrowserTestUtils.closeWindow(win2); @@ -46,7 +46,7 @@ add_task(async function testEventReceivedInNewWindow() { info("Opening a new window and expecting the SidebarFocused event to not fire"); let promiseNewWindow = BrowserTestUtils.waitForNewWindow(); - BrowserTestUtils.openNewBrowserWindow({opener: window}); + BrowserTestUtils.openNewBrowserWindow(); let win = await promiseNewWindow; let adoptedShown = BrowserTestUtils.waitForEvent(win, "SidebarShown"); diff --git a/browser/components/customizableui/test/browser_editcontrols_update.js b/browser/components/customizableui/test/browser_editcontrols_update.js index d24294273fbb..c0dd332c9b52 100644 --- a/browser/components/customizableui/test/browser_editcontrols_update.js +++ b/browser/components/customizableui/test/browser_editcontrols_update.js @@ -202,6 +202,11 @@ add_task(async function test_initial_state() { let testWindow = await BrowserTestUtils.openNewBrowserWindow(); await SimpleTest.promiseFocus(testWindow); + // For focusing the URL bar to have an effect, we need to ensure the URL bar isn't + // initially focused: + testWindow.gBrowser.selectedTab.focus(); + await TestUtils.waitForCondition(() => !testWindow.gURLBar.focused); + let overridePromise = expectCommandUpdate(isMac, testWindow); testWindow.gURLBar.focus(); diff --git a/browser/components/customizableui/test/browser_sidebar_toggle.js b/browser/components/customizableui/test/browser_sidebar_toggle.js index 18136102eab3..163bfc38af49 100644 --- a/browser/components/customizableui/test/browser_sidebar_toggle.js +++ b/browser/components/customizableui/test/browser_sidebar_toggle.js @@ -42,7 +42,7 @@ add_task(async function() { is(SidebarUI.currentID, "viewHistorySidebar", "Selected sidebar remembered"); await hideSidebar(); - let otherWin = await BrowserTestUtils.openNewBrowserWindow({opener: window}); + let otherWin = await BrowserTestUtils.openNewBrowserWindow(); await showSidebar(otherWin); is(otherWin.SidebarUI.currentID, "viewHistorySidebar", "Selected sidebar remembered across windows"); await hideSidebar(otherWin); diff --git a/browser/components/extensions/test/browser/browser_ext_sidebarAction_windows.js b/browser/components/extensions/test/browser/browser_ext_sidebarAction_windows.js index 4cc9a257f27b..5d6fe2629caf 100644 --- a/browser/components/extensions/test/browser/browser_ext_sidebarAction_windows.js +++ b/browser/components/extensions/test/browser/browser_ext_sidebarAction_windows.js @@ -48,7 +48,7 @@ add_task(async function sidebar_windows() { // SidebarUI relies on window.opener being set, which is normal behavior when // using menu or key commands to open a new browser window. - let win = await BrowserTestUtils.openNewBrowserWindow({opener: window}); + let win = await BrowserTestUtils.openNewBrowserWindow(); await secondSidebar; ok(!win.document.getElementById("sidebar-box").hidden, "sidebar box is visible in second window"); diff --git a/browser/components/privatebrowsing/test/browser/browser_privatebrowsing_about.js b/browser/components/privatebrowsing/test/browser/browser_privatebrowsing_about.js index 198062463f85..fc79f0aeaff3 100644 --- a/browser/components/privatebrowsing/test/browser/browser_privatebrowsing_about.js +++ b/browser/components/privatebrowsing/test/browser/browser_privatebrowsing_about.js @@ -10,10 +10,11 @@ const CB_UI_ENABLED_PREF = "browser.contentblocking.ui.enabled"; * Opens a new private window and loads "about:privatebrowsing" there. */ async function openAboutPrivateBrowsing() { - let win = await BrowserTestUtils.openNewBrowserWindow({ private: true }); + let win = await BrowserTestUtils.openNewBrowserWindow({ + private: true, + waitForNonAboutBlankLoad: true, + }); let tab = win.gBrowser.selectedBrowser; - tab.loadURI("about:privatebrowsing"); - await BrowserTestUtils.browserLoaded(tab); return { win, tab }; } diff --git a/browser/components/sessionstore/test/browser_394759_perwindowpb.js b/browser/components/sessionstore/test/browser_394759_perwindowpb.js index d03357e969ee..c58f6477ed2c 100644 --- a/browser/components/sessionstore/test/browser_394759_perwindowpb.js +++ b/browser/components/sessionstore/test/browser_394759_perwindowpb.js @@ -17,8 +17,7 @@ function promiseTestOpenCloseWindow(aIsPrivate, aTest) { return (async function() { let win = await BrowserTestUtils.openNewBrowserWindow({ "private": aIsPrivate }); win.gBrowser.selectedBrowser.loadURI(aTest.url); - await promiseBrowserLoaded(win.gBrowser.selectedBrowser); - await Promise.resolve(); + await promiseBrowserLoaded(win.gBrowser.selectedBrowser, true, aTest.url); // Mark the window with some unique data to be restored later on. ss.setWindowValue(win, aTest.key, aTest.value); await TabStateFlusher.flushWindow(win); diff --git a/dom/tests/browser/browser_bug1236512.js b/dom/tests/browser/browser_bug1236512.js index ba46d9d81c52..939092a847bf 100644 --- a/dom/tests/browser/browser_bug1236512.js +++ b/dom/tests/browser/browser_bug1236512.js @@ -43,12 +43,16 @@ async function waitContentVisibilityChange(aIsHidden, aBrowser) { */ add_task(async function() { info("creating test window"); + let winTest = await BrowserTestUtils.openNewBrowserWindow(); // Specify the width, height, left and top, so that the new window can be // fully covered by "window". - let winTest = await BrowserTestUtils.openNewBrowserWindow({ width: 500, - height: 500, - left: 200, - top: 200 }); + let resizePromise = BrowserTestUtils.waitForEvent(winTest, "resize", false, e => { + return winTest.innerHeight <= 500 && winTest.innerWidth <= 500; + }); + winTest.moveTo(200, 200); + winTest.resizeTo(500, 500); + await resizePromise; + let browserTest = winTest.gBrowser; info(`loading test page: ${testPageURL}`); diff --git a/testing/mochitest/BrowserTestUtils/BrowserTestUtils.jsm b/testing/mochitest/BrowserTestUtils/BrowserTestUtils.jsm index 94df22dceb2b..97ab4043e684 100644 --- a/testing/mochitest/BrowserTestUtils/BrowserTestUtils.jsm +++ b/testing/mochitest/BrowserTestUtils/BrowserTestUtils.jsm @@ -25,6 +25,9 @@ ChromeUtils.import("resource://gre/modules/Services.jsm"); ChromeUtils.import("resource://testing-common/TestUtils.jsm"); ChromeUtils.import("resource://testing-common/ContentTask.jsm"); +ChromeUtils.defineModuleGetter(this, "BrowserWindowTracker", + "resource:///modules/BrowserWindowTracker.jsm"); + Services .mm .loadFrameScript( @@ -701,61 +704,25 @@ var BrowserTestUtils = { }, /** - * @param {Object} options - * { - * private: A boolean indicating if the window should be - * private - * remote: A boolean indicating if the window should run - * remote browser tabs or not. If omitted, the window - * will choose the profile default state. - * width: Desired width of window - * height: Desired height of window - * } + * Open a new browser window from an existing one. + * This relies on OpenBrowserWindow in browser.js, and waits for the window + * to be completely loaded before resolving. + * + * @param {Object} + * Options to pass to OpenBrowserWindow. Additionally, supports: + * - waitForNonAboutBlankLoad + * Forces the initial browserLoaded check to wait for the tab to + * load something other than about:blank. + * * @return {Promise} * Resolves with the new window once it is loaded. */ async openNewBrowserWindow(options = {}) { - let argString = Cc["@mozilla.org/supports-string;1"]. - createInstance(Ci.nsISupportsString); - argString.data = ""; - let features = "chrome,dialog=no,all"; - let opener = null; - - if (options.opener) { - opener = options.opener; + let currentWin = BrowserWindowTracker.getTopWindow({private: false}); + if (!currentWin) { + throw new Error("Can't open a new browser window from this helper if no non-private window is open."); } - - if (options.private) { - features += ",private"; - } - - if (options.width) { - features += ",width=" + options.width; - } - if (options.height) { - features += ",height=" + options.height; - } - - if (options.left) { - features += ",left=" + options.left; - } - - if (options.top) { - features += ",top=" + options.top; - } - - if (options.hasOwnProperty("remote")) { - let remoteState = options.remote ? "remote" : "non-remote"; - features += `,${remoteState}`; - } - - if (options.url) { - argString.data = options.url; - } - - let win = Services.ww.openWindow( - opener, AppConstants.BROWSER_CHROME_URL, "_blank", - features, argString); + let win = currentWin.OpenBrowserWindow(options); // Wait for browser-delayed-startup-finished notification, it indicates // that the window has loaded completely and is ready to be used for @@ -764,7 +731,7 @@ var BrowserTestUtils = { TestUtils.topicObserved("browser-delayed-startup-finished", subject => subject == win).then(() => win); - let loadPromise = this.firstBrowserLoaded(win); + let loadPromise = this.firstBrowserLoaded(win, !options.waitForNonAboutBlankLoad); await startupPromise; await loadPromise; From d1b26d3f3484c704e36bd93cfa858ae4f69a55cc Mon Sep 17 00:00:00 2001 From: Gijs Kruitbosch Date: Mon, 3 Sep 2018 15:16:55 +0100 Subject: [PATCH 11/23] Bug 1486824 - review comment follow-up: change params for openNewBrowserWindow to explicitly check for URL, r=nhnt11 --- .../test/browser/browser_privatebrowsing_about.js | 2 +- testing/mochitest/BrowserTestUtils/BrowserTestUtils.jsm | 8 +++++--- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/browser/components/privatebrowsing/test/browser/browser_privatebrowsing_about.js b/browser/components/privatebrowsing/test/browser/browser_privatebrowsing_about.js index fc79f0aeaff3..2ec585395816 100644 --- a/browser/components/privatebrowsing/test/browser/browser_privatebrowsing_about.js +++ b/browser/components/privatebrowsing/test/browser/browser_privatebrowsing_about.js @@ -12,7 +12,7 @@ const CB_UI_ENABLED_PREF = "browser.contentblocking.ui.enabled"; async function openAboutPrivateBrowsing() { let win = await BrowserTestUtils.openNewBrowserWindow({ private: true, - waitForNonAboutBlankLoad: true, + waitForTabURL: "about:privatebrowsing", }); let tab = win.gBrowser.selectedBrowser; return { win, tab }; diff --git a/testing/mochitest/BrowserTestUtils/BrowserTestUtils.jsm b/testing/mochitest/BrowserTestUtils/BrowserTestUtils.jsm index 97ab4043e684..53d4ed057047 100644 --- a/testing/mochitest/BrowserTestUtils/BrowserTestUtils.jsm +++ b/testing/mochitest/BrowserTestUtils/BrowserTestUtils.jsm @@ -710,9 +710,9 @@ var BrowserTestUtils = { * * @param {Object} * Options to pass to OpenBrowserWindow. Additionally, supports: - * - waitForNonAboutBlankLoad + * - waitForTabURL * Forces the initial browserLoaded check to wait for the tab to - * load something other than about:blank. + * load the given URL (instead of about:blank) * * @return {Promise} * Resolves with the new window once it is loaded. @@ -731,7 +731,9 @@ var BrowserTestUtils = { TestUtils.topicObserved("browser-delayed-startup-finished", subject => subject == win).then(() => win); - let loadPromise = this.firstBrowserLoaded(win, !options.waitForNonAboutBlankLoad); + let loadPromise = this.firstBrowserLoaded(win, !options.waitForTabURL, browser => { + return !options.waitForTabURL || options.waitForTabURL == browser.currentURI.spec; + }); await startupPromise; await loadPromise; From 88400e06efb130a3e2ea8d1a002662d78c246e7e Mon Sep 17 00:00:00 2001 From: trisha Date: Fri, 31 Aug 2018 19:12:02 +0530 Subject: [PATCH 12/23] Bug 1484761 - Change "security certificates" to "certificates" on the new cert error pages r=johannh --- browser/actors/NetErrorChild.jsm | 14 +++++++------- .../en-US/chrome/pipnss/pipnss.properties | 18 +++++++++--------- 2 files changed, 16 insertions(+), 16 deletions(-) diff --git a/browser/actors/NetErrorChild.jsm b/browser/actors/NetErrorChild.jsm index 6ceb33649899..ecacca199ab6 100644 --- a/browser/actors/NetErrorChild.jsm +++ b/browser/actors/NetErrorChild.jsm @@ -124,7 +124,7 @@ class NetErrorChild extends ActorChild { msg1 = ""; msg1 += gPipNSSBundle.formatStringFromName("certErrorTrust_UnknownIssuer4", [hostString], 1); msg1 += "\n\n"; - msg1 += gPipNSSBundle.formatStringFromName("certErrorTrust_UnknownIssuer5", [brandName, hostString], 2); + msg1 += gPipNSSBundle.formatStringFromName("certErrorTrust_UnknownIssuer6", [brandName, hostString], 2); msg1 += "\n\n"; } else { msg1 += gPipNSSBundle.GetStringFromName("certErrorTrust_UnknownIssuer") + "\n"; @@ -168,7 +168,7 @@ class NetErrorChild extends ActorChild { if (newErrorPagesEnabled) { technicalInfo.textContent = ""; let brandName = gBrandBundle.GetStringFromName("brandShortName"); - msgPrefix = gPipNSSBundle.formatStringFromName("certErrorMismatchSinglePrefix1", [brandName, hostString], 2) + " "; + msgPrefix = gPipNSSBundle.formatStringFromName("certErrorMismatchSinglePrefix2", [brandName, hostString], 2) + " "; msgPrefix += gPipNSSBundle.GetStringFromName("certErrorMismatchSinglePrefix"); } else { msgPrefix = gPipNSSBundle.GetStringFromName("certErrorMismatchSinglePrefix"); @@ -242,7 +242,7 @@ class NetErrorChild extends ActorChild { if (newErrorPagesEnabled) { technicalInfo.textContent = ""; let brandName = gBrandBundle.GetStringFromName("brandShortName"); - msg = gPipNSSBundle.formatStringFromName("certErrorMismatchMultiple1", [brandName, hostString], 2) + " "; + msg = gPipNSSBundle.formatStringFromName("certErrorMismatchMultiple2", [brandName, hostString], 2) + " "; } else { msg = gPipNSSBundle.GetStringFromName("certErrorMismatchMultiple") + "\n"; } @@ -259,7 +259,7 @@ class NetErrorChild extends ActorChild { if (newErrorPagesEnabled) { technicalInfo.textContent = ""; let brandName = gBrandBundle.GetStringFromName("brandShortName"); - msg = gPipNSSBundle.formatStringFromName("certErrorMismatch1", [brandName, hostString], 2) + " "; + msg = gPipNSSBundle.formatStringFromName("certErrorMismatch2", [brandName, hostString], 2) + " "; } else { msg = gPipNSSBundle.formatStringFromName("certErrorMismatch", [hostString], 1); @@ -277,7 +277,7 @@ class NetErrorChild extends ActorChild { if (nowTime > input.data.validity.notAfter) { if (newErrorPagesEnabled) { technicalInfo.textContent = ""; - msg += gPipNSSBundle.formatStringFromName("certErrorExpiredNow1", + msg += gPipNSSBundle.formatStringFromName("certErrorExpiredNow2", [hostString], 1); msg += "\n"; } else { @@ -289,7 +289,7 @@ class NetErrorChild extends ActorChild { // eslint-disable-next-line no-lonely-if if (newErrorPagesEnabled) { technicalInfo.textContent = ""; - msg += gPipNSSBundle.formatStringFromName("certErrorNotYetValidNow1", + msg += gPipNSSBundle.formatStringFromName("certErrorNotYetValidNow2", [hostString], 1); msg += "\n"; } else { @@ -303,7 +303,7 @@ class NetErrorChild extends ActorChild { // eslint-disable-next-line no-lonely-if if (newErrorPagesEnabled) { technicalInfo.textContent = ""; - msg += gPipNSSBundle.formatStringFromName("certErrorExpiredNow1", + msg += gPipNSSBundle.formatStringFromName("certErrorExpiredNow2", [hostString], 1); msg += "\n"; } else { diff --git a/security/manager/locales/en-US/chrome/pipnss/pipnss.properties b/security/manager/locales/en-US/chrome/pipnss/pipnss.properties index 694b91218422..b33feec5bb75 100755 --- a/security/manager/locales/en-US/chrome/pipnss/pipnss.properties +++ b/security/manager/locales/en-US/chrome/pipnss/pipnss.properties @@ -279,8 +279,8 @@ certErrorTrust_UnknownIssuer=The certificate is not trusted because the issuer c certErrorTrust_UnknownIssuer2=The server might not be sending the appropriate intermediate certificates. certErrorTrust_UnknownIssuer3=An additional root certificate may need to be imported. certErrorTrust_UnknownIssuer4=Someone could be trying to impersonate the site and you should not continue. -# LOCALIZATION NOTE (certErrorTrust_UnknownIssuer5): %1$S is replaced by the brand name, %2$S is replaced by host name. -certErrorTrust_UnknownIssuer5=Websites prove their identity via security certificates. %1$S does not trust %2$S because its security certificate issuer is unknown, the certificate is self-signed, or the server is not sending the correct intermediate certificates. +# LOCALIZATION NOTE (certErrorTrust_UnknownIssuer6): %1$S is replaced by the brand name, %2$S is replaced by host name. +certErrorTrust_UnknownIssuer6=Websites prove their identity via certificates. %1$S does not trust %2$S because its security certificate issuer is unknown, the certificate is self-signed, or the server is not sending the correct intermediate certificates. certErrorTrust_CaInvalid=The certificate is not trusted because it was issued by an invalid CA certificate. certErrorTrust_Issuer=The certificate is not trusted because the issuer certificate is not trusted. certErrorTrust_SignatureAlgorithmDisabled=The certificate is not trusted because it was signed using a signature algorithm that was disabled because that algorithm is not secure. @@ -291,22 +291,22 @@ certErrorTrust_MitM=Your connection is being intercepted by a TLS proxy. Uninsta certErrorTrust_Symantec=The security certificate for %S is not trustworthy because the issuing organization failed to follow security practices. Certificates issued by Symantec, including the Thawte, GeoTrust, and RapidSSL brands, are not considered safe. certErrorMismatch=The certificate is not valid for the name %S. -# LOCALIZATION NOTE (certErrorMismatch1, certErrorMismatchSinglePrefix1, certErrorMismatchMultiple1): %1$S is replaced by the brand name, %2$S is replaced by host name. -certErrorMismatch1=Websites prove their identity via security certificates. %1$S does not trust %2$S because it uses a security certificate that is not valid for %2$S. +# LOCALIZATION NOTE (certErrorMismatch2, certErrorMismatchSinglePrefix2, certErrorMismatchMultiple2): %1$S is replaced by the brand name, %2$S is replaced by host name. +certErrorMismatch2=Websites prove their identity via certificates. %1$S does not trust %2$S because it uses a security certificate that is not valid for %2$S. # LOCALIZATION NOTE (certErrorMismatchSinglePrefix): %S is replaced by the domain for which the certificate is valid certErrorMismatchSinglePrefix=The certificate is only valid for %S. -# LOCALIZATION NOTE (certErrorMismatchSinglePrefix1): %3$S is replaced by the domain for which the certificate is valid -certErrorMismatchSinglePrefix1=Websites prove their identity via security certificates. %1$S does not trust %2$S because it uses a security certificate that is not valid for %2$S. +# LOCALIZATION NOTE (certErrorMismatchSinglePrefix2): %3$S is replaced by the domain for which the certificate is valid +certErrorMismatchSinglePrefix2=Websites prove their identity via certificates. %1$S does not trust %2$S because it uses a security certificate that is not valid for %2$S. certErrorMismatchMultiple=The certificate is only valid for the following names: -certErrorMismatchMultiple1=Websites prove their identity via security certificates. %1$S does not trust %2$S because it uses a security certificate that is not valid for %2$S. The certificate is only valid for the following names: +certErrorMismatchMultiple2=Websites prove their identity via certificates. %1$S does not trust %2$S because it uses a security certificate that is not valid for %2$S. The certificate is only valid for the following names: # LOCALIZATION NOTE (certErrorExpiredNow): Do not translate %1$S (date+time of expired certificate) or %2$S (current date+time) certErrorExpiredNow=The certificate expired on %1$S. The current time is %2$S. -certErrorExpiredNow1=Websites prove their identity via security certificates, which are valid for a set time period. The security certificate for %S appears to be expired. +certErrorExpiredNow2=Websites prove their identity via certificates, which are valid for a set time period. The security certificate for %S appears to be expired. # LOCALIZATION NOTE (certErrorNotYetValidNow): Do not translate %1$S (date+time certificate will become valid) or %2$S (current date+time) certErrorNotYetValidNow=The certificate will not be valid until %1$S. The current time is %2$S. -certErrorNotYetValidNow1=Websites prove their identity via security certificates, which are valid for a set time period. The security certificate for %S appears to be not yet valid. +certErrorNotYetValidNow2=Websites prove their identity via certificates, which are valid for a set time period. The security certificate for %S appears to be not yet valid. # LOCALIZATION NOTE (certErrorSymantecDistrustDescription): %S will be replaced by the domain for which the certificate is valid. certErrorSymantecDistrustDescription=Websites prove their identity via certificates, which are issued by certificate authorities. Most browsers will no longer trust Symantec, the certificate authority for %S. From caf7f524d71906edb756021fa7e71d8c3c013e56 Mon Sep 17 00:00:00 2001 From: Geoff Brown Date: Mon, 3 Sep 2018 08:57:53 -0600 Subject: [PATCH 13/23] Bug 1487886 - Run linux64/ccov wdspec in 2 chunks; r=marco --- taskcluster/ci/test/web-platform.yml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/taskcluster/ci/test/web-platform.yml b/taskcluster/ci/test/web-platform.yml index a720e7037f77..40c17e799d49 100644 --- a/taskcluster/ci/test/web-platform.yml +++ b/taskcluster/ci/test/web-platform.yml @@ -143,6 +143,10 @@ web-platform-tests-wdspec: linux64-asan/opt: 2 linux64-qr/.*: 2 # can't be tier-1 if it's not running on integration branches default: default + chunks: + by-test-platform: + linux64-ccov/.*: 2 + default: 1 web-platform-tests-wdspec-headless: description: "Web platform webdriver-spec headless run" From 5181659443de1a66d35221497fe61ded7f944acb Mon Sep 17 00:00:00 2001 From: Geoff Brown Date: Mon, 3 Sep 2018 08:57:55 -0600 Subject: [PATCH 14/23] Bug 1487877 - Disable some xpcshell tests on Android/debug only; r=me,a=test-only These continue to run on Android/opt and on debug on other platforms. These tests have very-long run times on Android/debug, making it impossible to balance chunk run-times and causing intermittent task timeouts. --- .../extensions/test/xpcshell/xpcshell-common.ini | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/toolkit/components/extensions/test/xpcshell/xpcshell-common.ini b/toolkit/components/extensions/test/xpcshell/xpcshell-common.ini index e7a9be8325c0..4f3604138ceb 100644 --- a/toolkit/components/extensions/test/xpcshell/xpcshell-common.ini +++ b/toolkit/components/extensions/test/xpcshell/xpcshell-common.ini @@ -63,13 +63,13 @@ skip-if = os == "android" # checking for telemetry needs to be updated: 1384923 skip-if = (os == "win" && !debug) #Bug 1419183 disable on Windows [test_ext_management_uninstall_self.js] [test_ext_messaging_startup.js] -skip-if = appname == "thunderbird" +skip-if = appname == "thunderbird" || (os == "android" && debug) [test_ext_onmessage_removelistener.js] skip-if = true # This test no longer tests what it is meant to test. [test_ext_permission_xhr.js] [test_ext_persistent_events.js] [test_ext_privacy.js] -skip-if = appname == "thunderbird" +skip-if = appname == "thunderbird" || (os == "android" && debug) [test_ext_privacy_disable.js] skip-if = appname == "thunderbird" [test_ext_privacy_update.js] @@ -83,6 +83,7 @@ skip-if = appname == "thunderbird" || os == "android" # proxy settings are not s [test_ext_proxy_speculative.js] [test_ext_proxy_startup.js] [test_ext_redirects.js] +skip-if = os == "android" && debug [test_ext_runtime_connect_no_receiver.js] [test_ext_runtime_getBrowserInfo.js] [test_ext_runtime_getPlatformInfo.js] @@ -103,8 +104,11 @@ skip-if = true # bug 1315829 skip-if = os == "android" [test_ext_startup_perf.js] [test_ext_storage.js] +skip-if = os == "android" && debug [test_ext_storage_idb_data_migration.js] +skip-if = os == "android" && debug [test_ext_storage_content.js] +skip-if = os == "android" && debug [test_ext_storage_managed.js] skip-if = os == "android" [test_ext_storage_sync.js] @@ -124,12 +128,17 @@ skip-if = os == "android" [test_ext_unload_frame.js] skip-if = true # Too frequent intermittent failures [test_ext_webRequest_auth.js] +skip-if = os == "android" && debug [test_ext_webRequest_filterResponseData.js] +skip-if = os == "android" && debug [test_ext_webRequest_permission.js] +skip-if = os == "android" && debug [test_ext_webRequest_responseBody.js] +skip-if = os == "android" && debug [test_ext_webRequest_set_cookie.js] -skip-if = appname == "thunderbird" +skip-if = appname == "thunderbird" || (os == "android" && debug) [test_ext_webRequest_startup.js] +skip-if = os == "android" && debug [test_ext_webRequest_suspend.js] [test_ext_webRequest_webSocket.js] skip-if = appname == "thunderbird" From a6aab5c8f4d578beaeb04704f54e06fcd27d3366 Mon Sep 17 00:00:00 2001 From: Ehsan Akhgari Date: Sun, 2 Sep 2018 19:35:52 -0400 Subject: [PATCH 15/23] Bug 1488013 - Don't move the UI elements too early otherwise the XBL binding wouldn't have been applied when we want to adjust the checked attribute on our checkbox element; r=johannh Differential Revision: https://phabricator.services.mozilla.com/D4829 --- .../preferences/in-content/privacy.js | 13 +++++--- .../tests/browser_contentblocking.js | 30 +++++++++++++++++++ 2 files changed, 39 insertions(+), 4 deletions(-) diff --git a/browser/components/preferences/in-content/privacy.js b/browser/components/preferences/in-content/privacy.js index ea2dc9d3c3f7..dbe265ec8e70 100644 --- a/browser/components/preferences/in-content/privacy.js +++ b/browser/components/preferences/in-content/privacy.js @@ -529,10 +529,15 @@ var gPrivacyPane = { let siteDataGroup = document.getElementById("siteDataGroup"); let browserPrivacyCategory = document.getElementById("browserPrivacyCategory"); - browserPrivacyCategory.parentNode.insertBefore(siteDataGroup, - browserPrivacyCategory.nextSibling); - browserPrivacyCategory.parentNode.insertBefore(trackingGroup, - browserPrivacyCategory.nextSibling); + // If we do this without a timeout, trackingProtectionReadPrefs will set the checked + // attribute on our checkbox element before the XBL binding has had a chance to have + // been re-applied to it. + setTimeout(() => { + browserPrivacyCategory.parentNode.insertBefore(siteDataGroup, + browserPrivacyCategory.nextSibling); + browserPrivacyCategory.parentNode.insertBefore(trackingGroup, + browserPrivacyCategory.nextSibling); + }, 0); }, /** diff --git a/browser/components/preferences/in-content/tests/browser_contentblocking.js b/browser/components/preferences/in-content/tests/browser_contentblocking.js index 86f3bbd61f11..5b6e847e7dae 100644 --- a/browser/components/preferences/in-content/tests/browser_contentblocking.js +++ b/browser/components/preferences/in-content/tests/browser_contentblocking.js @@ -56,6 +56,36 @@ add_task(async function testContentBlockingToggle() { gBrowser.removeCurrentTab(); }); +// Tests that the content blocking main category checkboxes have the correct default state. +add_task(async function testContentBlockingMainCategory() { + SpecialPowers.pushPrefEnv({set: [ + [CB_UI_PREF, true], + [CB_PREF, true], + [FB_PREF, true], + [TP_PREF, false], + [TP_PBM_PREF, true], + [NCB_PREF, Ci.nsICookieService.BEHAVIOR_REJECT_TRACKER], + ]}); + + let checkboxes = [ + "#contentBlockingFastBlockCheckbox", + "#contentBlockingTrackingProtectionCheckbox", + "#contentBlockingBlockCookiesCheckbox", + ]; + + await openPreferencesViaOpenPreferencesAPI("privacy", {leaveOpen: true}); + let doc = gBrowser.contentDocument; + + for (let selector of checkboxes) { + let element = doc.querySelector(selector); + ok(element, "checkbox " + selector + " exists"); + is(element.getAttribute("checked"), "true", + "checkbox " + selector + " is checked"); + } + + gBrowser.removeCurrentTab(); +}); + // Tests that the content blocking "Restore Defaults" button does what it's supposed to. add_task(async function testContentBlockingRestoreDefaults() { SpecialPowers.pushPrefEnv({set: [ From a81e4a8252aa7dc6ba003faf08dba532f737cf84 Mon Sep 17 00:00:00 2001 From: Ehsan Akhgari Date: Mon, 3 Sep 2018 10:57:35 -0400 Subject: [PATCH 16/23] Bug 1488235 - Remove the XPCOM component registration for nsHttpServer; r=valentin Differential Revision: https://phabricator.services.mozilla.com/D4876 --- netwerk/test/httpserver/README | 6 +++--- netwerk/test/httpserver/httpd.js | 9 --------- netwerk/test/httpserver/httpd.manifest | 2 -- 3 files changed, 3 insertions(+), 14 deletions(-) diff --git a/netwerk/test/httpserver/README b/netwerk/test/httpserver/README index e253c6d47115..97624789cac8 100644 --- a/netwerk/test/httpserver/README +++ b/netwerk/test/httpserver/README @@ -24,10 +24,10 @@ Firefox, these simply need to be added to the /components directory of your XPI. Other applications may require use of regxpcom or other techniques; consult the applicable documentation for further details. -Finally, create an instance of the server using the following command: +Finally, load httpd.js into the current file, and create an instance of the +server using the following command: - var server = Components.classes["@mozilla.org/server/jshttp;1"] - .createInstance(Components.interfaces.nsIHttpServer); + var server = new nsHttpServer(); At this point you'll want to initialize the server, since by default it doesn't serve many useful paths. For more information on this, see the IDL docs for the diff --git a/netwerk/test/httpserver/httpd.js b/netwerk/test/httpserver/httpd.js index e5115d44cad3..1e297d2b3fae 100644 --- a/netwerk/test/httpserver/httpd.js +++ b/netwerk/test/httpserver/httpd.js @@ -38,8 +38,6 @@ var EXPORTED_SYMBOLS = [ "HttpServer", ]; -ChromeUtils.import("resource://gre/modules/XPCOMUtils.jsm"); - const CC = Components.Constructor; const PR_UINT32_MAX = Math.pow(2, 32) - 1; @@ -390,8 +388,6 @@ function nsHttpServer() } nsHttpServer.prototype = { - classID: Components.ID("{54ef6f81-30af-4b1d-ac55-8ba811293e41}"), - // NSISERVERSOCKETLISTENER /** @@ -5329,11 +5325,6 @@ Request.prototype = } }; - -// XPCOM trappings - -var NSGetFactory = XPCOMUtils.generateNSGetFactory([nsHttpServer]); - /** * Creates a new HTTP server listening for loopback traffic on the given port, * starts it, and runs the server until the server processes a shutdown request, diff --git a/netwerk/test/httpserver/httpd.manifest b/netwerk/test/httpserver/httpd.manifest index 745e5d3672d1..ff184e020b97 100644 --- a/netwerk/test/httpserver/httpd.manifest +++ b/netwerk/test/httpserver/httpd.manifest @@ -1,3 +1 @@ -component {54ef6f81-30af-4b1d-ac55-8ba811293e41} httpd.js -contract @mozilla.org/server/jshttp;1 {54ef6f81-30af-4b1d-ac55-8ba811293e41} interfaces test_necko.xpt From 32868a163804f7acfb57843c981feba2a73fdaec Mon Sep 17 00:00:00 2001 From: Ehsan Akhgari Date: Sun, 2 Sep 2018 18:22:12 -0400 Subject: [PATCH 17/23] Bug 1488097 - Make browser_search_subdialogs_within_preferences_site_data.js test both the case with and without the Content Blocking UI; r=johannh Differential Revision: https://phabricator.services.mozilla.com/D4828 --- ...subdialogs_within_preferences_site_data.js | 37 +++++++++++++++++++ 1 file changed, 37 insertions(+) diff --git a/browser/components/preferences/in-content/tests/browser_search_subdialogs_within_preferences_site_data.js b/browser/components/preferences/in-content/tests/browser_search_subdialogs_within_preferences_site_data.js index 4395dcc1e5d3..21c462a2a802 100644 --- a/browser/components/preferences/in-content/tests/browser_search_subdialogs_within_preferences_site_data.js +++ b/browser/components/preferences/in-content/tests/browser_search_subdialogs_within_preferences_site_data.js @@ -7,6 +7,11 @@ add_task(async function() { await SpecialPowers.pushPrefEnv({"set": [["browser.preferences.search", true]]}); }); +// First, run the tests without the Content Blocking UI. +add_task(async function() { + await SpecialPowers.pushPrefEnv({"set": [["browser.contentblocking.ui.enabled", false]]}); +}); + /** * Test for searching for the "Settings - Site Data" subdialog. */ @@ -33,3 +38,35 @@ add_task(async function() { await evaluateSearchResults("third-party", "siteDataGroup"); BrowserTestUtils.removeTab(gBrowser.selectedTab); }); + +// Now, run the tests with the Content Blocking UI. +add_task(async function() { + await SpecialPowers.pushPrefEnv({"set": [["browser.contentblocking.ui.enabled", true]]}); +}); + +/** + * Test for searching for the "Settings - Site Data" subdialog. + */ +add_task(async function() { + await openPreferencesViaOpenPreferencesAPI("paneGeneral", {leaveOpen: true}); + await evaluateSearchResults("cookies", ["siteDataGroup", "trackingGroup"]); + BrowserTestUtils.removeTab(gBrowser.selectedTab); +}); + +add_task(async function() { + await openPreferencesViaOpenPreferencesAPI("paneGeneral", {leaveOpen: true}); + await evaluateSearchResults("site data", ["siteDataGroup"]); + BrowserTestUtils.removeTab(gBrowser.selectedTab); +}); + +add_task(async function() { + await openPreferencesViaOpenPreferencesAPI("paneGeneral", {leaveOpen: true}); + await evaluateSearchResults("cache", ["siteDataGroup"]); + BrowserTestUtils.removeTab(gBrowser.selectedTab); +}); + +add_task(async function() { + await openPreferencesViaOpenPreferencesAPI("paneGeneral", {leaveOpen: true}); + await evaluateSearchResults("third-party", ["siteDataGroup", "trackingGroup"]); + BrowserTestUtils.removeTab(gBrowser.selectedTab); +}); From f8bf86582d3377ba340637fc10131e41b56b6d31 Mon Sep 17 00:00:00 2001 From: Bas Schouten Date: Mon, 3 Sep 2018 15:16:28 +0200 Subject: [PATCH 18/23] Bug 1486415: Ensure the SourceSurface stays alive for the duration of MarkIndependent. r=jrmuizel Differential Revision: https://phabricator.services.mozilla.com/D4856 --- gfx/2d/SourceSurfaceD2D1.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/gfx/2d/SourceSurfaceD2D1.cpp b/gfx/2d/SourceSurfaceD2D1.cpp index d82ed43b7d55..ab0e815d921a 100644 --- a/gfx/2d/SourceSurfaceD2D1.cpp +++ b/gfx/2d/SourceSurfaceD2D1.cpp @@ -146,6 +146,8 @@ SourceSurfaceD2D1::DrawTargetWillChange() DrawTargetD2D1::mVRAMUsageSS += mSize.width * mSize.height * BytesPerPixel(mFormat); + // Ensure the object stays alive for the duration of MarkIndependent. + RefPtr deathGrip = this; // We now no longer depend on the source surface content remaining the same. MarkIndependent(); } From e221dc79e10b8f76656ce5faf7bb08b121912f7c Mon Sep 17 00:00:00 2001 From: Ehsan Akhgari Date: Mon, 3 Sep 2018 12:18:04 -0400 Subject: [PATCH 19/23] Bug 1488235 follow-up: Import XPCOMUtils.jsm in head_utils.js Landed on a CLOSED TREE --- netwerk/test/httpserver/test/head_utils.js | 1 + 1 file changed, 1 insertion(+) diff --git a/netwerk/test/httpserver/test/head_utils.js b/netwerk/test/httpserver/test/head_utils.js index 63f033a5d996..f48819eab0cf 100644 --- a/netwerk/test/httpserver/test/head_utils.js +++ b/netwerk/test/httpserver/test/head_utils.js @@ -11,6 +11,7 @@ load(_HTTPD_JS_PATH.path); // if these tests fail, we'll want the debug output DEBUG = true; +ChromeUtils.import("resource://gre/modules/XPCOMUtils.jsm"); ChromeUtils.import("resource://gre/modules/NetUtil.jsm"); /** From aa17415c4895e704da8ef267c12a900073be783a Mon Sep 17 00:00:00 2001 From: Ehsan Akhgari Date: Sun, 2 Sep 2018 18:12:41 -0400 Subject: [PATCH 20/23] Bug 1488096 - Give changeBlockListLink the same search-l10n-ids as changeBlockList; r=johannh Differential Revision: https://phabricator.services.mozilla.com/D4827 --- .../preferences/in-content/privacy.xul | 5 ++++- ...r_search_subdialogs_within_preferences_6.js | 18 +++++++++++++++--- 2 files changed, 19 insertions(+), 4 deletions(-) diff --git a/browser/components/preferences/in-content/privacy.xul b/browser/components/preferences/in-content/privacy.xul index df2ebd4d0064..bfd47d4071e0 100644 --- a/browser/components/preferences/in-content/privacy.xul +++ b/browser/components/preferences/in-content/privacy.xul @@ -379,7 +379,10 @@ data-l10n-id="content-blocking-tracking-protection-option-always" flex="1" /> -