Clipboard API: Use ExecutionContext from LocalFrame instead of ScriptState.
Retrieving an ExecutionContext from the LocalFrame passed from NavigatorClipboard ensures that the correct ExecutionContext for the current clipboard operation is always used. In cross-frame circumstances, ScriptState's ExecutionContext would be that of the parent frame, but LocalFrame's ExecutionContext would be that of the child frame. This was mentioned in [1], and initially introduced in [2]. This should ensure that the incorrect (parent frame's) PermissionManager isn't requested when determining whether a permission has been granted, or when asking for permission. This CL does not fix the potential for a null dereference if the ExecutionContext is detached, as both the ExecutionContext::From and GetExecutionContext will result in a null dereference in this case. [1]: https://crrev.com/c/2016200/19/third_party/blink/renderer/modules/clipboard/clipboard_promise.cc#91 [2]: https://crrev.com/c/804973 Bug: 1002794 Change-Id: I340224959fb98d3112464f4955c6d88e537f6199 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2057006 Commit-Queue: Darwin Huang <huangdarwin@chromium.org> Reviewed-by:Daniel Cheng <dcheng@chromium.org> Cr-Commit-Position: refs/heads/master@{#746506}
Showing
Please register or sign in to comment