gecko-dev/testing/web-platform/tests/mixed-content/generic/script.js
Hiroshige Hayashizaki 46ee10e74a Bug 1526275 [wpt PR 15262] - [WPT] Merge wpt/{referrer-policy,mixed-content}/generic/common.js, a=testonly
Automatic update from web-platform-tests
[WPT] Merge wpt/{referrer-policy,mixed-content}/generic/common.js

To merge wpt/{referrer-policy,mixed-content} test frameworks,
this CL merges their common.js.

The new common.js is based on mixed-content's common.js,
with some aspects imported from referrer-policy's common.js:
- Passes results from subresource payloads to resolved promises,
  converting if necessary using wrapResult().
  This is for referrer-policy tests that rely on subresource
  payload to get referrer request headers, while
  mixed-content tests don't use the payload information at all.
- Accepts `additionalAttributes` arguments (to be used to set
  referrer-policy-related attributes to elements).
- Extends bindEvents() to clean up event listeners on completion
  (which is done for some request types in
  referrer-policy's common.js).
- Imports queryImage() (with renaming to
  requestViaImageForReferrerPolicy) from referrer-policy's common.js
  (this should be merged with mixed-content version of
  image requests, but not now).

On mixed-content side:
- expect.py's response for script requests is modified
  because postMessage() is required by referrer-policy's common.js.

On referrer-policy side:
- Move referrer-policy-specific code from common.js
  to referrer-policy-test-case.js, including wrapResult().
- All tests (except for two [1][2]) are converted to promise-based,
  to handle errors correctly.
- Bugs in the remaining two tests [1][2] are fixed.

[1] referrer-policy/generic/iframe-inheritance.html
[2] referrer-policy/generic/sandboxed-iframe-with-opaque-origin.html

Then now
wpt/{referrer-policy,mixed-content}/generic/common.js
are the same.

They are duplicated (i.e. not moved/merged to a single file)
just to avoid mass modification of a large number of
generated files for each step of refactoring,
as these file names are hard-coded there.

Bug: 906850
Change-Id: I39f19d08d658c1a898fc453b621d82a2faaaaf6b
Reviewed-on: https://chromium-review.googlesource.com/c/1455745
Commit-Queue: Hiroshige Hayashizaki <hiroshige@chromium.org>
Reviewed-by: Mike West <mkwst@chromium.org>
Reviewed-by: Hiroki Nakagawa <nhiroki@chromium.org>
Reviewed-by: Jochen Eisinger <jochen@chromium.org>
Cr-Commit-Position: refs/heads/master@{#633917}

--

wpt-commits: 767f361425c20ded79c35630f709fc7addf7f80a
wpt-pr: 15262
2019-03-16 12:13:16 +00:00

1 line
22 B
JavaScript