Bug: GM eating up all mutation events (document-start, MutationObserver)

84 views
Skip to first unread message

sac_seb

unread,
Dec 29, 2013, 5:27:33 AM12/29/13
to greasemon...@googlegroups.com
Hello all,

the following event for the add of the title tag is not fired on http://www.example.com/ (alert is not shown):

// ==UserScript==
// @name        rtzgrgd
// @namespace   fhdf
// @description fdhdrfhdrfg
// @version     1
// @include     http*
// @grant       none
// @run-at document-start
// ==/UserScript==

MutationObserver = window.MutationObserver;
var observer = new MutationObserver(function(mutations) {
  mutations.forEach(function(mutation) {
   
    var addedNodes = mutation.addedNodes;
    for (var i = 0; i < addedNodes.length; i++) {
        if (addedNodes[i].nodeName == 'TITLE') {alert("Yes, script is active! Hurray!");}
    }
   
  });
});

// pass in the target node, as well as the observer options
observer.observe(document, {childList: true, subtree: true, attributes: true});

However, if the source of http://www.example.com/ is saved locally and the script is added there (as <script..</script> without using GM), everything works, event fires, alert is shown:
- see the attached example.com.htm

Besides, the user.js script is even working in Chrome (added in settings>extensions). So I guess it's not a problem in FF or the code. Somehow GM seems to swallow up all events, without giving them back. I have this problem with several userscripts (on some sites they're simply not active). This drives me crazy, if anyone has an idea about the problem or workaround please help ;)

Greetz

sac_seb

unread,
Dec 29, 2013, 5:31:45 AM12/29/13
to greasemon...@googlegroups.com
Attached is the testcase and the userscript. Strangely also: on some sites it is working with the userscript, too. E.g.: http://www.bing.com/translator/ (alert is also shown there).
example.com.htm
rtzgrgd.user.js

Anthony Lieuallen

unread,
Dec 29, 2013, 4:49:59 PM12/29/13
to greasemon...@googlegroups.com
On Sun, Dec 29, 2013 at 5:31 AM, sac_seb <sac6...@yahoo.co.uk> wrote:
Attached is the testcase and the userscript

Would you please file this as an issue in the tracker?
https://github.com/greasemonkey/greasemonkey/issues

sac_seb

unread,
Dec 29, 2013, 5:52:14 PM12/29/13
to greasemon...@googlegroups.com
Reply all
Reply to author
Forward
0 new messages