Introduce Origin-Trial for Service Worker Navigation Preload.
There are three possible states:
- A: Navigation Preload related methods and attributes are available in JS
and work correctly.
- B: Navigation Preload related methods and attributes are available in
JS. But NavigationPreloadManager's enable, disable and setHeaderValue
methods always return a rejected promise. And FetchEvent's
preloadResponse attribute returns a promise which always resolve with
undefined.
- C: Navigation Preload related methods and attributes are not available
in JS.
The state B is very weird state. But we can't avoid this, because the generated
code OriginTrials.cpp always return true when the Origin Trial is enabled.
https://cs.chromium.org/chromium/src/out/Debug/gen/blink/core/origin_trials/OriginTrials.cpp
And according to the discussion, this is the expected behavior.
https://groups.google.com/a/chromium.org/forum/#!topic/experimentation-dev/k6ZdmFp84QE
* Origin Trial: Have an effective header.
Command line
Default Enable Disabled
Default B A B
Field trial Enabled A A B
Disabled B A B
* Origin Trial: No header.
Command line
Default Enable Disabled
Default C A C
Field trial Enabled C A C
Disabled C A C
There is no way to test the field trial Enabled/Disabled cases in LayoutTest.
So the LayoutTests in this CL test the following combinations.
(Field trial=Default) * (Command line=Default/Enable/Disabled) * (OriginTrial=On/Off)
BUG=
649558
Review-Url:
https://codereview.chromium.org/2627023002
Cr-Commit-Position: refs/heads/master@{#443742}
Committed:
https://chromium.googlesource.com/chromium/src/+/519589379f0aa766e7fe2357515b0f506f001d12