Bug 1497940 - Part III, Remove unused pluginProblem mobile styles r=snorp

These styles and PluginHelper.js should’ve been removed back in bug 1381916.

contentPluginDisabled.png is not referenced anywhere so it is deleted together.

Differential Revision: https://phabricator.services.mozilla.com/D11701

--HG--
extra : moz-landing-system : lando
This commit is contained in:
Timothy Guan-tin Chien 2018-11-22 02:11:44 +00:00
Родитель e501f0a01e
Коммит da5e72fb54
10 изменённых файлов: 0 добавлений и 431 удалений

Просмотреть файл

@ -1,226 +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/. */
"use strict";
XPCOMUtils.defineLazyGetter(this, "GlobalEventDispatcher", () => EventDispatcher.instance);
var PluginHelper = {
showDoorHanger: function(aTab) {
if (!aTab.browser)
return;
// Even though we may not end up showing a doorhanger, this flag
// lets us know that we've tried to show a doorhanger.
aTab.shouldShowPluginDoorhanger = false;
let uri = aTab.browser.currentURI;
// If the user has previously set a plugins permission for this website,
// either play or don't play the plugins instead of showing a doorhanger.
let permValue = Services.perms.testPermission(uri, "plugins");
if (permValue != Services.perms.UNKNOWN_ACTION) {
if (permValue == Services.perms.ALLOW_ACTION)
PluginHelper.playAllPlugins(aTab.browser.contentWindow);
return;
}
let message = Strings.browser.formatStringFromName("clickToPlayPlugins.message2",
[uri.host], 1);
let buttons = [
{
label: Strings.browser.GetStringFromName("clickToPlayPlugins.dontActivate"),
callback: function(aChecked) {
// If the user checked "Don't ask again", make a permanent exception
if (aChecked)
Services.perms.add(uri, "plugins", Ci.nsIPermissionManager.DENY_ACTION);
// Other than that, do nothing
},
},
{
label: Strings.browser.GetStringFromName("clickToPlayPlugins.activate"),
callback: function(aChecked) {
// If the user checked "Don't ask again", make a permanent exception
if (aChecked)
Services.perms.add(uri, "plugins", Ci.nsIPermissionManager.ALLOW_ACTION);
PluginHelper.playAllPlugins(aTab.browser.contentWindow);
},
positive: true,
},
];
// Add a checkbox with a "Don't ask again" message if the uri contains a
// host. Adding a permanent exception will fail if host is not present.
let options = uri.host ? { checkbox: Strings.browser.GetStringFromName("clickToPlayPlugins.dontAskAgain") } : {};
NativeWindow.doorhanger.show(message, "ask-to-play-plugins", buttons, aTab.id, options);
},
delayAndShowDoorHanger: function(aTab) {
// To avoid showing the doorhanger if there are also visible plugin
// overlays on the page, delay showing the doorhanger to check if
// visible plugins get added in the near future.
if (!aTab.pluginDoorhangerTimeout) {
aTab.pluginDoorhangerTimeout = setTimeout(function() {
if (this.shouldShowPluginDoorhanger) {
PluginHelper.showDoorHanger(this);
}
}.bind(aTab), 500);
}
},
playAllPlugins: function(aContentWindow) {
let cwu = aContentWindow.windowUtils;
// XXX not sure if we should enable plugins for the parent documents...
let plugins = cwu.plugins;
if (!plugins || !plugins.length)
return;
plugins.forEach(this.playPlugin);
},
playPlugin: function(plugin) {
let objLoadingContent = plugin.QueryInterface(Ci.nsIObjectLoadingContent);
let mimeType = objLoadingContent.actualType;
if (mimeType) {
GlobalEventDispatcher.sendRequest({ type: "PluginHelper:playFlash" });
}
if (!objLoadingContent.activated)
objLoadingContent.playPlugin();
},
getPluginPreference: function getPluginPreference() {
let pluginDisable = Services.prefs.getBoolPref("plugin.disable");
if (pluginDisable)
return "0";
let state = Services.prefs.getIntPref("plugin.default.state");
return state == Ci.nsIPluginTag.STATE_CLICKTOPLAY ? "2" : "1";
},
setPluginPreference: function setPluginPreference(aValue) {
switch (aValue) {
case "0": // Enable Plugins = No
Services.prefs.setBoolPref("plugin.disable", true);
Services.prefs.clearUserPref("plugin.default.state");
break;
case "1": // Enable Plugins = Yes
Services.prefs.clearUserPref("plugin.disable");
Services.prefs.setIntPref("plugin.default.state", Ci.nsIPluginTag.STATE_ENABLED);
break;
case "2": // Enable Plugins = Tap to Play (default)
Services.prefs.clearUserPref("plugin.disable");
Services.prefs.clearUserPref("plugin.default.state");
break;
}
},
// Copied from /browser/base/content/browser.js
isTooSmall: function(plugin, overlay) {
// Is the <object>'s size too small to hold what we want to show?
let pluginRect = plugin.getBoundingClientRect();
// XXX bug 446693. The text-shadow on the submitted-report text at
// the bottom causes scrollHeight to be larger than it should be.
let overflows = (overlay.scrollWidth > pluginRect.width) ||
(overlay.scrollHeight - 5 > pluginRect.height);
return overflows;
},
getPluginMimeType: function(plugin) {
var tagMimetype = plugin.actualType;
if (tagMimetype == "") {
tagMimetype = plugin.type;
}
return tagMimetype;
},
handlePluginBindingAttached: function(aTab, aEvent) {
let plugin = aEvent.target;
let doc = plugin.ownerDocument;
let overlay = doc.getAnonymousElementByAttribute(plugin, "anonid", "main");
if (!overlay || overlay._bindingHandled) {
return;
}
overlay._bindingHandled = true;
let eventType = PluginHelper._getBindingType(plugin);
if (!eventType) {
// Not all bindings have handlers
return;
}
switch (eventType) {
case "PluginClickToPlay": {
// Check if plugins have already been activated for this page, or if
// the user has set a permission to always play plugins on the site
if (aTab.clickToPlayPluginsActivated ||
Services.perms.testPermission(aTab.browser.currentURI, "plugins") ==
Services.perms.ALLOW_ACTION) {
PluginHelper.playPlugin(plugin);
return;
}
// If the plugin is hidden, or if the overlay is too small, show a
// doorhanger notification
if (PluginHelper.isTooSmall(plugin, overlay)) {
PluginHelper.delayAndShowDoorHanger(aTab);
} else {
// There's a large enough visible overlay that we don't need to show
// the doorhanger.
aTab.shouldShowPluginDoorhanger = false;
overlay.classList.add("visible");
}
// Add click to play listener to the overlay
overlay.addEventListener("click", function(e) {
if (!e.isTrusted)
return;
e.preventDefault();
let win = e.target.ownerGlobal.top;
let tab = BrowserApp.getTabForWindow(win);
tab.clickToPlayPluginsActivated = true;
PluginHelper.playAllPlugins(win);
NativeWindow.doorhanger.hide("ask-to-play-plugins", tab.id);
}, true);
// Add handlers for over- and underflow in case the plugin gets resized
plugin.addEventListener("overflow", function(event) {
overlay.classList.remove("visible");
PluginHelper.delayAndShowDoorHanger(aTab);
});
plugin.addEventListener("underflow", function(event) {
// This is also triggered if only one dimension underflows,
// the other dimension might still overflow
if (!PluginHelper.isTooSmall(plugin, overlay)) {
overlay.classList.add("visible");
}
});
break;
}
}
},
// Helper to get the binding handler type from a plugin object
_getBindingType: function(plugin) {
if (!(plugin instanceof Ci.nsIObjectLoadingContent))
return null;
switch (plugin.pluginFallbackType) {
case Ci.nsIObjectLoadingContent.PLUGIN_UNSUPPORTED:
return "PluginNotFound";
case Ci.nsIObjectLoadingContent.PLUGIN_CLICK_TO_PLAY:
return "PluginClickToPlay";
default:
// Not all states map to a handler
return null;
}
},
};

