mirror of
https://github.com/HeyPuter/firefox.git
synced 2026-11-13 20:14:57 -10:00
Automatic update from web-platform-tests [sub apps] Remove user gesture requirement for install Sub App is IWA (Isolated Web App) api https://developer.chrome.com/docs/iwa/introduction that is not launched yet, it was initially developed as a PWA api, then migrated to IWA, thus some stuff is reworked, because IWA's have more elevated privileges. User gesture is fine to remove from security point of view, if there's at least an embargo mechanism to prevent permission prompt spamming. I have added it here https://chromium-review.git.corp.google.com/c/chromium/src/+/7867741?tab=comments I have removed renderer side preference for user gesture requirement, because it is not needed anymore. Note that the enterprise policy and pref is still named with user gesture suffix, it will be reworked in the future CL's together with the enterprise policy improvements. Design doc (googlers only) https://docs.google.com/document/d/1_WtizpE4GB9Z9AkXbvVTTGtaf70XlhHgDnzQEf4Ic4k/edit?pli=1&resourcekey=0-JZWmwGavJegVpbKsqPlGfw&tab=t.0 Bug: 414729785 Change-Id: Id008fb47263251111e7c00a9a2b10f686f957b92 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/7867849 Reviewed-by: Arthur Sonzogni <[email protected]> Commit-Queue: Vlad Krot <[email protected]> Reviewed-by: Philip Jägenstedt <[email protected]> Cr-Commit-Position: refs/heads/main@{#1640082} -- wpt-commits: 0b5ffd4f7508d45afdb50381bace2b4872a82af5 wpt-pr: 60339
100 lines
3.0 KiB
HTML
100 lines
3.0 KiB
HTML
<!DOCTYPE html>
|
|
<title>Sub Apps: Error cases for add()</title>
|
|
<script src="/resources/testdriver.js"></script>
|
|
<script src="/resources/testdriver-vendor.js"></script>
|
|
<script src="/resources/testharness.js"></script>
|
|
<script src="/resources/testharnessreport.js"></script>
|
|
<script src="resources/subapps-helpers.js"></script>
|
|
|
|
<body></body>
|
|
|
|
<script>
|
|
|
|
promise_test(async t => {
|
|
const iframe = document.createElement('iframe');
|
|
document.body.appendChild(iframe);
|
|
|
|
const iframeNavigator = iframe.contentWindow.navigator;
|
|
const iframeDOMException = iframe.contentWindow.DOMException;
|
|
|
|
// Detach the frame.
|
|
iframe.remove();
|
|
|
|
// At this point the iframe is detached and unloaded, and its execution
|
|
// context is gone.
|
|
await promise_rejects_dom(t, 'NotFoundError', iframeDOMException, iframeNavigator.subApps.add({}));
|
|
}, "The object is no longer associated to a document.");
|
|
|
|
promise_test(async t => {
|
|
const iframe = document.createElement('iframe');
|
|
document.body.appendChild(iframe);
|
|
|
|
const iframeNavigator = iframe.contentWindow.navigator;
|
|
const iframeDOMException = iframe.contentWindow.DOMException;
|
|
t.add_cleanup(() => iframe.remove());
|
|
|
|
await promise_rejects_dom(t, 'InvalidStateError', iframeDOMException, iframeNavigator.subApps.add({}));
|
|
}, "API is only supported in top-level browsing contexts.");
|
|
|
|
promise_test(async t => {
|
|
const full_url = document.location.origin + '/sub-app';
|
|
|
|
let add_call_params = {
|
|
[full_url]: { installURL: full_url },
|
|
};
|
|
|
|
await test_driver.bless("installing subapps", async function () {
|
|
await promise_rejects_dom(t, 'NotSupportedError', navigator.subApps.add(add_call_params));
|
|
});
|
|
}, 'API supports only root-relative paths.');
|
|
|
|
promise_test(async t => {
|
|
const url_1 = '/sub-app-1';
|
|
const url_2 = '/sub-app-2';
|
|
|
|
let add_call_params = {
|
|
[url_1]: {installURL: url_1},
|
|
[url_2]: {installURL: url_2},
|
|
};
|
|
|
|
let mocked_response = [
|
|
{ "manifestIdPath": url_1, "resultCode": Status.FAILURE },
|
|
{ "manifestIdPath": url_2, "resultCode": Status.FAILURE }
|
|
];
|
|
|
|
let expected_results = {
|
|
[url_1]: "failure",
|
|
[url_2]: "failure",
|
|
};
|
|
|
|
await test_driver.bless("installing a subapp", async function () {
|
|
await subapps_add_expect_reject_with_result(t, add_call_params, mocked_response, expected_results);
|
|
});
|
|
}, 'Service failed to add two sub-apps.');
|
|
|
|
promise_test(async t => {
|
|
const url_1 = '/sub-app-1';
|
|
const url_2 = '/sub-app-2';
|
|
|
|
let add_call_params = {
|
|
[url_1]: {installURL: url_1},
|
|
[url_2]: {installURL: url_2},
|
|
};
|
|
|
|
let mocked_response = [
|
|
{ "manifestIdPath": url_1, "resultCode": Status.SUCCESS },
|
|
{ "manifestIdPath": url_2, "resultCode": Status.FAILURE }
|
|
];
|
|
|
|
let expected_results = {
|
|
[url_1]: "success",
|
|
[url_2]: "failure",
|
|
};
|
|
|
|
await test_driver.bless("installing a subapp", async function () {
|
|
await subapps_add_expect_reject_with_result(t, add_call_params, mocked_response, expected_results);
|
|
});
|
|
}, 'Service added one sub-app failed to add another sub-app.');
|
|
|
|
</script>
|