merge mozilla-inbound to mozilla-central. r=merge a=merge

MozReview-Commit-ID: AeoHOxZLi6m
This commit is contained in:
Sebastian Hengst 2017-08-28 16:53:53 +02:00
Родитель 79c12610f3 00e96badb1
Коммит 9769c22d10
44 изменённых файлов: 343 добавлений и 351 удалений

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

@ -9,6 +9,11 @@
#include "mozilla/EventStates.h"
#include "mozilla/MemoryReporting.h"
#include "mozilla/dom/Element.h"
#ifdef ANDROID
#include "mozilla/IHistory.h"
#else
#include "mozilla/places/History.h"
#endif
#include "nsIURL.h"
#include "nsISizeOf.h"
#include "nsIDocShell.h"
@ -28,26 +33,30 @@
namespace mozilla {
namespace dom {
#ifndef ANDROID
using places::History;
#endif
Link::Link(Element *aElement)
: mElement(aElement)
, mHistory(services::GetHistoryService())
, mLinkState(eLinkState_NotLink)
, mNeedsRegistration(false)
, mRegistered(false)
, mHasPendingLinkUpdate(false)
, mInDNSPrefetch(false)
, mHistory(true)
{
MOZ_ASSERT(mElement, "Must have an element");
}
Link::Link()
: mElement(nullptr)
, mHistory(nullptr)
, mLinkState(eLinkState_NotLink)
, mNeedsRegistration(false)
, mRegistered(false)
, mHasPendingLinkUpdate(false)
, mInDNSPrefetch(false)
, mHistory(false)
{
}
@ -380,12 +389,19 @@ Link::LinkState() const
// Make sure the href attribute has a valid link (bug 23209).
// If we have a good href, register with History if available.
if (mHistory && hrefURI) {
nsresult rv = mHistory->RegisterVisitedCallback(hrefURI, self);
if (NS_SUCCEEDED(rv)) {
self->mRegistered = true;
#ifdef ANDROID
nsCOMPtr<IHistory> history = services::GetHistoryService();
#else
History* history = History::GetService();
#endif
if (history) {
nsresult rv = history->RegisterVisitedCallback(hrefURI, self);
if (NS_SUCCEEDED(rv)) {
self->mRegistered = true;
// And make sure we are in the document's link map.
element->GetComposedDoc()->AddStyleRelevantLink(self);
// And make sure we are in the document's link map.
element->GetComposedDoc()->AddStyleRelevantLink(self);
}
}
}
}
@ -752,14 +768,13 @@ Link::ResetLinkState(bool aNotify, bool aHasHref)
// with it before.
doc->ForgetLink(this);
}
UnregisterFromHistory();
}
// If we have an href, we should register with the history.
mNeedsRegistration = aHasHref;
// If we've cached the URI, reset always invalidates it.
UnregisterFromHistory();
mCachedURI = nullptr;
// Update our state back to the default.
@ -792,14 +807,19 @@ Link::UnregisterFromHistory()
return;
}
NS_ASSERTION(mCachedURI, "mRegistered is true, but we have no cached URI?!");
// And tell History to stop tracking us.
if (mHistory) {
nsresult rv = mHistory->UnregisterVisitedCallback(mCachedURI, this);
NS_ASSERTION(NS_SUCCEEDED(rv), "This should only fail if we misuse the API!");
if (NS_SUCCEEDED(rv)) {
mRegistered = false;
if (mHistory && mCachedURI) {
#ifdef ANDROID
nsCOMPtr<IHistory> history = services::GetHistoryService();
#else
History* history = History::GetService();
#endif
if (history) {
nsresult rv = history->UnregisterVisitedCallback(mCachedURI, this);
NS_ASSERTION(NS_SUCCEEDED(rv), "This should only fail if we misuse the API!");
if (NS_SUCCEEDED(rv)) {
mRegistered = false;
}
}
}
}
@ -844,7 +864,6 @@ Link::SizeOfExcludingThis(mozilla::SizeOfState& aState) const
// The following members don't need to be measured:
// - mElement, because it is a pointer-to-self used to avoid QIs
// - mHistory, because it is non-owning
return n;
}

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

@ -11,7 +11,6 @@
#ifndef mozilla_dom_Link_h__
#define mozilla_dom_Link_h__
#include "mozilla/IHistory.h"
#include "mozilla/MemoryReporting.h"
#include "nsIContent.h" // for nsLinkState
#include "nsIContentPolicy.h"
@ -182,10 +181,6 @@ private:
Element * const mElement;
// Strong reference to History. The link has to unregister before History
// can disappear.
nsCOMPtr<IHistory> mHistory;
uint16_t mLinkState;
bool mNeedsRegistration : 1;
@ -195,6 +190,8 @@ private:
bool mHasPendingLinkUpdate : 1;
bool mInDNSPrefetch : 1;
bool mHistory: 1;
};
NS_DEFINE_STATIC_IID_ACCESSOR(Link, MOZILLA_DOM_LINK_IMPLEMENTATION_IID)

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

@ -695,8 +695,7 @@ nsDOMClassInfo::Resolve(nsIXPConnectWrappedNative *wrapper, JSContext *cx,
// window.classname, just fall through and let the JS engine
// return the Object constructor.
if (!::JS_DefinePropertyById(cx, obj, id, desc.value(),
JSPROP_ENUMERATE,
JS_STUBGETTER, JS_STUBSETTER)) {
JSPROP_ENUMERATE)) {
return NS_ERROR_UNEXPECTED;
}
@ -944,8 +943,7 @@ DefineInterfaceConstants(JSContext *cx, JS::Handle<JSObject*> obj, const nsIID *
NS_ENSURE_TRUE(NS_SUCCEEDED(rv), rv);
if (!::JS_DefineProperty(cx, obj, name.get(), v,
JSPROP_ENUMERATE | JSPROP_READONLY | JSPROP_PERMANENT,
JS_STUBGETTER, JS_STUBSETTER)) {
JSPROP_ENUMERATE | JSPROP_READONLY | JSPROP_PERMANENT)) {
return NS_ERROR_UNEXPECTED;
}
}
@ -1475,8 +1473,7 @@ ResolvePrototype(nsIXPConnect *aXPConnect, nsGlobalWindow *aWin, JSContext *cx,
// Per ECMA, the prototype property is {DontEnum, DontDelete, ReadOnly}
if (!JS_WrapValue(cx, &v) ||
!JS_DefineProperty(cx, class_obj, "prototype", v,
JSPROP_PERMANENT | JSPROP_READONLY,
JS_STUBGETTER, JS_STUBSETTER)) {
JSPROP_PERMANENT | JSPROP_READONLY)) {
return NS_ERROR_UNEXPECTED;
}
@ -1757,8 +1754,7 @@ LookupComponentsShim(JSContext *cx, JS::Handle<JSObject*> global,
NS_ENSURE_TRUE(interfaces, NS_ERROR_OUT_OF_MEMORY);
bool ok =
JS_DefineProperty(cx, components, "interfaces", interfaces,
JSPROP_ENUMERATE | JSPROP_PERMANENT | JSPROP_READONLY,
JS_STUBGETTER, JS_STUBSETTER);
JSPROP_ENUMERATE | JSPROP_PERMANENT | JSPROP_READONLY);
NS_ENSURE_TRUE(ok, NS_ERROR_OUT_OF_MEMORY);
// Define a bunch of shims from the Ci.nsIDOMFoo to window.Foo for DOM
@ -1780,8 +1776,7 @@ LookupComponentsShim(JSContext *cx, JS::Handle<JSObject*> global,
// Define the shim on the interfaces object.
ok = JS_DefineProperty(cx, interfaces, geckoName, v,
JSPROP_ENUMERATE | JSPROP_PERMANENT | JSPROP_READONLY,
JS_STUBGETTER, JS_STUBSETTER);
JSPROP_ENUMERATE | JSPROP_PERMANENT | JSPROP_READONLY);
NS_ENSURE_TRUE(ok, NS_ERROR_OUT_OF_MEMORY);
}

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

