mirror of
https://github.com/mozilla/gecko-dev.git
synced 2025-02-04 13:07:52 +00:00
Bug 1625384 - Remove window.onappinstalled event, as it was never used or shipped r=baku
removing this from spec Differential Revision: https://phabricator.services.mozilla.com/D68506 --HG-- extra : moz-landing-system : lando
This commit is contained in:
parent
6b0b300cc5
commit
c837a27119
@ -255,7 +255,6 @@ method Window.NetworkInformation
|
||||
method Window.offscreenBuffering
|
||||
method Window.OffscreenCanvas
|
||||
method Window.OffscreenCanvasRenderingContext2D
|
||||
method Window.onappinstalled
|
||||
method Window.onbeforeinstallprompt
|
||||
method Window.oncancel
|
||||
method Window.ondeviceorientationabsolute
|
||||
|
@ -345,9 +345,6 @@ WINDOW_ONLY_EVENT(vrdisplaydisconnect, eVRDisplayDisconnect, EventNameType_None,
|
||||
eBasicEventClass)
|
||||
WINDOW_ONLY_EVENT(vrdisplaypresentchange, eVRDisplayPresentChange,
|
||||
EventNameType_None, eBasicEventClass)
|
||||
// Install events as per W3C Manifest spec
|
||||
WINDOW_ONLY_EVENT(appinstalled, eAppInstalled, EventNameType_None,
|
||||
eBasicEventClass)
|
||||
|
||||
TOUCH_EVENT(touchstart, eTouchStart, EventNameType_All, eTouchEventClass)
|
||||
TOUCH_EVENT(touchend, eTouchEnd, EventNameType_All, eTouchEventClass)
|
||||
|
@ -42,8 +42,6 @@ class ManifestMessagesChild extends ActorChild {
|
||||
return this.hasManifestLink(message);
|
||||
case "DOM:ManifestObtainer:Obtain":
|
||||
return this.obtainManifest(message);
|
||||
case "DOM:Manifest:FireAppInstalledEvent":
|
||||
return this.fireAppInstalledEvent(message);
|
||||
case "DOM:WebManifest:fetchIcon":
|
||||
return this.fetchIcon(message);
|
||||
}
|
||||
@ -85,20 +83,6 @@ class ManifestMessagesChild extends ActorChild {
|
||||
this.mm.sendAsyncMessage("DOM:ManifestObtainer:Obtain", response);
|
||||
}
|
||||
|
||||
fireAppInstalledEvent({ data: { id } }) {
|
||||
const ev = new Event("appinstalled");
|
||||
const response = makeMsgResponse(id);
|
||||
if (!this.mm.content || this.mm.content.top !== this.mm.content) {
|
||||
const msg =
|
||||
"Can only dispatch install event on top-level browsing contexts.";
|
||||
response.result = serializeError(new Error(msg));
|
||||
} else {
|
||||
response.success = true;
|
||||
this.mm.content.dispatchEvent(ev);
|
||||
}
|
||||
this.mm.sendAsyncMessage("DOM:Manifest:FireAppInstalledEvent", response);
|
||||
}
|
||||
|
||||
/**
|
||||
* Given a manifest and an expected icon size, ask ManifestIcons
|
||||
* to fetch the appropriate icon and send along result
|
||||
|
@ -5,7 +5,6 @@ support-files =
|
||||
blue-150.png
|
||||
cookie_checker.sjs
|
||||
cookie_setter.html
|
||||
file_reg_appinstalled_event.html
|
||||
file_testserver.sjs
|
||||
manifestLoader.html
|
||||
red-50.png
|
||||
@ -13,7 +12,6 @@ support-files =
|
||||
|
||||
[browser_Manifest_install.js]
|
||||
skip-if = verify
|
||||
[browser_fire_appinstalled_event.js]
|
||||
[browser_ManifestFinder_browserHasManifestLink.js]
|
||||
[browser_ManifestIcons_browserFetchIcon.js]
|
||||
[browser_ManifestObtainer_credentials.js]
|
||||
|
@ -1,52 +0,0 @@
|
||||
// Used by JSHint:
|
||||
/* global Cu, BrowserTestUtils, ok, add_task, gBrowser */
|
||||
"use strict";
|
||||
const { PromiseMessage } = ChromeUtils.import(
|
||||
"resource://gre/modules/PromiseMessage.jsm"
|
||||
);
|
||||
const testPath = "/browser/dom/manifest/test/file_reg_appinstalled_event.html";
|
||||
const defaultURL = new URL(
|
||||
"http://example.org/browser/dom/manifest/test/file_testserver.sjs"
|
||||
);
|
||||
const testURL = new URL(defaultURL);
|
||||
testURL.searchParams.append("file", testPath);
|
||||
|
||||
// Enable window.onappinstalled, so we can fire events at it.
|
||||
function enableOnAppInstalledPref() {
|
||||
const ops = {
|
||||
set: [["dom.manifest.onappinstalled", true]],
|
||||
};
|
||||
return SpecialPowers.pushPrefEnv(ops);
|
||||
}
|
||||
|
||||
// Send a message for the even to be fired.
|
||||
// This cause file_reg_install_event.html to be dynamically change.
|
||||
async function theTest(aBrowser) {
|
||||
aBrowser.allowEvents = true;
|
||||
let waitForInstall = ContentTask.spawn(aBrowser, null, async function() {
|
||||
await ContentTaskUtils.waitForEvent(content.window, "appinstalled");
|
||||
});
|
||||
const {
|
||||
data: { success },
|
||||
} = await PromiseMessage.send(
|
||||
aBrowser.messageManager,
|
||||
"DOM:Manifest:FireAppInstalledEvent"
|
||||
);
|
||||
ok(success, "message sent and received successfully.");
|
||||
try {
|
||||
await waitForInstall;
|
||||
ok(true, "AppInstalled event fired");
|
||||
} catch (err) {
|
||||
ok(false, "AppInstalled event didn't fire: " + err.message);
|
||||
}
|
||||
}
|
||||
|
||||
// Open a tab and run the test
|
||||
add_task(async function() {
|
||||
await enableOnAppInstalledPref();
|
||||
let tabOptions = {
|
||||
gBrowser,
|
||||
url: testURL.href,
|
||||
};
|
||||
await BrowserTestUtils.withNewTab(tabOptions, theTest);
|
||||
});
|
@ -1,15 +0,0 @@
|
||||
<meta charset=utf-8>
|
||||
<script>
|
||||
"use strict";
|
||||
window.addEventListener("appinstalled", () => {
|
||||
document
|
||||
.querySelector("#output")
|
||||
.innerHTML = "event received!";
|
||||
// Send a custom event back to the browser
|
||||
// to acknowledge that we got this
|
||||
const detail = { result: true };
|
||||
const ev = new CustomEvent("dom.manifest.onappinstalled", { detail });
|
||||
document.dispatchEvent(ev);
|
||||
});
|
||||
</script>
|
||||
<h1 id=output>waiting for event</h1>
|
@ -3,7 +3,6 @@ support-files =
|
||||
common.js
|
||||
resource.sjs
|
||||
manifestLoader.html
|
||||
file_reg_appinstalled_event.html
|
||||
file_testserver.sjs
|
||||
[test_ImageObjectProcessor_purpose.html]
|
||||
[test_ImageObjectProcessor_sizes.html]
|
||||
@ -22,4 +21,3 @@ support-files =
|
||||
[test_ManifestProcessor_start_url.html]
|
||||
[test_ManifestProcessor_theme_color.html]
|
||||
[test_ManifestProcessor_warnings.html]
|
||||
[test_window_onappinstalled_event.html]
|
@ -1,98 +0,0 @@
|
||||
<!DOCTYPE HTML>
|
||||
<html>
|
||||
<!--
|
||||
https://bugzilla.mozilla.org/show_bug.cgi?id=1265279
|
||||
-->
|
||||
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<title>Test for Bug 1309099 - Web Manifest: Implement window.onappinstalled</title>
|
||||
<script src="/tests/SimpleTest/SimpleTest.js"></script>
|
||||
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css">
|
||||
<script>
|
||||
"use strict";
|
||||
SimpleTest.waitForExplicitFinish();
|
||||
const finish = SimpleTest.finish.bind(SimpleTest);
|
||||
enableOnAppInstalledPref()
|
||||
.then(createIframe)
|
||||
.then(checkImplementation)
|
||||
.then(checkOnappInstalledEventFired)
|
||||
.then(checkAddEventListenerFires)
|
||||
.then(finish)
|
||||
.catch(err => {
|
||||
ok(false, err.stack);
|
||||
finish();
|
||||
});
|
||||
|
||||
function enableOnAppInstalledPref() {
|
||||
const ops = {
|
||||
"set": [
|
||||
["dom.manifest.onappinstalled", true],
|
||||
],
|
||||
};
|
||||
return SpecialPowers.pushPrefEnv(ops);
|
||||
}
|
||||
|
||||
// WebIDL conditional annotations for an interface are evaluate once per
|
||||
// global, so we need to create an iframe to see the effects of calling
|
||||
// enableOnAppInstalledPref().
|
||||
function createIframe() {
|
||||
return new Promise((resolve) => {
|
||||
const iframe = document.createElement("iframe");
|
||||
iframe.src = "about:blank";
|
||||
iframe.onload = () => resolve(iframe.contentWindow);
|
||||
document.body.appendChild(iframe);
|
||||
});
|
||||
}
|
||||
|
||||
// Check that the WebIDL is as expected.
|
||||
function checkImplementation(ifrWindow) {
|
||||
return new Promise((resolve, reject) => {
|
||||
const hasOnAppInstalledProp = ifrWindow.hasOwnProperty("onappinstalled");
|
||||
ok(hasOnAppInstalledProp, "window has own onappinstalled property");
|
||||
|
||||
// no point in continuing
|
||||
if (!hasOnAppInstalledProp) {
|
||||
const err = new Error("No 'onappinstalled' IDL attribute. Aborting early.");
|
||||
reject(err);
|
||||
return;
|
||||
}
|
||||
is(ifrWindow.onappinstalled, null, "window install is initially set to null");
|
||||
|
||||
// Check that enumerable, configurable, and has a getter and setter.
|
||||
const objDescriptor = Object.getOwnPropertyDescriptor(ifrWindow, "onappinstalled");
|
||||
ok(objDescriptor.enumerable, "is enumerable");
|
||||
ok(objDescriptor.configurable, "is configurable");
|
||||
ok(objDescriptor.hasOwnProperty("get"), "has getter");
|
||||
ok(objDescriptor.hasOwnProperty("set"), "has setter");
|
||||
resolve(ifrWindow);
|
||||
});
|
||||
}
|
||||
|
||||
// Checks that .onappinstalled receives an event.
|
||||
function checkOnappInstalledEventFired(ifrWindow) {
|
||||
const customEv = new CustomEvent("appinstalled");
|
||||
return new Promise((resolve) => {
|
||||
// Test is we receive the event on `appinstalled`
|
||||
ifrWindow.onappinstalled = ev => {
|
||||
ifrWindow.onappinstalled = null;
|
||||
is(ev, customEv, "The events should be the same event object");
|
||||
resolve(ifrWindow);
|
||||
};
|
||||
ifrWindow.dispatchEvent(customEv);
|
||||
});
|
||||
}
|
||||
|
||||
// Checks that .addEventListener("appinstalled") receives an event.
|
||||
function checkAddEventListenerFires(ifrWindow) {
|
||||
const customEv = new CustomEvent("appinstalled");
|
||||
return new Promise((resolve) => {
|
||||
ifrWindow.addEventListener("appinstalled", function(ev) {
|
||||
is(ev, customEv, "The events should be the same");
|
||||
resolve(ifrWindow);
|
||||
}, {once: true});
|
||||
ifrWindow.dispatchEvent(customEv);
|
||||
});
|
||||
}
|
||||
</script>
|
||||
</head>
|
@ -118,7 +118,6 @@ typedef OfflineResourceList ApplicationCache;
|
||||
offscreenBuffering,
|
||||
OffscreenCanvas,
|
||||
OffscreenCanvasRenderingContext2D,
|
||||
onappinstalled,
|
||||
onbeforeinstallprompt,
|
||||
oncancel,
|
||||
ondeviceorientationabsolute,
|
||||
@ -269,12 +268,6 @@ typedef OfflineResourceList ApplicationCache;
|
||||
Window includes GlobalEventHandlers;
|
||||
Window includes WindowEventHandlers;
|
||||
|
||||
// https://www.w3.org/TR/appmanifest/#onappinstalled-attribute
|
||||
partial interface Window {
|
||||
[Pref="dom.manifest.onappinstalled"]
|
||||
attribute EventHandler onappinstalled;
|
||||
};
|
||||
|
||||
// http://www.whatwg.org/specs/web-apps/current-work/
|
||||
interface mixin WindowSessionStorage {
|
||||
//[Throws] readonly attribute Storage sessionStorage;
|
||||
|
@ -1999,12 +1999,6 @@
|
||||
value: @IS_NIGHTLY_BUILD@
|
||||
mirror: always
|
||||
|
||||
# Whether window.onappinstalled from "W3C Web Manifest" is enabled
|
||||
- name: dom.manifest.onappinstalled
|
||||
type: bool
|
||||
value: false
|
||||
mirror: always
|
||||
|
||||
# Enable mapped array buffer by default.
|
||||
- name: dom.mapped_arraybuffer.enabled
|
||||
type: bool
|
||||
|
@ -523,7 +523,6 @@ let LEGACY_ACTORS = {
|
||||
child: {
|
||||
module: "resource://gre/modules/ManifestMessagesChild.jsm",
|
||||
messages: [
|
||||
"DOM:Manifest:FireAppInstalledEvent",
|
||||
"DOM:ManifestObtainer:Obtain",
|
||||
"DOM:WebManifest:fetchIcon",
|
||||
"DOM:WebManifest:hasManifestLink",
|
||||
|
@ -735,7 +735,6 @@ STATIC_ATOMS = [
|
||||
Atom("onanimationiteration", "onanimationiteration"),
|
||||
Atom("onanimationstart", "onanimationstart"),
|
||||
Atom("onAppCommand", "onAppCommand"),
|
||||
Atom("onappinstalled", "onappinstalled"),
|
||||
Atom("onaudioprocess", "onaudioprocess"),
|
||||
Atom("onauxclick", "onauxclick"),
|
||||
Atom("onbeforecopy", "onbeforecopy"),
|
||||
|
Loading…
x
Reference in New Issue
Block a user