Bug 1560495: Update unload event security information for Navigation-Timing Level 2 specification. r=baku

Differential Revision: https://phabricator.services.mozilla.com/D36293

--HG--
extra : moz-landing-system : lando
This commit is contained in:
Will Hawkins 2019-07-09 07:19:50 +00:00
parent 57a64c3906
commit b904ee7e69
8 changed files with 43 additions and 18 deletions

View File

@ -29,15 +29,41 @@ JSObject* PerformanceNavigationTiming::WrapObject(
rawValue, mPerformance->GetRandomTimelineSeed())
DOMHighResTimeStamp PerformanceNavigationTiming::UnloadEventStart() const {
DOMHighResTimeStamp rawValue =
mPerformance->GetDOMTiming()->GetUnloadEventStartHighRes();
DOMHighResTimeStamp rawValue = 0;
/*
* Per Navigation Timing Level 2, the value is 0 if
* a. there is no previous document or
* b. the same-origin-check fails.
*
* The same-origin-check is defined as:
* 1. If the previous document exists and its origin is not same
* origin as the current document's origin, return "fail".
* 2. Let request be the current document's request.
* 3. If request's redirect count is not zero, and all of request's
* HTTP redirects have the same origin as the current document,
* return "pass".
* 4. Otherwise, return "fail".
*/
if (mTimingData->AllRedirectsSameOrigin()) { // same-origin-check:2/3
/*
* GetUnloadEventStartHighRes returns 0 if
* 1. there is no previous document (a, above) or
* 2. the current URI does not have the same origin as
* the previous document's URI. (same-origin-check:1)
*/
rawValue = mPerformance->GetDOMTiming()->GetUnloadEventStartHighRes();
}
REDUCE_TIME_PRECISION;
}
DOMHighResTimeStamp PerformanceNavigationTiming::UnloadEventEnd() const {
DOMHighResTimeStamp rawValue =
mPerformance->GetDOMTiming()->GetUnloadEventEndHighRes();
DOMHighResTimeStamp rawValue = 0;
// See comments in PerformanceNavigationTiming::UnloadEventEnd().
if (mTimingData->AllRedirectsSameOrigin()) {
rawValue = mPerformance->GetDOMTiming()->GetUnloadEventEndHighRes();
}
REDUCE_TIME_PRECISION;
}

View File

@ -1,4 +1,2 @@
[nav2_test_redirect_xserver_opt_in.html]
[Navigation Timing 2 WPT]
expected: FAIL
disabled: https://bugzilla.mozilla.org/show_bug.cgi?id=1564217

View File

@ -0,0 +1,2 @@
[nav2_test_unloadEvents_no_previous_document.html]
disabled: https://bugzilla.mozilla.org/show_bug.cgi?id=1564217

View File

@ -0,0 +1,2 @@
[nav2_test_unloadEvents_previous_document_cross_origin.sub.html]
disabled: https://bugzilla.mozilla.org/show_bug.cgi?id=1564217

View File

@ -1,4 +1,2 @@
[nav2_test_unloadEvents_with_cross_origin_redirect_chain_partial_opt_in.html]
[Navigation Timing 2 WPT]
expected: FAIL
[nav2_test_unloadEvents_with_cross_origin_redirect_chain_partial_opt]
disabled: https://bugzilla.mozilla.org/show_bug.cgi?id=1564217

View File

@ -0,0 +1,2 @@
[nav2_test_unloadEvents_with_cross_origin_redirect_opt_in.html]
disabled: https://bugzilla.mozilla.org/show_bug.cgi?id=1564217

View File

@ -1,7 +1,2 @@
[nav2_test_unloadEvents_with_cross_origin_redirects.html]
disabled:
if os == "android" and not e10s: https://bugzilla.mozilla.org/show_bug.cgi?id=1499003
[Navigation Timing 2 WPT]
expected:
FAIL
[navigation-timing/nav2_test_unloadEvents_with_cross_origin_redirects.html]
disabled: https://bugzilla.mozilla.org/show_bug.cgi?id=1564217

View File

@ -0,0 +1,2 @@
[nav2_test_unloadEvents_with_previous_document.html]
disabled: https://bugzilla.mozilla.org/show_bug.cgi?id=1564217