Просмотреть файл

@ -30,7 +30,6 @@ chrome.jar:
content/EmbedRT.js (content/EmbedRT.js)
content/MemoryObserver.js (content/MemoryObserver.js)
content/ConsoleAPI.js (content/ConsoleAPI.js)
content/PluginHelper.js (content/PluginHelper.js)
content/PrintHelper.js (content/PrintHelper.js)
content/OfflineApps.js (content/OfflineApps.js)
content/MasterPassword.js (content/MasterPassword.js)

Просмотреть файл

@ -48,12 +48,3 @@ toolkit.jar:
skin/classic/global/media/closedCaptionButton-cc-on.svg (../shared/media/closedCaptionButton-cc-on.svg)
skin/classic/global/media/fullscreenEnterButton.svg (../shared/media/fullscreenEnterButton.svg)
skin/classic/global/media/fullscreenExitButton.svg (../shared/media/fullscreenExitButton.svg)
% skin mozapps classic/1.0 %skin/classic/mozapps/
skin/classic/mozapps/plugins/pluginProblem.css (mozapps/plugins/pluginProblem.css)
skin/classic/mozapps/plugins/contentPluginActivate.png (mozapps/plugins/contentPluginActivate.png)
skin/classic/mozapps/plugins/contentPluginBlocked.png (mozapps/plugins/contentPluginBlocked.png)
skin/classic/mozapps/plugins/contentPluginClose.png (mozapps/plugins/contentPluginClose.png)
skin/classic/mozapps/plugins/contentPluginCrashed.png (mozapps/plugins/contentPluginCrashed.png)
skin/classic/mozapps/plugins/contentPluginStripe.png (mozapps/plugins/contentPluginStripe.png)

Двоичный файл не отображается.

До

Ширина:  |  Высота:  |  Размер: 307 B

Двоичный файл не отображается.

До

Ширина:  |  Высота:  |  Размер: 1.5 KiB

Двоичный файл не отображается.

До

Ширина:  |  Высота:  |  Размер: 1.3 KiB

Двоичный файл не отображается.

До

Ширина:  |  Высота:  |  Размер: 1.2 KiB

