author Wes Kocher <>
Mon, 09 Dec 2013 20:45:54 -0800
changeset 159631 cd37573496575d867f6951fba24584da42787081
parent 151746 d0e2322cbc600214f76d82d62620fc0a72b8982c
child 167075 3fba6123d70f22172526336276d6496808611cf6
permissions -rw-r--r--
Merge m-c to inbound

/* This Source Code Form is subject to the terms of the Mozilla Public
 * License, v. 2.0. If a copy of the MPL was not distributed with this
 * file, You can obtain one at */

#include "InterAppComm.h"
#include "nsContentUtils.h"
#include "nsPIDOMWindow.h"
#include "nsJSPrincipals.h"
#include "mozilla/Preferences.h"
#include "AccessCheck.h"

using namespace mozilla::dom;

/* static */ bool
InterAppComm::EnabledForScope(JSContext* /* unused */, JS::Handle<JSObject*> aObj)
  // Disable the constructors if they're disabled by the preference for sure.
  if (!Preferences::GetBool("dom.inter-app-communication-api.enabled", false)) {
  	return false;

  // Only expose the constructors to the chrome codes for Gecko internal uses.
  // The content pages shouldn't be aware of the constructors.
  return xpc::AccessCheck::isChrome(aObj);