1
1
Bifurcation 0

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
xmlns="http://www.w3.org/1999/xhtml"
xmlns:xul="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
>
<body class="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='targetWin' style='display: none;'></div>
@ -16,26 +15,26 @@
&resurrect.thispage;
</legend>
<xul:button
value='google' label=' &resurrect.google;'
image='chrome://resurrect/skin/cacheicons/google.png'
/>
<xul:button
value='googletext' label=' &resurrect.google;&resurrect.textonly;'
image='chrome://resurrect/skin/cacheicons/google.png'
/>
<xul:button
value='archive' label=' &resurrect.archive;'
image='chrome://resurrect/skin/cacheicons/archive.png'
/>
<xul:button
value='archiveis' label=' &resurrect.archiveis;'
image='chrome://resurrect/skin/cacheicons/archiveis.ico'
/>
<xul:button
value='webcitation' label=' &resurrect.webcitation;'
image='chrome://resurrect/skin/cacheicons/webcitation.png'
/>
<button value='google'>
<img src='chrome://resurrect/skin/cacheicons/google.png' />
&resurrect.google;
</button>
<button value='googletext'>
<img src='chrome://resurrect/skin/cacheicons/google.png' />
&resurrect.google;&resurrect.textonly;
</button>
<button value='archive'>
<img src='chrome://resurrect/skin/cacheicons/archive.png' />
&resurrect.archive;
</button>
<button value='archiveis'>
<img src='chrome://resurrect/skin/cacheicons/archiveis.ico' />
&resurrect.archiveis;
</button>
<button value='webcitation'>
<img src='chrome://resurrect/skin/cacheicons/webcitation.png' />
&resurrect.webcitation;
</button>
</fieldset>
</body>
</html>

Voir le fichier

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

Voir le fichier

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