Fix allow/sandbox attribute timing issue on browser side

The issue of allow/sandbox attribute timing originates from bug crbug.com/972089.
The initial fix to that bug only deals with feature policy replication
problem on renderer side.

This CL adds a wpt test that targets a feature(camera) that is tested on
browser side. A test on similar issue with sandbox attribute is added
as well but as tentative.

On browser-side:
Frame policy value is captured at RenderFrameHostImpl::BeginNavigation,
and travel through the whole navigation process in
NavigationRequest::commit_params. Finally it will reach
NavigatorImpl::DidNavigate which is called by
RenderFrameHostImpl::DidCommitNavigationInternal.

NavigatorImpl will then use the value captured from the beginning of navigation
in commit_params to set the active frame policy instead of using currently
pending frame policy, which could be further modified by the time the navigation
commits.

This CL also gets rid of separate handling of remote frame container policy in
document.cc by capturing pending frame policy at NavigationControllerImpl::
CreateNavigationRequestFromLoadParams.

Quick Example:
1. we start on frames A(B), where A applies frame_policy P1 to B.
2. A changes policy to P2.
3. B starts navigation to C.
4. A changes policy to P3.
5. Navigation to C commits.
6. C navigates to D and commits.

Previously, we would have committed with policy P3 in both steps 5 and 6.
Now, we'll commit with P2 in step 5, and P3 in step 6.

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

The web-platform-tests Project

Taskcluster CI Status

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!