Multi-process Firefox compatibility

merged
ee564ee021
Cette révision appartient à :
Albirew 2016-03-14 18:42:00 +01:00
Parent 60d6f10416
révision a1ffb37b60
3 fichiers modifiés avec 52 ajouts et 60 suppressions

Voir le fichier

@ -3,11 +3,9 @@
<html <html
xmlns="http://www.w3.org/1999/xhtml" xmlns="http://www.w3.org/1999/xhtml"
xmlns:xul="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
> >
<body class="resurrect"> <body class="resurrect">
<fieldset id='resurrect'> <fieldset id='resurrect'>
<!-- fake elements so getElementById() doesn't die -->
<div id='targetTab' style='display: none;'></div> <div id='targetTab' style='display: none;'></div>
<div id='targetWin' style='display: none;'></div> <div id='targetWin' style='display: none;'></div>
@ -15,34 +13,35 @@
<img src='chrome://resurrect/skin/tb-icon-small.png' /> <img src='chrome://resurrect/skin/tb-icon-small.png' />
&resurrect.thispage; &resurrect.thispage;
</legend> </legend>
<xul:button
value='google' label=' &resurrect.google;' <button value='google'>
image='chrome://resurrect/skin/cacheicons/google.png' <img src='chrome://resurrect/skin/cacheicons/google.png' />
/> &resurrect.google;
<xul:button </button>
value='googletext' label=' &resurrect.google;&resurrect.textonly;' <button value='googletext'>
image='chrome://resurrect/skin/cacheicons/google.png' <img src='chrome://resurrect/skin/cacheicons/google.png' />
/> &resurrect.google;&resurrect.textonly;
<xul:button </button>
value='archive' label=' &resurrect.archive;' <button value='bing'>
image='chrome://resurrect/skin/cacheicons/archive.png' <img src='chrome://resurrect/skin/cacheicons/bing.png' />
/> &resurrect.bing;
<xul:button </button>
value='bing' label=' &resurrect.bing;' <button value='archive'>
image='chrome://resurrect/skin/cacheicons/bing.png' <img src='chrome://resurrect/skin/cacheicons/archive.png' />
/> &resurrect.archive;
<xul:button </button>
value='webcitation' label=' &resurrect.webcitation;' <button value='archiveis'>
image='chrome://resurrect/skin/cacheicons/webcitation.png' <img src='chrome://resurrect/skin/cacheicons/archiveis.ico' />
/> &resurrect.archiveis;
<xul:button </button>
value='archiveis' label=' &resurrect.archiveis;' <button value='webcitation'>
image='chrome://resurrect/skin/cacheicons/archiveis.png' <img src='chrome://resurrect/skin/cacheicons/webcitation.png' />
/> &resurrect.webcitation;
<xul:button </button>
value='isup' label=' &resurrect.isup;' <button value='isup'>
image='chrome://resurrect/skin/cacheicons/isup.png' <img src='chrome://resurrect/skin/cacheicons/isup.png' />
/> &resurrect.isup;
</button>
</fieldset> </fieldset>
</body> </body>
</html> </html>

Voir le fichier