@ -14686,8 +14686,7 @@ nsGlobalWindow::RedefineProperty(JSContext* aCx, const char* aPropName,
}
if (!JS_WrapObject(aCx, &thisObj) ||
!JS_DefineProperty(aCx, thisObj, aPropName, aValue, JSPROP_ENUMERATE,
JS_STUBGETTER, JS_STUBSETTER)) {
!JS_DefineProperty(aCx, thisObj, aPropName, aValue, JSPROP_ENUMERATE)) {
aError.Throw(NS_ERROR_FAILURE);
}
}

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

@ -837,8 +837,7 @@ CreateInterfaceObject(JSContext* cx, JS::Handle<JSObject*> global,
if (!namedConstructor ||
!JS_DefineProperty(cx, namedConstructor, "prototype",
proto,
JSPROP_PERMANENT | JSPROP_READONLY,
JS_STUBGETTER, JS_STUBSETTER) ||
JSPROP_PERMANENT | JSPROP_READONLY) ||
(defineOnGlobal &&
!DefineConstructor(cx, global, namedConstructors->mName,
namedConstructor))) {

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

@ -180,10 +180,6 @@ DOMProxyHandler::defineProperty(JSContext* cx, JS::Handle<JSObject*> proxy, JS::
Handle<PropertyDescriptor> desc,
JS::ObjectOpResult &result, bool *defined) const
{
if (desc.hasGetterObject() && desc.setter() == JS_StrictPropertyStub) {
return result.failGetterOnly();
}
if (xpc::WrapperFactory::IsXrayWrapper(proxy)) {
return result.succeed();
}

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

@ -48,6 +48,7 @@ NS_IMPL_ELEMENT_CLONE(HTMLVideoElement)
HTMLVideoElement::HTMLVideoElement(already_AddRefed<NodeInfo>& aNodeInfo)
: HTMLMediaElement(aNodeInfo)
, mUseScreenWakeLock(true)
, mIsOrientationLocked(false)
{
}

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

@ -9,6 +9,7 @@
#include "mozilla/Attributes.h"
#include "mozilla/dom/HTMLMediaElement.h"
#include "MediaPrefs.h"
namespace mozilla {
@ -139,6 +140,22 @@ public:
already_AddRefed<VideoPlaybackQuality> GetVideoPlaybackQuality();
bool MozOrientationLockEnabled() const
{
return MediaPrefs::VideoOrientationLockEnabled();
}
bool MozIsOrientationLocked() const
{
return mIsOrientationLocked;
}
void SetMozIsOrientationLocked(bool aLock)
{
mIsOrientationLocked = aLock;
}
protected:
virtual ~HTMLVideoElement();
@ -151,6 +168,8 @@ protected:
bool mUseScreenWakeLock;
RefPtr<WakeLock> mScreenWakeLock;
bool mIsOrientationLocked;
private:
static void MapAttributesIntoRule(const nsMappedAttributes* aAttributes,
GenericSpecifiedValues* aGenericData);

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

@ -211,6 +211,7 @@ private:
#ifdef MOZ_CUBEB_REMOTING
DECL_MEDIA_PREF("media.cubeb.sandbox", CubebSandbox, bool, false);
#endif // MOZ_CUBEB_REMOTING
DECL_MEDIA_PREF("media.videocontrols.lock-video-orientation", VideoOrientationLockEnabled, bool, false);
public:
// Manage the singleton:

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

@ -0,0 +1,30 @@
<!DOCTYPE html>
<html class="reftest-wait">
<head>
<title> Bug 1368490 : Crash if media recorder source stream reduces number of channels. </title>
</head>
<meta charset="utf-8">
<script type="text/javascript">
function boom() {
let audioContext = new window.AudioContext();
let oscillator = audioContext.createOscillator();
let dst = audioContext.createMediaStreamDestination();
oscillator.channelCount = 4;
dst.channelCount = 4;
oscillator.connect(dst, 0, 0);
oscillator.start();
mediaRec = new MediaRecorder(dst.stream);
mediaRec.start(100);
setTimeout(() => {
dst.channelCount = 1;
setTimeout(() => {
mediaRec.stop();
document.documentElement.removeAttribute("class");
}, 100);
}, 100);
}
</script>
<body onload="boom();"></body>
</html>

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

@ -83,6 +83,7 @@ load 1185176.html
load 1185192.html
load 1304948.html
load 1319486.html
load 1368490.html
load 1291702.html
load 1384248.html
load disconnect-wrong-destination.html

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

@ -49,6 +49,14 @@ partial interface HTMLVideoElement {
// True if the video should use a screen wake lock.
[Pref="dom.wakelock.enabled", Func="Navigator::HasWakeLockSupport"]
attribute boolean mozUseScreenWakeLock;
// Attributes for builtin video controls to lock screen orientation.
// True if video controls should lock orientation when fullscreen.
[Pref="media.videocontrols.lock-video-orientation", Func="IsChromeOrXBL"]
readonly attribute boolean mozOrientationLockEnabled;
// True if screen orientation is locked by video controls.
[Pref="media.videocontrols.lock-video-orientation", Func="IsChromeOrXBL"]
attribute boolean mozIsOrientationLocked;
};
// https://dvcs.w3.org/hg/html-media/raw-file/default/media-source/media-source.html#idl-def-HTMLVideoElement

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

@ -905,8 +905,7 @@ GetOrCreateClassObjectMap(JSContext *cx, JS::Handle<JSObject*> scope, const char
// It's not there. Create and define it.
JS::Rooted<JSObject*> map(cx, JS::NewWeakMapObject(cx));
if (!map || !JS_DefineProperty(cx, scope, mapName, map,
JSPROP_PERMANENT | JSPROP_READONLY,
JS_STUBGETTER, JS_STUBSETTER))
JSPROP_PERMANENT | JSPROP_READONLY))
{
return nullptr;
}
@ -1067,8 +1066,7 @@ nsXBLBinding::DoInitJSClass(JSContext *cx,
JSAutoCompartment ac3(cx, holder);
if (!JS_WrapObject(cx, &proto) ||
!JS_DefineUCProperty(cx, holder, aClassName.get(), -1, proto,
JSPROP_READONLY | JSPROP_PERMANENT,
JS_STUBGETTER, JS_STUBSETTER))
JSPROP_READONLY | JSPROP_PERMANENT))
{
return NS_ERROR_OUT_OF_MEMORY;
}

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

@ -120,8 +120,7 @@ nsXBLProtoImpl::InstallImplementation(nsXBLPrototypeBinding* aPrototypeBinding,
// Define it as a property on the scopeObject, using the same name used on
// the content side.
bool ok = JS_DefineUCProperty(cx, scopeObject, className, -1, propertyHolder,
JSPROP_PERMANENT | JSPROP_READONLY,
JS_STUBGETTER, JS_STUBSETTER);
JSPROP_PERMANENT | JSPROP_READONLY);
NS_ENSURE_TRUE(ok, NS_ERROR_UNEXPECTED);
} else {
propertyHolder = targetClassObject;

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

@ -2500,12 +2500,14 @@ EditorBase::InsertTextImpl(const nsAString& aStringToInsert,
// If a neighboring text node already exists, use that
if (!node->IsNodeOfType(nsINode::eTEXT)) {
if (offset && node->GetChildAt(offset - 1)->IsNodeOfType(nsINode::eTEXT)) {
node = node->GetChildAt(offset - 1);
nsIContent* child = node->GetChildAt(offset);
if (offset && child && child->GetPreviousSibling() &&
child->GetPreviousSibling()->IsNodeOfType(nsINode::eTEXT)) {
node = child->GetPreviousSibling();
offset = node->Length();
} else if (offset < static_cast<int32_t>(node->Length()) &&
node->GetChildAt(offset)->IsNodeOfType(nsINode::eTEXT)) {
node = node->GetChildAt(offset);
child && child->IsNodeOfType(nsINode::eTEXT)) {
node = child;
offset = 0;
}
}

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

@ -478,8 +478,7 @@ XPCShellEnvironment::Init()
JS::Rooted<Value> privateVal(cx, PrivateValue(this));
if (!JS_DefineProperty(cx, globalObj, "__XPCShellEnvironment",
privateVal,
JSPROP_READONLY | JSPROP_PERMANENT,
JS_STUBGETTER, JS_STUBSETTER) ||
JSPROP_READONLY | JSPROP_PERMANENT) ||
!JS_DefineFunctions(cx, globalObj, gGlobalFunctions) ||
!JS_DefineProfilingFunctions(cx, globalObj))
{

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

@ -575,7 +575,6 @@ JavaScriptShared::fromDescriptor(JSContext* cx, Handle<PropertyDescriptor> desc,
return false;
out->getter() = objVar;
} else {
MOZ_ASSERT(desc.getter() != JS_PropertyStub);
out->getter() = UnknownPropertyOp;
}
@ -588,7 +587,6 @@ JavaScriptShared::fromDescriptor(JSContext* cx, Handle<PropertyDescriptor> desc,
return false;
out->setter() = objVar;
} else {
MOZ_ASSERT(desc.setter() != JS_StrictPropertyStub);
out->setter() = UnknownPropertyOp;
}

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

@ -169,6 +169,7 @@ source-package:
DIST=$(DIST) \
MKDIR=$(MKDIR) \
TAR=$(TAR) \
AUTOCONF=$(AUTOCONF) \
MOZJS_MAJOR_VERSION=$(MOZJS_MAJOR_VERSION) \
MOZJS_MINOR_VERSION=$(MOZJS_MINOR_VERSION) \
MOZJS_PATCH_VERSION=$(MOZJS_PATCH_VERSION) \

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

@ -2081,17 +2081,11 @@ ShellAllocationMetadataBuilder::build(JSContext* cx, HandleObject,
static int createdIndex = 0;
createdIndex++;
if (!JS_DefineProperty(cx, obj, "index", createdIndex, 0,
JS_STUBGETTER, JS_STUBSETTER))
{
if (!JS_DefineProperty(cx, obj, "index", createdIndex, 0))
oomUnsafe.crash("ShellAllocationMetadataBuilder::build");
}
if (!JS_DefineProperty(cx, obj, "stack", stack, 0,
JS_STUBGETTER, JS_STUBSETTER))
{
if (!JS_DefineProperty(cx, obj, "stack", stack, 0))
oomUnsafe.crash("ShellAllocationMetadataBuilder::build");
}
int stackIndex = 0;
RootedId id(cx);
@ -2100,11 +2094,8 @@ ShellAllocationMetadataBuilder::build(JSContext* cx, HandleObject,
if (iter.isFunctionFrame() && iter.compartment() == cx->compartment()) {
id = INT_TO_JSID(stackIndex);
RootedObject callee(cx, iter.callee(cx));
if (!JS_DefinePropertyById(cx, stack, id, callee, 0,
JS_STUBGETTER, JS_STUBSETTER))
{
if (!JS_DefinePropertyById(cx, stack, id, callee, 0))
oomUnsafe.crash("ShellAllocationMetadataBuilder::build");
}
stackIndex++;
}
}

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

@ -2475,8 +2475,7 @@ JS_InitCTypesClass(JSContext* cx, HandleObject global)
return false;
if (!JS_DefineProperty(cx, global, "ctypes", ctypes,
JSPROP_READONLY | JSPROP_PERMANENT,
JS_STUBGETTER, JS_STUBSETTER)){
JSPROP_READONLY | JSPROP_PERMANENT)) {
return false;
}

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

@ -320,40 +320,70 @@ AtomicOperations::isLockfree(int32_t size)
} // namespace jit
} // namespace js
#if defined(JS_CODEGEN_ARM)
# include "jit/arm/AtomicOperations-arm.h"
#elif defined(JS_CODEGEN_ARM64)
// As explained above, our atomic operations are not portable even in principle,
// so we must include platform+compiler specific definitions here.
//
// x86, x64, arm, and arm64 are maintained by Mozilla. All other platform
// setups are by platform maintainers' request and are not maintained by
// Mozilla.
//
// If you are using a platform+compiler combination that causes an error below
// (and if the problem isn't just that the compiler uses a different name for a
// known architecture), you have basically three options:
//
// - find an already-supported compiler for the platform and use that instead
//
// - write your own support code for the platform+compiler and create a new
// case below
//
// - include jit/none/AtomicOperations-feeling-lucky.h in a case for the
// platform below, if you have a gcc-compatible compiler and truly feel
// lucky. You may have to add a little code to that file, too.
//
// Simulators are confusing. These atomic primitives must be compatible with
// the code that the JIT emits, but of course for an ARM simulator running on
// x86 the primitives here will be for x86, not for ARM, while the JIT emits ARM
// code. Our ARM simulator solves that the easy way: by using these primitives
// to implement its atomic operations. For other simulators there may need to
// be special cases below to provide simulator-compatible primitives, for
// example, for our ARM64 simulator the primitives could in principle
// participate in the memory exclusivity monitors implemented by the simulator.
// Such a solution is likely to be difficult.
#if defined(__x86_64__) || defined(_M_X64) || defined(__i386__) || defined(_M_IX86)
# if defined(__clang__) || defined(__GNUC__) || defined(_MSC_VER)
# include "jit/x86-shared/AtomicOperations-x86-shared.h"
# else
# error "No AtomicOperations support for this platform+compiler combination"
# endif
#elif defined(__arm__)
# if defined(__clang__) || defined(__GNUC__)
# include "jit/arm/AtomicOperations-arm.h"
# else
# error "No AtomicOperations support for this platform+compiler combination"
# endif
#elif defined(__aarch64__)
# include "jit/arm64/AtomicOperations-arm64.h"
#elif defined(JS_CODEGEN_MIPS32) || defined(JS_CODEGEN_MIPS64)
# include "jit/mips-shared/AtomicOperations-mips-shared.h"
#elif defined(__mips__)
# if defined(__clang__) || defined(__GNUC__)
# include "jit/mips-shared/AtomicOperations-mips-shared.h"
# else
# error "No AtomicOperations support for this platform+compiler combination"
# endif
#elif defined(__ppc__) || defined(__PPC__)
# include "jit/none/AtomicOperations-feeling-lucky.h"
#elif defined(__sparc__)
# include "jit/none/AtomicOperations-feeling-lucky.h"
#elif defined(JS_CODEGEN_NONE)
// You can disable the JIT with --disable-ion but you must still
// provide the atomic operations that will be used by the JS engine.
// When the JIT is disabled the operations are simply safe-for-races
// C++ realizations of atomics. These operations cannot be written
// in portable C++, hence the default here is to crash. See the
// top of the file for more guidance.
# if defined(__ppc64__) || defined(__PPC64__) || defined(__ppc64le__) || defined(__PPC64LE__)
# include "jit/none/AtomicOperations-feeling-lucky.h"
# elif defined(__aarch64__)
# include "jit/arm64/AtomicOperations-arm64.h"
# elif defined(__alpha__)
# include "jit/none/AtomicOperations-feeling-lucky.h"
# elif defined(__hppa__)
# include "jit/none/AtomicOperations-feeling-lucky.h"
# elif defined(__sh__)
# include "jit/none/AtomicOperations-feeling-lucky.h"
# else
# include "jit/none/AtomicOperations-none.h" // These MOZ_CRASH() always
# endif
#elif defined(JS_CODEGEN_X86) || defined(JS_CODEGEN_X64)
# include "jit/x86-shared/AtomicOperations-x86-shared.h"
#elif defined(__ppc64__) || defined(__PPC64__) || defined(__ppc64le__) || defined(__PPC64LE__)
# include "jit/none/AtomicOperations-feeling-lucky.h"
#elif defined(__alpha__)
# include "jit/none/AtomicOperations-feeling-lucky.h"
#elif defined(__hppa__)
# include "jit/none/AtomicOperations-feeling-lucky.h"
#elif defined(__sh__)
# include "jit/none/AtomicOperations-feeling-lucky.h"
#else
# error "Atomic operations must be defined for this platform"
# error "No AtomicOperations support provided for this platform"
#endif
#endif // jit_AtomicOperations_h

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

@ -3104,6 +3104,7 @@ CodeGeneratorARM::visitSignExtendInt64(LSignExtendInt64* lir)
masm.move16SignExtend(input.low, output.low);
break;
case MSignExtendInt64::Word:
masm.move32(input.low, output.low);
break;
}
masm.ma_asr(Imm32(31), output.low, output.high);

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

