mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
bug 436077 - Preferences, implement a pref that turns plugins on or off
This commit is contained in:
parent
e97b3a5f2d
commit
81bf0ac357
@ -247,3 +247,5 @@ pref("privacy.item.formdata", true);
|
||||
pref("privacy.item.downloads", true);
|
||||
pref("privacy.item.passwords", true);
|
||||
pref("privacy.item.sessions", true);
|
||||
|
||||
pref("plugins.enabled", false);
|
||||
|
@ -10,10 +10,6 @@ richlistitem[type="documenttab"] {
|
||||
-moz-binding: url("chrome://browser/content/deckbrowser.xml#documenttab");
|
||||
}
|
||||
|
||||
richpreflist {
|
||||
-moz-binding: url("chrome://browser/content/preferences/richpref.xml#richpreflist");
|
||||
}
|
||||
|
||||
richpref[type="bool"] {
|
||||
-moz-binding: url("chrome://browser/content/preferences/richpref.xml#richpref-bool");
|
||||
}
|
||||
|
@ -1,4 +1,5 @@
|
||||
/* -*- Mode: javascript; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
|
||||
// -*- Mode: js2; tab-width: 2; indent-tabs-mode: nil; js2-basic-offset: 2; js2-skip-preprocessor-directives: t; -*-
|
||||
/*
|
||||
* ***** BEGIN LICENSE BLOCK *****
|
||||
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||
*
|
||||
@ -148,6 +149,16 @@ var Browser = {
|
||||
}
|
||||
},
|
||||
|
||||
setPluginState: function(state)
|
||||
{
|
||||
var phs = Components.classes["@mozilla.org/plugin/host;1"]
|
||||
.getService(Components.interfaces.nsIPluginHost);
|
||||
var plugins = phs.getPluginTags({ });
|
||||
for (i = 0; i < plugins.length; ++i)
|
||||
plugins[i].disabled = state;
|
||||
dump(">>> plugins "+ (state ? "enabled" : "disabled") +" <<<\n");
|
||||
},
|
||||
|
||||
setupGeolocationPrompt: function() {
|
||||
try {
|
||||
var geolocationService = Cc["@mozilla.org/geolocation/service;1"].getService(Ci.nsIGeolocationService);
|
||||
@ -288,7 +299,7 @@ var Browser = {
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
|
||||
/**
|
||||
* Handle command event bubbling up from content. This allows us to do chrome-
|
||||
* privileged things based on buttons in, e.g., unprivileged error pages.
|
||||
@ -308,7 +319,7 @@ var Browser = {
|
||||
if (/^about:neterror\?e=nssBadCert/.test(errorDoc.documentURI)) {
|
||||
if (ot == errorDoc.getElementById('exceptionDialogButton')) {
|
||||
var params = { exceptionAdded : false };
|
||||
|
||||
|
||||
try {
|
||||
switch (gPrefService.getIntPref("browser.ssl_override_behavior")) {
|
||||
case 2 : // Pre-fetch & pre-populate
|
||||
@ -319,10 +330,10 @@ var Browser = {
|
||||
} catch (e) {
|
||||
Components.utils.reportError("Couldn't get ssl_override pref: " + e);
|
||||
}
|
||||
|
||||
|
||||
window.openDialog('chrome://pippki/content/exceptionDialog.xul',
|
||||
'','chrome,centerscreen,modal', params);
|
||||
|
||||
|
||||
// If the user added the exception cert, attempt to reload the page
|
||||
if (params.exceptionAdded)
|
||||
errorDoc.location.reload();
|
||||
@ -338,7 +349,7 @@ var Browser = {
|
||||
if (url.indexOf("|") != -1)
|
||||
url = url.split("|")[0];
|
||||
} catch (e) { /* Fall back on about blank */ }
|
||||
|
||||
|
||||
Browser.currentBrowser.loadURI(url, null, null, false);
|
||||
}
|
||||
}
|
||||
|
@ -251,7 +251,7 @@
|
||||
<richpref pref="javascript.enabled" type="bool" title="&javascript.enabled.title;">
|
||||
&javascript.enabled.description;
|
||||
</richpref>
|
||||
<richpref pref="plugins.enabled" type="bool" title="&plugins.enabled.title;">
|
||||
<richpref pref="plugins.enabled" type="bool" title="&plugins.enabled.title;" onsyncfrompreference="Browser.setPluginState(this.value);">
|
||||
&plugins.enabled.description;
|
||||
</richpref>
|
||||
|
||||
@ -267,7 +267,7 @@
|
||||
</richpref>
|
||||
</richlistbox>
|
||||
<hbox pack="end">
|
||||
<button label="Dismiss" oncommand="BrowserUI.show(PANELMODE_NONE);"/>
|
||||
<button label="Dismiss" oncommand="BrowserUI.show(UIMODE_NONE);"/>
|
||||
</hbox>
|
||||
</vbox>
|
||||
</deck>
|
||||
|
@ -49,15 +49,42 @@
|
||||
this.prefChanged();
|
||||
</constructor>
|
||||
|
||||
<method name="fireEvent">
|
||||
<parameter name="eventName"/>
|
||||
<parameter name="funcStr"/>
|
||||
<body>
|
||||
<![CDATA[
|
||||
var body = funcStr || this.getAttribute(eventName);
|
||||
if (!body)
|
||||
return;
|
||||
|
||||
try
|
||||
{
|
||||
var event = document.createEvent("Events");
|
||||
event.initEvent(eventName, true, true);
|
||||
var f = new Function("event", body);
|
||||
f.call(this, event);
|
||||
}
|
||||
catch (e)
|
||||
{
|
||||
dump(">>> "+ e +"\n");
|
||||
Components.utils.reportError(e);
|
||||
}
|
||||
]]>
|
||||
</body>
|
||||
</method>
|
||||
|
||||
<method name="inputChanged">
|
||||
<body>
|
||||
this.pref.value = this.value;
|
||||
this.fireEvent("onsynctopreference");
|
||||
</body>
|
||||
</method>
|
||||
|
||||
<method name="prefChanged">
|
||||
<body>
|
||||
this.value = this.pref.value;
|
||||
this.fireEvent("onsyncfrompreference");
|
||||
</body>
|
||||
</method>
|
||||
|
||||
@ -85,6 +112,7 @@
|
||||
<xul:preference anonid="pref" xbl:inherits="name=pref,type,inverted" instantApply="true" onchange="prefChanged();"/>
|
||||
</xul:preferences>
|
||||
</content>
|
||||
|
||||
<implementation>
|
||||
<property name="value" onget="return this.input.checked;" onset="return this.input.setChecked(val);"/>
|
||||
</implementation>
|
||||
@ -107,16 +135,19 @@
|
||||
<xul:preference anonid="pref" xbl:inherits="name=pref,inverted" type="int" instantApply="true" onchange="prefChanged();"/>
|
||||
</xul:preferences>
|
||||
</content>
|
||||
|
||||
<implementation>
|
||||
<method name="inputChanged">
|
||||
<body>
|
||||
this.pref.value = this.getAttribute(this.value ? "on" : "off");
|
||||
this.fireEvent("onsynctopreference");
|
||||
</body>
|
||||
</method>
|
||||
|
||||
<method name="prefChanged">
|
||||
<body>
|
||||
this.value = this.pref.value == this.getAttribute("on");
|
||||
this.fireEvent("onsyncfrompreference");
|
||||
</body>
|
||||
</method>
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user