Двоичный файл не отображается.

До

Ширина:  |  Высота:  |  Размер: 1.6 KiB

Двоичный файл не отображается.

До

Ширина:  |  Высота:  |  Размер: 285 B

Просмотреть файл

@ -1,195 +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/. */
@namespace html url(http://www.w3.org/1999/xhtml);
/* These styles affect only the bound element, not other page content. */
.mainBox {
font: message-box;
font-size: 12px;
text-align: center;
display: table;
width: 100%;
height: 100%;
background-color: rgb(72,72,72);
color: white;
-moz-user-select: none;
}
.hoverBox {
display: table-cell;
box-sizing: border-box;
padding: 5px;
vertical-align: middle;
width: 100%;
height: 100%;
}
:-moz-handler-vulnerable-updatable .hoverBox:active,
:-moz-handler-vulnerable-no-update .hoverBox:active,
:-moz-handler-clicktoplay .hoverBox:active {
background-color: rgb(65, 65, 65);
}
:-moz-handler-clicktoplay .hoverBox:active .msgTapToPlay,
:-moz-handler-clicktoplay .hoverBox:active .msgClickToPlay,
:-moz-handler-vulnerable-updatable .hoverBox:active .msgTapToPlay,
:-moz-handler-vulnerable-updatable .hoverBox:active .msgClickToPlay,
:-moz-handler-vulnerable-no-update .hoverBox:active .msgTapToPlay,
:-moz-handler-vulnerable-no-update .hoverBox:active .msgClickToPlay {
color: red;
}
:-moz-handler-vulnerable-updatable .hoverBox,
:-moz-handler-vulnerable-no-update .hoverBox,
:-moz-handler-blocked .hoverBox,
:-moz-handler-crashed .hoverBox {
background-image: url(chrome://mozapps/skin/plugins/contentPluginStripe.png);
}
html|a {
color: white;
}
.icon {
width: 48px;
height: 48px;
background-position: center;
background-repeat: no-repeat;
border: none;
background-color: transparent;
-moz-user-focus: ignore;
margin-bottom: 6px;
}
:-moz-handler-vulnerable-updatable .icon,
:-moz-handler-vulnerable-no-update .icon {
background-image: url(chrome://mozapps/skin/plugins/contentPluginBlocked.png);
-moz-user-focus: normal;
}
:-moz-handler-blocked .icon {
background-image: url(chrome://mozapps/skin/plugins/contentPluginBlocked.png);
}
:-moz-handler-clicktoplay .icon {
background-image: url(chrome://mozapps/skin/plugins/contentPluginActivate.png);
-moz-user-focus: normal;
}
:-moz-handler-crashed .icon {
background-image: url(chrome://mozapps/skin/plugins/contentPluginCrashed.png);
}
.throbber {
padding-left: 16px; /* width of the background image */
background: url(chrome://global/skin/icons/loading.png) no-repeat;
margin-left: 5px;
}
.msgTapToPlay,
.msgClickToPlay {
text-decoration: underline;
}
@media (-moz-touch-enabled: 0) {
:-moz-handler-clicktoplay .msgTapToPlay {
display: none;
}
}
@media (-moz-touch-enabled) {
:-moz-handler-clicktoplay .msgClickToPlay {
display: none;
}
}
.submitStatus div {
min-height: 19px; /* height of biggest line (with throbber) */
}
.submitComment {
width: 340px;
height: 70px;
padding: 5px;
border: none;
border-radius: 5px;
resize: none;
font-family: inherit;
font-size: inherit;
}
.submitURLOptInBox {
text-align: start;
}
.submitURLOptIn {
margin-left: -1px;
}
.mainBox[chromedir="rtl"] .submitURLOptIn {
margin-left: 0;
margin-right: -1px;
}
.submitButtonBox {
margin-top: 7px;
}
.submitButton {
float: right;
}
.mainBox[chromedir="rtl"] .submitButton {
float: left;
}
.helpIcon {
display: inline-block;
min-width: 16px;
min-height: 16px;
background: url(chrome://mozapps/skin/plugins/pluginHelp-16.png) no-repeat;
cursor: pointer;
float: left;
}
.mainBox[chromedir="rtl"] .helpIcon {
float: right;
}
.closeIcon {
display: block;
width: 16px;
height: 16px;
margin-top: 4px;
margin-inline-start: -20px;
margin-inline-end: 4px;
border: none;
background-color: transparent;
background-image: url("chrome://mozapps/skin/plugins/contentPluginClose.png");
background-repeat: no-repeat;
}
.closeIcon:hover {
background-position: -16px 0;
}
.closeIcon:hover:active {
background-position: -32px 0;
}
.action-link {
display: inline-block;
border-radius: 10px;
background-color: rgb(35, 35, 35);
padding: 2px 8px;
margin-top: 7px;
text-decoration: none;
}
.action-link:active {
background-color: rgb(20, 20, 20);
}
:-moz-handler-vulnerable-updatable .action-link {
background-color: #a81b0c;
}
:-moz-handler-vulnerable-updatable .action-link:active {
background-color: #801409;
}