[Pkg-mozext-commits] [greasemonkey] 45/55: [e10s on] gBrowser.addEventListener("DOMContentLoaded") => framescript.js
David Prévot
taffit at moszumanska.debian.org
Thu Oct 29 15:38:07 UTC 2015
This is an automated email from the git hooks/post-receive script.
taffit pushed a commit to branch master
in repository greasemonkey.
commit 3ea4de9308b05b542e7c1711dc6473b7997133f9
Author: Anthony Lieuallen <arantius at gmail.com>
Date: Wed Sep 30 10:15:09 2015 -0400
[e10s on] gBrowser.addEventListener("DOMContentLoaded") => framescript.js
# Conflicts:
# content/framescript.jshttps://github.com/greasemonkey/greasemonkey/issues/2280
---
content/browser.js | 21 +++++++++------------
content/framescript.js | 13 ++++++++++---
2 files changed, 19 insertions(+), 15 deletions(-)
diff --git a/content/browser.js b/content/browser.js
index 4c13c38..3a77c1e 100644
--- a/content/browser.js
+++ b/content/browser.js
@@ -14,15 +14,19 @@ GM_BrowserUI.init = function() {
window.addEventListener("unload", GM_BrowserUI.chromeUnload, false);
window.messageManager.addMessageListener('greasemonkey:open-in-tab',
GM_BrowserUI.openInTab);
+ window.messageManager.addMessageListener("greasemonkey:DOMContentLoaded",
+ function (aMessage) {
+ var contentType = aMessage.data.contentType;
+ var href = aMessage.data.href;
+ GM_BrowserUI.checkDisabledScriptNavigation(contentType, href);
+ });
};
/**
* The browser XUL has loaded. Find the elements we need and set up our
* listeners and wrapper objects.
*/
-GM_BrowserUI.chromeLoad = function(e) {
- // Store DOM element references in this object, also for use elsewhere.
- GM_BrowserUI.tabBrowser = document.getElementById("content");
+GM_BrowserUI.chromeLoad = function(aEvent) {
GM_BrowserUI.bundle = Components.classes["@mozilla.org/intl/stringbundle;1"]
.getService(Components.interfaces.nsIStringBundleService)
.createBundle("chrome://greasemonkey/locale/gm-browser.properties");
@@ -31,13 +35,6 @@ GM_BrowserUI.chromeLoad = function(e) {
GM_prefRoot.watch("enabled", GM_BrowserUI.refreshStatus);
GM_BrowserUI.refreshStatus();
- document.getElementById('content').addEventListener(
- 'DOMContentLoaded', function(aEvent) {
- var safeWin = aEvent.target.defaultView;
- var href = safeWin.location.href;
- GM_BrowserUI.checkDisabledScriptNavigation(aEvent, safeWin, href);
- }, true);
-
document.getElementById("contentAreaContextMenu")
.addEventListener("popupshowing", GM_BrowserUI.contextMenuShowing, false);
@@ -204,9 +201,9 @@ GM_BrowserUI.openOptions = function() {
openDialog('chrome://greasemonkey/content/options.xul', null, 'modal');
};
-GM_BrowserUI.checkDisabledScriptNavigation = function(aEvent, aSafeWin, aHref) {
+GM_BrowserUI.checkDisabledScriptNavigation = function(aContentType, aHref) {
if (!aHref.match(/\.user\.js$/)) return;
- if (aSafeWin.document.contentType.match(/^text\/(x|ht)ml/)) return;
+ if (aContentType.match(/^text\/(x|ht)ml/)) return;
// Handle enabled (i.e. show script source button) navigation by default.
var msg = GM_BrowserUI.bundle.GetStringFromName('greeting.msg');
diff --git a/content/framescript.js b/content/framescript.js
index 9bf289d..cd73b85 100644
--- a/content/framescript.js
+++ b/content/framescript.js
@@ -44,13 +44,20 @@ function contentObserver(win) {
// \\ // \\ // \\ // \\ // \\ // \\ // \\ // \\ // \\ // \\ // \\ // \\ // \\ //
-function blankLoad(aEvent) {
+function browserLoad(aEvent) {
var contentWin = aEvent.target.defaultView;
- if (contentWin.location.href.match(/^about:(blank|reader)/)) {
+ var href = contentWin.location.href;
+
+ if (href.match(/^about:(blank|reader)/)) {
// #1696: document-element-inserted doesn't see about:blank
runScripts('document-start', contentWin);
runScripts('document-end', contentWin);
}
+
+ gScope.sendAsyncMessage("greasemonkey:DOMContentLoaded", {
+ "contentType": contentWin.document.contentType,
+ "href": href
+ });
}
@@ -189,7 +196,7 @@ function windowCreated() {
// \\ // \\ // \\ // \\ // \\ // \\ // \\ // \\ // \\ // \\ // \\ // \\ // \\ //
-addEventListener('DOMContentLoaded', blankLoad);
+addEventListener('DOMContentLoaded', browserLoad);
addEventListener('DOMWindowCreated', windowCreated);
if (content) windowCreated();
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-mozext/greasemonkey.git
More information about the Pkg-mozext-commits
mailing list