Bug 952890 part 2. Remove the IsArrayLike method, since it no longer matches any spec concept. r=peterv

This commit is contained in:
Boris Zbarsky 2014-02-14 10:46:09 -05:00
Родитель 4ea2d8e2d5
Коммит 80ea81c519
3 изменённых файлов: 1 добавлений и 104 удалений

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

@ -222,64 +222,6 @@ nsScreen::GetLockOrientationPermission() const
return doc->MozFullScreen() ? FULLSCREEN_LOCK_ALLOWED : LOCK_DENIED;
}
NS_IMETHODIMP
nsScreen::MozLockOrientation(JS::Handle<JS::Value> aOrientation, JSContext* aCx,
bool* aReturn)
{
if (aOrientation.isObject()) {
JS::Rooted<JSObject*> seq(aCx, &aOrientation.toObject());
if (IsArrayLike(aCx, seq)) {
uint32_t length;
// JS_GetArrayLength actually works on all objects
if (!JS_GetArrayLength(aCx, seq, &length)) {
return NS_ERROR_FAILURE;
}
Sequence<nsString> orientations;
if (!orientations.SetCapacity(length)) {
return NS_ERROR_OUT_OF_MEMORY;
}
for (uint32_t i = 0; i < length; ++i) {
JS::Rooted<JS::Value> temp(aCx);
if (!JS_GetElement(aCx, seq, i, &temp)) {
return NS_ERROR_FAILURE;
}
JS::Rooted<JSString*> jsString(aCx, JS::ToString(aCx, temp));
if (!jsString) {
return NS_ERROR_FAILURE;
}
nsDependentJSString str;
if (!str.init(aCx, jsString)) {
return NS_ERROR_FAILURE;
}
*orientations.AppendElement() = str;
}
ErrorResult rv;
*aReturn = MozLockOrientation(orientations, rv);
return rv.ErrorCode();
}
}
JS::Rooted<JSString*> jsString(aCx, JS::ToString(aCx, aOrientation));
if (!jsString) {
return NS_ERROR_FAILURE;
}
nsDependentJSString orientation;
if (!orientation.init(aCx, jsString)) {
return NS_ERROR_FAILURE;
}
ErrorResult rv;
*aReturn = MozLockOrientation(orientation, rv);
return rv.ErrorCode();
}
bool
nsScreen::MozLockOrientation(const nsAString& aOrientation, ErrorResult& aRv)
{
@ -365,13 +307,6 @@ nsScreen::MozUnlockOrientation()
hal::UnlockScreenOrientation();
}
NS_IMETHODIMP
nsScreen::SlowMozUnlockOrientation()
{
MozUnlockOrientation();
return NS_OK;
}
bool
nsScreen::IsDeviceSizePageSize()
{

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

@ -264,12 +264,6 @@ IsNotDateOrRegExp(JSContext* cx, JS::Handle<JSObject*> obj)
return !JS_ObjectIsDate(cx, obj) && !JS_ObjectIsRegExp(cx, obj);
}
MOZ_ALWAYS_INLINE bool
IsArrayLike(JSContext* cx, JS::Handle<JSObject*> obj)
{
return IsNotDateOrRegExp(cx, obj);
}
MOZ_ALWAYS_INLINE bool
IsObjectValueConvertibleToDictionary(JSContext* cx,
JS::Handle<JS::Value> objVal)

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

@ -5,7 +5,7 @@
#include "nsIDOMEventTarget.idl"
[scriptable, builtinclass, uuid(bcdf4ce4-9785-4e31-a851-1d51ea16da20)]
[scriptable, builtinclass, uuid(e732649a-4f78-4ded-abe1-dbdc36fd59d3)]
interface nsIDOMScreen : nsIDOMEventTarget
{
readonly attribute long top;
@ -26,36 +26,4 @@ interface nsIDOMScreen : nsIDOMEventTarget
*/
[binaryname(SlowMozOrientation)]
readonly attribute DOMString mozOrientation;
/**
* Lock the screen to the specified orientations(s). This method returns true
* if the lock was acquired successfully, and false otherwise.
*
* The parameter can be a DOMString or an Array of DOMStrings. If you pass a
* string, we lock the screen to that one orientation. If you pass an Array,
* we ensure that the screen is always in one of the given orientations.
*
* Valid orientations are "portrait", "portrait-primary",
* "portrait-secondary", "landscape", "landscape-primary", and
* "landscape-secondary".
* These tokens are case-sensitive.
*
* If you pass a string that's not one of the valid orientations, or if you
* pass an array of orientations and any of the orientations in the array is
* not valid, we reject the lock and return false.
*
* The "-primary" orientations correspond to holding the device right-side up,
* while the "-secondary" orientations correspond to holding the device
* upside-down. Locking the orientation in "portrait" is the same as locking
* the orientation in ['portrait-primary', 'portrait-secondary'], and the
* "landscape" orientation similarly corresponds to the set
* ['landscape-primary', 'landscape-secondary'].
*/
[implicit_jscontext] boolean mozLockOrientation(in jsval orientation);
/**
* Unlock the screen orientation.
*/
[binaryname(SlowMozUnlockOrientation)]
void mozUnlockOrientation();
};