mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-10 20:05:49 +00:00
Bug 1374574 - Remove the FlyWeb system add-on from Firefox. r=mconley
MozReview-Commit-ID: BWqZIGz5hQx --HG-- extra : rebase_source : edf0c6585431ac8fdd229a2a09c8b21b797e8a5d
This commit is contained in:
parent
549d81f9c6
commit
2926a6c050
291
browser/extensions/flyweb/bootstrap.js
vendored
291
browser/extensions/flyweb/bootstrap.js
vendored
@ -1,291 +0,0 @@
|
||||
/* -*- indent-tabs-mode: nil; js-indent-level: 2 -*- */
|
||||
/* 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/. */
|
||||
|
||||
const {classes: Cc, interfaces: Ci, utils: Cu} = Components;
|
||||
|
||||
Cu.import("resource://gre/modules/XPCOMUtils.jsm");
|
||||
|
||||
XPCOMUtils.defineLazyModuleGetter(this, "CustomizableUI",
|
||||
"resource:///modules/CustomizableUI.jsm");
|
||||
XPCOMUtils.defineLazyModuleGetter(this, "Console",
|
||||
"resource://gre/modules/Console.jsm");
|
||||
XPCOMUtils.defineLazyModuleGetter(this, "Services",
|
||||
"resource://gre/modules/Services.jsm");
|
||||
XPCOMUtils.defineLazyModuleGetter(this, "Integration",
|
||||
"resource://gre/modules/Integration.jsm");
|
||||
XPCOMUtils.defineLazyModuleGetter(this, "PermissionUI",
|
||||
"resource:///modules/PermissionUI.jsm");
|
||||
|
||||
XPCOMUtils.defineLazyGetter(this, "gFlyWebBundle", function() {
|
||||
const tns = {
|
||||
"flyweb-button.label": "FlyWeb",
|
||||
"flyweb-button.tooltiptext": "Discover nearby FlyWeb services",
|
||||
"flyweb-items-empty": "There are no FlyWeb services currently nearby"
|
||||
};
|
||||
return {
|
||||
GetStringFromName(name) {
|
||||
return tns[name];
|
||||
}
|
||||
};
|
||||
});
|
||||
|
||||
const FLYWEB_ENABLED_PREF = "dom.flyweb.enabled";
|
||||
|
||||
function install(aData, aReason) {}
|
||||
|
||||
function uninstall(aData, aReason) {}
|
||||
|
||||
function startup(aData, aReason) {
|
||||
// Observe pref changes and enable/disable as necessary.
|
||||
Services.prefs.addObserver(FLYWEB_ENABLED_PREF, prefObserver);
|
||||
|
||||
// Only initialize if pref is enabled.
|
||||
let enabled = Services.prefs.getBoolPref(FLYWEB_ENABLED_PREF);
|
||||
if (enabled) {
|
||||
FlyWebView.init();
|
||||
}
|
||||
}
|
||||
|
||||
function shutdown(aData, aReason) {
|
||||
Services.prefs.removeObserver(FLYWEB_ENABLED_PREF, prefObserver);
|
||||
|
||||
let enabled = Services.prefs.getBoolPref(FLYWEB_ENABLED_PREF);
|
||||
if (enabled) {
|
||||
FlyWebView.uninit();
|
||||
}
|
||||
}
|
||||
|
||||
// use enabled pref as a way for tests (e.g. test_contextmenu.html) to disable
|
||||
// the addon when running.
|
||||
function prefObserver(aSubject, aTopic, aData) {
|
||||
let enabled = Services.prefs.getBoolPref(FLYWEB_ENABLED_PREF);
|
||||
if (enabled) {
|
||||
FlyWebView.init();
|
||||
} else {
|
||||
FlyWebView.uninit();
|
||||
}
|
||||
}
|
||||
|
||||
let gDiscoveryManagerInstance;
|
||||
|
||||
class DiscoveryManager {
|
||||
constructor(aWindow) {
|
||||
this._discoveryManager = new aWindow.FlyWebDiscoveryManager();
|
||||
}
|
||||
|
||||
destroy() {
|
||||
if (this._id) {
|
||||
this.stop();
|
||||
}
|
||||
|
||||
this._discoveryManager = null;
|
||||
}
|
||||
|
||||
start(callback) {
|
||||
if (!this._id) {
|
||||
this._id = this._discoveryManager.startDiscovery(this);
|
||||
}
|
||||
|
||||
this._callback = callback;
|
||||
}
|
||||
|
||||
stop() {
|
||||
this._discoveryManager.stopDiscovery(this._id);
|
||||
|
||||
this._id = null;
|
||||
}
|
||||
|
||||
pairWith(serviceId, callback) {
|
||||
this._discoveryManager.pairWithService(serviceId, {
|
||||
pairingSucceeded(service) {
|
||||
callback(service);
|
||||
},
|
||||
|
||||
pairingFailed(error) {
|
||||
console.error("FlyWeb failed to pair with service " + serviceId, error);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
onDiscoveredServicesChanged(services) {
|
||||
if (!this._id || !this._callback) {
|
||||
return;
|
||||
}
|
||||
|
||||
this._callback(services);
|
||||
}
|
||||
}
|
||||
|
||||
const FlyWebPermissionPromptIntegration = (base) => ({
|
||||
__proto__: base,
|
||||
createPermissionPrompt(type, request) {
|
||||
if (type != "flyweb-publish-server") {
|
||||
return super.createPermissionPrompt(...arguments);
|
||||
}
|
||||
|
||||
return {
|
||||
__proto__: PermissionUI.PermissionPromptForRequestPrototype,
|
||||
get request() {
|
||||
return request;
|
||||
},
|
||||
get permissionKey() {
|
||||
return "flyweb-publish-server";
|
||||
},
|
||||
get popupOptions() {
|
||||
return {
|
||||
learnMoreURL: "https://flyweb.github.io",
|
||||
popupIconURL: "chrome://flyweb-shared/skin/icon.svg",
|
||||
};
|
||||
},
|
||||
get notificationID() {
|
||||
return "flyweb-publish-server";
|
||||
},
|
||||
get anchorID() {
|
||||
const kAnchorID = "flyweb-publish-server-notification-icon";
|
||||
let chromeDoc = this.browser.ownerDocument;
|
||||
let anchor = chromeDoc.getElementById(kAnchorID);
|
||||
if (!anchor) {
|
||||
let notificationPopupBox =
|
||||
chromeDoc.getElementById("notification-popup-box");
|
||||
let notificationIcon = chromeDoc.createElement("image");
|
||||
notificationIcon.id = kAnchorID;
|
||||
notificationIcon.setAttribute("src",
|
||||
"chrome://flyweb-shared/skin/icon.svg");
|
||||
notificationIcon.classList.add("notification-anchor-icon");
|
||||
notificationIcon.setAttribute("role", "button");
|
||||
notificationIcon.setAttribute("aria-label",
|
||||
"View the publish-server request");
|
||||
notificationIcon.style.mozContextProperties = "fill";
|
||||
notificationIcon.style.fill = "currentcolor";
|
||||
notificationIcon.style.opacity = "0.4";
|
||||
notificationPopupBox.appendChild(notificationIcon);
|
||||
}
|
||||
|
||||
return kAnchorID;
|
||||
},
|
||||
get message() {
|
||||
return "Would you like to let this site start a server accessible " +
|
||||
"to nearby devices and people?";
|
||||
},
|
||||
get promptActions() {
|
||||
return [{
|
||||
label: "Allow Server",
|
||||
accessKey: "A",
|
||||
action: Ci.nsIPermissionManager.ALLOW_ACTION,
|
||||
expireType: Ci.nsIPermissionManager.EXPIRE_SESSION,
|
||||
}, {
|
||||
label: "Block Server",
|
||||
accessKey: "B",
|
||||
action: Ci.nsIPermissionManager.DENY_ACTION,
|
||||
expireType: Ci.nsIPermissionManager.EXPIRE_SESSION,
|
||||
}];
|
||||
},
|
||||
};
|
||||
},
|
||||
});
|
||||
|
||||
let FlyWebView = {
|
||||
init() {
|
||||
// Create widget and add it to the menu panel.
|
||||
CustomizableUI.createWidget({
|
||||
id: "flyweb-button",
|
||||
type: "view",
|
||||
viewId: "flyweb-panel",
|
||||
label: gFlyWebBundle.GetStringFromName("flyweb-button.label"),
|
||||
tooltiptext: gFlyWebBundle.GetStringFromName("flyweb-button.tooltiptext"),
|
||||
|
||||
onBeforeCreated(aDocument) {
|
||||
let panel = aDocument.createElement("panelview");
|
||||
panel.id = "flyweb-panel";
|
||||
panel.setAttribute("class", "PanelUI-subView");
|
||||
panel.setAttribute("flex", "1");
|
||||
|
||||
let empty = aDocument.createElement("description");
|
||||
empty.id = "flyweb-items-empty";
|
||||
empty.setAttribute("mousethrough", "always");
|
||||
empty.textContent = gFlyWebBundle.GetStringFromName("flyweb-items-empty");
|
||||
|
||||
let items = aDocument.createElement("vbox");
|
||||
items.id = "flyweb-items";
|
||||
items.setAttribute("class", "panel-subview-body");
|
||||
|
||||
panel.appendChild(empty);
|
||||
panel.appendChild(items);
|
||||
|
||||
panel.addEventListener("command", this);
|
||||
|
||||
aDocument.getElementById("PanelUI-multiView").appendChild(panel);
|
||||
|
||||
this._sheetURI = Services.io.newURI("chrome://flyweb/skin/flyweb.css");
|
||||
aDocument.defaultView.QueryInterface(Ci.nsIInterfaceRequestor).
|
||||
getInterface(Ci.nsIDOMWindowUtils).loadSheet(this._sheetURI, 1);
|
||||
},
|
||||
|
||||
onDestroyed(aDocument) {
|
||||
aDocument.defaultView.QueryInterface(Ci.nsIInterfaceRequestor).
|
||||
getInterface(Ci.nsIDOMWindowUtils).removeSheet(this._sheetURI, 1);
|
||||
},
|
||||
|
||||
onViewShowing(aEvent) {
|
||||
let doc = aEvent.target.ownerDocument;
|
||||
|
||||
let items = doc.getElementById("flyweb-items");
|
||||
let empty = doc.getElementById("flyweb-items-empty");
|
||||
|
||||
if (!gDiscoveryManagerInstance) {
|
||||
gDiscoveryManagerInstance = new DiscoveryManager(doc.defaultView);
|
||||
}
|
||||
|
||||
gDiscoveryManagerInstance.start((services) => {
|
||||
while (items.firstChild) {
|
||||
items.firstChild.remove();
|
||||
}
|
||||
|
||||
let fragment = doc.createDocumentFragment();
|
||||
|
||||
for (let service of services) {
|
||||
let button = doc.createElement("toolbarbutton");
|
||||
button.setAttribute("class", "subviewbutton cui-withicon");
|
||||
button.setAttribute("label", service.displayName);
|
||||
button.setAttribute("data-service-id", service.serviceId);
|
||||
fragment.appendChild(button);
|
||||
}
|
||||
|
||||
items.appendChild(fragment);
|
||||
|
||||
empty.hidden = services.length > 0;
|
||||
});
|
||||
},
|
||||
|
||||
onViewHiding(aEvent) {
|
||||
gDiscoveryManagerInstance.stop();
|
||||
},
|
||||
|
||||
handleEvent(aEvent) {
|
||||
if (aEvent.type === "command") {
|
||||
let serviceId = aEvent.target.getAttribute("data-service-id");
|
||||
gDiscoveryManagerInstance.pairWith(serviceId, (service) => {
|
||||
aEvent.view.openUILinkIn(service.uiUrl, "tab");
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
Integration.contentPermission
|
||||
.register(FlyWebPermissionPromptIntegration);
|
||||
},
|
||||
|
||||
uninit() {
|
||||
CustomizableUI.destroyWidget("flyweb-button");
|
||||
|
||||
if (gDiscoveryManagerInstance) {
|
||||
gDiscoveryManagerInstance.destroy();
|
||||
gDiscoveryManagerInstance = null;
|
||||
}
|
||||
|
||||
Integration.contentPermission
|
||||
.unregister(FlyWebPermissionPromptIntegration);
|
||||
}
|
||||
};
|
@ -1,32 +0,0 @@
|
||||
<?xml version="1.0"?>
|
||||
<!-- 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/. -->
|
||||
|
||||
#filter substitution
|
||||
|
||||
<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>flyweb@mozilla.org</em:id>
|
||||
<em:version>1.0.0</em:version>
|
||||
<em:type>2</em:type>
|
||||
<em:bootstrap>true</em:bootstrap>
|
||||
<em:multiprocessCompatible>true</em:multiprocessCompatible>
|
||||
|
||||
<!-- Target Application this theme can install into,
|
||||
with minimum and maximum supported versions. -->
|
||||
<em:targetApplication>
|
||||
<Description>
|
||||
<em:id>{ec8030f7-c20a-464f-9b0e-13a3a9e97384}</em:id>
|
||||
<em:minVersion>@MOZ_APP_VERSION@</em:minVersion>
|
||||
<em:maxVersion>@MOZ_APP_MAXVERSION@</em:maxVersion>
|
||||
</Description>
|
||||
</em:targetApplication>
|
||||
|
||||
<!-- Front End MetaData -->
|
||||
<em:name>FlyWeb</em:name>
|
||||
<em:description>Discover nearby services in the browser</em:description>
|
||||
</Description>
|
||||
</RDF>
|
@ -1,10 +0,0 @@
|
||||
# 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/.
|
||||
|
||||
[features/flyweb@mozilla.org] chrome.jar:
|
||||
% skin flyweb classic/1.0 %skin/linux/ os=LikeUnix
|
||||
% skin flyweb classic/1.0 %skin/osx/ os=Darwin
|
||||
% skin flyweb classic/1.0 %skin/windows/ os=WINNT
|
||||
% skin flyweb-shared classic/1.0 %skin/shared/
|
||||
skin/ (skin/*)
|
@ -1,21 +0,0 @@
|
||||
# -*- 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/.
|
||||
|
||||
with Files("**"):
|
||||
BUG_COMPONENT = ("Core", "Networking")
|
||||
|
||||
DEFINES['MOZ_APP_VERSION'] = CONFIG['MOZ_APP_VERSION']
|
||||
DEFINES['MOZ_APP_MAXVERSION'] = CONFIG['MOZ_APP_MAXVERSION']
|
||||
|
||||
FINAL_TARGET_FILES.features['flyweb@mozilla.org'] += [
|
||||
'bootstrap.js'
|
||||
]
|
||||
|
||||
FINAL_TARGET_PP_FILES.features['flyweb@mozilla.org'] += [
|
||||
'install.rdf.in'
|
||||
]
|
||||
|
||||
JAR_MANIFESTS += ['jar.mn']
|
@ -1,5 +0,0 @@
|
||||
/* 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/. */
|
||||
|
||||
@import url("chrome://flyweb-shared/skin/flyweb.css");
|
@ -1,5 +0,0 @@
|
||||
/* 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/. */
|
||||
|
||||
@import url("chrome://flyweb-shared/skin/flyweb.css");
|
@ -1,18 +0,0 @@
|
||||
/* 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/. */
|
||||
|
||||
#flyweb-panel {
|
||||
width: 20em;
|
||||
}
|
||||
|
||||
#flyweb-items-empty {
|
||||
box-sizing: border-box;
|
||||
color: GrayText;
|
||||
padding: 10px 20px;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
#flyweb-button {
|
||||
list-style-image: url("chrome://flyweb-shared/skin/icon.svg");
|
||||
}
|
@ -1,6 +0,0 @@
|
||||
<svg xmlns="http://www.w3.org/2000/svg" fill="context-fill" width="64" height="64">
|
||||
<circle cx="32" cy="52" r="6"/>
|
||||
<path d="M6.894 15.255c-2.254 1.547-4.386 3.304-6.36 5.28l-.354.352 3.536 3.536.354-.354c1.62-1.62 3.363-3.074 5.196-4.37-1.14-1.237-1.97-2.758-2.372-4.446zm56.57 5.277C55.06 12.128 43.888 7.5 32 7.5c-2.265 0-4.504.17-6.703.5.822 1.44 1.3 3.1 1.312 4.87 1.77-.24 3.57-.37 5.39-.37 10.55 0 20.467 4.108 27.927 11.567l.354.354 3.538-3.533-.355-.354zM16.613 10.94c1.103 0 2 .897 2 2s-.897 2-2 2-2-.897-2-2 .897-2 2-2m0-4c-3.313 0-6 2.687-6 6s2.687 6 6 6 6-2.687 6-6-2.687-6-6-6zM46.492 37.502c-1.853-1.852-4.002-3.292-6.334-4.305.03.324.05.652.05.984 0 1.48-.33 2.876-.906 4.14 1.33.71 2.56 1.622 3.657 2.72l.352.352 3.533-3.534-.354-.354zm-26.23-2.295c-.972.683-1.9 1.44-2.758 2.297l-.354.354 3.536 3.537.354-.354c.35-.35.715-.677 1.09-.99-1.012-1.39-1.684-3.042-1.868-4.842zM30.21 32.182c1.1 0 1.998.897 1.998 2s-.896 2-2 2c-1.102 0-2-.897-2-2s.898-2 2-2m0-4c-3.312 0-6 2.686-6 6 0 3.312 2.688 6 6 6 3.314 0 6-2.688 6-6 0-3.315-2.686-6-6-6zM32.207 23.716c0-1.497.34-2.912.932-4.188-.38-.013-.76-.028-1.14-.028-8.68 0-16.844 3.38-22.98 9.52l-.356.354L12.2 32.91l.354-.355C17.748 27.36 24.654 24.5 32 24.5c.083 0 .165.005.247.006-.02-.26-.04-.524-.04-.79zm22.773 5.302c-.987-.987-2.033-1.896-3.12-2.738-.446 1.68-1.312 3.188-2.49 4.4.717.585 1.41 1.21 2.073 1.873l.354.354 3.537-3.535-.354-.354z"/>
|
||||
<path d="M42.207 21.716c1.103 0 2 .897 2 2s-.897 2-2 2-2-.897-2-2 .897-2 2-2m0-4c-3.313 0-6 2.687-6 6s2.687 6 6 6 6-2.687 6-6-2.686-6-6-6z"/>
|
||||
</svg>
|
||||
|
Before Width: | Height: | Size: 1.5 KiB |
@ -1,5 +0,0 @@
|
||||
/* 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/. */
|
||||
|
||||
@import url("chrome://flyweb-shared/skin/flyweb.css");
|
@ -20,7 +20,6 @@ DIRS += [
|
||||
# Only include the following system add-ons if building Aurora or Nightly
|
||||
if not CONFIG['RELEASE_OR_BETA']:
|
||||
DIRS += [
|
||||
'flyweb',
|
||||
'presentation',
|
||||
]
|
||||
|
||||
|
@ -91,22 +91,6 @@ browser/features/firefox@getpocket.com/chrome/skin/linux/menuPanel.png
|
||||
browser/features/firefox@getpocket.com/chrome/skin/linux/menuPanel@2x.png
|
||||
browser/features/firefox@getpocket.com/chrome/skin/windows/menuPanel.png
|
||||
browser/features/firefox@getpocket.com/chrome/skin/windows/menuPanel@2x.png
|
||||
# flyweb reduction is bug 1313107
|
||||
browser/features/flyweb@mozilla.org/chrome/skin/linux/flyweb.css
|
||||
browser/features/flyweb@mozilla.org/chrome/skin/linux/icon-16.png
|
||||
browser/features/flyweb@mozilla.org/chrome/skin/linux/icon-32-anchored.png
|
||||
browser/features/flyweb@mozilla.org/chrome/skin/linux/icon-32.png
|
||||
browser/features/flyweb@mozilla.org/chrome/skin/linux/icon-64-anchored.png
|
||||
browser/features/flyweb@mozilla.org/chrome/skin/linux/icon-64.png
|
||||
browser/features/flyweb@mozilla.org/chrome/skin/osx/flyweb.css
|
||||
browser/features/flyweb@mozilla.org/chrome/skin/osx/icon-32-anchored.png
|
||||
browser/features/flyweb@mozilla.org/chrome/skin/osx/icon-64-anchored.png
|
||||
browser/features/flyweb@mozilla.org/chrome/skin/windows/flyweb.css
|
||||
browser/features/flyweb@mozilla.org/chrome/skin/windows/icon-16.png
|
||||
browser/features/flyweb@mozilla.org/chrome/skin/windows/icon-32-anchored.png
|
||||
browser/features/flyweb@mozilla.org/chrome/skin/windows/icon-32.png
|
||||
browser/features/flyweb@mozilla.org/chrome/skin/windows/icon-64-anchored.png
|
||||
browser/features/flyweb@mozilla.org/chrome/skin/windows/icon-64.png
|
||||
chrome.manifest
|
||||
chrome/toolkit/skin/classic/global/autocomplete.css
|
||||
chrome/toolkit/skin/classic/global/button.css
|
||||
|
@ -35,7 +35,7 @@ function* spawnTest() {
|
||||
exec: {
|
||||
output: [/The following/, /Mochitest/, /Special Powers/],
|
||||
notinoutput: [
|
||||
/Web Compat/, /FlyWeb/, /Pocket/, /Multi-process staged rollout/,
|
||||
/Web Compat/, /Pocket/, /Multi-process staged rollout/,
|
||||
/Form Autofill/, /Application Update Service Helper/, /Presentation/,
|
||||
/Shield Recipe Client/]
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user