Firefox startScroll and sendAsyncMessage

In the latest Firefox 31+ the startScroll (e) function has been changed and must be called with startScroll (scrolldir, screenX, screenY)

Reset change: https://hg.mozilla.org/integration/mozilla-inbound/diff/cc298e4b0f47/toolkit/content/widgets/browser.xml

Before changing, I can start startScroll manually from my classic bootstrap.js extension with:

aWindow.gBrowser.selectedBrowser.startScroll(e);

      

I got feedback on mozilla's IRC channel to use sendAsyncMessage "Autoscroll: Start" so I tried various combinations

aWindow.gBrowser.selectedBrowser.startScroll("NSEW", e.screenX, e.screenY);
aWindow.gBrowser.selectedBrowser.messageManager.sendAsyncMessage("Autoscroll:Start", {scrolldir:"NSEW", screenX:e.screenX, screenY:e.screenY});

      

but nothing works.

Minor minimal boostrap.js extension of my problem can be seen at http://pastebin.com/azv1jePt

Does anyone know how to manually start autoscroll in a newer version of Firefox directly from the bootstrap.js extension, without using any chrome scripts?

Thanks
Senicar

+3


source to share


1 answer


What worked for me was to simulate the mousedown middle button event from the script frame (no need to call startScroll or sendAsyncMessage):

content.document.documentElement.dispatchEvent(new content.MouseEvent("mousedown", {
    view: content,
    bubbles: true,
    cancelable: true,
    button: 1,
    screenX: /* anEvent.screenX */,
    screenY: /* anEvent.screenY */
}));

      



Hope it helps

0


source







All Articles