view extension/components/stub.js @ 3:413435fc6202

We now show a notification box when a page calls window.powerbox.request().
author Atul Varma <varmaa@toolness.com>
date Thu, 06 Aug 2009 15:50:24 -0700
parents d3ccbd89f5cc
children
line wrap: on
line source

const Cc = Components.classes;
const Ci = Components.interfaces;
const Cu = Components.utils;

// The bulk of this function was taken from:
//
// http://code.google.com/p/gears/source/browse/trunk/gears/base/firefox/static_files/components/stub.js

function NSGetModule() {
  return {
    registerSelf: function(compMgr, location, loaderStr, type) {
      var appInfo = Cc["@mozilla.org/xre/app-info;1"]
                    .getService(Ci.nsIXULAppInfo);
      var platformVersion = appInfo.platformVersion.substring(0, 5);
      var libFile = location.parent.parent;
      libFile.append("lib");
      libFile.append(platformVersion);

      // Note: we register a directory instead of an individual file because
      // Gecko will only load components with a specific file name pattern. We
      // don't want this file to have to know about that. Luckily, if you
      // register a directory, Gecko will look inside the directory for files
      // to load.
      compMgr = compMgr.QueryInterface(Ci.nsIComponentRegistrar);
      compMgr.autoRegister(libFile);
    }
  };
}