Capture frame policy at the beginning of navigation

Changing the frame policy when a navigation is already in-flight must not affect
the in-flight navigation because of
https://html.spec.whatwg.org/multipage/iframe-embed-object.html#attr-iframe-allow

The snapshot is made at the beginning of a local_frame_client navigation and used
on document initialization(after commit of navigation). If the frame owner is a
remote one, the old value is used.

- capture frame policy at the start of navigation
    - local_frame_client_impl
    - NavigationInfo
    - render_frame_impl.BeginNavigationInternal

- pass it from renderer process to browser process through
  CommonNavigationParams in navigation_params.mojom
  - MakeCommonNavigationParams

- use value in CommonNavigationParams to init navigation_params
  - render_frame_impl.CommitNavigationInternal
  - web_navigation_params
    -> DocumentInit
    -> Document::InitializeFeaturePolicy

More detailed information could be found on crbug page.

A document_loader_test is added to further strengthen the test on frame
policy value used. Verified that the added test would fail without the
patch.

Bug: 972089
Change-Id: I694aa46b6e8e04bebc86b0e7886b856a9a302905
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1796119
Reviewed-by: Daniel Cheng <dcheng@chromium.org>
Reviewed-by: Alex Moshchuk <alexmos@chromium.org>
Reviewed-by: Ian Clelland <iclelland@chromium.org>
Commit-Queue: Charlie Hu <chenleihu@google.com>
Cr-Commit-Position: refs/heads/master@{#714475}
1 file changed
tree: 7315d78e4e06adf9154e1a182df460b95e64f44a
  1. .github/
  2. .well-known/
  3. 2dcontext/
  4. accelerometer/
  5. accname/
  6. acid/
  7. ambient-light/
  8. animation-worklet/
  9. annotation-model/
  10. annotation-protocol/
  11. annotation-vocab/
  12. apng/
  13. appmanifest/
  14. audio-output/
  15. background-fetch/
  16. BackgroundSync/
  17. battery-status/
  18. beacon/
  19. bluetooth/
  20. clear-site-data/
  21. client-hints/
  22. clipboard-apis/
  23. common/
  24. compat/
  25. compression/
  26. conformance-checkers/
  27. console/
  28. contacts/
  29. content-security-policy/
  30. cookie-store/
  31. cookies/
  32. core-aam/
  33. cors/
  34. credential-management/
  35. css/
  36. custom-elements/
  37. device-memory/
  38. docs/
  39. dom/
  40. domparsing/
  41. domxpath/
  42. dpub-aam/
  43. dpub-aria/
  44. editing/
  45. element-timing/
  46. encoding/
  47. encrypted-media/
  48. entries-api/
  49. event-timing/
  50. eventsource/
  51. feature-policy/
  52. fetch/
  53. FileAPI/
  54. fonts/
  55. forced-colors-mode/
  56. fullscreen/
  57. gamepad/
  58. generic-sensor/
  59. geolocation-API/
  60. geolocation-sensor/
  61. graphics-aam/
  62. gyroscope/
  63. hr-time/
  64. html/
  65. html-longdesc/
  66. html-media-capture/
  67. idle-detection/
  68. imagebitmap-renderingcontext/
  69. images/
  70. import-maps/
  71. IndexedDB/
  72. inert/
  73. infrastructure/
  74. input-device-capabilities/
  75. input-events/
  76. interfaces/
  77. intersection-observer/
  78. js/
  79. keyboard-lock/
  80. keyboard-map/
  81. kv-storage/
  82. largest-contentful-paint/
  83. layout-instability/
  84. lifecycle/
  85. loading/
  86. longtask-timing/
  87. magnetometer/
  88. mathml/
  89. measure-memory/
  90. media/
  91. media-capabilities/
  92. media-playback-quality/
  93. media-source/
  94. mediacapture-depth/
  95. mediacapture-fromelement/
  96. mediacapture-image/
  97. mediacapture-record/
  98. mediacapture-streams/
  99. mediasession/
  100. mimesniff/
  101. mixed-content/
  102. mst-content-hint/
  103. native-file-system/
  104. navigation-timing/
  105. netinfo/
  106. network-error-logging/
  107. notifications/
  108. offscreen-canvas/
  109. old-tests/
  110. orientation-event/
  111. orientation-sensor/
  112. origin-policy/
  113. page-visibility/
  114. paint-timing/
  115. payment-handler/
  116. payment-method-basic-card/
  117. payment-method-id/
  118. payment-request/
  119. performance-timeline/
  120. permissions/
  121. picture-in-picture/
  122. pointerevents/
  123. pointerlock/
  124. portals/
  125. preload/
  126. presentation-api/
  127. printing/
  128. priority-hints/
  129. proximity/
  130. push-api/
  131. quirks/
  132. referrer-policy/
  133. remote-playback/
  134. reporting/
  135. requestidlecallback/
  136. resize-observer/
  137. resource-timing/
  138. resources/
  139. screen-capture/
  140. screen-orientation/
  141. screen_enumeration/
  142. scroll-animations/
  143. scroll-to-text-fragment/
  144. secure-contexts/
  145. selection/
  146. serial/
  147. server-timing/
  148. service-workers/
  149. shadow-dom/
  150. shape-detection/
  151. signed-exchange/
  152. sms/
  153. speech-api/
  154. std-toast/
  155. storage/
  156. storage-access-api/
  157. streams/
  158. subresource-integrity/
  159. svg/
  160. svg-aam/
  161. timing-entrytypes-registry/
  162. tools/
  163. touch-events/
  164. trusted-types/
  165. uievents/
  166. upgrade-insecure-requests/
  167. url/
  168. user-timing/
  169. vibration/
  170. visual-viewport/
  171. wai-aria/
  172. wake-lock/
  173. wasm/
  174. web-animations/
  175. web-locks/
  176. web-nfc/
  177. web-share/
  178. webaudio/
  179. webauthn/
  180. WebCryptoAPI/
  181. webdriver/
  182. webgl/
  183. webgpu/
  184. WebIDL/
  185. webmessaging/
  186. webmidi/
  187. webrtc/
  188. webrtc-extensions/
  189. webrtc-identity/
  190. webrtc-quic/
  191. webrtc-stats/
  192. webrtc-svc/
  193. websockets/
  194. webstorage/
  195. webusb/
  196. webvr/
  197. webvtt/
  198. webxr/
  199. workers/
  200. worklets/
  201. x-frame-options/
  202. xhr/
  203. xslt/
  204. .azure-pipelines.yml
  205. .codecov.yml
  206. .gitattributes
  207. .gitignore
  208. .mailmap
  209. .pyup.yml
  210. .taskcluster.yml
  211. check_stability.ini
  212. CODEOWNERS
  213. CONTRIBUTING.md
  214. LICENSE.md
  215. lint.whitelist
  216. README.md
  217. testharness_runner.html
  218. update-built-tests.sh
  219. wpt
  220. wpt.py
README.md

The web-platform-tests Project

The web-platform-tests Project is a W3C-coordinated attempt to build a cross-browser test suite for the Web-platform stack. Writing tests in a way that allows them to be run in all browsers gives browser projects confidence that they are shipping software that is compatible with other implementations, and that later implementations will be compatible with their implementations. This in turn gives Web authors/developers confidence that they can actually rely on the Web platform to deliver on the promise of working across browsers and devices without needing extra layers of abstraction to paper over the gaps left by specification editors and implementors.

The most important sources of information and activity are:

  • github.com/web-platform-tests/wpt: the canonical location of the project's source code revision history and the discussion forum for changes to the code
  • web-platform-tests.org: the documentation website; details how to set up the project, how to write tests, how to give and receive peer review, how to serve as an administrator, and more
  • wpt.live: a public deployment of the test suite, allowing anyone to run the tests by visiting from an Internet-enabled browser of their choice
  • wpt.fyi: an archive of test results collected from an array of web browsers on a regular basis
  • Real-time chat room: the IRC chat room named #testing on irc.w3.org; includes participants located around the world, but busiest during the European working day; all discussion is archived here
  • Mailing list: a public and low-traffic discussion list

If you'd like clarification about anything, don't hesitate to ask in the chat room or on the mailing list.

Setting Up the Repo

Clone or otherwise get https://github.com/web-platform-tests/wpt.

Note: because of the frequent creation and deletion of branches in this repo, it is recommended to “prune” stale branches when fetching updates, i.e. use git pull --prune (or git fetch -p && git merge).

Running the Tests

See the documentation website and in particular the system setup for running tests locally.

Command Line Tools

The wpt command provides a frontend to a variety of tools for working with and running web-platform-tests. Some of the most useful commands are:

  • wpt serve - For starting the wpt http server
  • wpt run - For running tests in a browser
  • wpt lint - For running the lint against all tests
  • wpt manifest - For updating or generating a MANIFEST.json test manifest
  • wpt install - For installing the latest release of a browser or webdriver server on the local machine.

Windows Notes

On Windows wpt commands must be prefixed with python or the path to the python binary (if python is not in your %PATH%).

python wpt [command]

Alternatively, you may also use Bash on Ubuntu on Windows in the Windows 10 Anniversary Update build, then access your windows partition from there to launch wpt commands.

Please make sure git and your text editor do not automatically convert line endings, as it will cause lint errors. For git, please set git config core.autocrlf false in your working tree.

Publication

The master branch is automatically synced to http://w3c-test.org/.

Pull requests are automatically mirrored except those that modify sensitive resources (such as .py). The latter require someone with merge access to comment with “LGTM” or “w3c-test:mirror” to indicate the pull request has been checked.

Branches

In the vast majority of cases the only upstream branch that you should need to care about is master. If you see other branches in the repository, you can generally safely ignore them.

Contributing

Save the Web, Write Some Tests!

Absolutely everyone is welcome to contribute to test development. No test is too small or too simple, especially if it corresponds to something for which you've noted an interoperability bug in a browser.

The way to contribute is just as usual:

  • Fork this repository (and make sure you're still relatively in sync with it if you forked a while ago).
  • Create a branch for your changes: git checkout -b topic.
  • Make your changes.
  • Run ./wpt lint as described above.
  • Commit locally and push that to your repo.
  • Create a pull request based on the above.

Issues with web-platform-tests

If you spot an issue with a test and are not comfortable providing a pull request per above to fix it, please file a new issue. Thank you!