https://github.com/mozilla/gecko-dev
Raw File
Tip revision: 7e4176185aa3b8a7ba4b8498e2c8852bb4f79714 authored by seabld on 13 April 2012, 02:26:42 UTC
Added tag SEAMONKEY_2_9b3_RELEASE for changeset FIREFOX_12_0b5_BUILD1. CLOSED TREE a=release
Tip revision: 7e41761
test-ipcbrowser-content.js
function windowUtils() {
    return content.QueryInterface(Components.interfaces.nsIInterfaceRequestor)
               .getInterface(Components.interfaces.nsIDOMWindowUtils);
}

function recvSetViewport(w, h) {

    dump("setting viewport to "+ w +"x"+ h +"\n");

    windowUtils().setCSSViewport(w, h);
}

function recvSetDisplayPort(x, y, w, h) {

    dump("setting displayPort to <"+ x +", "+ y +", "+ w +", "+ h +">\n");

    windowUtils().setDisplayPortForElement(x, y, w, h, content.document.documentElement);
}

function recvSetResolution(xres, yres) {

    dump("setting xres="+ xres +" yres="+ yres +"\n");

    windowUtils().setResolution(xres, yres);
}

function recvScrollBy(dx, dy) {
    content.scrollBy(dx, dy);
}

function recvScrollTo(x, y) {
    content.scrollTo(x, y);
}

addMessageListener(
    "setViewport",
    function (m) { recvSetViewport(m.json.w, m.json.h); }
);

addMessageListener(
    "setDisplayPort",
    function (m) { recvSetDisplayPort(m.json.x, m.json.y,
                                      m.json.w, m.json.h); }
);

addMessageListener(
    "setResolution",
    function (m) { recvSetResolution(m.json.xres, m.json.yres); }
);

addMessageListener(
    "scrollBy",
    function(m) { recvScrollBy(m.json.dx, m.json.dy); }
);

addMessageListener(
    "scrollTo",
    function(m) { recvScrollTo(m.json.x, m.json.y); }
);
back to top