From b0077c1653a2a7a68fe3e9b81c7f2570d4c5b293 Mon Sep 17 00:00:00 2001 From: Boris Zbarsky Date: Fri, 29 Apr 2016 23:13:46 -0400 Subject: [PATCH] Bug 1184351. Remove a race in the picture-tag cases in mixed-content web platform tests. r=jgraham --- .../no-redirect/opt-in-blocks.https.html.ini | 5 ----- .../no-redirect/no-opt-in-blocks.https.html.ini | 10 ---------- .../no-redirect/no-opt-in-blocks.https.html.ini | 10 ---------- .../tests/mixed-content/generic/common.js | 13 ++++++++++++- 4 files changed, 12 insertions(+), 26 deletions(-) delete mode 100644 testing/web-platform/meta/mixed-content/blockable/http-csp/same-host-http/picture-tag/top-level/no-redirect/opt-in-blocks.https.html.ini delete mode 100644 testing/web-platform/meta/mixed-content/blockable/no-opt-in/cross-origin-http/picture-tag/top-level/no-redirect/no-opt-in-blocks.https.html.ini delete mode 100644 testing/web-platform/meta/mixed-content/blockable/no-opt-in/same-host-http/picture-tag/top-level/no-redirect/no-opt-in-blocks.https.html.ini diff --git a/testing/web-platform/meta/mixed-content/blockable/http-csp/same-host-http/picture-tag/top-level/no-redirect/opt-in-blocks.https.html.ini b/testing/web-platform/meta/mixed-content/blockable/http-csp/same-host-http/picture-tag/top-level/no-redirect/opt-in-blocks.https.html.ini deleted file mode 100644 index c72f29e028f5..000000000000 --- a/testing/web-platform/meta/mixed-content/blockable/http-csp/same-host-http/picture-tag/top-level/no-redirect/opt-in-blocks.https.html.ini +++ /dev/null @@ -1,5 +0,0 @@ -[opt-in-blocks.https.html] - type: testharness - disabled: - if debug and (os == "linux"): https://bugzilla.mozilla.org/show_bug.cgi?id=1184351 - if e10s and (os == "linux"): https://bugzilla.mozilla.org/show_bug.cgi?id=1184351 diff --git a/testing/web-platform/meta/mixed-content/blockable/no-opt-in/cross-origin-http/picture-tag/top-level/no-redirect/no-opt-in-blocks.https.html.ini b/testing/web-platform/meta/mixed-content/blockable/no-opt-in/cross-origin-http/picture-tag/top-level/no-redirect/no-opt-in-blocks.https.html.ini deleted file mode 100644 index bb716a8dbe43..000000000000 --- a/testing/web-platform/meta/mixed-content/blockable/no-opt-in/cross-origin-http/picture-tag/top-level/no-redirect/no-opt-in-blocks.https.html.ini +++ /dev/null @@ -1,10 +0,0 @@ -[no-opt-in-blocks.https.html] - type: testharness - disabled: - if e10s and (os == "linux"): https://bugzilla.mozilla.org/show_bug.cgi?id=1184351 - if e10s and (os == "mac"): https://bugzilla.mozilla.org/show_bug.cgi?id=1184351 - [opt_in_method: no-opt-in\n origin: cross-origin-http\n source_scheme: https\n context_nesting: top-level\n redirection: no-redirect\n subresource: picture-tag\n expectation: blocked] - expected: - if debug and (os == "linux"): FAIL - if debug and (os == "mac"): FAIL - diff --git a/testing/web-platform/meta/mixed-content/blockable/no-opt-in/same-host-http/picture-tag/top-level/no-redirect/no-opt-in-blocks.https.html.ini b/testing/web-platform/meta/mixed-content/blockable/no-opt-in/same-host-http/picture-tag/top-level/no-redirect/no-opt-in-blocks.https.html.ini deleted file mode 100644 index 068b638b5ac5..000000000000 --- a/testing/web-platform/meta/mixed-content/blockable/no-opt-in/same-host-http/picture-tag/top-level/no-redirect/no-opt-in-blocks.https.html.ini +++ /dev/null @@ -1,10 +0,0 @@ -[no-opt-in-blocks.https.html] - type: testharness - disabled: - if debug and (os == "linux"): https://bugzilla.mozilla.org/show_bug.cgi?id=1184351 - if e10s and (os == "linux"): https://bugzilla.mozilla.org/show_bug.cgi?id=1184351 - if e10s and (os == "mac"): https://bugzilla.mozilla.org/show_bug.cgi?id=1184351 - [opt_in_method: no-opt-in\n origin: same-host-http\n source_scheme: https\n context_nesting: top-level\n redirection: no-redirect\n subresource: picture-tag\n expectation: blocked] - expected: - if debug and (os == "mac"): FAIL - diff --git a/testing/web-platform/tests/mixed-content/generic/common.js b/testing/web-platform/tests/mixed-content/generic/common.js index 3881513b2f25..36427a4669fa 100644 --- a/testing/web-platform/tests/mixed-content/generic/common.js +++ b/testing/web-platform/tests/mixed-content/generic/common.js @@ -107,11 +107,22 @@ function createElement(tagName, attrs, parent, doBindEvents) { // We set the attributes after binding to events to catch any // event-triggering attribute changes. E.g. form submission. - setAttributes(element, attrs); + // + // But be careful with images: unlike other elements they will start the load + // as soon as the attr is set, even if not in the document yet, and sometimes + // complete it synchronously, so the append doesn't have the effect we want. + // So for images, we want to set the attrs after appending, whereas for other + // elements we want to do it before appending. + var isImg = (tagName == "img"); + if (!isImg) + setAttributes(element, attrs); if (parent) parent.appendChild(element); + if (isImg) + setAttributes(element, attrs); + return element; }