mirror of
https://repo.dactyloidae.xyz/Dactyloidae/UXP.git
synced 2026-10-06 15:27:30 +09:00
import FIREFOX_52_6_0esr_RELEASE from mozilla-esr52 hg repo
This commit is contained in:
commit
dcd9973243
150858 changed files with 23884658 additions and 0 deletions
6
tools/quitter/Makefile.in
Normal file
6
tools/quitter/Makefile.in
Normal file
|
|
@ -0,0 +1,6 @@
|
|||
#
|
||||
# This Source Code Form is subject to the terms of the Mozilla Public
|
||||
# License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||
|
||||
XPI_PKGNAME = quitter@mozilla.org
|
||||
70
tools/quitter/QuitterObserver.js
Normal file
70
tools/quitter/QuitterObserver.js
Normal file
|
|
@ -0,0 +1,70 @@
|
|||
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
Components.utils.import("resource://gre/modules/XPCOMUtils.jsm");
|
||||
Components.utils.import("resource://gre/modules/Services.jsm");
|
||||
|
||||
const Cc = Components.classes;
|
||||
const Ci = Components.interfaces;
|
||||
|
||||
const CHILD_SCRIPT = "chrome://quitter/content/contentscript.js";
|
||||
|
||||
/* XPCOM gunk */
|
||||
function QuitterObserver() {}
|
||||
|
||||
QuitterObserver.prototype = {
|
||||
classDescription: "Quitter Observer for use in testing.",
|
||||
classID: Components.ID("{c235a986-5ac1-4f28-ad73-825dae9bad90}"),
|
||||
contractID: "@mozilla.org/quitter-observer;1",
|
||||
QueryInterface: XPCOMUtils.generateQI([Components.interfaces.nsIObserver]),
|
||||
_xpcom_categories: [{category: "profile-after-change", service: true }],
|
||||
isFrameScriptLoaded: false,
|
||||
|
||||
observe: function(aSubject, aTopic, aData)
|
||||
{
|
||||
if (aTopic == "profile-after-change") {
|
||||
this.init();
|
||||
} else if (!this.isFrameScriptLoaded &&
|
||||
aTopic == "chrome-document-global-created") {
|
||||
|
||||
var messageManager = Cc["@mozilla.org/globalmessagemanager;1"].
|
||||
getService(Ci.nsIMessageBroadcaster);
|
||||
// Register for any messages our API needs us to handle
|
||||
messageManager.addMessageListener("Quitter.Quit", this);
|
||||
|
||||
messageManager.loadFrameScript(CHILD_SCRIPT, true);
|
||||
this.isFrameScriptLoaded = true;
|
||||
} else if (aTopic == "xpcom-shutdown") {
|
||||
this.uninit();
|
||||
}
|
||||
},
|
||||
|
||||
init: function()
|
||||
{
|
||||
var obs = Services.obs;
|
||||
obs.addObserver(this, "xpcom-shutdown", false);
|
||||
obs.addObserver(this, "chrome-document-global-created", false);
|
||||
},
|
||||
|
||||
uninit: function()
|
||||
{
|
||||
var obs = Services.obs;
|
||||
obs.removeObserver(this, "chrome-document-global-created", false);
|
||||
},
|
||||
|
||||
/**
|
||||
* messageManager callback function
|
||||
* This will get requests from our API in the window and process them in chrome for it
|
||||
**/
|
||||
receiveMessage: function(aMessage) {
|
||||
switch(aMessage.name) {
|
||||
case "Quitter.Quit":
|
||||
let appStartup = Cc["@mozilla.org/toolkit/app-startup;1"].getService(Ci.nsIAppStartup);
|
||||
appStartup.quit(Ci.nsIAppStartup.eForceQuit);
|
||||
break;
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
const NSGetFactory = XPCOMUtils.generateNSGetFactory([QuitterObserver]);
|
||||
4
tools/quitter/chrome.manifest
Normal file
4
tools/quitter/chrome.manifest
Normal file
|
|
@ -0,0 +1,4 @@
|
|||
category profile-after-change @mozilla.org/quitter-observer;1 @mozilla.org/quitter-observer;1
|
||||
component {c235a986-5ac1-4f28-ad73-825dae9bad90} components/QuitterObserver.js
|
||||
content quitter chrome/quitter/content/
|
||||
contract @mozilla.org/quitter-observer;1 {c235a986-5ac1-4f28-ad73-825dae9bad90}
|
||||
37
tools/quitter/contentscript.js
Normal file
37
tools/quitter/contentscript.js
Normal file
|
|
@ -0,0 +1,37 @@
|
|||
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
var Ci = Components.interfaces;
|
||||
var Cc = Components.classes;
|
||||
var Cu = Components.utils;
|
||||
|
||||
function Quitter() {
|
||||
}
|
||||
|
||||
Quitter.prototype = {
|
||||
toString: function() { return "[Quitter]"; },
|
||||
quit: function() { sendSyncMessage('Quitter.Quit', {}); }
|
||||
};
|
||||
|
||||
// This is a frame script, so it may be running in a content process.
|
||||
// In any event, it is targeted at a specific "tab", so we listen for
|
||||
// the DOMWindowCreated event to be notified about content windows
|
||||
// being created in this context.
|
||||
|
||||
function QuitterManager() {
|
||||
addEventListener("DOMWindowCreated", this, false);
|
||||
}
|
||||
|
||||
QuitterManager.prototype = {
|
||||
handleEvent: function handleEvent(aEvent) {
|
||||
var quitter = new Quitter(window);
|
||||
var window = aEvent.target.defaultView;
|
||||
window.wrappedJSObject.Quitter = Cu.cloneInto({
|
||||
toString: quitter.toString.bind(quitter),
|
||||
quit: quitter.quit.bind(quitter)
|
||||
}, window, {cloneFunctions: true});
|
||||
}
|
||||
};
|
||||
|
||||
var quittermanager = new QuitterManager();
|
||||
35
tools/quitter/install.rdf
Normal file
35
tools/quitter/install.rdf
Normal file
|
|
@ -0,0 +1,35 @@
|
|||
<?xml version="1.0"?>
|
||||
|
||||
<RDF xmlns="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
|
||||
xmlns:em="http://www.mozilla.org/2004/em-rdf#">
|
||||
|
||||
<Description about="urn:mozilla:install-manifest">
|
||||
<em:id>quitter@mozilla.org</em:id>
|
||||
<em:version>2016.03.10</em:version>
|
||||
<em:type>2</em:type>
|
||||
|
||||
<!-- Target Application this extension can install into,
|
||||
with minimum and maximum supported versions. -->
|
||||
<em:targetApplication>
|
||||
<Description>
|
||||
<!-- Firefox -->
|
||||
<em:id>{ec8030f7-c20a-464f-9b0e-13a3a9e97384}</em:id>
|
||||
<em:minVersion>45.0</em:minVersion>
|
||||
<em:maxVersion>*</em:maxVersion>
|
||||
</Description>
|
||||
</em:targetApplication>
|
||||
<em:targetApplication>
|
||||
<Description>
|
||||
<!-- Fennec -->
|
||||
<em:id>{aa3c5121-dab2-40e2-81ca-7ea25febc110}</em:id>
|
||||
<em:minVersion>45.0</em:minVersion>
|
||||
<em:maxVersion>*</em:maxVersion>
|
||||
</Description>
|
||||
</em:targetApplication>
|
||||
|
||||
<!-- Front End MetaData -->
|
||||
<em:name>Quitter</em:name>
|
||||
<em:description>Adds a quit method that content pages can use to quit the application.</em:description>
|
||||
<em:creator>Mozilla</em:creator>
|
||||
</Description>
|
||||
</RDF>
|
||||
3
tools/quitter/jar.mn
Normal file
3
tools/quitter/jar.mn
Normal file
|
|
@ -0,0 +1,3 @@
|
|||
quitter.jar:
|
||||
% content quitter %content/
|
||||
content/contentscript.js (contentscript.js)
|
||||
21
tools/quitter/moz.build
Normal file
21
tools/quitter/moz.build
Normal file
|
|
@ -0,0 +1,21 @@
|
|||
# -*- Mode: python; indent-tabs-mode: nil; tab-width: 40 -*-
|
||||
# vim: set filetype=python:
|
||||
# This Source Code Form is subject to the terms of the Mozilla Public
|
||||
# License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||
|
||||
EXTRA_COMPONENTS += [
|
||||
'QuitterObserver.js',
|
||||
]
|
||||
|
||||
XPI_NAME = 'quitter'
|
||||
|
||||
JAR_MANIFESTS += ['jar.mn']
|
||||
|
||||
USE_EXTENSION_MANIFEST = True
|
||||
NO_JS_MANIFEST = True
|
||||
|
||||
FINAL_TARGET_FILES += [
|
||||
'chrome.manifest',
|
||||
'install.rdf',
|
||||
]
|
||||
BIN
tools/quitter/quitter@mozilla.org.xpi
Normal file
BIN
tools/quitter/quitter@mozilla.org.xpi
Normal file
Binary file not shown.
Loading…
Add table
Add a link
Reference in a new issue