@ -1,21 +1,18 @@
var resurrect={ var resurrect={
originalDoc:null, contextUrl:null,
// // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // //
onLoad:function() { onLoad:function() {
window.removeEventListener('load', resurrect.onLoad, false); window.removeEventListener('load', resurrect.onLoad, false);
document.getElementById('contentAreaContextMenu') document.getElementById('contentAreaContextMenu')
.addEventListener('popupshowing', resurrect.toggleContextItems, false); .addEventListener('popupshowing', resurrect.toggleContextItems, false);
addEventListener('DOMContentLoaded', resurrect.contentDomLoad, false);
window.document.getElementById('appcontent').addEventListener(
'DOMContentLoaded', resurrect.contentDomLoad, false);
}, },
toggleContextItems:function(event) { toggleContextItems:function(event) {
resurrect.clickTarget=event.target; resurrect.contextUrl = gContextMenu.linkURL;
var onDocument=!( var onDocument=!(
gContextMenu.isContentSelected || gContextMenu.onTextInput || gContextMenu.isContentSelected || gContextMenu.onTextInput ||
@ -30,17 +27,18 @@ var resurrect={
contentDomLoad:function(event) { contentDomLoad:function(event) {
var contentDoc=event.target; var contentDoc=event.target;
if (contentDoc.documentURI.match(/^about:neterror/)) { if (contentDoc.documentURI.indexOf('about:neterror') != 0) return;
// Inject our content...
var xhr = new XMLHttpRequest(); // Inject our content...
// next must be synchronous, else, panel wont show in neterror page (TypeError: xhr.responseXML is null) var xhr = new XMLHttpRequest();
xhr.open('GET', 'chrome://resurrect/content/netError.xhtml', false); xhr.open('GET', 'chrome://resurrect/content/netError.xhtml', true);
xhr.send(null); xhr.onload = function() {
var resurrectFieldset = xhr.responseXML.getElementById('resurrect'); var fieldset = xhr.responseXML.getElementById('resurrect');
var newFieldset = contentDoc.adoptNode(resurrectFieldset); var xhtml = new XMLSerializer().serializeToString(fieldset);
var container = contentDoc.getElementById('errorPageContainer'); var container = contentDoc.getElementById('errorPageContainer');
container.appendChild(newFieldset); container.innerHTML += xhtml;
// ...including the CSS.
// ...plus the CSS.
var link = contentDoc.createElement('link'); var link = contentDoc.createElement('link');
link.setAttribute('rel', 'stylesheet'); link.setAttribute('rel', 'stylesheet');
link.setAttribute('href', 'chrome://resurrect/skin/netError.css'); link.setAttribute('href', 'chrome://resurrect/skin/netError.css');
@ -50,16 +48,17 @@ var resurrect={
// Add the className that enables it, only when appropriate. // Add the className that enables it, only when appropriate.
contentDoc.location.href = contentDoc.location.href =
'javascript:if ("nssBadCert" != getErrorCode()) {' 'javascript:if ("nssBadCert" != getErrorCode()) {'
+ 'document.body.className += " resurrect";' + 'document.body.className += " resurrect";'
+ '}; void(0)'; + '}; void(0)';
// Add event listener. // Add event listener.
contentDoc.getElementById('resurrect').addEventListener( contentDoc.getElementById('resurrect').addEventListener(
'click', resurrect.clickedHtml, false); 'click', resurrect.clickedHtml, false);
contentDoc.getElementById('resurrect').addEventListener( contentDoc.getElementById('resurrect').addEventListener(
'keypress', resurrect.clickedHtml, false); 'keypress', resurrect.clickedHtml, false);
} };
xhr.send(null);
}, },
disableButtons:function(doc) { disableButtons:function(doc) {
@ -78,15 +77,7 @@ var resurrect={
}, },
link:function(event) { link:function(event) {
var el=document.popupNode; resurrect.showDialog(resurrect.contextUrl);
try {
while (el && el.tagName && 'A'!=el.tagName.toUpperCase()) {
el=el.parentNode;
}
resurrect.showDialog(el.href);
} catch (e) { }
return null;
}, },
// // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // //
@ -111,8 +102,6 @@ var resurrect={
// // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // //
showDialog:function(url) { showDialog:function(url) {
resurrect.originalDoc=getBrowser().contentWindow.document;
window.openDialog( window.openDialog(
'chrome://resurrect/content/resurrect-select-mirror.xul', 'chrome://resurrect/content/resurrect-select-mirror.xul',
'_blank', '_blank',

Voir le fichier

@ -32,6 +32,10 @@ body.resurrect fieldset#resurrect legend img {
body.resurrect fieldset#resurrect button { body.resurrect fieldset#resurrect button {
width: 14em; width: 14em;
} }
body.resurrect fieldset#resurrect button img {
vertical-align: middle;
margin-top: -6px;
}
/* Issue #6: Display below this popup. */ /* Issue #6: Display below this popup. */
body.resurrect fieldset#resurrect { body.resurrect fieldset#resurrect {