-
Notifications
You must be signed in to change notification settings - Fork 3.1k
[WebDriver BiDi] enable and disable scripting via BiDi #11441
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
08b9d18
5ab5058
da9aacb
d000f00
6303818
ede50a4
f12e345
06fd207
30f2432
a358cad
8e25e3f
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -4700,6 +4700,7 @@ a.setAttribute('href', 'https://example.com/'); // change the content attribute | |
| <li><dfn data-x-href="https://w3c.github.io/webdriver-bidi/#webdriver-bidi-user-prompt-opened">WebDriver BiDi user prompt opened</dfn></li> | ||
| <li><dfn data-x-href="https://w3c.github.io/webdriver-bidi/#webdriver-bidi-file-dialog-opened">WebDriver BiDi file dialog opened</dfn></li> | ||
| <li><dfn data-x-href="https://w3c.github.io/webdriver-bidi/#webdriver-bidi-emulated-language">WebDriver BiDi emulated language</dfn></li> | ||
| <li><dfn data-x-href="https://w3c.github.io/webdriver-bidi/#webdriver-bidi-scripting-is-enabled">WebDriver BiDi scripting is enabled</dfn></li> | ||
| </ul> | ||
| </dd> | ||
|
|
||
|
|
@@ -115982,6 +115983,9 @@ document.querySelector("button").addEventListener("click", bound); | |
| <span data-x="concept-document-window">associated <code>Document</code></span>'s <span>active | ||
| sandboxing flag set</span> does not have its <span>sandboxed scripts browsing context flag</span> | ||
| set.</li> | ||
|
|
||
| <li id="WebDriverBiDiScriptingIsEnabled">The result of <span>WebDriver BiDi scripting is | ||
| enabled</span> with <var>settings</var> is true.</li> | ||
| </ul> | ||
| </div> | ||
|
|
||
|
|
@@ -115995,17 +115999,28 @@ document.querySelector("button").addEventListener("click", bound); | |
| <hr> | ||
|
|
||
| <div algorithm> | ||
| <p><dfn data-x="concept-n-script">Scripting is enabled</dfn> for a node <var>node</var> if | ||
| <var>node</var>'s <span>node document</span>'s <span data-x="concept-document-bc">browsing | ||
| context</span> is non-null, and <span data-x="concept-environment-script">scripting is | ||
| enabled</span> for <var>node</var>'s <span>relevant settings object</span>.</p> | ||
| <p><dfn data-x="concept-n-noscript">Scripting is disabled</dfn> for a | ||
| <span>platform object</span> <var>object</var> if any of the following are true:</p> | ||
|
|
||
| <ul> | ||
| <li><p><span data-x="concept-environment-noscript">Scripting is disabled</span> for | ||
| <var>object</var>'s <span>relevant settings object</span>.</p></li> | ||
|
|
||
| <li><p>The <var>object</var> implements <code>Node</code>, and <var>object</var>'s | ||
| <span>node document</span>'s <span data-x="concept-document-bc">browsing context</span> is | ||
| null.</p></li> | ||
|
|
||
| <li><p>The <var>object</var> implements <code>Window</code> and <var>object</var>'s <span | ||
| data-x="concept-document-window">associated <code>Document</code></span>'s <span | ||
| data-x="concept-document-bc">browsing context</span> is null.</p></li> | ||
| </ul> | ||
| </div> | ||
|
|
||
| <p><dfn data-x="concept-n-noscript">Scripting is disabled</dfn> for a node when scripting is not | ||
| <span data-x="concept-n-script">enabled</span>, i.e., when its <span>node document</span>'s <span | ||
| data-x="concept-document-bc">browsing context</span> is null or when <span | ||
| data-x="concept-environment-noscript">scripting is disabled</span> for its <span>relevant settings | ||
| object</span>.</p> | ||
| <div algorithm> | ||
| <p><dfn data-x="concept-n-script">Scripting is enabled</dfn> for a <span>platform object</span> | ||
| <var>object</var>, when <var>object</var>'s scripting is not <span | ||
| data-x="concept-n-noscript">disabled</span>.</p> | ||
| </div> | ||
|
|
||
| <h5>Secure contexts</h5> | ||
|
|
||
|
|
@@ -117223,8 +117238,15 @@ document.querySelector("button").addEventListener("click", bound); | |
| <p>To <dfn data-x="creating a classic script">create a classic script</dfn>, given a | ||
| <span>string</span> <var>source</var>, an <span>environment settings object</span> | ||
| <var>settings</var>, a <span>URL</span> <var>baseURL</var>, a <span>script fetch options</span> | ||
| <var>options</var>, an optional boolean <var>mutedErrors</var> (default false), and an optional | ||
| <span>URL</span>-or-null <var>sourceURLForWindowScripts</var> (default null):</p> | ||
| <var>options</var>, an optional boolean <var>mutedErrors</var> (default false), an optional | ||
| <span>URL</span>-or-null <var>sourceURLForWindowScripts</var> (default null) and an optional | ||
| boolean <var>bypassDisabledScripting</var> (default false):</p> | ||
|
|
||
| <p class="note">The <var>bypassDisabledScripting</var> parameter is intended to be used for | ||
| running scripts even if <span data-x="concept-environment-noscript">scripting is disabled</span>. | ||
| This is required for some automation scenarios, e.g. for WebDriver BiDi command <a | ||
| href="https://w3c.github.io/webdriver-bidi/#commands-scriptevaluate">"script.evaluate"</a>. | ||
| </p> | ||
|
|
||
| <ol> | ||
| <li> | ||
|
|
@@ -117238,7 +117260,8 @@ document.querySelector("button").addEventListener("click", bound); | |
| </li> | ||
|
|
||
| <li><p>If <span data-x="concept-environment-noscript">scripting is disabled</span> for | ||
| <var>settings</var>, then set <var>source</var> to the empty string.</p></li> | ||
| <var>settings</var> and <var>bypassDisabledScripting</var> is false, then set | ||
| <var>source</var> to the empty string.</p></li> | ||
|
|
||
| <li><p>Let <var>script</var> be a new <span>classic script</span> that this algorithm will | ||
| subsequently initialize.</p></li> | ||
|
|
@@ -119806,9 +119829,6 @@ dictionary <dfn dictionary>PromiseRejectionEventInit</dfn> : <span>EventInit</sp | |
| <var>finalizationRegistry</var>.[[CleanupCallback]].[[Callback]].[[Realm]]'s <span | ||
| data-x="concept-realm-settings-object">environment settings object</span>.</p></li> | ||
|
|
||
| <li><p><span>Check if we can run script</span> with <var>entry</var>. If this returns "do not | ||
| run", then return.</p></li> | ||
|
|
||
| <li> | ||
| <p><span>Prepare to run script</span> with <var>entry</var>.</p> | ||
|
|
||
|
|
@@ -119890,9 +119910,6 @@ dictionary <dfn dictionary>PromiseRejectionEventInit</dfn> : <span>EventInit</sp | |
| <p><span>Queue a microtask</span> to perform the following steps:</p> | ||
|
|
||
| <ol> | ||
| <li><p>If <var>job settings</var> is not null, then <span>check if we can run script</span> | ||
| with <var>job settings</var>. If this returns "do not run" then return.</p></li> | ||
|
|
||
| <li> | ||
| <p>If <var>job settings</var> is not null, then <span>prepare to run script</span> with | ||
| <var>job settings</var>.</p> | ||
|
|
@@ -122256,6 +122273,9 @@ import "https://example.com/foo/../module2.mjs";</code></pre> | |
| <code>Event</code> object <var>event</var> is as follows:</p> | ||
|
|
||
| <ol> | ||
| <li><p>If <span data-x="concept-n-noscript">scripting is disabled</span> for | ||
| <var>eventTarget</var>, then return.</p></li> | ||
|
|
||
| <li><p>Let <var>callback</var> be the result of <span>getting the current value of the event | ||
| handler</span> given <var>eventTarget</var> and <var>name</var>.</p></li> | ||
|
|
||
|
|
@@ -122450,8 +122470,8 @@ typedef <span>OnBeforeUnloadEventHandlerNonNull</span>? <dfn typedef>OnBeforeUnl | |
| <var>element</var> be null, and <var>document</var> be <var>eventTarget</var>'s <span | ||
| data-x="concept-document-window">associated <code>Document</code></span>.</p></li> | ||
|
|
||
| <li><p>If <span data-x="concept-n-noscript">scripting is disabled</span> for | ||
| <var>document</var>, then return null.</p></li> | ||
| <li><p>If <var>document</var>'s <span>active sandboxing flag set</span> has its | ||
|
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The "sandboxed scripts browsing context flag" check used to be a part of the "Scripting is enabled". Now as the "Scripting is enabled" is removed, we still don't want to allow for sandboxed scripts to have access to the event handlers, so check "sandboxed scripts browsing context flag" here.
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I suspect that the sandbox flag check isn't needed for the same reason it could be removed from FinalizationRegistry and microtasks above. For It's possible I don't understand sandboxing, but we should probably do the same thing in all three of these cases.
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Other documents can still peek into the sandboxed iframe, if But this is also relevant for BC-less documents, e.g. a |
||
| <span>sandboxed scripts browsing context flag</span> set, return null.</p></li> | ||
|
|
||
| <li><p>Let <var>body</var> be the uncompiled script body in <var>eventHandler</var>'s <span | ||
| data-x="event handler value">value</span>.</p></li> | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.