diff --git a/docs/writing-tests/testdriver.md b/docs/writing-tests/testdriver.md index 82ad4ff624cebb..11193b147f038f 100644 --- a/docs/writing-tests/testdriver.md +++ b/docs/writing-tests/testdriver.md @@ -206,15 +206,13 @@ _Note: these special-key codepoints are not necessarily what you would expect. F ### set_permission -Usage: `test_driver.set_permission(descriptor, state, one_realm=false, context=null)` +Usage: `test_driver.set_permission(descriptor, state, context=null)` * _descriptor_: a [PermissionDescriptor](https://w3c.github.io/permissions/#dictdef-permissiondescriptor) or derived object * _state_: a [PermissionState](https://w3c.github.io/permissions/#enumdef-permissionstate) value - * _one_realm_: a boolean that indicates whether the permission settings - apply to only one realm * context: a WindowProxy for the browsing context in which to perform the call This function causes permission requests and queries for the status of a @@ -226,5 +224,5 @@ Example: ``` js await test_driver.set_permission({ name: "background-fetch" }, "denied"); -await test_driver.set_permission({ name: "push", userVisibleOnly: true }, "granted", true); +await test_driver.set_permission({ name: "push", userVisibleOnly: true }, "granted"); ``` diff --git a/generic-sensor/generic-sensor-permission.https.html b/generic-sensor/generic-sensor-permission.https.html index a86ed5dae21579..5edc80026ddeea 100644 --- a/generic-sensor/generic-sensor-permission.https.html +++ b/generic-sensor/generic-sensor-permission.https.html @@ -13,7 +13,7 @@ for (const entry of ['accelerometer', 'gyroscope', 'magnetometer', 'ambient-light-sensor']) { promise_test(async t => { - await test_driver.set_permission({ name: entry }, 'denied', false); + await test_driver.set_permission({ name: entry }, 'denied'); const status = await navigator.permissions.query({ name: entry }); assert_class_string(status, "PermissionStatus"); @@ -21,7 +21,7 @@ }, `Deny ${entry} permission should work.`); promise_test(async t => { - await test_driver.set_permission({ name: entry }, 'granted', false); + await test_driver.set_permission({ name: entry }, 'granted'); const status = await navigator.permissions.query({ name: entry }); assert_class_string(status, "PermissionStatus"); diff --git a/geolocation-API/disabled-by-permissions-policy.https.sub.html b/geolocation-API/disabled-by-permissions-policy.https.sub.html index 9b603982b99ab9..6bd3e3500bc505 100644 --- a/geolocation-API/disabled-by-permissions-policy.https.sub.html +++ b/geolocation-API/disabled-by-permissions-policy.https.sub.html @@ -17,8 +17,7 @@ promise_test(async (t) => { await test_driver.set_permission( { name: "geolocation" }, - "granted", - false + "granted" ); const posError = await new Promise((resolve, reject) => { diff --git a/idle-detection/basics.tentative.https.window.js b/idle-detection/basics.tentative.https.window.js index 7fa8578fc46b62..32cb6204b99012 100644 --- a/idle-detection/basics.tentative.https.window.js +++ b/idle-detection/basics.tentative.https.window.js @@ -5,7 +5,7 @@ 'use strict'; promise_setup(async t => { - await test_driver.set_permission({name: 'idle-detection'}, 'granted', false); + await test_driver.set_permission({name: 'idle-detection'}, 'granted'); }) promise_test(async t => { diff --git a/idle-detection/idle-detection-allowed-by-permissions-policy-attribute-redirect-on-load.https.sub.html b/idle-detection/idle-detection-allowed-by-permissions-policy-attribute-redirect-on-load.https.sub.html index fc92a09f6c89bc..e419840ccdde72 100644 --- a/idle-detection/idle-detection-allowed-by-permissions-policy-attribute-redirect-on-load.https.sub.html +++ b/idle-detection/idle-detection-allowed-by-permissions-policy-attribute-redirect-on-load.https.sub.html @@ -21,7 +21,7 @@ relative_worker_frame_path; promise_setup(async () => { - await test_driver.set_permission({ name: 'idle-detection' }, 'granted', false); + await test_driver.set_permission({ name: 'idle-detection' }, 'granted'); }); promise_test(async t => { diff --git a/idle-detection/idle-detection-allowed-by-permissions-policy-attribute.https.sub.html b/idle-detection/idle-detection-allowed-by-permissions-policy-attribute.https.sub.html index be2de1d76c6235..e05772d9bca351 100644 --- a/idle-detection/idle-detection-allowed-by-permissions-policy-attribute.https.sub.html +++ b/idle-detection/idle-detection-allowed-by-permissions-policy-attribute.https.sub.html @@ -17,7 +17,7 @@ const cross_origin_worker_frame_src = sub + same_origin_worker_frame_src; promise_setup(async () => { - await test_driver.set_permission({ name: 'idle-detection' }, 'granted', false); + await test_driver.set_permission({ name: 'idle-detection' }, 'granted'); }); promise_test(async t => { diff --git a/idle-detection/idle-detection-allowed-by-permissions-policy.https.sub.html b/idle-detection/idle-detection-allowed-by-permissions-policy.https.sub.html index 47a7d69ee0c877..6fae367730b40b 100644 --- a/idle-detection/idle-detection-allowed-by-permissions-policy.https.sub.html +++ b/idle-detection/idle-detection-allowed-by-permissions-policy.https.sub.html @@ -17,7 +17,7 @@ const cross_origin_worker_frame_src = sub + same_origin_worker_frame_src; promise_setup(async () => { - await test_driver.set_permission({ name: 'idle-detection' }, 'granted', false); + await test_driver.set_permission({ name: 'idle-detection' }, 'granted'); }); promise_test(async t => { diff --git a/idle-detection/idle-detection-default-permissions-policy.https.sub.html b/idle-detection/idle-detection-default-permissions-policy.https.sub.html index 762e29968ecc8b..90cb7f88d30cb5 100644 --- a/idle-detection/idle-detection-default-permissions-policy.https.sub.html +++ b/idle-detection/idle-detection-default-permissions-policy.https.sub.html @@ -14,7 +14,7 @@ same_origin_src; promise_setup(async () => { - await test_driver.set_permission({ name: 'idle-detection' }, 'granted', false); + await test_driver.set_permission({ name: 'idle-detection' }, 'granted'); }); promise_test(async t => { diff --git a/idle-detection/idle-permission.tentative.https.window.js b/idle-detection/idle-permission.tentative.https.window.js index b6c66e9c09a63e..524062f9f3dd7a 100644 --- a/idle-detection/idle-permission.tentative.https.window.js +++ b/idle-detection/idle-permission.tentative.https.window.js @@ -3,14 +3,14 @@ 'use strict'; promise_test(async t => { - await test_driver.set_permission({name: 'idle-detection'}, 'denied', false); + await test_driver.set_permission({name: 'idle-detection'}, 'denied'); let detector = new IdleDetector(); await promise_rejects_dom(t, 'NotAllowedError', detector.start()); }, 'Denying idle-detection permission should block access.'); promise_test(async t => { - await test_driver.set_permission({name: 'idle-detection'}, 'granted', false); + await test_driver.set_permission({name: 'idle-detection'}, 'granted'); let detector = new IdleDetector(); await detector.start(); @@ -24,7 +24,7 @@ promise_test(async t => { }, 'Granting idle-detection permission should allow access.'); promise_test(async t => { - await test_driver.set_permission({name: 'idle-detection'}, 'prompt', false); + await test_driver.set_permission({name: 'idle-detection'}, 'prompt'); await promise_rejects_dom(t, 'NotAllowedError', IdleDetector.requestPermission()); diff --git a/idle-detection/idlharness-worker.https.window.js b/idle-detection/idlharness-worker.https.window.js index 5464e9923dc916..e8fcf9ede67165 100644 --- a/idle-detection/idlharness-worker.https.window.js +++ b/idle-detection/idlharness-worker.https.window.js @@ -4,7 +4,7 @@ 'use strict'; promise_test(async t => { - await test_driver.set_permission({name: 'idle-detection'}, 'granted', false); + await test_driver.set_permission({name: 'idle-detection'}, 'granted'); await fetch_tests_from_worker(new Worker('resources/idlharness-worker.js')); }, 'Run idlharness tests in a worker.'); diff --git a/idle-detection/idlharness.https.window.js b/idle-detection/idlharness.https.window.js index 6bbdfe52877b33..2f1758098fe0a3 100644 --- a/idle-detection/idlharness.https.window.js +++ b/idle-detection/idlharness.https.window.js @@ -11,7 +11,7 @@ idl_test( ['idle-detection'], ['dom', 'html'], async (idl_array, t) => { - await test_driver.set_permission({ name: 'idle-detection' }, 'granted', false); + await test_driver.set_permission({ name: 'idle-detection' }, 'granted'); self.idle = new IdleDetector(); let watcher = new EventWatcher(t, self.idle, ["change"]); diff --git a/idle-detection/interceptor.https.html b/idle-detection/interceptor.https.html index 644ed0fc75fc34..e9350ce8ce01ad 100644 --- a/idle-detection/interceptor.https.html +++ b/idle-detection/interceptor.https.html @@ -11,7 +11,7 @@ 'use strict'; promise_setup(async t => { - await test_driver.set_permission({ name: 'idle-detection' }, 'granted', false); + await test_driver.set_permission({ name: 'idle-detection' }, 'granted'); if (isChromiumBased) { await loadChromiumResources(); } diff --git a/infrastructure/metadata/infrastructure/testdriver/set_permission.https.html.ini b/infrastructure/metadata/infrastructure/testdriver/set_permission.https.html.ini index fe0d8cc157f467..026e6823515d14 100644 --- a/infrastructure/metadata/infrastructure/testdriver/set_permission.https.html.ini +++ b/infrastructure/metadata/infrastructure/testdriver/set_permission.https.html.ini @@ -1,8 +1,8 @@ [set_permission.https.html] - [Grant Permission for one realm] + [Grant Permission] expected: if product != "chrome": FAIL - [Deny Permission, omit one realm] + [Deny Permission] expected: if product != "chrome": FAIL diff --git a/infrastructure/testdriver/set_permission.https.html b/infrastructure/testdriver/set_permission.https.html index af743f63828960..7bc42a8538d52c 100644 --- a/infrastructure/testdriver/set_permission.https.html +++ b/infrastructure/testdriver/set_permission.https.html @@ -1,5 +1,5 @@ - + TestDriver set_permission method @@ -7,11 +7,17 @@ diff --git a/mediacapture-image/MediaStreamTrack-applyConstraints-getSettings.https.html b/mediacapture-image/MediaStreamTrack-applyConstraints-getSettings.https.html index 3b52dd56936a4d..1309d3bded8f83 100644 --- a/mediacapture-image/MediaStreamTrack-applyConstraints-getSettings.https.html +++ b/mediacapture-image/MediaStreamTrack-applyConstraints-getSettings.https.html @@ -11,7 +11,7 @@ image_capture_test(async t => { await test_driver.set_permission({name: 'camera', panTiltZoom: true}, - 'granted', false); + 'granted'); const constraints = { advanced : [{ whiteBalanceMode : 'single-shot', exposureMode : 'manual', @@ -96,7 +96,7 @@ image_capture_test(async t => { await test_driver.set_permission({name: 'camera', panTiltZoom: true}, - 'denied', false); + 'denied'); let stream = await navigator.mediaDevices.getUserMedia({video: true}); let videoTrack = stream.getVideoTracks()[0]; diff --git a/mediacapture-image/MediaStreamTrack-applyConstraints-reject.https.html b/mediacapture-image/MediaStreamTrack-applyConstraints-reject.https.html index 2935327368d8ab..ac6216ae199f97 100644 --- a/mediacapture-image/MediaStreamTrack-applyConstraints-reject.https.html +++ b/mediacapture-image/MediaStreamTrack-applyConstraints-reject.https.html @@ -11,7 +11,7 @@ var makePromiseTest = function(getConstraint) { image_capture_test(async (t, imageCaptureTest) => { await test_driver.set_permission({name: 'camera', panTiltZoom: true}, - 'granted', false); + 'granted'); imageCaptureTest.mockImageCapture().state().supportsTorch = false; diff --git a/mediacapture-image/MediaStreamTrack-applyConstraints.https.html b/mediacapture-image/MediaStreamTrack-applyConstraints.https.html index e5466ede04a31a..bfbf04afdb5d24 100644 --- a/mediacapture-image/MediaStreamTrack-applyConstraints.https.html +++ b/mediacapture-image/MediaStreamTrack-applyConstraints.https.html @@ -13,7 +13,7 @@ image_capture_test(async (t, imageCaptureTest) => { await test_driver.set_permission({name: 'camera', panTiltZoom: true}, - 'granted', false); + 'granted'); const constraints = { advanced : [{ whiteBalanceMode : 'single-shot', exposureMode : 'manual', diff --git a/mediacapture-image/MediaStreamTrack-clone.https.html b/mediacapture-image/MediaStreamTrack-clone.https.html index c2b3e2bf8ab1b8..3ee21031eb016b 100644 --- a/mediacapture-image/MediaStreamTrack-clone.https.html +++ b/mediacapture-image/MediaStreamTrack-clone.https.html @@ -11,7 +11,7 @@ // original, with a mock Mojo service implementation. image_capture_test(async (t, imageCaptureTest) => { await test_driver.set_permission({name: 'camera', panTiltZoom: true}, - 'granted', false); + 'granted'); const constraints = { advanced : [{ whiteBalanceMode : 'single-shot', exposureMode : 'manual', @@ -126,7 +126,7 @@ // when cloning a MediaStreamTrack. image_capture_test(async (t, imageCaptureTest) => { await test_driver.set_permission({name: 'camera', panTiltZoom: true}, - 'granted', false); + 'granted'); let stream = await navigator.mediaDevices.getUserMedia({video: true}); let originalVideoTrack = stream.getVideoTracks()[0]; @@ -199,7 +199,7 @@ // when cloning a MediaStreamTrack. image_capture_test(async (t, imageCaptureTest) => { await test_driver.set_permission({name: 'camera', panTiltZoom: true}, - 'granted', false); + 'granted'); let stream = await navigator.mediaDevices.getUserMedia({video: true}); let originalVideoTrack = stream.getVideoTracks()[0]; diff --git a/mediacapture-image/MediaStreamTrack-getCapabilities.https.html b/mediacapture-image/MediaStreamTrack-getCapabilities.https.html index 8d22ad20949b48..6a4835a475fc2f 100644 --- a/mediacapture-image/MediaStreamTrack-getCapabilities.https.html +++ b/mediacapture-image/MediaStreamTrack-getCapabilities.https.html @@ -16,7 +16,7 @@ image_capture_test(async (t, imageCaptureTest) => { const ptzPermission = hasPanTiltZoomPermissionGranted ? 'granted' : 'denied'; await test_driver.set_permission({name: 'camera', panTiltZoom: true}, - ptzPermission, false); + ptzPermission); let mockCapabilities = imageCaptureTest.mockImageCapture().state(); diff --git a/mediacapture-image/MediaStreamTrack-getConstraints.https.html b/mediacapture-image/MediaStreamTrack-getConstraints.https.html index 18cb9dba978008..70cd2f2b070776 100644 --- a/mediacapture-image/MediaStreamTrack-getConstraints.https.html +++ b/mediacapture-image/MediaStreamTrack-getConstraints.https.html @@ -32,7 +32,7 @@ function makePromiseTest(constraint) { image_capture_test(async function(t) { await test_driver.set_permission({name: 'camera', panTiltZoom: true}, - 'granted', false); + 'granted'); let stream = await navigator.mediaDevices.getUserMedia({video: true}); let videoTrack = stream.getVideoTracks()[0]; diff --git a/mediacapture-image/MediaStreamTrack-getSettings.https.html b/mediacapture-image/MediaStreamTrack-getSettings.https.html index 907991d1522404..bd8a1ea1008659 100644 --- a/mediacapture-image/MediaStreamTrack-getSettings.https.html +++ b/mediacapture-image/MediaStreamTrack-getSettings.https.html @@ -17,7 +17,7 @@ image_capture_test(async (t, imageCaptureTest) => { const ptzPermission = hasPanTiltZoomPermissionGranted ? 'granted' : 'denied'; await test_driver.set_permission({name: 'camera', panTiltZoom: true}, - ptzPermission, false); + ptzPermission); let mockSettings = imageCaptureTest.mockImageCapture().state(); diff --git a/mediacapture-streams/permission-helper.js b/mediacapture-streams/permission-helper.js index 769f3ee24247b4..0a237f7d438f9f 100644 --- a/mediacapture-streams/permission-helper.js +++ b/mediacapture-streams/permission-helper.js @@ -4,7 +4,7 @@ async function setMediaPermission(status="granted", scope=["camera", "microphone"]) { try { for (let s of scope) { - await test_driver.set_permission({ name: s }, status, true); + await test_driver.set_permission({ name: s }, status); } } catch (e) { const noSetPermissionSupport = typeof e === "string" && e.match(/set_permission not implemented/); diff --git a/permissions-policy/resources/permissions-policy-geolocation.html b/permissions-policy/resources/permissions-policy-geolocation.html index c9ae680ff2d229..b858a52392b168 100644 --- a/permissions-policy/resources/permissions-policy-geolocation.html +++ b/permissions-policy/resources/permissions-policy-geolocation.html @@ -7,8 +7,7 @@ test_driver.set_test_context(window.parent); await test_driver.set_permission( { name: "geolocation" }, - "granted", - false + "granted" ); let enabled = true; try { diff --git a/permissions-policy/resources/permissions-policy-screen-wakelock.html b/permissions-policy/resources/permissions-policy-screen-wakelock.html index 5b8f1aa8bc5262..b1866322518c5f 100644 --- a/permissions-policy/resources/permissions-policy-screen-wakelock.html +++ b/permissions-policy/resources/permissions-policy-screen-wakelock.html @@ -6,7 +6,7 @@ Promise.resolve().then(async () => { try { await test_driver.set_permission( - { name: 'screen-wake-lock' }, 'granted', false); + { name: 'screen-wake-lock' }, 'granted'); const wakeLock = await navigator.wakeLock.request("screen"); await wakeLock.release(); diff --git a/resources/chromium/generic_sensor_mocks.js b/resources/chromium/generic_sensor_mocks.js index bbc3973b407af8..98a29c2104fd91 100644 --- a/resources/chromium/generic_sensor_mocks.js +++ b/resources/chromium/generic_sensor_mocks.js @@ -490,7 +490,7 @@ self.GenericSensorTest = (() => { for (const entry of ['accelerometer', 'gyroscope', 'magnetometer', 'ambient-light-sensor']) { - await test_driver.set_permission({name: entry}, 'granted', false); + await test_driver.set_permission({name: entry}, 'granted'); } } diff --git a/resources/chromium/nfc-mock.js b/resources/chromium/nfc-mock.js index a7ce560a9f9a7c..4796735b136447 100644 --- a/resources/chromium/nfc-mock.js +++ b/resources/chromium/nfc-mock.js @@ -410,7 +410,7 @@ self.WebNFCTest = (() => { throw new Error('Call reset() before initialize().'); // Grant nfc permissions for Chromium testdriver. - await test_driver.set_permission({ name: 'nfc' }, 'granted', false); + await test_driver.set_permission({ name: 'nfc' }, 'granted'); if (testInternal.mockNFC == null) { testInternal.mockNFC = new MockNFC(); diff --git a/resources/testdriver.js b/resources/testdriver.js index d23f9fb83b2565..76ae2834fdfb0a 100644 --- a/resources/testdriver.js +++ b/resources/testdriver.js @@ -398,24 +398,22 @@ * * @example * await test_driver.set_permission({ name: "background-fetch" }, "denied"); - * await test_driver.set_permission({ name: "push", userVisibleOnly: true }, "granted", true); + * await test_driver.set_permission({ name: "push", userVisibleOnly: true }, "granted"); * - * @param {Object} descriptor - a `PermissionDescriptor - * `_ - * object + * @param {PermissionDescriptor} descriptor - a `PermissionDescriptor + * `_ + * dictionary. * @param {String} state - the state of the permission - * @param {boolean} one_realm - Optional. Whether the permission applies to only one realm * @param {WindowProxy} context - Browsing context in which * to run the call, or null for the current * browsing context. * @returns {Promise} fulfilled after the permission is set, or rejected if setting the * permission fails */ - set_permission: function(descriptor, state, one_realm=false, context=null) { + set_permission: function(descriptor, state, context=null) { let permission_params = { descriptor, state, - oneRealm: one_realm, }; return window.test_driver_internal.set_permission(permission_params, context); }, diff --git a/screen-details/screen_enumeration_permission.https.window.js b/screen-details/screen_enumeration_permission.https.window.js index 52c3b7db5cd7ac..32596fac9ea3bd 100644 --- a/screen-details/screen_enumeration_permission.https.window.js +++ b/screen-details/screen_enumeration_permission.https.window.js @@ -4,7 +4,7 @@ "use strict"; promise_test(async t => { - await test_driver.set_permission({ name: "window-placement" }, "denied", false); + await test_driver.set_permission({ name: "window-placement" }, "denied"); const status = await navigator.permissions.query({ name:"window-placement" }); assert_class_string(status, "PermissionStatus"); @@ -12,7 +12,7 @@ promise_test(async t => { }, "Deny window management permission should work."); promise_test(async t => { - await test_driver.set_permission({ name: "window-placement" }, "granted", false); + await test_driver.set_permission({ name: "window-placement" }, "granted"); const status = await navigator.permissions.query({ name: "window-placement" }); assert_class_string(status, "PermissionStatus"); diff --git a/speculation-rules/prerender/restriction-background-sync.tentative.https.html b/speculation-rules/prerender/restriction-background-sync.tentative.https.html index 7d49e14830aefc..05f9388f943d71 100644 --- a/speculation-rules/prerender/restriction-background-sync.tentative.https.html +++ b/speculation-rules/prerender/restriction-background-sync.tentative.https.html @@ -30,8 +30,7 @@ // periodicSync.register() waits until the permission is granted, which // is deferred during prerendering so the test would trivially pass without // the permission. - await test_driver.set_permission({name: 'periodic-background-sync'}, 'granted', - location.origin, location.origin); + await test_driver.set_permission({name: 'periodic-background-sync'}, 'granted'); // Install the service worker first to test periodicSync.register in the // prerendering page. diff --git a/speculation-rules/prerender/restriction-midi-sysex.https.html b/speculation-rules/prerender/restriction-midi-sysex.https.html index 2d675552d6fd5f..a48fbd39c3ebd9 100644 --- a/speculation-rules/prerender/restriction-midi-sysex.https.html +++ b/speculation-rules/prerender/restriction-midi-sysex.https.html @@ -21,7 +21,7 @@ // is deferred during prerendering so the test would trivially pass without // the permission. await test_driver.set_permission( - {name: 'midi', sysex: true}, 'granted', true); + {name: 'midi', sysex: true}, 'granted'); const gotMessage = new Promise(resolve => { bc.addEventListener('message', e => { diff --git a/speculation-rules/prerender/restriction-midi.https.html b/speculation-rules/prerender/restriction-midi.https.html index b61ed7369fa828..6338700d7f9225 100644 --- a/speculation-rules/prerender/restriction-midi.https.html +++ b/speculation-rules/prerender/restriction-midi.https.html @@ -21,7 +21,7 @@ // is deferred during prerendering so the test would trivially pass without // the permission. await test_driver.set_permission( - {name: 'midi', sysex: false}, 'granted', true); + {name: 'midi', sysex: false}, 'granted'); const gotMessage = new Promise(resolve => { bc.addEventListener('message', e => { diff --git a/speculation-rules/prerender/restriction-notification.https.html b/speculation-rules/prerender/restriction-notification.https.html index 205d020ccb88fa..c7428387a4b498 100644 --- a/speculation-rules/prerender/restriction-notification.https.html +++ b/speculation-rules/prerender/restriction-notification.https.html @@ -25,7 +25,7 @@ await test_driver.set_permission({ name: 'notifications' - }, 'granted', true); + }, 'granted'); const gotMessage = new Promise(resolve => { bc.addEventListener('message', e => { resolve(e.data); @@ -48,7 +48,7 @@ await test_driver.set_permission({ name: 'notifications' - }, 'granted', true); + }, 'granted'); const gotMessage = new Promise(resolve => { bc.addEventListener('message', e => { resolve(e.data); diff --git a/tools/wptrunner/wptrunner/executors/actions.py b/tools/wptrunner/wptrunner/executors/actions.py index 42961f03eede56..a4b689ba921777 100644 --- a/tools/wptrunner/wptrunner/executors/actions.py +++ b/tools/wptrunner/wptrunner/executors/actions.py @@ -143,9 +143,8 @@ def __call__(self, payload): descriptor = permission_params["descriptor"] name = descriptor["name"] state = permission_params["state"] - one_realm = permission_params.get("oneRealm", False) - self.logger.debug("Setting permission %s to %s, oneRealm=%s" % (name, state, one_realm)) - self.protocol.set_permission.set_permission(descriptor, state, one_realm) + self.logger.debug("Setting permission %s to %s" % (name, state)) + self.protocol.set_permission.set_permission(descriptor, state) class AddVirtualAuthenticatorAction: name = "add_virtual_authenticator" diff --git a/tools/wptrunner/wptrunner/executors/executormarionette.py b/tools/wptrunner/wptrunner/executors/executormarionette.py index f902a5f18ba489..6fafca8762a6aa 100644 --- a/tools/wptrunner/wptrunner/executors/executormarionette.py +++ b/tools/wptrunner/wptrunner/executors/executormarionette.py @@ -611,13 +611,11 @@ class MarionetteSetPermissionProtocolPart(SetPermissionProtocolPart): def setup(self): self.marionette = self.parent.marionette - def set_permission(self, descriptor, state, one_realm): + def set_permission(self, descriptor, state): body = { "descriptor": descriptor, "state": state, } - if one_realm is not None: - body["oneRealm"] = one_realm try: self.marionette._send_message("WebDriver:SetPermission", body) except errors.UnsupportedOperationException: diff --git a/tools/wptrunner/wptrunner/executors/executorwebdriver.py b/tools/wptrunner/wptrunner/executors/executorwebdriver.py index e3cbb95f2e9b54..54a571799995b4 100644 --- a/tools/wptrunner/wptrunner/executors/executorwebdriver.py +++ b/tools/wptrunner/wptrunner/executors/executorwebdriver.py @@ -290,13 +290,11 @@ class WebDriverSetPermissionProtocolPart(SetPermissionProtocolPart): def setup(self): self.webdriver = self.parent.webdriver - def set_permission(self, descriptor, state, one_realm): + def set_permission(self, descriptor, state): permission_params_dict = { "descriptor": descriptor, "state": state, } - if one_realm is not None: - permission_params_dict["oneRealm"] = one_realm self.webdriver.send_session_command("POST", "permissions", permission_params_dict) diff --git a/tools/wptrunner/wptrunner/executors/protocol.py b/tools/wptrunner/wptrunner/executors/protocol.py index 997c833f66a1fa..75e113c71d3f3b 100644 --- a/tools/wptrunner/wptrunner/executors/protocol.py +++ b/tools/wptrunner/wptrunner/executors/protocol.py @@ -374,12 +374,11 @@ class SetPermissionProtocolPart(ProtocolPart): name = "set_permission" @abstractmethod - def set_permission(self, descriptor, state, one_realm=False): + def set_permission(self, descriptor, state): """Set permission state. :param descriptor: A PermissionDescriptor object. - :param state: The state to set the permission to. - :param one_realm: Whether to set the permission for only one realm.""" + :param state: The state to set the permission to.""" pass diff --git a/web-nfc/NDEFReader_make-read-only.https.window.js b/web-nfc/NDEFReader_make-read-only.https.window.js index 64cc935d302add..f5872088ca6b19 100644 --- a/web-nfc/NDEFReader_make-read-only.https.window.js +++ b/web-nfc/NDEFReader_make-read-only.https.window.js @@ -8,7 +8,7 @@ const invalid_signals = ['string', 123, {}, true, Symbol(), () => {}, self]; nfc_test(async t => { - await test_driver.set_permission({name: 'nfc'}, 'denied', false); + await test_driver.set_permission({name: 'nfc'}, 'denied'); const ndef = new NDEFReader(); await promise_rejects_dom(t, 'NotAllowedError', ndef.makeReadOnly()); }, 'NDEFReader.makeReadOnly should fail if user permission is not granted.'); diff --git a/web-nfc/NDEFReader_scan.https.html b/web-nfc/NDEFReader_scan.https.html index cb35aba20faa63..a1a4a04db7a9b2 100644 --- a/web-nfc/NDEFReader_scan.https.html +++ b/web-nfc/NDEFReader_scan.https.html @@ -36,7 +36,7 @@ }, "Test that NDEFReader.scan rejects if signal is not an AbortSignal."); nfc_test(async t => { - await test_driver.set_permission({ name: 'nfc' }, 'denied', false); + await test_driver.set_permission({ name: 'nfc' }, 'denied'); const ndef = new NDEFReader(); await promise_rejects_dom(t, 'NotAllowedError', ndef.scan()); }, "NDEFReader.scan should fail if user permission is not granted."); diff --git a/web-nfc/NDEFReader_write.https.html b/web-nfc/NDEFReader_write.https.html index 8f6cd81de5547c..0463b779de9c5e 100644 --- a/web-nfc/NDEFReader_write.https.html +++ b/web-nfc/NDEFReader_write.https.html @@ -145,7 +145,7 @@ invalid records."); nfc_test(async t => { - await test_driver.set_permission({ name: 'nfc' }, 'denied', false); + await test_driver.set_permission({ name: 'nfc' }, 'denied'); const ndef = new NDEFReader(); await promise_rejects_dom(t, 'NotAllowedError', ndef.write(test_text_data)); }, 'NDEFReader.write should fail if user permission is not granted.'); diff --git a/web-nfc/nfc_permission.https.window.js b/web-nfc/nfc_permission.https.window.js index 9150a708a49859..9cb4209d2f49a9 100644 --- a/web-nfc/nfc_permission.https.window.js +++ b/web-nfc/nfc_permission.https.window.js @@ -4,7 +4,7 @@ 'use strict'; promise_test(async t => { - await test_driver.set_permission({name: 'nfc'}, 'denied', false); + await test_driver.set_permission({name: 'nfc'}, 'denied'); const status = await navigator.permissions.query({name: 'nfc'}); assert_class_string(status, 'PermissionStatus'); @@ -12,7 +12,7 @@ promise_test(async t => { }, 'Deny nfc permission should work.'); promise_test(async t => { - await test_driver.set_permission({name: 'nfc'}, 'granted', false); + await test_driver.set_permission({name: 'nfc'}, 'granted'); const status = await navigator.permissions.query({name: 'nfc'}); assert_class_string(status, 'PermissionStatus'); diff --git a/webdriver/tests/permissions/set.py b/webdriver/tests/permissions/set.py index 4dce1589641d9c..9b71c4486c37a7 100644 --- a/webdriver/tests/permissions/set.py +++ b/webdriver/tests/permissions/set.py @@ -28,7 +28,6 @@ def query(session, name): { "descriptor": "geolocation", "state": "granted" }, { "descriptor": [ { "name": "geolocation" } ], "state": "granted" }, [ { "descriptor": { "name": "geolocation" }, "state": "granted" } ], - { "descriptor": { "name": "geolocation" }, "state": "granted", "oneRealm": 23 } ]) @pytest.mark.capabilities({"acceptInsecureCerts": True}) def test_invalid_parameters(session, url, parameters): @@ -54,16 +53,10 @@ def test_non_secure_context(session, url, state): assert_error(response, "invalid argument") @pytest.mark.parametrize("state", ["granted", "denied", "prompt"]) -@pytest.mark.parametrize("realmSetting", [ - { "oneRealm": True }, - { "oneRealm": False }, - {} -]) @pytest.mark.capabilities({"acceptInsecureCerts": True}) -def test_set_to_state(session, url, state, realmSetting): +def test_set_to_state(session, url, state): session.url = url("/common/blank.html", protocol="https") parameters = { "descriptor": { "name": "geolocation" }, "state": state } - parameters.update(realmSetting) response = session.transport.send( "POST", "/session/{session_id}/permissions".format(**vars(session)), parameters @@ -88,55 +81,3 @@ def test_set_to_state(session, url, state, realmSetting): assert isinstance(result, dict) assert result.get("status") == "success" assert result.get("value") == state - -# > 7. If parameters.oneRealm is true, [...] -# > 8. Otherwise, let targets be a list containing all environment settings -# > objects whose origin is the same as the origin of settings. -# -# Ensure that all realms are affected when `oneRealm` is not enabled. -@pytest.mark.parametrize("state", ["granted", "denied", "prompt"]) -@pytest.mark.parametrize("realmSetting", [ - { "oneRealm": False }, - {} -]) -@pytest.mark.capabilities({"acceptInsecureCerts": True}) -def test_set_to_state_cross_realm(session, url, state, realmSetting): - session.url = url("/common/blank.html", protocol="https") - original_window = session.window_handle - session.window_handle = session.new_window() - session.url = url("/common/blank.html", protocol="https") - parameters = { "descriptor": { "name": "geolocation" }, "state": state } - parameters.update(realmSetting) - - response = session.transport.send( - "POST", "/session/{session_id}/permissions".format(**vars(session)), - parameters - ) - - try: - assert_success(response) - except AssertionError: - # > 4. If parameters.state is an inappropriate permission state for any - # > implementation-defined reason, return a WebDriver error with - # > WebDriver error code invalid argument. - assert_error(response, "invalid argument") - return - - assert response.body.get("value") == None - - session.window_handle = original_window - - response = query(session, "geolocation") - - assert_success(response) - result = response.body.get("value") - - assert isinstance(result, dict) - assert result.get("status") == "success" - assert result.get("value") == state - -# The following test is not implemented because UAs may vary in the way they -# modify permissions across realms, so the behavior of the `oneRealm` parameter -# cannot be asserted uniformly. -# def test_set_to_state_one_realm(): -# pass