[Pkg-mozext-commits] [all-in-one-sidebar] 01/09: Major: changes for page info #93 #94
David Prévot
taffit at moszumanska.debian.org
Sat Jan 9 19:44:12 UTC 2016
This is an automated email from the git hooks/post-receive script.
taffit pushed a commit to branch master
in repository all-in-one-sidebar.
commit 9f4c385243131e088df0c269c68071e7b8dcf2e8
Author: Ingo Wennemaring <github at addonlab.com>
Date: Sun Jan 3 20:02:02 2016 +0100
Major: changes for page info #93 #94
- disable page info in sidebar by default
- fix displaying of page info in windows
- of course it still has to be fixed for displaying in the sidebar :-(
---
content/pageinfo.js | 529 +++++++++++++++++++++++++------------------
content/pageinfo.xul | 6 -
content/prefs/prefs.xul | 2 +
defaults/preferences/aios.js | 2 +-
4 files changed, 312 insertions(+), 227 deletions(-)
diff --git a/content/pageinfo.js b/content/pageinfo.js
index 518741c..2287eed 100644
--- a/content/pageinfo.js
+++ b/content/pageinfo.js
@@ -2,8 +2,12 @@
var aios_inSidebar = (top.document.getElementById('sidebar-box')) ? true : false;
var aios_inTab = (AiOS_HELPER.mostRecentWindow.aiosLastSelTab) ? true : false;
-// Listener fuer automatische Aktualisierung hinzufuegen u. entfernen
+
if(aios_inSidebar) {
+ window.addEventListener("DOMContentLoaded", aios_init, false);
+ window.addEventListener("unload", aios_persistSelTab, false);
+
+ // Listener fuer automatische Aktualisierung hinzufuegen u. entfernen
window.addEventListener("load", function(e) {
top.gBrowser.addProgressListener(aiosProgListener);
}, false);
@@ -14,7 +18,6 @@ if(aios_inSidebar) {
}
-
function aios_init() {
// Menueleiste unter Mac OS X ausblenden
aios_hideMacMenubar();
@@ -117,223 +120,309 @@ function aios_persistSelTab() {
}
-/* Called when PageInfo window is loaded. Arguments are:
- * window.arguments[0] - (optional) an object consisting of
- * - doc: (optional) document to use for source. if not provided,
- * the calling window's document will be used
- * - initialTab: (optional) id of the inital tab to display
- */
-function onLoadPageInfo() {
- gBundle = document.getElementById("pageinfobundle");
- gStrings.unknown = gBundle.getString("unknown");
- gStrings.notSet = gBundle.getString("notset");
- gStrings.mediaImg = gBundle.getString("mediaImg");
- gStrings.mediaBGImg = gBundle.getString("mediaBGImg");
- gStrings.mediaObject = gBundle.getString("mediaObject");
- gStrings.mediaEmbed = gBundle.getString("mediaEmbed");
- gStrings.mediaLink = gBundle.getString("mediaLink");
- gStrings.mediaInput = gBundle.getString("mediaInput");
- //@line 292 "e:\builds\moz2_slave\rel-cen-w32-bld\build\browser\base\content\pageinfo\pageInfo.js"
- gStrings.mediaVideo = gBundle.getString("mediaVideo");
- gStrings.mediaAudio = gBundle.getString("mediaAudio");
- //@line 295 "e:\builds\moz2_slave\rel-cen-w32-bld\build\browser\base\content\pageinfo\pageInfo.js"
-
- var args = "arguments" in window &&
- window.arguments.length >= 1 &&
- window.arguments[0];
-
- // mod by eXXile
- if(aios_inSidebar) {
- var aios_sidebar = top.document.getElementById('sidebar-box');
- var aios_window = document.getElementById('main-window');
-
- gDocument = AiOS_HELPER.mostRecentWindow.content.document;
- gWindow = AiOS_HELPER.mostRecentWindow.content.window;
- }
- else if(aios_inTab) {
-
- gDocument = AiOS_HELPER.mostRecentWindow.aiosLastSelTab.document;
- gWindow = AiOS_HELPER.mostRecentWindow.content.window;
- }
- // Original-FF-Teil
- else {
- if (!args || !args.doc) {
- gWindow = window.opener.content;
- gDocument = gWindow.document;
- }
- }
-
- // init media view
- var imageTree = document.getElementById("imagetree");
- imageTree.view = gImageView;
- /* Select the requested tab, if the name is specified */
- loadTab(args);
- Components.classes["@mozilla.org/observer-service;1"]
- .getService(Components.interfaces.nsIObserverService)
- .notifyObservers(window, "page-info-dialog-loaded", null);
-}
-
-var security = {
- // Display the server certificate (static)
- viewCert : function () {
- var cert = security._cert;
- //viewCertHelper(window, cert);
-
- // mod by eXXile
- if(aios_inSidebar) viewCertHelper(AiOS_HELPER.mostRecentWindow.content.window, cert);
- else if(aios_inTab) viewCertHelper(AiOS_HELPER.mostRecentWindow.aiosLastSelTab.window, cert);
- else viewCertHelper(window, cert);
- // endmod by eXXile
- },
-
- _getSecurityInfo : function() {
- const nsIX509Cert = Components.interfaces.nsIX509Cert;
- //mod by exxile const nsIX509CertDB = Components.interfaces.nsIX509CertDB;
- const nsX509CertDB = "@mozilla.org/security/x509certdb;1";
- const nsISSLStatusProvider = Components.interfaces.nsISSLStatusProvider;
- const nsISSLStatus = Components.interfaces.nsISSLStatus;
-
- // We don't have separate info for a frame, return null until further notice
- // (see bug 138479)
- if (gWindow != gWindow.top)
- return null;
-
- var hName = null;
- try {
- hName = gWindow.location.host;
- }
- catch (exception) { }
-
- var ui = security._getSecurityUI();
- if (!ui)
- return null;
-
- var isBroken =
- (ui.state & Components.interfaces.nsIWebProgressListener.STATE_IS_BROKEN);
- var isInsecure =
- (ui.state & Components.interfaces.nsIWebProgressListener.STATE_IS_INSECURE);
- var isEV =
- (ui.state & Components.interfaces.nsIWebProgressListener.STATE_IDENTITY_EV_TOPLEVEL);
- ui.QueryInterface(nsISSLStatusProvider);
- var status = ui.SSLStatus;
-
- if (!isInsecure && status) {
- status.QueryInterface(nsISSLStatus);
- var cert = status.serverCert;
- var issuerName =
- this.mapIssuerOrganization(cert.issuerOrganization) || cert.issuerName;
-
- var retval = {
- hostName : hName,
- cAName : issuerName,
- encryptionAlgorithm : undefined,
- encryptionStrength : undefined,
- isBroken : isBroken,
- isEV : isEV,
- cert : cert,
- fullLocation : gWindow.location
- };
-
- try {
- retval.encryptionAlgorithm = status.cipherName;
- retval.encryptionStrength = status.secretKeyLength;
- }
- catch (e) {
- }
-
- return retval;
- } else {
- return {
- hostName : hName,
- cAName : "",
- encryptionAlgorithm : "",
- encryptionStrength : 0,
- isBroken : isBroken,
- isEV : isEV,
- cert : null,
- fullLocation : gWindow.location
- };
- }
- },
-
- // Find the secureBrowserUI object (if present)
- _getSecurityUI : function() {
- // mod by eXXile
- if(aios_inSidebar) {
- if("gBrowser" in top) return top.gBrowser.securityUI;
- return null;
- }
- else if(aios_inTab) {
- return AiOS_HELPER.mostRecentWindow.aiosLastSelTab.securityUI;
- }
- // Original-FF-Teil
- else {
- if (window.opener.gBrowser) return window.opener.gBrowser.securityUI;
- return null;
- }
- },
-
- // Interface for mapping a certificate issuer organization to
- // the value to be displayed.
- // Bug 82017 - this implementation should be moved to pipnss C++ code
- mapIssuerOrganization: function(name) {
- if (!name) return null;
-
- if (name == "RSA Data Security, Inc.") return "Verisign, Inc.";
-
- // No mapping required
- return name;
- },
-
- /**
- * Open the cookie manager window
- */
- viewCookies : function() {
- var wm = Components.classes["@mozilla.org/appshell/window-mediator;1"].getService(Components.interfaces.nsIWindowMediator);
- var win = wm.getMostRecentWindow("Browser:Cookies");
- var eTLDService = Components.classes["@mozilla.org/network/effective-tld-service;1"].
- getService(Components.interfaces.nsIEffectiveTLDService);
-
- var eTLD;
- var uri = gDocument.documentURIObject;
- try {
- eTLD = eTLDService.getBaseDomain(uri);
- }
- catch (e) {
- // getBaseDomain will fail if the host is an IP address or is empty
- eTLD = uri.asciiHost;
- }
-
- if (win) {
- win.gCookiesWindow.setFilter(eTLD);
- win.focus();
- }
- else
- window.openDialog("chrome://browser/content/preferences/cookies.xul",
- "Browser:Cookies", "", {
- filterString : eTLD
- });
- },
-
- /**
- * Open the login manager window
- */
- viewPasswords : function() {
- var wm = Components.classes["@mozilla.org/appshell/window-mediator;1"].getService(Components.interfaces.nsIWindowMediator);
- var win = wm.getMostRecentWindow("Toolkit:PasswordManager");
- if (win) {
- win.setFilter(this._getSecurityInfo().hostName);
- win.focus();
- }
- else
- window.openDialog("chrome://passwordmgr/content/passwordManager.xul",
- "Toolkit:PasswordManager", "",
- {
- filterString : this._getSecurityInfo().hostName
- });
- },
-
- _cert : null
-};
+// function onLoadPageInfo()
+// {
+// gBundle = document.getElementById("pageinfobundle");
+// gStrings.unknown = gBundle.getString("unknown");
+// gStrings.notSet = gBundle.getString("notset");
+// gStrings.mediaImg = gBundle.getString("mediaImg");
+// gStrings.mediaBGImg = gBundle.getString("mediaBGImg");
+// gStrings.mediaBorderImg = gBundle.getString("mediaBorderImg");
+// gStrings.mediaListImg = gBundle.getString("mediaListImg");
+// gStrings.mediaCursor = gBundle.getString("mediaCursor");
+// gStrings.mediaObject = gBundle.getString("mediaObject");
+// gStrings.mediaEmbed = gBundle.getString("mediaEmbed");
+// gStrings.mediaLink = gBundle.getString("mediaLink");
+// gStrings.mediaInput = gBundle.getString("mediaInput");
+// gStrings.mediaVideo = gBundle.getString("mediaVideo");
+// gStrings.mediaAudio = gBundle.getString("mediaAudio");
+//
+// var args = "arguments" in window &&
+// window.arguments.length >= 1 &&
+// window.arguments[0];
+//
+// // init media view
+// var imageTree = document.getElementById("imagetree");
+// imageTree.view = gImageView;
+//
+// /* Select the requested tab, if the name is specified */
+// loadTab(args);
+// Components.classes["@mozilla.org/observer-service;1"]
+// .getService(Components.interfaces.nsIObserverService)
+// .notifyObservers(window, "page-info-dialog-loaded", null);
+// }
+
+
+// function jsdump(str) {
+// Components.classes['@mozilla.org/consoleservice;1']
+// .getService(Components.interfaces.nsIConsoleService)
+// .logStringMessage(str);
+// }
+
+
+// function loadTab(args)
+// {
+// // If the "View Image Info" context menu item was used, the related image
+// // element is provided as an argument. This can't be a background image.
+// let imageElement = args && args.imageElement;
+// if (imageElement) {
+// gImageElement = {currentSrc: imageElement.currentSrc,
+// width: imageElement.width, height: imageElement.height,
+// imageText: imageElement.title || imageElement.alt};
+// }
+// else {
+// gImageElement = null;
+// }
+//
+// //jsdump('hi ' + AiOS_HELPER.mostRecentWindow);
+//
+// // mod by eXXile
+// // let aiosDocument = AiOS_HELPER.mostRecentWindow.content.document;
+// //
+// // let aiosFrameOuterWindowID = aiosDocument.defaultView
+// // .QueryInterface(Ci.nsIInterfaceRequestor)
+// // .getInterface(Ci.nsIDOMWindowUtils)
+// // .outerWindowID;
+//
+// // let frameOuterWindowID = (aios_inSidebar) ? aiosFrameOuterWindowID : args && args.frameOuterWindowID;
+// let frameOuterWindowID = args && args.frameOuterWindowID;
+//
+//
+// /* Load the page info */
+// loadPageInfo(frameOuterWindowID);
+//
+// var initialTab = (args && args.initialTab) || "generalTab";
+// var radioGroup = document.getElementById("viewGroup");
+// initialTab = document.getElementById(initialTab) || document.getElementById("generalTab");
+// radioGroup.selectedItem = initialTab;
+// radioGroup.selectedItem.doCommand();
+// radioGroup.focus();
+// }
+
+
+
+
+// old code used up to 0.7.27
+//
+// /* Called when PageInfo window is loaded. Arguments are:
+// * window.arguments[0] - (optional) an object consisting of
+// * - doc: (optional) document to use for source. if not provided,
+// * the calling window's document will be used
+// * - initialTab: (optional) id of the inital tab to display
+// */
+// function onLoadPageInfo() {
+// gBundle = document.getElementById("pageinfobundle");
+// gStrings.unknown = gBundle.getString("unknown");
+// gStrings.notSet = gBundle.getString("notset");
+// gStrings.mediaImg = gBundle.getString("mediaImg");
+// gStrings.mediaBGImg = gBundle.getString("mediaBGImg");
+// gStrings.mediaObject = gBundle.getString("mediaObject");
+// gStrings.mediaEmbed = gBundle.getString("mediaEmbed");
+// gStrings.mediaLink = gBundle.getString("mediaLink");
+// gStrings.mediaInput = gBundle.getString("mediaInput");
+// //@line 292 "e:\builds\moz2_slave\rel-cen-w32-bld\build\browser\base\content\pageinfo\pageInfo.js"
+// gStrings.mediaVideo = gBundle.getString("mediaVideo");
+// gStrings.mediaAudio = gBundle.getString("mediaAudio");
+// //@line 295 "e:\builds\moz2_slave\rel-cen-w32-bld\build\browser\base\content\pageinfo\pageInfo.js"
+//
+// var args = "arguments" in window &&
+// window.arguments.length >= 1 &&
+// window.arguments[0];
+//
+// // mod by eXXile
+// if(aios_inSidebar) {
+// var aios_sidebar = top.document.getElementById('sidebar-box');
+// var aios_window = document.getElementById('main-window');
+//
+// gDocument = AiOS_HELPER.mostRecentWindow.content.document;
+// gWindow = AiOS_HELPER.mostRecentWindow.content.window;
+// }
+// else if(aios_inTab) {
+//
+// gDocument = AiOS_HELPER.mostRecentWindow.aiosLastSelTab.document;
+// gWindow = AiOS_HELPER.mostRecentWindow.content.window;
+// }
+// // Original-FF-Teil
+// else {
+// if (!args || !args.doc) {
+// gWindow = window.opener.content;
+// gDocument = gWindow.document;
+// }
+// }
+//
+// // init media view
+// var imageTree = document.getElementById("imagetree");
+// imageTree.view = gImageView;
+//
+// /* Select the requested tab, if the name is specified */
+// loadTab(args);
+// Components.classes["@mozilla.org/observer-service;1"]
+// .getService(Components.interfaces.nsIObserverService)
+// .notifyObservers(window, "page-info-dialog-loaded", null);
+// }
+//
+//
+// var security = {
+// // Display the server certificate (static)
+// viewCert : function () {
+// var cert = security._cert;
+// //viewCertHelper(window, cert);
+//
+// // mod by eXXile
+// if(aios_inSidebar) viewCertHelper(AiOS_HELPER.mostRecentWindow.content.window, cert);
+// else if(aios_inTab) viewCertHelper(AiOS_HELPER.mostRecentWindow.aiosLastSelTab.window, cert);
+// else viewCertHelper(window, cert);
+// // endmod by eXXile
+// },
+//
+// _getSecurityInfo : function() {
+// const nsIX509Cert = Components.interfaces.nsIX509Cert;
+// //mod by exxile const nsIX509CertDB = Components.interfaces.nsIX509CertDB;
+// const nsX509CertDB = "@mozilla.org/security/x509certdb;1";
+// const nsISSLStatusProvider = Components.interfaces.nsISSLStatusProvider;
+// const nsISSLStatus = Components.interfaces.nsISSLStatus;
+//
+// // We don't have separate info for a frame, return null until further notice
+// // (see bug 138479)
+// if (gWindow != gWindow.top)
+// return null;
+//
+// var hName = null;
+// try {
+// hName = gWindow.location.host;
+// }
+// catch (exception) { }
+//
+// var ui = security._getSecurityUI();
+// if (!ui)
+// return null;
+//
+// var isBroken =
+// (ui.state & Components.interfaces.nsIWebProgressListener.STATE_IS_BROKEN);
+// var isInsecure =
+// (ui.state & Components.interfaces.nsIWebProgressListener.STATE_IS_INSECURE);
+// var isEV =
+// (ui.state & Components.interfaces.nsIWebProgressListener.STATE_IDENTITY_EV_TOPLEVEL);
+// ui.QueryInterface(nsISSLStatusProvider);
+// var status = ui.SSLStatus;
+//
+// if (!isInsecure && status) {
+// status.QueryInterface(nsISSLStatus);
+// var cert = status.serverCert;
+// var issuerName =
+// this.mapIssuerOrganization(cert.issuerOrganization) || cert.issuerName;
+//
+// var retval = {
+// hostName : hName,
+// cAName : issuerName,
+// encryptionAlgorithm : undefined,
+// encryptionStrength : undefined,
+// isBroken : isBroken,
+// isEV : isEV,
+// cert : cert,
+// fullLocation : gWindow.location
+// };
+//
+// try {
+// retval.encryptionAlgorithm = status.cipherName;
+// retval.encryptionStrength = status.secretKeyLength;
+// }
+// catch (e) {
+// }
+//
+// return retval;
+// } else {
+// return {
+// hostName : hName,
+// cAName : "",
+// encryptionAlgorithm : "",
+// encryptionStrength : 0,
+// isBroken : isBroken,
+// isEV : isEV,
+// cert : null,
+// fullLocation : gWindow.location
+// };
+// }
+// },
+//
+// // Find the secureBrowserUI object (if present)
+// _getSecurityUI : function() {
+// // mod by eXXile
+// if(aios_inSidebar) {
+// if("gBrowser" in top) return top.gBrowser.securityUI;
+// return null;
+// }
+// else if(aios_inTab) {
+// return AiOS_HELPER.mostRecentWindow.aiosLastSelTab.securityUI;
+// }
+// // Original-FF-Teil
+// else {
+// if (window.opener.gBrowser) return window.opener.gBrowser.securityUI;
+// return null;
+// }
+// },
+//
+// // Interface for mapping a certificate issuer organization to
+// // the value to be displayed.
+// // Bug 82017 - this implementation should be moved to pipnss C++ code
+// mapIssuerOrganization: function(name) {
+// if (!name) return null;
+//
+// if (name == "RSA Data Security, Inc.") return "Verisign, Inc.";
+//
+// // No mapping required
+// return name;
+// },
+//
+// /**
+// * Open the cookie manager window
+// */
+// viewCookies : function() {
+// var wm = Components.classes["@mozilla.org/appshell/window-mediator;1"].getService(Components.interfaces.nsIWindowMediator);
+// var win = wm.getMostRecentWindow("Browser:Cookies");
+// var eTLDService = Components.classes["@mozilla.org/network/effective-tld-service;1"].
+// getService(Components.interfaces.nsIEffectiveTLDService);
+//
+// var eTLD;
+// var uri = gDocument.documentURIObject;
+// try {
+// eTLD = eTLDService.getBaseDomain(uri);
+// }
+// catch (e) {
+// // getBaseDomain will fail if the host is an IP address or is empty
+// eTLD = uri.asciiHost;
+// }
+//
+// if (win) {
+// win.gCookiesWindow.setFilter(eTLD);
+// win.focus();
+// }
+// else
+// window.openDialog("chrome://browser/content/preferences/cookies.xul",
+// "Browser:Cookies", "", {
+// filterString : eTLD
+// });
+// },
+//
+// /**
+// * Open the login manager window
+// */
+// viewPasswords : function() {
+// var wm = Components.classes["@mozilla.org/appshell/window-mediator;1"].getService(Components.interfaces.nsIWindowMediator);
+// var win = wm.getMostRecentWindow("Toolkit:PasswordManager");
+// if (win) {
+// win.setFilter(this._getSecurityInfo().hostName);
+// win.focus();
+// }
+// else
+// window.openDialog("chrome://passwordmgr/content/passwordManager.xul",
+// "Toolkit:PasswordManager", "",
+// {
+// filterString : this._getSecurityInfo().hostName
+// });
+// },
+//
+// _cert : null
+// };
diff --git a/content/pageinfo.xul b/content/pageinfo.xul
index a2e5aba..676e094 100644
--- a/content/pageinfo.xul
+++ b/content/pageinfo.xul
@@ -6,12 +6,6 @@
<script type="application/x-javascript" src="chrome://aios/content/_helper.js" />
<script type="application/x-javascript" src="chrome://aios/content/pageinfo.js" />
- <script><![CDATA[
- window.addEventListener("DOMContentLoaded", aios_init, false);
- window.addEventListener("unload", aios_persistSelTab, false);
- ]]>
- </script>
-
<window id="main-window" persist="screenX screenY width height sizemode seltab" />
<radiogroup id="viewGroup" onclick="aios_persistSelTab();" />
diff --git a/content/prefs/prefs.xul b/content/prefs/prefs.xul
index 3ad5998..67c7cfa 100644
--- a/content/prefs/prefs.xul
+++ b/content/prefs/prefs.xul
@@ -703,9 +703,11 @@
<caption label="&pageInfoCmd.label;" />
<checkbox preference="PIOpen" label="&misc.enablesidebar.label; *" aiosChilds="PILayout" oncommand="aios_checkboxObserver(this);" />
+<!--
<vbox class="indent" aiosAdvanced="true">
<checkbox id="obj-PILayout" preference="PILayout" label="&misc.layout.label;" />
</vbox>
+-->
</groupbox>
</vbox>
diff --git a/defaults/preferences/aios.js b/defaults/preferences/aios.js
index c9d9031..fe8aa28 100644
--- a/defaults/preferences/aios.js
+++ b/defaults/preferences/aios.js
@@ -70,7 +70,7 @@ pref("extensions.aios.hi.layout", true);
pref("extensions.aios.mp.sidebar", true);
-pref("extensions.aios.pi.sidebar", true);
+pref("extensions.aios.pi.sidebar", false);
pref("extensions.aios.pi.layout", true);
pref("extensions.aios.pi.layoutall", false);
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-mozext/all-in-one-sidebar.git
More information about the Pkg-mozext-commits
mailing list