Multi-process Firefox compatibility.

Fixes #8
Cette révision appartient à :
Anthony Lieuallen 2015-09-09 22:22:14 -04:00
Parent 4653c2558a
révision ee564ee021
3 fichiers modifiés avec 44 ajouts et 51 suppressions

Voir le fichier

@ -3,11 +3,10 @@
<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 --> <!-- fake elements so getElementById() in selectMirror() 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>
@ -16,26 +15,26 @@
&resurrect.thispage; &resurrect.thispage;
</legend> </legend>
<xul:button <button value='google'>
value='google' label=' &resurrect.google;' <img src='chrome://resurrect/skin/cacheicons/google.png' />
image='chrome://resurrect/skin/cacheicons/google.png' &resurrect.google;
/> </button>
<xul:button <button value='googletext'>
value='googletext' label=' &resurrect.google;&resurrect.textonly;' <img src='chrome://resurrect/skin/cacheicons/google.png' />
image='chrome://resurrect/skin/cacheicons/google.png' &resurrect.google;&resurrect.textonly;
/> </button>
<xul:button <button value='archive'>
value='archive' label=' &resurrect.archive;' <img src='chrome://resurrect/skin/cacheicons/archive.png' />
image='chrome://resurrect/skin/cacheicons/archive.png' &resurrect.archive;
/> </button>
<xul:button <button value='archiveis'>
value='archiveis' label=' &resurrect.archiveis;' <img src='chrome://resurrect/skin/cacheicons/archiveis.ico' />
image='chrome://resurrect/skin/cacheicons/archiveis.ico' &resurrect.archiveis;
/> </button>
<xul:button <button value='webcitation'>
value='webcitation' label=' &resurrect.webcitation;' <img src='chrome://resurrect/skin/cacheicons/webcitation.png' />
image='chrome://resurrect/skin/cacheicons/webcitation.png' &resurrect.webcitation;
/> </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,16 +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...
xhr.open('GET', 'chrome://resurrect/content/netError.xhtml', false); var xhr = new XMLHttpRequest();
xhr.send(null); xhr.open('GET', 'chrome://resurrect/content/netError.xhtml', true);
var resurrectFieldset = xhr.responseXML.getElementById('resurrect'); xhr.onload = function() {
var newFieldset = contentDoc.adoptNode(resurrectFieldset); var fieldset = xhr.responseXML.getElementById('resurrect');
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');
@ -49,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) {
@ -77,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;
}, },
// // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // //
@ -110,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 {