B2G/gecko/toolkit/components/social/MozSocialAPI.jsm
// and then calls attachToWindow as appropriate
and then calls attachToWindow as appropriate
and then calls attachToWindow as appropriate
function injectController(doc, topic, data) {
  try {
    let window = doc.defaultView;
    if (!window)
      return;
    if (doc.documentURIObject.scheme == "about") {
      return;
    }
    var containingBrowser = window.QueryInterface(Ci.nsIInterfaceRequestor)
                                  .getInterface(Ci.nsIWebNavigation)
                                  .QueryInterface(Ci.nsIDocShell)
                                  .chromeEventHandler;
    let origin = containingBrowser.getAttribute("origin");
    if (!origin) {
      return;
    }
    SocialService.getProvider(origin, function(provider) {
      if (provider && provider.workerURL) {
        attachToWindow(provider, window);
      }
    });
  } catch(e) {
    Cu.reportError("MozSocialAPI injectController: unable to attachToWindow for " + doc.location + ": " + e);
  }
}
function injectController ( doc , topic , data ) { try { let window = doc . defaultView ; if ( ! window ) return ; if ( doc . documentURIObject . scheme == "about" ) { return ; } var containingBrowser = window . QueryInterface ( Ci . nsIInterfaceRequestor ) . getInterface ( Ci . nsIWebNavigation ) . QueryInterface ( Ci . nsIDocShell ) . chromeEventHandler ; let origin = containingBrowser . getAttribute ( "origin" ) ; if ( ! origin ) { return ; } SocialService . getProvider ( origin , function ( provider ) { if ( provider && provider . workerURL ) { attachToWindow ( provider , window ) ; } } ) ; } catch ( e ) { Cu . reportError ( "MozSocialAPI injectController: unable to attachToWindow for " + doc . location + ": " + e ) ; } }
and then calls attachToWindow as appropriate
and then calls attachToWindow as appropriate
// Do not attempt to load the API into about: error pages