Backed out 2 changesets (bug 920840, bug 920831) for bustage. DONTBUILD

Backed out changeset dac111df7fdf (bug 920840)
Backed out changeset bfde80bc6826 (bug 920831)
This commit is contained in:
Ryan VanderMeulen 2013-09-27 23:14:26 -04:00
Родитель def31255cf
Коммит 1d4927cb26
6 изменённых файлов: 24 добавлений и 23 удалений

Просмотреть файл

@ -1786,17 +1786,6 @@ bool Navigator::HasPushNotificationsSupport(JSContext* /* unused */,
return win && Preferences::GetBool("services.push.enabled", false) && CheckPermission(win, "push"); return win && Preferences::GetBool("services.push.enabled", false) && CheckPermission(win, "push");
} }
#ifdef MOZ_B2G
/* static */
bool Navigator::HasInputMethodSupport(JSContext* /* unused */,
JSObject* aGlobal)
{
nsCOMPtr<nsPIDOMWindow> win = GetWindowFromGlobal(aGlobal);
return Preferences::GetBool("dom.mozInputMethod.testing", false) ||
(win && CheckPermission(win, "keyboard"));
}
#endif
/* static */ /* static */
already_AddRefed<nsPIDOMWindow> already_AddRefed<nsPIDOMWindow>
Navigator::GetWindowFromGlobal(JSObject* aGlobal) Navigator::GetWindowFromGlobal(JSObject* aGlobal)

Просмотреть файл

@ -300,10 +300,6 @@ public:
static bool HasPushNotificationsSupport(JSContext* /* unused */, static bool HasPushNotificationsSupport(JSContext* /* unused */,
JSObject* aGlobal); JSObject* aGlobal);
#ifdef MOZ_B2G
static bool HasInputMethodSupport(JSContext* /* unused */, JSObject* aGlobal);
#endif
nsPIDOMWindow* GetParentObject() const nsPIDOMWindow* GetParentObject() const
{ {
return GetWindow(); return GetWindow();

Просмотреть файл

@ -2040,13 +2040,8 @@ ConstructJSImplementation(JSContext* aCx, const char* aContractId,
aRv.Throw(rv); aRv.Throw(rv);
return nullptr; return nullptr;
} }
// With JS-implemented WebIDL, the return value of init() is not used to determine MOZ_ASSERT(initReturn.isUndefined(),
// if init() failed, so init() should only return undefined. Any kind of permission "nsIDOMGlobalPropertyInitializer should return undefined");
// or pref checking must happen by adding an attribute to the WebIDL interface.
if (!initReturn.isUndefined()) {
MOZ_ASSERT(false, "The init() method for JS-implemented WebIDL should not return anything");
MOZ_CRASH();
}
} }
// Extract the JS implementation from the XPCOM object. // Extract the JS implementation from the XPCOM object.
nsCOMPtr<nsIXPConnectWrappedJS> implWrapped = nsCOMPtr<nsIXPConnectWrappedJS> implWrapped =

Просмотреть файл

@ -199,6 +199,8 @@ MozKeyboard.prototype = {
} }
}; };
const TESTING_ENABLED_PREF = "dom.mozInputMethod.testing";
/* /*
* A WeakMap to map input method iframe window to its active status. * A WeakMap to map input method iframe window to its active status.
*/ */
@ -315,6 +317,24 @@ MozInputMethod.prototype = {
}), }),
init: function mozInputMethodInit(win) { init: function mozInputMethodInit(win) {
// Check if we're in testing mode.
let isTesting = false;
try {
isTesting = Services.prefs.getBoolPref(TESTING_ENABLED_PREF);
} catch (e) {}
// Don't bypass the permission check if not in testing mode.
if (!isTesting) {
let principal = win.document.nodePrincipal;
let perm = Services.perms
.testExactPermissionFromPrincipal(principal, "keyboard");
if (perm != Ci.nsIPermissionManager.ALLOW_ACTION) {
dump("No permission to use the keyboard API for " +
principal.origin + "\n");
return;
}
}
this._window = win; this._window = win;
this._mgmt = new MozInputMethodManager(win); this._mgmt = new MozInputMethodManager(win);
this.innerWindowID = win.QueryInterface(Ci.nsIInterfaceRequestor) this.innerWindowID = win.QueryInterface(Ci.nsIInterfaceRequestor)

Просмотреть файл

@ -324,6 +324,7 @@ var interfaceNamesInGlobalScope =
{name: "MozEmergencyCbModeEvent", b2g: true}, {name: "MozEmergencyCbModeEvent", b2g: true},
{name: "MozIccManager", b2g: true}, {name: "MozIccManager", b2g: true},
{name: "MozInputContext", b2g: true}, {name: "MozInputContext", b2g: true},
{name: "MozInputMethod", b2g: true},
{name: "MozInputMethodManager", b2g: true}, {name: "MozInputMethodManager", b2g: true},
"MozMmsEvent", "MozMmsEvent",
"MozMmsMessage", "MozMmsMessage",

Просмотреть файл

@ -6,7 +6,7 @@
[JSImplementation="@mozilla.org/b2g-inputmethod;1", [JSImplementation="@mozilla.org/b2g-inputmethod;1",
NavigatorProperty="mozInputMethod", NavigatorProperty="mozInputMethod",
Func="Navigator::HasInputMethodSupport"] Pref="dom.mozInputMethod.enabled"]
interface MozInputMethod : EventTarget { interface MozInputMethod : EventTarget {
// Input Method Manager contain a few global methods expose to apps // Input Method Manager contain a few global methods expose to apps
readonly attribute MozInputMethodManager mgmt; readonly attribute MozInputMethodManager mgmt;