michael@0: /* This Source Code Form is subject to the terms of the Mozilla Public michael@0: * License, v. 2.0. If a copy of the MPL was not distributed with this michael@0: * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ michael@0: michael@0: #include "InterAppComm.h" michael@0: #include "nsContentUtils.h" michael@0: #include "nsPIDOMWindow.h" michael@0: #include "nsJSPrincipals.h" michael@0: #include "mozilla/Preferences.h" michael@0: #include "AccessCheck.h" michael@0: michael@0: using namespace mozilla::dom; michael@0: michael@0: /* static */ bool michael@0: InterAppComm::EnabledForScope(JSContext* /* unused */, michael@0: JS::Handle /* unused */) michael@0: { michael@0: // Disable the constructors if they're disabled by the preference for sure. michael@0: if (!Preferences::GetBool("dom.inter-app-communication-api.enabled", false)) { michael@0: return false; michael@0: } michael@0: michael@0: // Only expose the constructors to the chrome codes for Gecko internal uses. michael@0: // The content pages shouldn't be aware of the constructors. michael@0: return nsContentUtils::ThreadsafeIsCallerChrome(); michael@0: }