dom/apps/src/InterAppComm.cpp

changeset 0
6474c204b198
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/dom/apps/src/InterAppComm.cpp	Wed Dec 31 06:09:35 2014 +0100
     1.3 @@ -0,0 +1,26 @@
     1.4 +/* This Source Code Form is subject to the terms of the Mozilla Public
     1.5 + * License, v. 2.0. If a copy of the MPL was not distributed with this
     1.6 + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
     1.7 +
     1.8 +#include "InterAppComm.h"
     1.9 +#include "nsContentUtils.h"
    1.10 +#include "nsPIDOMWindow.h"
    1.11 +#include "nsJSPrincipals.h"
    1.12 +#include "mozilla/Preferences.h"
    1.13 +#include "AccessCheck.h"
    1.14 +
    1.15 +using namespace mozilla::dom;
    1.16 +
    1.17 +/* static */ bool
    1.18 +InterAppComm::EnabledForScope(JSContext* /* unused */,
    1.19 +			      JS::Handle<JSObject*> /* unused */)
    1.20 +{
    1.21 +  // Disable the constructors if they're disabled by the preference for sure.
    1.22 +  if (!Preferences::GetBool("dom.inter-app-communication-api.enabled", false)) {
    1.23 +  	return false;
    1.24 +  }
    1.25 +
    1.26 +  // Only expose the constructors to the chrome codes for Gecko internal uses.
    1.27 +  // The content pages shouldn't be aware of the constructors.
    1.28 +  return nsContentUtils::ThreadsafeIsCallerChrome();
    1.29 +}

mercurial