Skip to content

Commit

Permalink
Bug 1873688 - [bidi] Ignore "realm" argument when provided together w…
Browse files Browse the repository at this point in the history
…ith "context" to "script.evaluate", "script.callFunction" and "script.disown". r=webdriver-reviewers,whimboo

Differential Revision: https://phabricator.services.mozilla.com/D198151
  • Loading branch information
lutien committed Jan 10, 2024
1 parent 961a9e5 commit 7cb4381
Showing 1 changed file with 5 additions and 11 deletions.
16 changes: 5 additions & 11 deletions remote/webdriver-bidi/modules/root/script.sys.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -647,17 +647,8 @@ class ScriptModule extends Module {
`Expected "target" to be an object, got ${target}`
);

const {
context: contextId = null,
realm: realmId = null,
sandbox = null,
} = target;

if (realmId != null && (contextId != null || sandbox != null)) {
throw new lazy.error.InvalidArgumentError(
`A context and a realm reference are mutually exclusive`
);
}
const { context: contextId = null, sandbox = null } = target;
let { realm: realmId = null } = target;

if (contextId != null) {
lazy.assert.string(
Expand All @@ -671,6 +662,9 @@ class ScriptModule extends Module {
`Expected "sandbox" to be a string, got ${sandbox}`
);
}

// Ignore realm if context is provided.
realmId = null;
} else if (realmId != null) {
lazy.assert.string(
realmId,
Expand Down

0 comments on commit 7cb4381

Please sign in to comment.