@ -1,136 +0,0 @@
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*-
* vim: set ts=8 sts=4 et sw=4 tw=99:
* 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 http://mozilla.org/MPL/2.0/. */
/* For documentation, see jit/AtomicOperations.h */
#ifndef jit_none_AtomicOperations_none_h
#define jit_none_AtomicOperations_none_h
#include "mozilla/Assertions.h"
// A "none" build is never run (ref IRC discussion with h4writer) and
// all functions here can therefore MOZ_CRASH, even if they are
// referenced from other than jitted code.
inline bool
js::jit::AtomicOperations::isLockfree8()
{
MOZ_CRASH();
}
inline void
js::jit::AtomicOperations::fenceSeqCst()
{
MOZ_CRASH();
}
template<typename T>
inline T
js::jit::AtomicOperations::loadSeqCst(T* addr)
{
MOZ_CRASH();
}
template<typename T>
inline void
js::jit::AtomicOperations::storeSeqCst(T* addr, T val)
{
MOZ_CRASH();
}
template<typename T>
inline T
js::jit::AtomicOperations::compareExchangeSeqCst(T* addr, T oldval, T newval)
{
MOZ_CRASH();
}
template<typename T>
inline T
js::jit::AtomicOperations::fetchAddSeqCst(T* addr, T val)
{
MOZ_CRASH();
}
template<typename T>
inline T
js::jit::AtomicOperations::fetchSubSeqCst(T* addr, T val)
{
MOZ_CRASH();
}
template<typename T>
inline T
js::jit::AtomicOperations::fetchAndSeqCst(T* addr, T val)
{
MOZ_CRASH();
}
template<typename T>
inline T
js::jit::AtomicOperations::fetchOrSeqCst(T* addr, T val)
{
MOZ_CRASH();
}
template<typename T>
inline T
js::jit::AtomicOperations::fetchXorSeqCst(T* addr, T val)
{
MOZ_CRASH();
}
template<typename T>
inline T
js::jit::AtomicOperations::exchangeSeqCst(T* addr, T val)
{
MOZ_CRASH();
}
template<typename T>
inline T
js::jit::AtomicOperations::loadSafeWhenRacy(T* addr)
{
MOZ_CRASH();
}
template<typename T>
inline void
js::jit::AtomicOperations::storeSafeWhenRacy(T* addr, T val)
{
MOZ_CRASH();
}
inline void
js::jit::AtomicOperations::memcpySafeWhenRacy(void* dest, const void* src, size_t nbytes)
{
MOZ_ASSERT(!((char*)dest <= (char*)src && (char*)src < (char*)dest+nbytes));
MOZ_ASSERT(!((char*)src <= (char*)dest && (char*)dest < (char*)src+nbytes));
MOZ_CRASH();
}
inline void
js::jit::AtomicOperations::memmoveSafeWhenRacy(void* dest, const void* src, size_t nbytes)
{
MOZ_CRASH();
}
template<size_t nbytes>
inline void
js::jit::RegionLock::acquire(void* addr)
{
(void)spinlock; // Remove a lot of "unused" warnings.
MOZ_CRASH();
}
template<size_t nbytes>
inline void
js::jit::RegionLock::release(void* addr)
{
MOZ_CRASH();
}
#endif // jit_none_AtomicOperations_none_h

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

@ -45,16 +45,14 @@ BEGIN_TEST(testAddPropertyHook)
JS::RootedValue arr(cx, JS::ObjectValue(*obj));
CHECK(JS_DefineProperty(cx, global, "arr", arr,
JSPROP_ENUMERATE,
JS_STUBGETTER, JS_STUBSETTER));
JSPROP_ENUMERATE));
JS::RootedObject arrObj(cx, &arr.toObject());
for (int i = 0; i < ExpectedCount; ++i) {
obj = JS_NewObject(cx, &AddPropertyClass);
CHECK(obj);
CHECK(JS_DefineElement(cx, arrObj, i, obj,
JSPROP_ENUMERATE,
JS_STUBGETTER, JS_STUBSETTER));
JSPROP_ENUMERATE));
}
// Now add a prop to each of the objects, but make sure to do

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

@ -12,12 +12,11 @@ BEGIN_TEST(testSetProperty_NativeGetterStubSetter)
JS::RootedObject obj(cx, JS_NewPlainObject(cx));
CHECK(obj);
CHECK(JS_DefineProperty(cx, global, "globalProp", obj, JSPROP_ENUMERATE,
JS_STUBGETTER, JS_STUBSETTER));
CHECK(JS_DefineProperty(cx, global, "globalProp", obj, JSPROP_ENUMERATE));
CHECK(JS_DefineProperty(cx, obj, "prop", JS::UndefinedHandleValue,
JSPROP_SHARED | JSPROP_PROPOP_ACCESSORS,
JS_PROPERTYOP_GETTER(NativeGet), JS_STUBSETTER));
JS_PROPERTYOP_GETTER(NativeGet), nullptr));
EXEC("'use strict'; \n"
"var error, passed = false; \n"

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

@ -1712,19 +1712,6 @@ JS::GetFirstArgumentAsTypeHint(JSContext* cx, CallArgs args, JSType *result)
return false;
}
JS_PUBLIC_API(bool)
JS_PropertyStub(JSContext* cx, HandleObject obj, HandleId id, MutableHandleValue vp)
{
return true;
}
JS_PUBLIC_API(bool)
JS_StrictPropertyStub(JSContext* cx, HandleObject obj, HandleId id, MutableHandleValue vp,
ObjectOpResult& result)
{
return result.succeed();
}
JS_PUBLIC_API(JSObject*)
JS_InitClass(JSContext* cx, HandleObject obj, HandleObject parent_proto,
const JSClass* clasp, JSNative constructor, unsigned nargs,
@ -2185,23 +2172,11 @@ DefinePropertyById(JSContext* cx, HandleObject obj, HandleId id, HandleValue val
// than JSNatives. However, we might be pulling this property descriptor off
// of something with JSNative property descriptors. If we are, wrap them in
// JS Function objects.
//
// But skip doing this if our accessors are the well-known stub
// accessors, since those are known to be JSGetterOps. Assert
// some sanity about it, though.
MOZ_ASSERT_IF(getter == JS_PropertyStub,
setter == JS_StrictPropertyStub || (attrs & JSPROP_PROPOP_ACCESSORS));
MOZ_ASSERT_IF(setter == JS_StrictPropertyStub,
getter == JS_PropertyStub || (attrs & JSPROP_PROPOP_ACCESSORS));
// If !(attrs & JSPROP_PROPOP_ACCESSORS), then either getter/setter are both
// If !(attrs & JSPROP_PROPOP_ACCESSORS), then getter/setter are both
// possibly-null JSNatives (or possibly-null JSFunction* if JSPROP_GETTER or
// JSPROP_SETTER is appropriately set), or both are the well-known property
// stubs. The subsequent block must handle only the first of these cases,
// so carefully exclude the latter case.
if (!(attrs & JSPROP_PROPOP_ACCESSORS) &&
getter != JS_PropertyStub && setter != JS_StrictPropertyStub)
{
// JSPROP_SETTER is appropriately set).
if (!(attrs & JSPROP_PROPOP_ACCESSORS)) {
if (getter && !(attrs & JSPROP_GETTER)) {
RootedAtom atom(cx, IdToFunctionName(cx, id, FunctionPrefixKind::Get));
if (!atom)
@ -2246,10 +2221,6 @@ DefinePropertyById(JSContext* cx, HandleObject obj, HandleId id, HandleValue val
? JS_FUNC_TO_DATA_PTR(JSObject*, setter)
: nullptr);
if (getter == JS_PropertyStub)
getter = nullptr;
if (setter == JS_StrictPropertyStub)
setter = nullptr;
return DefineProperty(cx, obj, id, value, getter, setter, attrs);
}

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

@ -2104,14 +2104,6 @@ GetFirstArgumentAsTypeHint(JSContext* cx, CallArgs args, JSType *result);
} /* namespace JS */
extern JS_PUBLIC_API(bool)
JS_PropertyStub(JSContext* cx, JS::HandleObject obj, JS::HandleId id,
JS::MutableHandleValue vp);
extern JS_PUBLIC_API(bool)
JS_StrictPropertyStub(JSContext* cx, JS::HandleObject obj, JS::HandleId id,
JS::MutableHandleValue vp, JS::ObjectOpResult& result);
template<typename T>
struct JSConstScalarSpec {
const char* name;
@ -2261,10 +2253,6 @@ inline int CheckIsSetterOp(JSSetterOp op);
(static_cast<void>(sizeof(JS::detail::CheckIsSetterOp(v))), \
reinterpret_cast<JSNative>(v))
#define JS_STUBGETTER JS_PROPERTYOP_GETTER(JS_PropertyStub)
#define JS_STUBSETTER JS_PROPERTYOP_SETTER(JS_StrictPropertyStub)
#define JS_PS_ACCESSOR_SPEC(name, getter, setter, flags, extraFlags) \
{ name, uint8_t(JS_CHECK_ACCESSOR_FLAGS(flags) | extraFlags), \
{ { getter, setter } } }
@ -2905,8 +2893,6 @@ class WrappedPtrOperations<JS::PropertyDescriptor, Wrapper>
MOZ_ASSERT(!hasAll(JSPROP_IGNORE_READONLY | JSPROP_READONLY));
MOZ_ASSERT_IF(has(JSPROP_IGNORE_VALUE), value().isUndefined());
}
MOZ_ASSERT(getter() != JS_PropertyStub);
MOZ_ASSERT(setter() != JS_StrictPropertyStub);
MOZ_ASSERT_IF(has(JSPROP_RESOLVING), !has(JSPROP_IGNORE_ENUMERATE));
MOZ_ASSERT_IF(has(JSPROP_RESOLVING), !has(JSPROP_IGNORE_PERMANENT));
@ -2957,9 +2943,6 @@ class MutableWrappedPtrOperations<JS::PropertyDescriptor, Wrapper>
void initFields(JS::HandleObject obj, JS::HandleValue v, unsigned attrs,
JSGetterOp getterOp, JSSetterOp setterOp) {
MOZ_ASSERT(getterOp != JS_PropertyStub);
MOZ_ASSERT(setterOp != JS_StrictPropertyStub);
object().set(obj);
value().set(v);
setAttributes(attrs);
@ -3020,11 +3003,9 @@ class MutableWrappedPtrOperations<JS::PropertyDescriptor, Wrapper>
void setAttributes(unsigned attrs) { desc().attrs = attrs; }
void setGetter(JSGetterOp op) {
MOZ_ASSERT(op != JS_PropertyStub);
desc().getter = op;
}
void setSetter(JSSetterOp op) {
MOZ_ASSERT(op != JS_StrictPropertyStub);
desc().setter = op;
}
void setGetterObject(JSObject* obj) {

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

@ -232,9 +232,7 @@ DefineHelpProperty(JSContext* cx, HandleObject obj, const char* prop, const char
RootedAtom atom(cx, Atomize(cx, value, strlen(value)));
if (!atom)
return false;
return JS_DefineProperty(cx, obj, prop, atom,
JSPROP_READONLY | JSPROP_PERMANENT,
JS_STUBGETTER, JS_STUBSETTER);
return JS_DefineProperty(cx, obj, prop, atom, JSPROP_READONLY | JSPROP_PERMANENT);
}
JS_FRIEND_API(bool)

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

@ -1440,11 +1440,8 @@ js::InitMathClass(JSContext* cx, HandleObject obj)
if (!Math)
return nullptr;
if (!JS_DefineProperty(cx, obj, js_Math_str, Math, JSPROP_RESOLVING,
JS_STUBGETTER, JS_STUBSETTER))
{
if (!JS_DefineProperty(cx, obj, js_Math_str, Math, JSPROP_RESOLVING))
return nullptr;
}
if (!JS_DefineFunctions(cx, Math, math_static_methods))
return nullptr;
if (!JS_DefineConstDoubles(cx, Math, math_constants))

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

@ -2815,9 +2815,6 @@ js::DefineElement(JSContext* cx, HandleObject obj, uint32_t index, HandleValue v
JSGetterOp getter, JSSetterOp setter, unsigned attrs,
ObjectOpResult& result)
{
MOZ_ASSERT(getter != JS_PropertyStub);
MOZ_ASSERT(setter != JS_StrictPropertyStub);
RootedId id(cx);
if (!IndexToId(cx, index, &id))
return false;
@ -2851,9 +2848,6 @@ bool
js::DefineElement(JSContext* cx, HandleObject obj, uint32_t index, HandleValue value,
JSGetterOp getter, JSSetterOp setter, unsigned attrs)
{
MOZ_ASSERT(getter != JS_PropertyStub);
MOZ_ASSERT(setter != JS_StrictPropertyStub);
RootedId id(cx);
if (!IndexToId(cx, index, &id))
return false;

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

@ -992,11 +992,8 @@ js::InitJSONClass(JSContext* cx, HandleObject obj)
if (!JSON)
return nullptr;
if (!JS_DefineProperty(cx, global, js_JSON_str, JSON, JSPROP_RESOLVING,
JS_STUBGETTER, JS_STUBSETTER))
{
if (!JS_DefineProperty(cx, global, js_JSON_str, JSON, JSPROP_RESOLVING))
return nullptr;
}
if (!JS_DefineFunctions(cx, JSON, json_static_methods))
return nullptr;

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

@ -7,6 +7,7 @@ set -e
: ${MKDIR:=mkdir}
: ${TAR:=tar}
: ${AUTOCONF:=autoconf-2.13}
: ${SRCDIR:=$(cd $(dirname $0); pwd 2>/dev/null)}
: ${MOZJS_NAME:=mozjs}
# The place to gather files to be added to the tarball.
@ -34,6 +35,7 @@ echo "Environment:"
echo " MAKE = $MAKE"
echo " MKDIR = $MKDIR"
echo " TAR = $TAR"
echo " AUTOCONF = $AUTOCONF"
echo " STAGING = $STAGING"
echo " DIST = $DIST"
echo " SRCDIR = $SRCDIR"
@ -98,6 +100,12 @@ case $cmd in
${MKDIR} -p ${tgtpath}/.cargo
cp -pPR ${TOPSRCDIR}/.cargo/config.in ${tgtpath}/.cargo
# generate configure files to avoid build dependency on autoconf-2.13
cp -pPR ${TOPSRCDIR}/js/src/configure.in ${tgtpath}/js/src/configure
chmod a+x ${tgtpath}/js/src/configure
${AUTOCONF} --localdir=${TOPSRCDIR}/js/src \
${TOPSRCDIR}/js/src/old-configure.in >${tgtpath}/js/src/old-configure
# put in js itself
cp -pPR ${TOPSRCDIR}/mfbt ${tgtpath}
cp -p ${SRCDIR}/../moz.configure ${tgtpath}/js

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

@ -261,8 +261,7 @@ RegisterPerfMeasurement(JSContext* cx, HandleObject globalArg)
return 0;
for (const pm_const* c = pm_consts; c->name; c++) {
if (!JS_DefineProperty(cx, ctor, c->name, c->value, PM_CATTRS,
JS_STUBGETTER, JS_STUBSETTER))
if (!JS_DefineProperty(cx, ctor, c->name, c->value, PM_CATTRS))
return 0;
}

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

@ -195,9 +195,7 @@ js::SetPropertyIgnoringNamedGetter(JSContext* cx, HandleObject obj, HandleId id,
RootedObject receiverObj(cx, &receiver.toObject());
// Nonstandard SpiderMonkey special case: setter ops.
SetterOp setter = ownDesc.setter();
MOZ_ASSERT(setter != JS_StrictPropertyStub);
if (setter && setter != JS_StrictPropertyStub) {
if (SetterOp setter = ownDesc.setter()) {
RootedValue valCopy(cx, v);
return CallJSSetterOp(cx, setter, receiverObj, id, &valCopy, result);
}

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

@ -831,7 +831,7 @@ js::InitProxyClass(JSContext* cx, HandleObject obj)
if (!JS_DefineFunctions(cx, ctor, static_methods))
return nullptr;
if (!JS_DefineProperty(cx, obj, "Proxy", ctor, JSPROP_RESOLVING, JS_STUBGETTER, JS_STUBSETTER))
if (!JS_DefineProperty(cx, obj, "Proxy", ctor, JSPROP_RESOLVING))
return nullptr;
global->setConstructor(JSProto_Proxy, ObjectValue(*ctor));

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

@ -1233,7 +1233,8 @@ bool
GlobalHelperThreadState::canStartWasmTier2Generator(const AutoLockHelperThreadState& lock)
{
return !wasmTier2GeneratorWorklist(lock).empty() &&
checkTaskThreadLimit<wasm::Tier2GeneratorTask*>(maxWasmTier2GeneratorThreads());
checkTaskThreadLimit<wasm::Tier2GeneratorTask*>(maxWasmTier2GeneratorThreads(),
/*isMaster=*/true);
}
bool

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

@ -396,8 +396,6 @@ NativeObject::addProperty(JSContext* cx, HandleNativeObject obj, HandleId id,
unsigned flags, bool allowDictionary)
{
MOZ_ASSERT(!JSID_IS_VOID(id));
MOZ_ASSERT(getter != JS_PropertyStub);
MOZ_ASSERT(setter != JS_StrictPropertyStub);
MOZ_ASSERT(obj->uninlinedNonProxyIsExtensible());
MOZ_ASSERT(!obj->containsPure(id));

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

@ -457,8 +457,6 @@ NativeObject::addPropertyInternal(JSContext* cx,
bool allowDictionary, const AutoKeepShapeTables& keep)
{
MOZ_ASSERT_IF(!allowDictionary, !obj->inDictionaryMode());
MOZ_ASSERT(getter != JS_PropertyStub);
MOZ_ASSERT(setter != JS_StrictPropertyStub);
AutoRooterGetterSetter gsRoot(cx, attrs, &getter, &setter);
@ -606,8 +604,6 @@ NativeObject::putProperty(JSContext* cx, HandleNativeObject obj, HandleId id,
unsigned flags)
{
MOZ_ASSERT(!JSID_IS_VOID(id));
MOZ_ASSERT(getter != JS_PropertyStub);
MOZ_ASSERT(setter != JS_StrictPropertyStub);
#ifdef DEBUG
if (obj->is<ArrayObject>()) {
@ -792,8 +788,6 @@ NativeObject::changeProperty(JSContext* cx, HandleNativeObject obj, HandleShape
unsigned attrs, GetterOp getter, SetterOp setter)
{
MOZ_ASSERT(obj->containsPure(shape));
MOZ_ASSERT(getter != JS_PropertyStub);
MOZ_ASSERT(setter != JS_StrictPropertyStub);
MOZ_ASSERT_IF(attrs & (JSPROP_GETTER | JSPROP_SETTER), attrs & JSPROP_SHARED);
/* Allow only shared (slotless) => unshared (slotful) transition. */

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

@ -656,6 +656,7 @@ class BaseCompiler
FuncOffsets finish();
MOZ_MUST_USE bool emitFunction();
void emitInitStackLocals();
// Used by some of the ScratchRegister implementations.
operator MacroAssembler&() const { return masm; }
@ -2260,26 +2261,8 @@ class BaseCompiler
}
}
// Initialize the stack locals to zero.
//
// The following are all Bug 1316820:
//
// TODO / OPTIMIZE: on x64, at least, scratch will be a 64-bit
// register and we can move 64 bits at a time.
//
// TODO / OPTIMIZE: On SSE2 or better SIMD systems we may be
// able to store 128 bits at a time. (I suppose on some
// systems we have 512-bit SIMD for that matter.)
//
// TODO / OPTIMIZE: if we have only one initializing store
// then it's better to store a zero literal, probably.
if (varLow_ < varHigh_) {
ScratchI32 scratch(*this);
masm.mov(ImmWord(0), scratch);
for (int32_t i = varLow_ ; i < varHigh_ ; i += 4)
storeToFrameI32(scratch, i + 4);
}
if (varLow_ < varHigh_)
emitInitStackLocals();
if (debugEnabled_)
insertBreakablePoint(CallSiteDesc::EnterFrame);
@ -7497,6 +7480,107 @@ BaseCompiler::emitFunction()
return true;
}
void
BaseCompiler::emitInitStackLocals()
{
MOZ_ASSERT(varLow_ < varHigh_, "there should be stack locals to initialize");
static const uint32_t wordSize = sizeof(void*);
// A local's localOffset always points above it in the frame, so that when
// translated to a stack address we end up with an address pointing to the
// base of the local. Thus to go from a raw frame offset to an SP offset we
// first add K to the frame offset to obtain a localOffset for a slot of
// size K, and then map that to an SP offset. Hence all the adjustments to
// `low` in the offset calculations below.
// On 64-bit systems we may have 32-bit alignment for the local area as it
// may be preceded by parameters and prologue/debug data.
uint32_t low = varLow_;
if (low % wordSize) {
masm.store32(Imm32(0), Address(StackPointer, localOffsetToSPOffset(low + 4)));
low += 4;
}
MOZ_ASSERT(low % wordSize == 0);
const uint32_t high = AlignBytes(varHigh_, wordSize);
MOZ_ASSERT(high <= uint32_t(localSize_), "localSize_ should be aligned at least that");
// An unrollLimit of 16 is chosen so that we only need an 8-bit signed
// immediate to represent the offset in the store instructions in the loop
// on x64.
const uint32_t unrollLimit = 16;
const uint32_t initWords = (high - low) / wordSize;
const uint32_t tailWords = initWords % unrollLimit;
const uint32_t loopHigh = high - (tailWords * wordSize);
// With only one word to initialize, just store an immediate zero.
if (initWords == 1) {
masm.storePtr(ImmWord(0), Address(StackPointer, localOffsetToSPOffset(low + wordSize)));
return;
}
// For other cases, it's best to have a zero in a register.
//
// One can do more here with SIMD registers (store 16 bytes at a time) or
// with instructions like STRD on ARM (store 8 bytes at a time), but that's
// for another day.
RegI32 zero = needI32();
masm.mov(ImmWord(0), zero);
// For the general case we want to have a loop body of unrollLimit stores
// and then a tail of less than unrollLimit stores. When initWords is less
// than 2*unrollLimit the loop trip count is at most 1 and there is no
// benefit to having the pointer calculations and the compare-and-branch.
// So we completely unroll when we have initWords < 2 * unrollLimit. (In
// this case we'll end up using 32-bit offsets on x64 for up to half of the
// stores, though.)
// Fully-unrolled case.
if (initWords < 2 * unrollLimit) {
for (uint32_t i = low; i < high; i += wordSize)
masm.storePtr(zero, Address(StackPointer, localOffsetToSPOffset(i + wordSize)));
freeGPR(zero);
return;
}
// Unrolled loop with a tail. Stores will use negative offsets. That's OK
// for x86 and ARM, at least.
// Compute pointer to the highest-addressed slot on the frame.
RegI32 p = needI32();
masm.computeEffectiveAddress(Address(StackPointer, localOffsetToSPOffset(low + wordSize)),
p);
// Compute pointer to the lowest-addressed slot on the frame that will be
// initialized by the loop body.
RegI32 lim = needI32();
masm.computeEffectiveAddress(Address(StackPointer,
localOffsetToSPOffset(loopHigh + wordSize)),
lim);
// The loop body. Eventually we'll have p == lim and exit the loop.
Label again;
masm.bind(&again);
for (uint32_t i = 0; i < unrollLimit; ++i)
masm.storePtr(zero, Address(p, -(wordSize * i)));
masm.subPtr(Imm32(unrollLimit * wordSize), p);
masm.branchPtr(Assembler::LessThan, lim, p, &again);
// The tail.
for (uint32_t i = 0; i < tailWords; ++i)
masm.storePtr(zero, Address(p, -(wordSize * i)));
freeGPR(p);
freeGPR(lim);
freeGPR(zero);
}
BaseCompiler::BaseCompiler(const ModuleEnvironment& env,
Decoder& decoder,
const FuncBytes& func,

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

@ -433,8 +433,7 @@ ExportFunction(JSContext* cx, HandleValue vfunction, HandleValue vscope, HandleV
// the target.
if (!JSID_IS_VOID(options.defineAs)) {
if (!JS_DefinePropertyById(cx, targetScope, id, rval,
JSPROP_ENUMERATE,
JS_STUBGETTER, JS_STUBSETTER)) {
JSPROP_ENUMERATE)) {
return false;
}
}
@ -480,8 +479,7 @@ CreateObjectIn(JSContext* cx, HandleValue vobj, CreateObjectInOptions& options,
if (define) {
if (!JS_DefinePropertyById(cx, scope, options.defineAs, obj,
JSPROP_ENUMERATE,
JS_STUBGETTER, JS_STUBSETTER))
JSPROP_ENUMERATE))
return false;
}
}

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

@ -936,3 +936,7 @@ pref("javascript.options.native_regexp", false);
// Ask for permission when enumerating WebRTC devices.
pref("media.navigator.permission.device", true);
#ifdef NIGHTLY_BUILD
pref("media.videocontrols.lock-video-orientation", true);
#endif

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

@ -1942,9 +1942,6 @@ History::~History()
UnregisterWeakMemoryReporter(this);
gService = nullptr;
NS_ASSERTION(mObservers.Count() == 0,
"Not all Links were removed before we disappear!");
}
void
@ -2416,8 +2413,9 @@ History::GetService()
}
nsCOMPtr<IHistory> service(do_GetService(NS_IHISTORY_CONTRACTID));
MOZ_ASSERT(service, "Cannot obtain IHistory service!");
NS_ASSERTION(gService, "Our constructor was not run?!");
if (service) {
NS_ASSERTION(gService, "Our constructor was not run?!");
}
return gService;
}

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

@ -32,6 +32,7 @@ if CONFIG['MOZ_PLACES']:
EXPORTS.mozilla.places = [
'Database.h',
'History.h',
'Shutdown.h',
]
UNIFIED_SOURCES += [

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

@ -1234,12 +1234,38 @@
},
onFullscreenChange() {
this.updateOrientationState(this.isVideoInFullScreen());
if (this.isVideoInFullScreen()) {
Utils._hideControlsTimeout = setTimeout(this._hideControlsFn, this.HIDE_CONTROLS_TIMEOUT_MS);
}
this.setFullscreenButtonState();
},
updateOrientationState(lock) {
if (!this.video.mozOrientationLockEnabled) {
return;
}
if (lock) {
if (this.video.mozIsOrientationLocked) {
return;
}
let dimenDiff = this.video.videoWidth - this.video.videoHeight;
if (dimenDiff > 0) {
this.video.mozIsOrientationLocked = window.screen.mozLockOrientation("landscape");
} else if (dimenDiff < 0) {
this.video.mozIsOrientationLocked = window.screen.mozLockOrientation("portrait");
} else {
this.video.mozIsOrientationLocked = window.screen.mozLockOrientation(window.screen.orientation);
}
} else {
if (!this.video.mozIsOrientationLocked) {
return;
}
window.screen.mozUnlockOrientation();
this.video.mozIsOrientationLocked = false;
}
},
clickToPlayClickHandler(e) {
if (e.button != 0) {
return;
@ -1836,6 +1862,7 @@
<destructor>
<![CDATA[
this.Utils.terminateEventListeners();
this.Utils.updateOrientationState(false);
// randomID used to be a <field>, which meant that the XBL machinery
// undefined the property when the element was unbound. The code in
// this file actually depends on this, so now that randomID is an