Merge m-c to inbound.

This commit is contained in:
Ryan VanderMeulen 2013-11-21 14:41:01 -05:00
commit c51d51d6d4
160 changed files with 1569 additions and 1056 deletions

View File

@ -18,4 +18,4 @@
# Modifying this file will now automatically clobber the buildbot machines \o/
#
Bug 934646 backout needs a clobber
More Windows WebIDL changes.

View File

@ -107,8 +107,6 @@ function test() {
aWindow.gBrowser.contentWindow);
});
});
aWindow.gBrowser.selectedBrowser.loadURI(testURI);
}
function testOnWindow(aOptions, aCallback) {

View File

@ -2,8 +2,6 @@
# 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/.
MODULE_NAME = nsBrowserCompsModule
ifeq ($(OS_ARCH),WINNT)
OS_LIBS += $(call EXPAND_LIBNAME,ole32 shell32 shlwapi)
endif

View File

@ -35,6 +35,10 @@ registerCleanupFunction(function() {
// Properly shut down the server to avoid memory leaks.
DebuggerServer.destroy();
// Debugger tests use a lot of memory, so force a GC to help fragmentation.
info("Forcing GC after debugger test.");
Cu.forceGC();
});
// Import the GCLI test helper

View File

@ -44,4 +44,8 @@ function test() {
aDebuggee.performRequests(1, CONTENT_TYPE_SJS + "?fmt=html-long");
});
// This test uses a lot of memory, so force a GC to help fragmentation.
info("Forcing GC after netmonitor test.");
Cu.forceGC();
}

View File

@ -29,6 +29,11 @@ registerCleanupFunction(function () {
Services.prefs.clearUserPref(REMOTE_ENABLED);
Services.prefs.clearUserPref(SHOW_PLATFORM_DATA);
DebuggerServer.destroy();
// These tests use a lot of memory due to GL contexts, so force a GC to help
// fragmentation.
info("Forcing GC after profiler test.");
Cu.forceGC();
});
function getProfileInternals(uid) {

View File

@ -38,6 +38,11 @@ registerCleanupFunction(() => {
info("finish() was called, cleaning up...");
Services.prefs.setBoolPref("devtools.debugger.log", gEnableLogging);
Services.prefs.setBoolPref("devtools.shadereditor.enabled", gToolEnabled);
// These tests use a lot of memory due to GL contexts, so force a GC to help
// fragmentation.
info("Forcing GC after shadereditor test.");
Cu.forceGC();
});
function addTab(aUrl, aWindow) {

View File

@ -0,0 +1,21 @@
# Bug 931149
race:DoImageDataComplete
# Bug 939786
race:_pt_root
# Bug 939788
# Tracked by http://code.google.com/p/thread-sanitizer/issues/detail?id=40
race:ELMCreationDetector
# Bug 939790
race:xpcom/components/nsComponentManager.h
# Bug 939807
race:ComputeUTCTime
# Bug 939805
race:g_variant_type_info_get
# Bug 844759
race:js::gc::ArenaLists::allocateFromArenaInline

View File

@ -768,7 +768,7 @@ void undo_file(const char *name, bool backup = false)
ElfSegment *second = elf.getSegmentByType(PT_LOAD, first);
ElfSegment *filler = nullptr;
// If the second PT_LOAD is a filler from elfhack --fill, check the third.
if (!second->isElfHackFillerSegment()) {
if (second->isElfHackFillerSegment()) {
filler = second;
second = elf.getSegmentByType(PT_LOAD, filler);
}

View File

@ -4,7 +4,7 @@
# 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/.
SOURCES += [
UNIFIED_SOURCES += [
'DomainPolicy.cpp',
'nsJSPrincipals.cpp',
'nsNullPrincipal.cpp',

View File

@ -345,9 +345,6 @@ ifdef LIBXUL_LIBRARY
ifdef IS_COMPONENT
$(error IS_COMPONENT is set, but is not compatible with LIBXUL_LIBRARY)
endif
ifdef MODULE_NAME
$(error MODULE_NAME is $(MODULE_NAME) but MODULE_NAME and LIBXUL_LIBRARY are not compatible)
endif
FORCE_STATIC_LIB=1
endif

View File

@ -456,20 +456,6 @@ ifdef IS_COMPONENT
EXTRA_DSO_LDOPTS += $(MOZ_COMPONENTS_VERSION_SCRIPT_LDFLAGS)
endif # IS_COMPONENT
#
# Enforce the requirement that MODULE_NAME must be set
# for components in static builds
#
ifdef IS_COMPONENT
ifdef EXPORT_LIBRARY
ifndef FORCE_SHARED_LIB
ifndef MODULE_NAME
$(error MODULE_NAME is required for components which may be used in static builds)
endif
endif
endif
endif
#
# MacOS X specific stuff
#

View File

@ -808,7 +808,6 @@ dnl ========================================================
dnl = Mac OS X SDK support
dnl ========================================================
MACOS_SDK_DIR=
NEXT_ROOT=
MOZ_ARG_WITH_STRING(macos-sdk,
[ --with-macos-sdk=dir Location of platform SDK to use (Mac OS X only)],
MACOS_SDK_DIR=$withval)
@ -830,10 +829,8 @@ if test -z "${MACOS_PRIVATE_FRAMEWORKS_DEFAULTED}"; then
fi
dnl MACOS_SDK_DIR will be set to the SDK location whenever one is in use.
dnl NEXT_ROOT will be set and exported only if it's needed.
AC_SUBST(MACOS_SDK_DIR)
AC_SUBST(MACOS_PRIVATE_FRAMEWORKS_DIR)
AC_SUBST(NEXT_ROOT)
if test "$MACOS_SDK_DIR"; then
dnl Sync this section with the ones in NSPR and NSS.
@ -6798,9 +6795,11 @@ MOZ_ARG_ENABLE_BOOL(dmd,
MOZ_DMD=1,
MOZ_DMD= )
if test "$NS_TRACE_MALLOC"; then # trace-malloc disables DMD
MOZ_DMD=
dnl The two options are conflicting. Fails the configure to alert the user.
if test "$NS_TRACE_MALLOC" -a "$MOZ_DMD"; then
AC_MSG_ERROR([--enable-trace-malloc and --enable-dmd are conflicting options])
fi
if test "$MOZ_DMD"; then
USE_ELF_DYNSTR_GC=
AC_DEFINE(MOZ_DMD)
@ -6863,6 +6862,11 @@ MOZ_ARG_ENABLE_BOOL(replace-malloc,
MOZ_REPLACE_MALLOC=1,
MOZ_REPLACE_MALLOC= )
dnl The two options are conflicting. Fails the configure to alert the user.
if test "$NS_TRACE_MALLOC" -a "$MOZ_REPLACE_MALLOC"; then
AC_MSG_ERROR([--enable-trace-malloc and --enable-replace-malloc are conflicting options])
fi
if test -n "$MOZ_REPLACE_MALLOC" -a -z "$MOZ_MEMORY"; then
dnl We don't want to enable jemalloc unconditionally because it may be a
dnl deliberate choice not to enable it (bug 702250, for instance)

View File

@ -1082,13 +1082,6 @@ CanvasRenderingContext2D::GetInputStream(const char *aMimeType,
const PRUnichar *aEncoderOptions,
nsIInputStream **aStream)
{
nsAutoArrayPtr<uint8_t> imageBuffer;
int32_t format = 0;
GetImageBuffer(getter_Transfers(imageBuffer), &format);
if (!imageBuffer) {
return NS_ERROR_FAILURE;
}
nsCString enccid("@mozilla.org/image/encoder;2?type=");
enccid += aMimeType;
nsCOMPtr<imgIEncoder> encoder = do_CreateInstance(enccid.get());
@ -1096,6 +1089,13 @@ CanvasRenderingContext2D::GetInputStream(const char *aMimeType,
return NS_ERROR_FAILURE;
}
nsAutoArrayPtr<uint8_t> imageBuffer;
int32_t format = 0;
GetImageBuffer(getter_Transfers(imageBuffer), &format);
if (!imageBuffer) {
return NS_ERROR_FAILURE;
}
return ImageEncoder::GetInputStream(mWidth, mHeight, imageBuffer, format,
encoder, aEncoderOptions, aStream);
}

View File

@ -794,13 +794,6 @@ WebGLContext::GetInputStream(const char* aMimeType,
if (!gl)
return NS_ERROR_FAILURE;
nsAutoArrayPtr<uint8_t> imageBuffer;
int32_t format = 0;
GetImageBuffer(getter_Transfers(imageBuffer), &format);
if (!imageBuffer) {
return NS_ERROR_FAILURE;
}
nsCString enccid("@mozilla.org/image/encoder;2?type=");
enccid += aMimeType;
nsCOMPtr<imgIEncoder> encoder = do_CreateInstance(enccid.get());
@ -808,6 +801,13 @@ WebGLContext::GetInputStream(const char* aMimeType,
return NS_ERROR_FAILURE;
}
nsAutoArrayPtr<uint8_t> imageBuffer;
int32_t format = 0;
GetImageBuffer(getter_Transfers(imageBuffer), &format);
if (!imageBuffer) {
return NS_ERROR_FAILURE;
}
return ImageEncoder::GetInputStream(mWidth, mHeight, imageBuffer, format,
encoder, aEncoderOptions, aStream);
}

View File

@ -156,7 +156,7 @@ nsDOMMessageEvent::Constructor(const mozilla::dom::GlobalObject& aGlobal,
if (!event->mWindowSource) {
MessagePortBase* port = nullptr;
nsresult rv = UNWRAP_OBJECT(MessagePort, aCx, aParam.mSource, port);
nsresult rv = UNWRAP_OBJECT(MessagePort, aParam.mSource, port);
if (NS_FAILED(rv)) {
aRv.Throw(NS_ERROR_INVALID_ARG);
return nullptr;

View File

@ -3236,6 +3236,14 @@ HTMLInputElement::StartRangeThumbDrag(WidgetGUIEvent* aEvent)
nsIPresShell::SetCapturingContent(this, CAPTURE_IGNOREALLOWED |
CAPTURE_RETARGETTOELEMENT);
nsRangeFrame* rangeFrame = do_QueryFrame(GetPrimaryFrame());
// Before we change the value, record the current value so that we'll
// correctly send a 'change' event if appropriate. We need to do this here
// because the 'focus' event is handled after the 'mousedown' event that
// we're being called for (i.e. too late to update mFocusedValue, since we'll
// have changed it by then).
GetValueInternal(mFocusedValue);
SetValueOfRangeForUserEvent(rangeFrame->GetValueAtEventPoint(aEvent));
}
@ -3383,7 +3391,8 @@ HTMLInputElement::PostHandleEvent(nsEventChainPostVisitor& aVisitor)
if (aVisitor.mEvent->message == NS_FOCUS_CONTENT ||
aVisitor.mEvent->message == NS_BLUR_CONTENT) {
if (aVisitor.mEvent->message == NS_FOCUS_CONTENT &&
MayFireChangeOnBlur()) {
MayFireChangeOnBlur() &&
!mIsDraggingRange) { // StartRangeThumbDrag already set mFocusedValue
GetValueInternal(mFocusedValue);
}

View File

@ -185,6 +185,10 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=722599
is(rangeChange, 1, "Change event shouldn't be dispatched on range input element during drag of thumb");
synthesizeMouse(range, centerOfRangeX, centerOfRangeY, { type: "mouseup" });
is(rangeChange, 2, "Change event should be dispatched on range input element at end of drag");
range.blur();
is(rangeChange, 2, "Change event shouldn't be dispatched on range input element when range loses focus after a drag");
synthesizeMouse(range, centerOfRangeX - 10, centerOfRangeY, {});
is(rangeChange, 3, "Change event should be dispatched on range input element for a click that gives the range focus");
//Input type change test.
input = document.getElementById("input_checkbox");

View File

@ -35,7 +35,8 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=702949
var i = document.getElementsByTagName('input')[0];
var file = FileUtils.getFile("TmpD", ["testfile"]);
var file = FileUtils.getDir("TmpD", [], false);
file.append("testfile");
file.createUnique(SpecialPowers.Ci.nsIFile.NORMAL_FILE_TYPE, 0644);
SpecialPowers.wrap(i).value = file.path;

View File

@ -162,7 +162,7 @@ WebVTTListener::OnCue(const JS::Value &aCue, JSContext* aCx)
}
TextTrackCue* cue;
nsresult rv = UNWRAP_OBJECT(VTTCue, aCx, &aCue.toObject(), cue);
nsresult rv = UNWRAP_OBJECT(VTTCue, &aCue.toObject(), cue);
NS_ENSURE_SUCCESS(rv, rv);
cue->SetTrackElement(mElement);
@ -180,8 +180,7 @@ WebVTTListener::OnRegion(const JS::Value &aRegion, JSContext* aCx)
}
TextTrackRegion* region;
nsresult rv = UNWRAP_OBJECT(VTTRegion, aCx, &aRegion.toObject(),
region);
nsresult rv = UNWRAP_OBJECT(VTTRegion, &aRegion.toObject(), region);
NS_ENSURE_SUCCESS(rv, rv);
mElement->mTrack->AddRegion(*region);

View File

@ -105,6 +105,10 @@ this.ActivitiesServiceFilter = {
continue;
}
if (Array.isArray(aValues[prop]) && aValues[prop].length == 0) {
continue;
}
// Otherwise, let's check the value against the filter.
if (!matchObject(aValues[prop], filtersMap[prop].filter)) {
return false;

View File

@ -150,4 +150,8 @@ function run_test() {
{a: { required: true, pattern: 'foobar'}}));
do_check_true(ActivitiesServiceFilter.match({a: 'FoOBaR'},
{a: { required: true, pattern: 'foobar', patternFlags: 'i'}}));
// Bug 923274
do_check_true(ActivitiesServiceFilter.match({a:[]}, {a:'a'}));
do_check_false(ActivitiesServiceFilter.match({a:[]}, {a: { required: true, value: 'a'}}));
}

View File

@ -191,7 +191,7 @@ PostMessageWriteStructuredClone(JSContext* cx,
}
MessagePortBase* port = nullptr;
nsresult rv = UNWRAP_OBJECT(MessagePort, cx, obj, port);
nsresult rv = UNWRAP_OBJECT(MessagePort, obj, port);
if (NS_SUCCEEDED(rv)) {
nsRefPtr<MessagePortBase> newPort = port->Clone();

View File

@ -4003,7 +4003,7 @@ nsHTMLDocumentSH::GetDocumentAllNodeList(JSContext *cx,
// We already have a node list in our reserved slot, use it.
JS::Rooted<JSObject*> obj(cx, JSVAL_TO_OBJECT(collection));
nsIHTMLCollection* htmlCollection;
rv = UNWRAP_OBJECT(HTMLCollection, cx, obj, htmlCollection);
rv = UNWRAP_OBJECT(HTMLCollection, obj, htmlCollection);
if (NS_SUCCEEDED(rv)) {
NS_ADDREF(*nodeList = static_cast<nsContentList*>(htmlCollection));
}

View File

@ -7572,7 +7572,7 @@ PostMessageWriteStructuredClone(JSContext* cx,
if (MessageChannel::PrefEnabled()) {
MessagePortBase* port = nullptr;
nsresult rv = UNWRAP_OBJECT(MessagePort, cx, obj, port);
nsresult rv = UNWRAP_OBJECT(MessagePort, obj, port);
if (NS_SUCCEEDED(rv) && scInfo->subsumes) {
nsRefPtr<MessagePortBase> newPort = port->Clone();

View File

@ -2805,7 +2805,7 @@ NS_DOMWriteStructuredClone(JSContext* cx,
void *closure)
{
ImageData* imageData;
nsresult rv = UNWRAP_OBJECT(ImageData, cx, obj, imageData);
nsresult rv = UNWRAP_OBJECT(ImageData, obj, imageData);
if (NS_FAILED(rv)) {
// Don't know what this is. Bail.
xpc::Throw(cx, NS_ERROR_DOM_DATA_CLONE_ERR);

View File

@ -199,8 +199,7 @@ ErrorResult::ReportJSExceptionFromJSImplementation(JSContext* aCx)
"Why didn't you tell us you planned to handle JS exceptions?");
dom::DOMError* domError;
nsresult rv = UNWRAP_OBJECT(DOMError, aCx, &mJSException.toObject(),
domError);
nsresult rv = UNWRAP_OBJECT(DOMError, &mJSException.toObject(), domError);
if (NS_FAILED(rv)) {
// Unwrapping really shouldn't fail here, if mExceptionHandling is set to
// eRethrowContentExceptions then the CallSetup destructor only stores an
@ -1790,13 +1789,13 @@ ReparentWrapper(JSContext* aCx, JS::Handle<JSObject*> aObjArg)
}
nsObjectLoadingContent* htmlobject;
nsresult rv = UNWRAP_OBJECT(HTMLObjectElement, aCx, aObj, htmlobject);
nsresult rv = UNWRAP_OBJECT(HTMLObjectElement, aObj, htmlobject);
if (NS_FAILED(rv)) {
rv = UnwrapObject<prototypes::id::HTMLEmbedElement,
HTMLSharedObjectElement>(aCx, aObj, htmlobject);
HTMLSharedObjectElement>(aObj, htmlobject);
if (NS_FAILED(rv)) {
rv = UnwrapObject<prototypes::id::HTMLAppletElement,
HTMLSharedObjectElement>(aCx, aObj, htmlobject);
HTMLSharedObjectElement>(aObj, htmlobject);
if (NS_FAILED(rv)) {
htmlobject = nullptr;
}

View File

@ -193,9 +193,9 @@ IsDOMObject(JSObject* obj)
return IsDOMClass(clasp) || IsDOMProxy(obj, clasp);
}
#define UNWRAP_OBJECT(Interface, cx, obj, value) \
#define UNWRAP_OBJECT(Interface, obj, value) \
mozilla::dom::UnwrapObject<mozilla::dom::prototypes::id::Interface, \
mozilla::dom::Interface##Binding::NativeType>(cx, obj, value)
mozilla::dom::Interface##Binding::NativeType>(obj, value)
// Some callers don't want to set an exception when unwrapping fails
// (for example, overload resolution uses unwrapping to tell what sort
@ -203,7 +203,7 @@ IsDOMObject(JSObject* obj)
// U must be something that a T* can be assigned to (e.g. T* or an nsRefPtr<T>).
template <prototypes::ID PrototypeID, class T, typename U>
MOZ_ALWAYS_INLINE nsresult
UnwrapObject(JSContext* cx, JSObject* obj, U& value)
UnwrapObject(JSObject* obj, U& value)
{
/* First check to see whether we have a DOM object */
const DOMClass* domClass = GetDOMClass(obj);

View File

@ -157,7 +157,7 @@ CallbackObject::CallSetup::ShouldRethrowException(JS::Handle<JS::Value> aExcepti
}
DOMError* domError;
return NS_SUCCEEDED(UNWRAP_OBJECT(DOMError, mCx, obj, domError));
return NS_SUCCEEDED(UNWRAP_OBJECT(DOMError, obj, domError));
}
CallbackObject::CallSetup::~CallSetup()

View File

@ -2536,7 +2536,7 @@ class CastableObjectUnwrapper():
codeOnFailure = self.substitution["codeOnFailure"] % {'securityError': 'rv == NS_ERROR_XPC_SECURITY_MANAGER_VETO'}
return string.Template(
"""{
nsresult rv = UnwrapObject<${protoID}, ${type}>(cx, ${source}, ${target});
nsresult rv = UnwrapObject<${protoID}, ${type}>(${source}, ${target});
if (NS_FAILED(rv)) {
${codeOnFailure}
}

View File

@ -39,6 +39,7 @@ public:
FMRadioRequest(nsPIDOMWindow* aWindow, FMRadio* aFMRadio)
: DOMRequest(aWindow)
, mType(FMRadioRequestArgs::T__None)
{
// |FMRadio| inherits from |nsIDOMEventTarget| and |nsISupportsWeakReference|
// which both inherits from nsISupports, so |nsISupports| is an ambiguous
@ -46,6 +47,18 @@ public:
mFMRadio = do_GetWeakReference(static_cast<nsIDOMEventTarget*>(aFMRadio));
}
FMRadioRequest(nsPIDOMWindow* aWindow, FMRadio* aFMRadio,
FMRadioRequestArgs::Type aType)
: DOMRequest(aWindow)
{
MOZ_ASSERT(aType >= FMRadioRequestArgs::T__None &&
aType <= FMRadioRequestArgs::T__Last,
"Wrong FMRadioRequestArgs in FMRadioRequest");
mFMRadio = do_GetWeakReference(static_cast<nsIDOMEventTarget*>(aFMRadio));
mType = aType;
}
~FMRadioRequest() { }
NS_IMETHODIMP
@ -70,6 +83,10 @@ public:
FireError(mResponseType.get_ErrorResponse().error());
break;
case FMRadioResponseType::TSuccessResponse:
if (mType == FMRadioRequestArgs::TEnableRequestArgs) {
fmRadio->EnableAudioChannelAgent();
}
FireSuccess(JS::UndefinedHandleValue);
break;
default:
@ -80,6 +97,7 @@ public:
}
private:
FMRadioRequestArgs::Type mType;
nsWeakPtr mFMRadio;
};
@ -87,6 +105,7 @@ NS_IMPL_ISUPPORTS_INHERITED0(FMRadioRequest, DOMRequest)
FMRadio::FMRadio()
: mHeadphoneState(SWITCH_STATE_OFF)
, mAudioChannelAgentEnabled(false)
, mHasInternalAntenna(false)
, mIsShutdown(false)
{
@ -121,20 +140,29 @@ FMRadio::Init(nsPIDOMWindow *aWindow)
/* useCapture = */ true,
/* wantsUntrusted = */ false);
mAudioChannelAgent = do_CreateInstance("@mozilla.org/audiochannelagent;1");
if (!mAudioChannelAgent) {
return;
}
mAudioChannelAgent->InitWithWeakCallback(nsIAudioChannelAgent::AUDIO_AGENT_CHANNEL_CONTENT,
this);
// All of the codes below are for AudioChannel. We can directly return here
// if preferences doesn't enable AudioChannelService.
NS_ENSURE_TRUE_VOID(Preferences::GetBool("media.useAudioChannelService"));
nsCOMPtr<nsIAudioChannelAgent> audioChannelAgent =
do_CreateInstance("@mozilla.org/audiochannelagent;1");
NS_ENSURE_TRUE_VOID(audioChannelAgent);
audioChannelAgent->InitWithWeakCallback(
nsIAudioChannelAgent::AUDIO_AGENT_CHANNEL_CONTENT,
this);
nsCOMPtr<nsIDocShell> docshell = do_GetInterface(GetOwner());
if (docshell) {
bool isActive = false;
docshell->GetIsActive(&isActive);
mAudioChannelAgent->SetVisibilityState(isActive);
}
NS_ENSURE_TRUE_VOID(docshell);
bool isActive = false;
docshell->GetIsActive(&isActive);
audioChannelAgent->SetVisibilityState(isActive);
// Once all necessary resources are got successfully, we just enabled
// mAudioChannelAgent.
mAudioChannelAgent = audioChannelAgent;
}
void
@ -181,13 +209,12 @@ FMRadio::Notify(const FMRadioEventType& aType)
break;
case EnabledChanged:
if (Enabled()) {
int32_t playingState = 0;
mAudioChannelAgent->StartPlaying(&playingState);
SetCanPlay(playingState == AudioChannelState::AUDIO_CHANNEL_STATE_NORMAL);
DispatchTrustedEvent(NS_LITERAL_STRING("enabled"));
} else {
mAudioChannelAgent->StopPlaying();
if (mAudioChannelAgentEnabled) {
mAudioChannelAgent->StopPlaying();
mAudioChannelAgentEnabled = false;
}
DispatchTrustedEvent(NS_LITERAL_STRING("disabled"));
}
@ -244,7 +271,8 @@ FMRadio::Enable(double aFrequency)
return nullptr;
}
nsRefPtr<FMRadioRequest> r = new FMRadioRequest(win, this);
nsRefPtr<FMRadioRequest> r =
new FMRadioRequest(win, this, FMRadioRequestArgs::TEnableRequestArgs);
IFMRadioService::Singleton()->Enable(aFrequency, r);
return r.forget();
@ -340,6 +368,18 @@ FMRadio::HandleEvent(nsIDOMEvent* aEvent)
return NS_OK;
}
void
FMRadio::EnableAudioChannelAgent()
{
NS_ENSURE_TRUE_VOID(mAudioChannelAgent);
int32_t playingState = 0;
mAudioChannelAgent->StartPlaying(&playingState);
SetCanPlay(playingState == AudioChannelState::AUDIO_CHANNEL_STATE_NORMAL);
mAudioChannelAgentEnabled = true;
}
NS_IMETHODIMP
FMRadio::CanPlayChanged(int32_t aCanPlay)
{

View File

@ -34,7 +34,6 @@ public:
FMRadio();
NS_DECL_ISUPPORTS_INHERITED
NS_DECL_NSIAUDIOCHANNELAGENTCALLBACK
NS_REALLY_FORWARD_NSIDOMEVENTTARGET(nsDOMEventTargetHelper)
@ -83,6 +82,9 @@ public:
IMPL_EVENT_HANDLER(antennaavailablechange);
IMPL_EVENT_HANDLER(frequencychange);
// nsIAudioChannelAgentCallback
NS_IMETHOD CanPlayChanged(int32_t aCanPlay);
// nsIDOMEventListener
NS_IMETHOD HandleEvent(nsIDOMEvent* aEvent);
@ -90,8 +92,10 @@ private:
~FMRadio();
void SetCanPlay(bool aCanPlay);
void EnableAudioChannelAgent();
hal::SwitchState mHeadphoneState;
bool mAudioChannelAgentEnabled;
bool mHasInternalAntenna;
bool mIsShutdown;

View File

@ -10,7 +10,7 @@ EXPORTS.mozilla.dom += [
'GamepadService.h',
]
SOURCES = [
UNIFIED_SOURCES = [
'Gamepad.cpp',
'GamepadButton.cpp',
'GamepadService.cpp',

View File

@ -77,7 +77,7 @@ IDBKeyRange::FromJSVal(JSContext* aCx,
else {
MOZ_ASSERT(aVal.isObject());
// An object is not permitted unless it's another IDBKeyRange.
if (NS_FAILED(UNWRAP_OBJECT(IDBKeyRange, aCx, obj, keyRange))) {
if (NS_FAILED(UNWRAP_OBJECT(IDBKeyRange, obj, keyRange))) {
return NS_ERROR_DOM_INDEXEDDB_DATA_ERR;
}
}

View File

@ -1592,7 +1592,7 @@ IDBObjectStore::StructuredCloneWriteCallback(JSContext* aCx,
FileManager* fileManager = transaction->Database()->Manager();
file::FileHandle* fileHandle = nullptr;
if (NS_SUCCEEDED(UNWRAP_OBJECT(FileHandle, aCx, aObj, fileHandle))) {
if (NS_SUCCEEDED(UNWRAP_OBJECT(FileHandle, aObj, fileHandle))) {
nsRefPtr<FileInfo> fileInfo = fileHandle->GetFileInfo();
// Throw when trying to store non IDB file handles or IDB file handles

View File

@ -63,11 +63,36 @@ MakeSchemaVersion(uint32_t aMajorSchemaVersion,
const int32_t kSQLiteSchemaVersion = int32_t((kMajorSchemaVersion << 4) +
kMinorSchemaVersion);
const uint32_t kGoldenRatioU32 = 0x9E3779B9U;
inline
uint32_t
RotateBitsLeft32(uint32_t value, uint8_t bits)
{
MOZ_ASSERT(bits < 32);
return (value << bits) | (value >> (32 - bits));
}
inline
uint32_t
HashName(const nsAString& aName)
{
const char16_t* str = aName.BeginReading();
size_t length = aName.Length();
uint32_t hash = 0;
for (size_t i = 0; i < length; i++) {
hash = kGoldenRatioU32 * (RotateBitsLeft32(hash, 5) ^ str[i]);
}
return hash;
}
nsresult
GetDatabaseFilename(const nsAString& aName,
nsAString& aDatabaseFilename)
{
aDatabaseFilename.AppendInt(HashString(aName));
aDatabaseFilename.AppendInt(HashName(aName));
nsCString escapedName;
if (!NS_Escape(NS_ConvertUTF16toUTF8(aName), escapedName, url_XPAlphas)) {

View File

@ -415,7 +415,7 @@ IndexedDBDatabaseParent::HandleRequestEvent(nsIDOMEvent* aEvent,
MOZ_ASSERT(!JSVAL_IS_PRIMITIVE(result));
IDBDatabase *database;
rv = UNWRAP_OBJECT(IDBDatabase, cx, &result.toObject(), database);
rv = UNWRAP_OBJECT(IDBDatabase, &result.toObject(), database);
if (NS_FAILED(rv)) {
NS_WARNING("Didn't get the object we expected!");
return rv;

View File

@ -762,8 +762,9 @@ function isPlainTextField(element) {
return false;
}
return element instanceof HTMLInputElement ||
element instanceof HTMLTextAreaElement;
return element instanceof HTMLTextAreaElement ||
(element instanceof HTMLInputElement &&
element.mozIsTextField(false));
}
function getJSON(element, focusCounter) {

View File

@ -3,8 +3,6 @@
# 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/.
MODULE_NAME = TestPlugin
RELATIVE_PATH=.
COCOA_NAME=Test
include @srcdir@/testplugin.mk

View File

@ -3,8 +3,6 @@
# 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/.
MODULE_NAME = SecondTestPlugin
RELATIVE_PATH=..
COCOA_NAME=SecondTest
include @srcdir@/../testplugin.mk

View File

@ -233,7 +233,7 @@ Promise::JSCallback(JSContext *aCx, unsigned aArgc, JS::Value *aVp)
MOZ_ASSERT(v.isObject());
Promise* promise;
if (NS_FAILED(UNWRAP_OBJECT(Promise, aCx, &v.toObject(), promise))) {
if (NS_FAILED(UNWRAP_OBJECT(Promise, &v.toObject(), promise))) {
return Throw(aCx, NS_ERROR_UNEXPECTED);
}
@ -501,7 +501,7 @@ Promise::ResolveInternal(JSContext* aCx,
if (aValue.isObject()) {
JS::Rooted<JSObject*> valueObj(aCx, &aValue.toObject());
Promise* nextPromise;
nsresult rv = UNWRAP_OBJECT(Promise, aCx, valueObj, nextPromise);
nsresult rv = UNWRAP_OBJECT(Promise, valueObj, nextPromise);
if (NS_SUCCEEDED(rv)) {
nsRefPtr<PromiseCallback> resolveCb = new ResolvePromiseCallback(this);

View File

@ -32,6 +32,7 @@ var provider = {
this._isHigh = enable;
if (enable) {
this._seenHigh = true;
do_execute_soon(stop_high_accuracy_watch);
}
},
_isHigh: false,
@ -58,6 +59,9 @@ function errorCallback()
do_test_finished();
}
var geolocation;
var watchID2;
function run_test()
{
if (runningInParent) {
@ -78,18 +82,21 @@ function run_test()
prefs.setBoolPref("geo.wifi.scan", false);
}
let geolocation = Cc["@mozilla.org/geolocation;1"].createInstance(Ci.nsISupports);
do_test_pending();
geolocation = Cc["@mozilla.org/geolocation;1"].createInstance(Ci.nsISupports);
let watchID1 = geolocation.watchPosition(successCallback, errorCallback);
let watchID2 = geolocation.watchPosition(successCallback, errorCallback,
{enableHighAccuracy: true});
watchID2 = geolocation.watchPosition(successCallback, errorCallback,
{enableHighAccuracy: true});
do_timeout(5000, function() {
if (!runningInParent) {
do_await_remote_message('high_acc_enabled', stop_high_accuracy_watch);
}
}
function stop_high_accuracy_watch() {
geolocation.clearWatch(watchID2);
do_timeout(1000, check_results);
});
check_results();
}
function check_results()

View File

@ -32,6 +32,7 @@ var provider = {
this._isHigh = enable;
if (enable) {
this._seenHigh = true;
do_send_remote_message('high_acc_enabled');
}
},
_isHigh: false,

View File

@ -346,7 +346,7 @@ struct WorkerStructuredCloneCallbacks
// See if this is an ImageData object.
{
ImageData* imageData = nullptr;
if (NS_SUCCEEDED(UNWRAP_OBJECT(ImageData, aCx, aObj, imageData))) {
if (NS_SUCCEEDED(UNWRAP_OBJECT(ImageData, aObj, imageData))) {
// Prepare the ImageData internals.
uint32_t width = imageData->Width();
uint32_t height = imageData->Height();
@ -5407,7 +5407,7 @@ GetWorkerCrossThreadDispatcher(JSContext* aCx, JS::Value aWorker)
}
WorkerPrivate* w = nullptr;
UNWRAP_OBJECT(Worker, aCx, &aWorker.toObject(), w);
UNWRAP_OBJECT(Worker, &aWorker.toObject(), w);
MOZ_ASSERT(w);
return w->GetCrossThreadDispatcher();
}

View File

@ -22,9 +22,9 @@
#include "RuntimeService.h" // For WorkersDumpEnabled().
#define UNWRAP_WORKER_OBJECT(Interface, cx, obj, value) \
#define UNWRAP_WORKER_OBJECT(Interface, obj, value) \
UnwrapObject<prototypes::id::Interface##_workers, \
mozilla::dom::Interface##Binding_workers::NativeType>(cx, obj, value)
mozilla::dom::Interface##Binding_workers::NativeType>(obj, value)
using namespace mozilla::dom;
USING_WORKERS_NAMESPACE
@ -259,7 +259,7 @@ DedicatedWorkerGlobalScope::DedicatedWorkerGlobalScope(WorkerPrivate* aWorkerPri
DedicatedWorkerGlobalScope::Visible(JSContext* aCx, JSObject* aObj)
{
DedicatedWorkerGlobalScope* self = nullptr;
nsresult rv = UNWRAP_WORKER_OBJECT(DedicatedWorkerGlobalScope, aCx, aObj, self);
nsresult rv = UNWRAP_WORKER_OBJECT(DedicatedWorkerGlobalScope, aObj, self);
return NS_SUCCEEDED(rv) && self;
}
@ -299,7 +299,7 @@ SharedWorkerGlobalScope::SharedWorkerGlobalScope(WorkerPrivate* aWorkerPrivate,
SharedWorkerGlobalScope::Visible(JSContext* aCx, JSObject* aObj)
{
SharedWorkerGlobalScope* self = nullptr;
nsresult rv = UNWRAP_WORKER_OBJECT(SharedWorkerGlobalScope, aCx, aObj, self);
nsresult rv = UNWRAP_WORKER_OBJECT(SharedWorkerGlobalScope, aObj, self);
return NS_SUCCEEDED(rv) && self;
}

View File

@ -701,7 +701,7 @@ AlphaBoxBlur::BoxBlur_C(uint8_t* aData,
uint32_t value = bottomRight - topRight - bottomLeft;
value += topLeft;
data[stride * y + x] = (uint64_t(reciprocal) * value) >> 32;
data[stride * y + x] = (uint64_t(reciprocal) * value + (uint64_t(1) << 31)) >> 32;
}
}
}

View File

@ -12,14 +12,32 @@ namespace mozilla {
namespace gfx {
MOZ_ALWAYS_INLINE
uint32_t DivideAndPack(__m128i aValues, __m128i aDivisor, __m128i aMask)
__m128i Divide(__m128i aValues, __m128i aDivisor)
{
__m128i multiplied = _mm_srli_epi64(_mm_mul_epu32(aValues, aDivisor), 32); // 00p300p1
multiplied = _mm_or_si128(multiplied, _mm_and_si128(_mm_mul_epu32(_mm_srli_epi64(aValues, 32), aDivisor),
aMask)); // p4p3p2p1
__m128i final = _mm_packus_epi16(_mm_packs_epi32(multiplied, _mm_setzero_si128()), _mm_setzero_si128());
const __m128i mask = _mm_setr_epi32(0x0, 0xffffffff, 0x0, 0xffffffff);
static const union {
int64_t i64[2];
__m128i m;
} roundingAddition = { { int64_t(1) << 31, int64_t(1) << 31 } };
return _mm_cvtsi128_si32(final);
__m128i multiplied31 = _mm_mul_epu32(aValues, aDivisor);
__m128i multiplied42 = _mm_mul_epu32(_mm_srli_epi64(aValues, 32), aDivisor);
// Add 1 << 31 before shifting or masking the lower 32 bits away, so that the
// result is rounded.
__m128i p_3_1 = _mm_srli_epi64(_mm_add_epi64(multiplied31, roundingAddition.m), 32);
__m128i p4_2_ = _mm_and_si128(_mm_add_epi64(multiplied42, roundingAddition.m), mask);
__m128i p4321 = _mm_or_si128(p_3_1, p4_2_);
return p4321;
}
MOZ_ALWAYS_INLINE
__m128i BlurFourPixels(const __m128i& aTopLeft, const __m128i& aTopRight,
const __m128i& aBottomRight, const __m128i& aBottomLeft,
const __m128i& aDivisor)
{
__m128i values = _mm_add_epi32(_mm_sub_epi32(_mm_sub_epi32(aBottomRight, aTopRight), aBottomLeft), aTopLeft);
return Divide(values, aDivisor);
}
MOZ_ALWAYS_INLINE
@ -175,7 +193,7 @@ GenerateIntegralImage_SSE2(int32_t aLeftInflation, int32_t aRightInflation,
*/
void
AlphaBoxBlur::BoxBlur_SSE2(uint8_t* aData,
int32_t aLeftLobe,
int32_t aLeftLobe,
int32_t aRightLobe,
int32_t aTopLobe,
int32_t aBottomLobe,
@ -209,7 +227,6 @@ AlphaBoxBlur::BoxBlur_SSE2(uint8_t* aData,
mStride, size);
__m128i divisor = _mm_set1_epi32(reciprocal);
__m128i mask = _mm_setr_epi32(0x0, 0xffffffff, 0x0, 0xffffffff);
// This points to the start of the rectangle within the IntegralImage that overlaps
// the surface being blurred.
@ -226,7 +243,53 @@ AlphaBoxBlur::BoxBlur_SSE2(uint8_t* aData,
uint32_t *bottomRightBase = innerIntegral + ((y + aBottomLobe) * ptrdiff_t(stride32bit) + aRightLobe);
uint32_t *bottomLeftBase = innerIntegral + ((y + aBottomLobe) * ptrdiff_t(stride32bit) - aLeftLobe);
for (int32_t x = 0; x < size.width; x += 4) {
int32_t x = 0;
// Process 16 pixels at a time for as long as possible.
for (; x <= size.width - 16; x += 16) {
if (inSkipRectY && x > skipRect.x && x < skipRect.XMost()) {
x = skipRect.XMost() - 16;
// Trigger early jump on coming loop iterations, this will be reset
// next line anyway.
inSkipRectY = false;
continue;
}
__m128i topLeft;
__m128i topRight;
__m128i bottomRight;
__m128i bottomLeft;
topLeft = loadUnaligned128((__m128i*)(topLeftBase + x));
topRight = loadUnaligned128((__m128i*)(topRightBase + x));
bottomRight = loadUnaligned128((__m128i*)(bottomRightBase + x));
bottomLeft = loadUnaligned128((__m128i*)(bottomLeftBase + x));
__m128i result1 = BlurFourPixels(topLeft, topRight, bottomRight, bottomLeft, divisor);
topLeft = loadUnaligned128((__m128i*)(topLeftBase + x + 4));
topRight = loadUnaligned128((__m128i*)(topRightBase + x + 4));
bottomRight = loadUnaligned128((__m128i*)(bottomRightBase + x + 4));
bottomLeft = loadUnaligned128((__m128i*)(bottomLeftBase + x + 4));
__m128i result2 = BlurFourPixels(topLeft, topRight, bottomRight, bottomLeft, divisor);
topLeft = loadUnaligned128((__m128i*)(topLeftBase + x + 8));
topRight = loadUnaligned128((__m128i*)(topRightBase + x + 8));
bottomRight = loadUnaligned128((__m128i*)(bottomRightBase + x + 8));
bottomLeft = loadUnaligned128((__m128i*)(bottomLeftBase + x + 8));
__m128i result3 = BlurFourPixels(topLeft, topRight, bottomRight, bottomLeft, divisor);
topLeft = loadUnaligned128((__m128i*)(topLeftBase + x + 12));
topRight = loadUnaligned128((__m128i*)(topRightBase + x + 12));
bottomRight = loadUnaligned128((__m128i*)(bottomRightBase + x + 12));
bottomLeft = loadUnaligned128((__m128i*)(bottomLeftBase + x + 12));
__m128i result4 = BlurFourPixels(topLeft, topRight, bottomRight, bottomLeft, divisor);
__m128i final = _mm_packus_epi16(_mm_packs_epi32(result1, result2), _mm_packs_epi32(result3, result4));
_mm_storeu_si128((__m128i*)(data + stride * y + x), final);
}
// Process the remaining pixels 4 bytes at a time.
for (; x < size.width; x += 4) {
if (inSkipRectY && x > skipRect.x && x < skipRect.XMost()) {
x = skipRect.XMost() - 4;
// Trigger early jump on coming loop iterations, this will be reset
@ -239,9 +302,10 @@ AlphaBoxBlur::BoxBlur_SSE2(uint8_t* aData,
__m128i bottomRight = loadUnaligned128((__m128i*)(bottomRightBase + x));
__m128i bottomLeft = loadUnaligned128((__m128i*)(bottomLeftBase + x));
__m128i values = _mm_add_epi32(_mm_sub_epi32(_mm_sub_epi32(bottomRight, topRight), bottomLeft), topLeft);
__m128i result = BlurFourPixels(topLeft, topRight, bottomRight, bottomLeft, divisor);
__m128i final = _mm_packus_epi16(_mm_packs_epi32(result, _mm_setzero_si128()), _mm_setzero_si128());
*(uint32_t*)(data + stride * y + x) = DivideAndPack(values, divisor, mask);
*(uint32_t*)(data + stride * y + x) = _mm_cvtsi128_si32(final);
}
}

View File

@ -23,14 +23,15 @@ EXPORTS.harfbuzz += [
]
SOURCES += [
'hb-blob.cc', # error: use of undeclared identifier 'snprintf' (FreeBSD)
'hb-common.cc', # error: use of undeclared identifier 'strdup'
'hb-ot-shape-complex-indic.cc', # error: redefinition of enumerator 'INIT'
'hb-ot-shape-complex-sea.cc', # error: redefinition of 'basic_features'
'hb-ot-shape.cc', # error: functions that differ only in their return type cannot be overloaded
'hb-shape-plan.cc', # error: redefinition of 'hb_ot_shaper_face_data_ensure'
]
UNIFIED_SOURCES += [
'hb-blob.cc',
'hb-buffer.cc',
'hb-face.cc',
'hb-fallback-shape.cc',
@ -46,7 +47,6 @@ UNIFIED_SOURCES += [
'hb-ot-shape-normalize.cc',
'hb-ot-tag.cc',
'hb-set.cc',
'hb-shape-plan.cc',
'hb-shape.cc',
'hb-shaper.cc',
'hb-unicode.cc',

View File

@ -357,10 +357,10 @@ void ImageLayerD3D10::AllocateTexturesYCbCr(PlanarYCbCrImage *aImage)
D3D10_SUBRESOURCE_DATA dataY;
D3D10_SUBRESOURCE_DATA dataCb;
D3D10_SUBRESOURCE_DATA dataCr;
CD3D10_TEXTURE2D_DESC descY(DXGI_FORMAT_R8_UNORM,
CD3D10_TEXTURE2D_DESC descY(DXGI_FORMAT_A8_UNORM,
data->mYSize.width,
data->mYSize.height, 1, 1);
CD3D10_TEXTURE2D_DESC descCbCr(DXGI_FORMAT_R8_UNORM,
CD3D10_TEXTURE2D_DESC descCbCr(DXGI_FORMAT_A8_UNORM,
data->mCbCrSize.width,
data->mCbCrSize.height, 1, 1);

View File

@ -249,9 +249,9 @@ float4 CalculateYCbCrColor(const float2 aTexCoords)
float4 yuv;
float4 color;
yuv.r = tCr.Sample(LayerTextureSamplerLinear, aTexCoords).r - 0.5;
yuv.g = tY.Sample(LayerTextureSamplerLinear, aTexCoords).r - 0.0625;
yuv.b = tCb.Sample(LayerTextureSamplerLinear, aTexCoords).r - 0.5;
yuv.r = tCr.Sample(LayerTextureSamplerLinear, aTexCoords).a - 0.5;
yuv.g = tY.Sample(LayerTextureSamplerLinear, aTexCoords).a - 0.0625;
yuv.b = tCb.Sample(LayerTextureSamplerLinear, aTexCoords).a - 0.5;
color.r = yuv.g * 1.164 + yuv.r * 1.596;
color.g = yuv.g * 1.164 - 0.813 * yuv.r - 0.391 * yuv.b;

View File

@ -1,7 +1,3 @@
/* 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/. */
#if 0
//
// FX Version: fx_4_0
@ -1607,16 +1603,16 @@ technique10 RenderYCbCrLayer
dcl_2d s2
texld r0, t0, s0
texld r1, t0, s2
add r0.y, r1.x, c1.x
mul r0.yz, r0.y, c1.xzww
add r0.x, r0.x, c1.y
mad r0.z, r0.x, c2.x, -r0.z
mad r1.x, r0.x, c2.x, r0.y
add r0.x, r1.w, c1.x
mul r0.xy, r0.x, c1.zwzw
add r0.z, r0.w, c1.y
mad r0.y, r0.z, c2.x, -r0.y
mad r1.x, r0.z, c2.x, r0.x
texld r2, t0, s1
add r0.y, r2.x, c1.x
mad r1.y, r0.y, -c2.z, r0.z
mul r0.y, r0.y, c2.y
mad r1.z, r0.x, c2.x, r0.y
add r0.x, r2.w, c1.x
mad r1.y, r0.x, -c2.z, r0.y
mul r0.x, r0.x, c2.y
mad r1.z, r0.z, c2.x, r0.x
mov r1.w, c2.w
mul r0, r1, c0.x
mov oC0, r0
@ -1632,14 +1628,14 @@ technique10 RenderYCbCrLayer
dcl_output o0.xyzw
dcl_temps 3
sample r0.xyzw, v1.xyxx, t2.xyzw, s0
add r0.x, r0.x, l(-0.500000)
add r0.x, r0.w, l(-0.500000)
mul r0.xy, r0.xxxx, l(1.596000, 0.813000, 0.000000, 0.000000)
sample r1.xyzw, v1.xyxx, t0.xyzw, s0
add r0.z, r1.x, l(-0.062500)
add r0.z, r1.w, l(-0.062500)
mad r0.y, r0.z, l(1.164000), -r0.y
mad r1.x, r0.z, l(1.164000), r0.x
sample r2.xyzw, v1.xyxx, t1.xyzw, s0
add r0.x, r2.x, l(-0.500000)
add r0.x, r2.w, l(-0.500000)
mad r1.y, -r0.x, l(0.391000), r0.y
mul r0.x, r0.x, l(2.018000)
mad r1.z, r0.z, l(1.164000), r0.x
@ -4151,18 +4147,18 @@ technique10 RenderYCbCrLayerMask
dcl_2d s3
texld r0, t0, s0
texld r1, t0, s2
add r0.y, r1.x, c1.x
mul r0.yz, r0.y, c1.xzww
add r0.x, r0.x, c1.y
mad r0.z, r0.x, c2.x, -r0.z
mad r1.x, r0.x, c2.x, r0.y
add r0.x, r1.w, c1.x
mul r0.xy, r0.x, c1.zwzw
add r0.z, r0.w, c1.y
mad r0.y, r0.z, c2.x, -r0.y
mad r1.x, r0.z, c2.x, r0.x
mov r2.xy, t0.wzzw
texld r3, t0, s1
texld r2, r2, s3
add r0.y, r3.x, c1.x
mad r1.y, r0.y, -c2.z, r0.z
mul r0.y, r0.y, c2.y
mad r1.z, r0.x, c2.x, r0.y
add r0.x, r3.w, c1.x
mad r1.y, r0.x, -c2.z, r0.y
mul r0.x, r0.x, c2.y
mad r1.z, r0.z, c2.x, r0.x
mov r1.w, c2.w
mul r0, r1, c0.x
mul r0, r2.w, r0
@ -4181,14 +4177,14 @@ technique10 RenderYCbCrLayerMask
dcl_output o0.xyzw
dcl_temps 3
sample r0.xyzw, v1.xyxx, t2.xyzw, s0
add r0.x, r0.x, l(-0.500000)
add r0.x, r0.w, l(-0.500000)
mul r0.xy, r0.xxxx, l(1.596000, 0.813000, 0.000000, 0.000000)
sample r1.xyzw, v1.xyxx, t0.xyzw, s0
add r0.z, r1.x, l(-0.062500)
add r0.z, r1.w, l(-0.062500)
mad r0.y, r0.z, l(1.164000), -r0.y
mad r1.x, r0.z, l(1.164000), r0.x
sample r2.xyzw, v1.xyxx, t1.xyzw, s0
add r0.x, r2.x, l(-0.500000)
add r0.x, r2.w, l(-0.500000)
mad r1.y, -r0.x, l(0.391000), r0.y
mul r0.x, r0.x, l(2.018000)
mad r1.z, r0.z, l(1.164000), r0.x
@ -4688,10 +4684,10 @@ technique10 RenderSolidColorLayerMask
const BYTE g_main[] =
{
68, 88, 66, 67, 165, 47,
2, 116, 253, 33, 81, 39,
75, 42, 228, 176, 250, 109,
200, 179, 1, 0, 0, 0,
68, 88, 66, 67, 218, 142,
35, 224, 179, 182, 169, 21,
79, 128, 135, 14, 250, 174,
44, 181, 1, 0, 0, 0,
30, 32, 1, 0, 1, 0,
0, 0, 36, 0, 0, 0,
70, 88, 49, 48, 242, 31,
@ -8373,10 +8369,10 @@ const BYTE g_main[] =
0, 0, 0, 1, 0, 0,
0, 2, 0, 0, 0, 0,
0, 0, 0, 96, 7, 0,
0, 68, 88, 66, 67, 240,
1, 205, 211, 197, 17, 202,
42, 30, 221, 209, 206, 174,
135, 152, 163, 1, 0, 0,
0, 68, 88, 66, 67, 248,
27, 107, 126, 143, 194, 255,
95, 146, 68, 72, 180, 162,
134, 32, 4, 1, 0, 0,
0, 96, 7, 0, 0, 6,
0, 0, 0, 56, 0, 0,
0, 220, 1, 0, 0, 44,
@ -8416,35 +8412,35 @@ const BYTE g_main[] =
160, 66, 0, 0, 3, 1,
0, 15, 128, 0, 0, 228,
176, 2, 8, 228, 160, 2,
0, 0, 3, 0, 0, 2,
128, 1, 0, 0, 128, 1,
0, 0, 3, 0, 0, 1,
128, 1, 0, 255, 128, 1,
0, 0, 160, 5, 0, 0,
3, 0, 0, 6, 128, 0,
0, 85, 128, 1, 0, 248,
3, 0, 0, 3, 128, 0,
0, 0, 128, 1, 0, 238,
160, 2, 0, 0, 3, 0,
0, 1, 128, 0, 0, 0,
0, 4, 128, 0, 0, 255,
128, 1, 0, 85, 160, 4,
0, 0, 4, 0, 0, 4,
128, 0, 0, 0, 128, 2,
0, 0, 160, 0, 0, 170,
0, 0, 4, 0, 0, 2,
128, 0, 0, 170, 128, 2,
0, 0, 160, 0, 0, 85,
129, 4, 0, 0, 4, 1,
0, 1, 128, 0, 0, 0,
0, 1, 128, 0, 0, 170,
128, 2, 0, 0, 160, 0,
0, 85, 128, 66, 0, 0,
0, 0, 128, 66, 0, 0,
3, 2, 0, 15, 128, 0,
0, 228, 176, 1, 8, 228,
160, 2, 0, 0, 3, 0,
0, 2, 128, 2, 0, 0,
0, 1, 128, 2, 0, 255,
128, 1, 0, 0, 160, 4,
0, 0, 4, 1, 0, 2,
128, 0, 0, 85, 128, 2,
0, 170, 161, 0, 0, 170,
128, 0, 0, 0, 128, 2,
0, 170, 161, 0, 0, 85,
128, 5, 0, 0, 3, 0,
0, 2, 128, 0, 0, 85,
0, 1, 128, 0, 0, 0,
128, 2, 0, 85, 160, 4,
0, 0, 4, 1, 0, 4,
128, 0, 0, 0, 128, 2,
0, 0, 160, 0, 0, 85,
128, 0, 0, 170, 128, 2,
0, 0, 160, 0, 0, 0,
128, 1, 0, 0, 2, 1,
0, 8, 128, 2, 0, 255,
160, 5, 0, 0, 3, 0,
@ -8481,7 +8477,7 @@ const BYTE g_main[] =
96, 16, 0, 0, 0, 0,
0, 0, 0, 0, 7, 18,
0, 16, 0, 0, 0, 0,
0, 10, 0, 16, 0, 0,
0, 58, 0, 16, 0, 0,
0, 0, 0, 1, 64, 0,
0, 0, 0, 0, 191, 56,
0, 0, 10, 50, 0, 16,
@ -8498,7 +8494,7 @@ const BYTE g_main[] =
0, 0, 96, 16, 0, 0,
0, 0, 0, 0, 0, 0,
7, 66, 0, 16, 0, 0,
0, 0, 0, 10, 0, 16,
0, 0, 0, 58, 0, 16,
0, 1, 0, 0, 0, 1,
64, 0, 0, 0, 0, 128,
189, 50, 0, 0, 10, 34,
@ -8521,7 +8517,7 @@ const BYTE g_main[] =
0, 0, 0, 0, 96, 16,
0, 0, 0, 0, 0, 0,
0, 0, 7, 18, 0, 16,
0, 0, 0, 0, 0, 10,
0, 0, 0, 0, 0, 58,
0, 16, 0, 2, 0, 0,
0, 1, 64, 0, 0, 0,
0, 0, 191, 50, 0, 0,
@ -14776,9 +14772,9 @@ const BYTE g_main[] =
1, 0, 0, 0, 2, 0,
0, 0, 0, 0, 0, 0,
52, 8, 0, 0, 68, 88,
66, 67, 53, 130, 196, 222,
55, 6, 85, 223, 2, 38,
19, 66, 81, 203, 15, 85,
66, 67, 202, 83, 22, 204,
207, 151, 51, 179, 174, 132,
82, 181, 125, 14, 145, 73,
1, 0, 0, 0, 52, 8,
0, 0, 6, 0, 0, 0,
56, 0, 0, 0, 24, 2,
@ -14822,20 +14818,20 @@ const BYTE g_main[] =
1, 0, 15, 128, 0, 0,
228, 176, 2, 8, 228, 160,
2, 0, 0, 3, 0, 0,
2, 128, 1, 0, 0, 128,
1, 128, 1, 0, 255, 128,
1, 0, 0, 160, 5, 0,
0, 3, 0, 0, 6, 128,
0, 0, 85, 128, 1, 0,
248, 160, 2, 0, 0, 3,
0, 0, 1, 128, 0, 0,
0, 128, 1, 0, 85, 160,
0, 3, 0, 0, 3, 128,
0, 0, 0, 128, 1, 0,
238, 160, 2, 0, 0, 3,
0, 0, 4, 128, 0, 0,
255, 128, 1, 0, 85, 160,
4, 0, 0, 4, 0, 0,
4, 128, 0, 0, 0, 128,
2, 128, 0, 0, 170, 128,
2, 0, 0, 160, 0, 0,
170, 129, 4, 0, 0, 4,
85, 129, 4, 0, 0, 4,
1, 0, 1, 128, 0, 0,
0, 128, 2, 0, 0, 160,
0, 0, 85, 128, 1, 0,
170, 128, 2, 0, 0, 160,
0, 0, 0, 128, 1, 0,
0, 2, 2, 0, 3, 128,
0, 0, 235, 176, 66, 0,
0, 3, 3, 0, 15, 128,
@ -14844,17 +14840,17 @@ const BYTE g_main[] =
2, 0, 15, 128, 2, 0,
228, 128, 3, 8, 228, 160,
2, 0, 0, 3, 0, 0,
2, 128, 3, 0, 0, 128,
1, 128, 3, 0, 255, 128,
1, 0, 0, 160, 4, 0,
0, 4, 1, 0, 2, 128,
0, 0, 85, 128, 2, 0,
170, 161, 0, 0, 170, 128,
0, 0, 0, 128, 2, 0,
170, 161, 0, 0, 85, 128,
5, 0, 0, 3, 0, 0,
2, 128, 0, 0, 85, 128,
1, 128, 0, 0, 0, 128,
2, 0, 85, 160, 4, 0,
0, 4, 1, 0, 4, 128,
0, 0, 0, 128, 2, 0,
0, 160, 0, 0, 85, 128,
0, 0, 170, 128, 2, 0,
0, 160, 0, 0, 0, 128,
1, 0, 0, 2, 1, 0,
8, 128, 2, 0, 255, 160,
5, 0, 0, 3, 0, 0,
@ -14898,7 +14894,7 @@ const BYTE g_main[] =
0, 96, 16, 0, 0, 0,
0, 0, 0, 0, 0, 7,
18, 0, 16, 0, 0, 0,
0, 0, 10, 0, 16, 0,
0, 0, 58, 0, 16, 0,
0, 0, 0, 0, 1, 64,
0, 0, 0, 0, 0, 191,
56, 0, 0, 10, 50, 0,
@ -14915,7 +14911,7 @@ const BYTE g_main[] =
0, 0, 0, 96, 16, 0,
0, 0, 0, 0, 0, 0,
0, 7, 66, 0, 16, 0,
0, 0, 0, 0, 10, 0,
0, 0, 0, 0, 58, 0,
16, 0, 1, 0, 0, 0,
1, 64, 0, 0, 0, 0,
128, 189, 50, 0, 0, 10,
@ -14939,7 +14935,7 @@ const BYTE g_main[] =
16, 0, 0, 0, 0, 0,
0, 0, 0, 7, 18, 0,
16, 0, 0, 0, 0, 0,
10, 0, 16, 0, 2, 0,
58, 0, 16, 0, 2, 0,
0, 0, 1, 64, 0, 0,
0, 0, 0, 191, 50, 0,
0, 10, 34, 0, 16, 0,

View File

@ -185,9 +185,9 @@ float4 CalculateYCbCrColor(const float2 aTexCoords)
float4 yuv;
float4 color;
yuv.r = tCr.Sample(sSampler, aTexCoords).r - 0.5;
yuv.g = tY.Sample(sSampler, aTexCoords).r - 0.0625;
yuv.b = tCb.Sample(sSampler, aTexCoords).r - 0.5;
yuv.r = tCr.Sample(sSampler, aTexCoords).a - 0.5;
yuv.g = tY.Sample(sSampler, aTexCoords).a - 0.0625;
yuv.b = tCb.Sample(sSampler, aTexCoords).a - 0.5;
color.r = yuv.g * 1.164 + yuv.r * 1.596;
color.g = yuv.g * 1.164 - 0.813 * yuv.r - 0.391 * yuv.b;

File diff suppressed because it is too large Load Diff

View File

@ -496,7 +496,7 @@ DeprecatedTextureHostYCbCrD3D11::UpdateImpl(const SurfaceDescriptor& aImage,
initData.pSysMem = yuvDeserializer.GetYData();
initData.SysMemPitch = yuvDeserializer.GetYStride();
CD3D11_TEXTURE2D_DESC desc(DXGI_FORMAT_R8_UNORM, size.width, size.height,
CD3D11_TEXTURE2D_DESC desc(DXGI_FORMAT_A8_UNORM, size.width, size.height,
1, 1, D3D11_BIND_SHADER_RESOURCE,
D3D11_USAGE_IMMUTABLE);

View File

@ -184,31 +184,31 @@ static void AllocateTexturesYCbCr(PlanarYCbCrImage *aImage,
HRESULT hr;
hr = aDevice->CreateTexture(data->mYSize.width, data->mYSize.height,
1, 0, D3DFMT_L8, D3DPOOL_DEFAULT,
1, 0, D3DFMT_A8, D3DPOOL_DEFAULT,
getter_AddRefs(backendData->mYTexture), nullptr);
if (!FAILED(hr)) {
hr = aDevice->CreateTexture(data->mCbCrSize.width, data->mCbCrSize.height,
1, 0, D3DFMT_L8, D3DPOOL_DEFAULT,
1, 0, D3DFMT_A8, D3DPOOL_DEFAULT,
getter_AddRefs(backendData->mCbTexture), nullptr);
}
if (!FAILED(hr)) {
hr = aDevice->CreateTexture(data->mCbCrSize.width, data->mCbCrSize.height,
1, 0, D3DFMT_L8, D3DPOOL_DEFAULT,
1, 0, D3DFMT_A8, D3DPOOL_DEFAULT,
getter_AddRefs(backendData->mCrTexture), nullptr);
}
if (!FAILED(hr)) {
hr = aDevice->CreateTexture(data->mYSize.width, data->mYSize.height,
1, 0, D3DFMT_L8, D3DPOOL_SYSTEMMEM,
1, 0, D3DFMT_A8, D3DPOOL_SYSTEMMEM,
getter_AddRefs(tmpYTexture), nullptr);
}
if (!FAILED(hr)) {
hr = aDevice->CreateTexture(data->mCbCrSize.width, data->mCbCrSize.height,
1, 0, D3DFMT_L8, D3DPOOL_SYSTEMMEM,
1, 0, D3DFMT_A8, D3DPOOL_SYSTEMMEM,
getter_AddRefs(tmpCbTexture), nullptr);
}
if (!FAILED(hr)) {
hr = aDevice->CreateTexture(data->mCbCrSize.width, data->mCbCrSize.height,
1, 0, D3DFMT_L8, D3DPOOL_SYSTEMMEM,
1, 0, D3DFMT_A8, D3DPOOL_SYSTEMMEM,
getter_AddRefs(tmpCrTexture), nullptr);
}
@ -227,16 +227,16 @@ static void AllocateTexturesYCbCr(PlanarYCbCrImage *aImage,
} else {
HRESULT hr;
hr = aDevice->CreateTexture(data->mYSize.width, data->mYSize.height,
1, 0, D3DFMT_L8, D3DPOOL_MANAGED,
1, 0, D3DFMT_A8, D3DPOOL_MANAGED,
getter_AddRefs(backendData->mYTexture), nullptr);
if (!FAILED(hr)) {
aDevice->CreateTexture(data->mCbCrSize.width, data->mCbCrSize.height,
1, 0, D3DFMT_L8, D3DPOOL_MANAGED,
1, 0, D3DFMT_A8, D3DPOOL_MANAGED,
getter_AddRefs(backendData->mCbTexture), nullptr);
}
if (!FAILED(hr)) {
aDevice->CreateTexture(data->mCbCrSize.width, data->mCbCrSize.height,
1, 0, D3DFMT_L8, D3DPOOL_MANAGED,
1, 0, D3DFMT_A8, D3DPOOL_MANAGED,
getter_AddRefs(backendData->mCrTexture), nullptr);
}

View File

@ -1,7 +1,3 @@
/* 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/. */
#if 0
//
// Generated by Microsoft (R) HLSL Shader Compiler 9.29.952.3111
@ -585,12 +581,12 @@ const BYTE RGBShaderPS[] =
texld r0, t0, s2
texld r1, t0, s0
texld r2, t0, s1
add r0.x, r0.x, c1.x
add r0.y, r1.x, c1.y
add r0.x, r0.w, c1.x
add r0.y, r1.w, c1.y
mul r0.y, r0.y, c1.z
mad r0.z, r0.x, -c2.x, r0.y
mad r1.x, r0.x, c1.w, r0.y
add r0.x, r2.x, c1.x
add r0.x, r2.w, c1.x
mad r1.y, r0.x, -c2.y, r0.z
mad r1.z, r0.x, c2.z, r0.y
mov r1.w, c2.w
@ -674,10 +670,10 @@ const BYTE YCbCrShaderPS[] =
15, 128, 0, 0, 228, 176,
1, 8, 228, 160, 2, 0,
0, 3, 0, 0, 1, 128,
0, 0, 0, 128, 1, 0,
0, 0, 255, 128, 1, 0,
0, 160, 2, 0, 0, 3,
0, 0, 2, 128, 1, 0,
0, 128, 1, 0, 85, 160,
255, 128, 1, 0, 85, 160,
5, 0, 0, 3, 0, 0,
2, 128, 0, 0, 85, 128,
1, 0, 170, 160, 4, 0,
@ -689,7 +685,7 @@ const BYTE YCbCrShaderPS[] =
1, 0, 255, 160, 0, 0,
85, 128, 2, 0, 0, 3,
0, 0, 1, 128, 2, 0,
0, 128, 1, 0, 0, 160,
255, 128, 1, 0, 0, 160,
4, 0, 0, 4, 1, 0,
2, 128, 0, 0, 0, 128,
2, 0, 85, 161, 0, 0,
@ -1755,12 +1751,12 @@ const BYTE RGBShaderPSMask[] =
texld r1, t0, s0
texld r2, t0, s1
texld r3, t1, s3
add r0.x, r0.x, c1.x
add r0.y, r1.x, c1.y
add r0.x, r0.w, c1.x
add r0.y, r1.w, c1.y
mul r0.y, r0.y, c1.z
mad r0.z, r0.x, -c2.x, r0.y
mad r1.x, r0.x, c1.w, r0.y
add r0.x, r2.x, c1.x
add r0.x, r2.w, c1.x
mad r1.y, r0.x, -c2.y, r0.z
mad r1.z, r0.x, c2.z, r0.y
mov r1.w, c2.w
@ -1859,10 +1855,10 @@ const BYTE YCbCrShaderPSMask[] =
15, 128, 1, 0, 228, 176,
3, 8, 228, 160, 2, 0,
0, 3, 0, 0, 1, 128,
0, 0, 0, 128, 1, 0,
0, 0, 255, 128, 1, 0,
0, 160, 2, 0, 0, 3,
0, 0, 2, 128, 1, 0,
0, 128, 1, 0, 85, 160,
255, 128, 1, 0, 85, 160,
5, 0, 0, 3, 0, 0,
2, 128, 0, 0, 85, 128,
1, 0, 170, 160, 4, 0,
@ -1874,7 +1870,7 @@ const BYTE YCbCrShaderPSMask[] =
1, 0, 255, 160, 0, 0,
85, 128, 2, 0, 0, 3,
0, 0, 1, 128, 2, 0,
0, 128, 1, 0, 0, 160,
255, 128, 1, 0, 0, 160,
4, 0, 0, 4, 1, 0,
2, 128, 0, 0, 0, 128,
2, 0, 85, 161, 0, 0,

View File

@ -189,9 +189,9 @@ float4 YCbCrShader(const VS_OUTPUT aVertex) : COLOR
float4 yuv;
float4 color;
yuv.r = tex2D(s2DCr, aVertex.vTexCoords).r - 0.5;
yuv.g = tex2D(s2DY, aVertex.vTexCoords).r - 0.0625;
yuv.b = tex2D(s2DCb, aVertex.vTexCoords).r - 0.5;
yuv.r = tex2D(s2DCr, aVertex.vTexCoords).a - 0.5;
yuv.g = tex2D(s2DY, aVertex.vTexCoords).a - 0.0625;
yuv.b = tex2D(s2DCb, aVertex.vTexCoords).a - 0.5;
color.r = yuv.g * 1.164 + yuv.r * 1.596;
color.g = yuv.g * 1.164 - 0.813 * yuv.r - 0.391 * yuv.b;
@ -255,9 +255,9 @@ float4 YCbCrShaderMask(const VS_OUTPUT_MASK aVertex) : COLOR
float4 yuv;
float4 color;
yuv.r = tex2D(s2DCr, aVertex.vTexCoords).r - 0.5;
yuv.g = tex2D(s2DY, aVertex.vTexCoords).r - 0.0625;
yuv.b = tex2D(s2DCb, aVertex.vTexCoords).r - 0.5;
yuv.r = tex2D(s2DCr, aVertex.vTexCoords).a - 0.5;
yuv.g = tex2D(s2DY, aVertex.vTexCoords).a - 0.0625;
yuv.b = tex2D(s2DCb, aVertex.vTexCoords).a - 0.5;
color.r = yuv.g * 1.164 + yuv.r * 1.596;
color.g = yuv.g * 1.164 - 0.813 * yuv.r - 0.391 * yuv.b;

View File

@ -358,17 +358,17 @@ DeprecatedTextureHostYCbCrD3D9::UpdateImpl(const SurfaceDescriptor& aImage,
yuvDeserializer.GetYData(),
yuvDeserializer.GetYStride(),
size,
D3DFMT_L8, 1);
D3DFMT_A8, 1);
mTextures[1] = DataToTexture(mDevice,
yuvDeserializer.GetCbData(),
yuvDeserializer.GetCbCrStride(),
gfxCbCrSize,
D3DFMT_L8, 1);
D3DFMT_A8, 1);
mTextures[2] = DataToTexture(mDevice,
yuvDeserializer.GetCrData(),
yuvDeserializer.GetCbCrStride(),
gfxCbCrSize,
D3DFMT_L8, 1);
D3DFMT_A8, 1);
}
// aTexture should be in SYSTEMMEM, returns a texture in the default

View File

@ -36,6 +36,17 @@ CompositableHost* AsCompositable(const T& op)
return static_cast<CompositableParent*>(op.compositableParent())->GetCompositableHost();
}
// This function can in some cases fail and return false without it being a bug.
// This can theoretically happen if the ImageBridge sends frames before
// we created the layer tree. Since we can't enforce that the layer
// tree is already created before ImageBridge operates, there isn't much
// we can do about it, but in practice it is very rare.
// Typically when a tab with a video is dragged from a window to another,
// there can be a short time when the video is still sending frames
// asynchonously while the layer tree is not reconstructed. It's not a
// big deal.
// Note that Layers transactions do not need to call this because they always
// schedule the composition, in LayerManagerComposite::EndTransaction.
template<typename T>
bool ScheduleComposition(const T& op)
{
@ -133,7 +144,7 @@ CompositableParentManager::ReceiveCompositableUpdate(const CompositableOperation
op.textureId(), newBack));
}
if (shouldRecomposite) {
if (IsAsync() && shouldRecomposite) {
ScheduleComposition(op);
}
}
@ -221,8 +232,8 @@ CompositableParentManager::ReceiveCompositableUpdate(const CompositableOperation
MOZ_ASSERT(tex.get());
compositable->UseTextureHost(tex);
if (!ScheduleComposition(op)) {
NS_WARNING("could not find a compositor to schedule composition");
if (IsAsync()) {
ScheduleComposition(op);
}
break;
}

View File

@ -31,6 +31,12 @@ protected:
bool ReceiveCompositableUpdate(const CompositableOperation& aEdit,
EditReplyVector& replyv);
bool IsOnCompositorSide() const MOZ_OVERRIDE { return true; }
/**
* Return true if this protocol is asynchronous with respect to the content
* thread (ImageBridge for instance).
*/
virtual bool IsAsync() const { return false; }
};
} // namespace

View File

@ -61,6 +61,8 @@ public:
virtual bool RecvUpdate(const EditArray& aEdits, EditReplyArray* aReply);
virtual bool RecvUpdateNoSwap(const EditArray& aEdits);
virtual bool IsAsync() const MOZ_OVERRIDE { return true; }
PCompositableParent* AllocPCompositableParent(const TextureInfo& aInfo,
uint64_t*) MOZ_OVERRIDE;
bool DeallocPCompositableParent(PCompositableParent* aActor) MOZ_OVERRIDE;

View File

@ -11,7 +11,7 @@ EXPORTS += [
'yuv_row.h',
]
SOURCES += [
UNIFIED_SOURCES += [
'ycbcr_to_rgb565.cpp',
'yuv_convert.cpp',
'yuv_row_c.cpp',

View File

@ -10,7 +10,7 @@ XPIDL_SOURCES += [
XPIDL_MODULE = 'imgicon'
SOURCES += [
UNIFIED_SOURCES += [
'nsIconModule.cpp',
'nsIconProtocolHandler.cpp',
'nsIconURI.cpp',

View File

@ -25,7 +25,6 @@ namespace JS {
D(TOO_MUCH_MALLOC) \
D(ALLOC_TRIGGER) \
D(DEBUG_GC) \
D(DEBUG_MODE_GC) \
D(TRANSPLANT) \
D(RESET) \
D(OUT_OF_NURSERY) \

View File

@ -431,6 +431,12 @@ js::IsBuiltinEvalForScope(JSObject *scopeChain, const Value &v)
return scopeChain->global().getOriginalEval() == v;
}
bool
js::IsBuiltinEvalForScope(GlobalObject *global, const Value &v)
{
return global->getOriginalEval() == v;
}
bool
js::IsAnyBuiltinEval(JSFunction *fun)
{

View File

@ -38,6 +38,11 @@ DirectEvalFromIon(JSContext *cx,
extern bool
IsBuiltinEvalForScope(JSObject *scopeChain, const Value &v);
class GlobalObject;
extern bool
IsBuiltinEvalForScope(GlobalObject *global, const Value &v);
// True iff fun is a built-in eval function.
extern bool
IsAnyBuiltinEval(JSFunction *fun);

View File

@ -345,9 +345,6 @@ ifdef LIBXUL_LIBRARY
ifdef IS_COMPONENT
$(error IS_COMPONENT is set, but is not compatible with LIBXUL_LIBRARY)
endif
ifdef MODULE_NAME
$(error MODULE_NAME is $(MODULE_NAME) but MODULE_NAME and LIBXUL_LIBRARY are not compatible)
endif
FORCE_STATIC_LIB=1
endif

View File

@ -456,20 +456,6 @@ ifdef IS_COMPONENT
EXTRA_DSO_LDOPTS += $(MOZ_COMPONENTS_VERSION_SCRIPT_LDFLAGS)
endif # IS_COMPONENT
#
# Enforce the requirement that MODULE_NAME must be set
# for components in static builds
#
ifdef IS_COMPONENT
ifdef EXPORT_LIBRARY
ifndef FORCE_SHARED_LIB
ifndef MODULE_NAME
$(error MODULE_NAME is required for components which may be used in static builds)
endif
endif
endif
endif
#
# MacOS X specific stuff
#

View File

@ -672,15 +672,12 @@ dnl ========================================================
dnl = Mac OS X SDK support
dnl ========================================================
MACOS_SDK_DIR=
NEXT_ROOT=
MOZ_ARG_WITH_STRING(macos-sdk,
[ --with-macos-sdk=dir Location of platform SDK to use (Mac OS X only)],
MACOS_SDK_DIR=$withval)
dnl MACOS_SDK_DIR will be set to the SDK location whenever one is in use.
dnl NEXT_ROOT will be set and exported only if it's needed.
AC_SUBST(MACOS_SDK_DIR)
AC_SUBST(NEXT_ROOT)
if test "$MACOS_SDK_DIR"; then
dnl Sync this section with the ones in NSPR and NSS.

View File

@ -2127,6 +2127,9 @@ Parser<FullParseHandler>::functionArgsAndBody(ParseNode *pn, HandleFunction fun,
// Advance this parser over tokens processed by the syntax parser.
parser->tokenStream.tell(&position);
tokenStream.seek(position, parser->tokenStream);
// Update the end position of the parse node.
pn->pn_pos.end = tokenStream.currentToken().pos.end;
}
if (!addFreeVariablesFromLazyFunction(fun, pc))

View File

@ -226,13 +226,8 @@ Zone::discardJitCode(FreeOp *fop)
script->resetUseCount();
}
for (CompartmentsInZoneIter comp(this); !comp.done(); comp.next()) {
/* Free optimized baseline stubs. */
if (comp->jitCompartment())
comp->jitCompartment()->optimizedStubSpace()->free();
comp->types.clearCompilerOutputs(fop);
}
for (CompartmentsInZoneIter comp(this); !comp.done(); comp.next())
jit::FinishDiscardJitCode(fop, comp);
}
#endif
}

View File

@ -0,0 +1,19 @@
// Lazy scripts should correctly report line offsets
var g = newGlobal();
var dbg = new Debugger();
g.eval("// Header comment\n" + // <- line 6 in this file
"\n" +
"\n" +
"function f(n) {\n" + // <- line 9 in this file
" var foo = '!';\n" +
"}");
dbg.addDebuggee(g);
var scripts = dbg.findScripts();
for (var i = 0; i < scripts.length; i++) {
// Nothing should have offsets for the deffun on line 9 if lazy scripts
// correctly update the position.
assertEq(scripts[i].getLineOffsets(9).length, 0);
}

View File

@ -3881,7 +3881,7 @@ TryAttachGetElemStub(JSContext *cx, HandleScript script, jsbytecode *pc, ICGetEl
}
// Check for TypedArray[int] => Number accesses.
if (obj->is<TypedArrayObject>() && rhs.isInt32() && res.isNumber() &&
if (obj->is<TypedArrayObject>() && rhs.isNumber() && res.isNumber() &&
!TypedArrayGetElemStubExists(stub, obj))
{
// Don't attach CALLELEM stubs for accesses on typed array expected to yield numbers.
@ -3891,8 +3891,11 @@ TryAttachGetElemStub(JSContext *cx, HandleScript script, jsbytecode *pc, ICGetEl
#endif
Rooted<TypedArrayObject*> tarr(cx, &obj->as<TypedArrayObject>());
if (!cx->runtime()->jitSupportsFloatingPoint && TypedArrayRequiresFloatingPoint(tarr))
if (!cx->runtime()->jitSupportsFloatingPoint &&
(TypedArrayRequiresFloatingPoint(tarr) || rhs.isDouble()))
{
return true;
}
IonSpew(IonSpew_BaselineIC, " Generating GetElem(TypedArray[Int32]) stub");
ICGetElem_TypedArray::Compiler compiler(cx, tarr->lastProperty(), tarr->type());
@ -4502,7 +4505,6 @@ ICGetElem_TypedArray::Compiler::generateStubCode(MacroAssembler &masm)
{
Label failure;
masm.branchTestObject(Assembler::NotEqual, R0, &failure);
masm.branchTestInt32(Assembler::NotEqual, R1, &failure);
GeneralRegisterSet regs(availableGeneralRegs(2));
Register scratchReg = regs.takeAny();
@ -4512,6 +4514,24 @@ ICGetElem_TypedArray::Compiler::generateStubCode(MacroAssembler &masm)
masm.loadPtr(Address(BaselineStubReg, ICGetElem_TypedArray::offsetOfShape()), scratchReg);
masm.branchTestObjShape(Assembler::NotEqual, obj, scratchReg, &failure);
// Ensure the index is an integer.
if (cx->runtime()->jitSupportsFloatingPoint) {
Label isInt32;
masm.branchTestInt32(Assembler::Equal, R1, &isInt32);
{
// If the index is a double, try to convert it to int32. It's okay
// to convert -0 to 0: the shape check ensures the object is a typed
// array so the difference is not observable.
masm.branchTestDouble(Assembler::NotEqual, R1, &failure);
masm.unboxDouble(R1, FloatReg0);
masm.convertDoubleToInt32(FloatReg0, scratchReg, &failure, /* negZeroCheck = */false);
masm.tagValue(JSVAL_TYPE_INT32, scratchReg, R1);
}
masm.bind(&isInt32);
} else {
masm.branchTestInt32(Assembler::NotEqual, R1, &failure);
}
// Unbox key.
Register key = masm.extractInt32(R1, ExtractTemp1);
@ -4940,14 +4960,17 @@ DoSetElemFallback(JSContext *cx, BaselineFrame *frame, ICSetElem_Fallback *stub,
return true;
}
if (obj->is<TypedArrayObject>() && index.isInt32() && rhs.isNumber()) {
if (obj->is<TypedArrayObject>() && index.isNumber() && rhs.isNumber()) {
Rooted<TypedArrayObject*> tarr(cx, &obj->as<TypedArrayObject>());
if (!cx->runtime()->jitSupportsFloatingPoint && TypedArrayRequiresFloatingPoint(tarr))
if (!cx->runtime()->jitSupportsFloatingPoint &&
(TypedArrayRequiresFloatingPoint(tarr) || index.isDouble()))
{
return true;
}
uint32_t len = tarr->length();
int32_t idx = index.toInt32();
bool expectOutOfBounds = (idx < 0) || (static_cast<uint32_t>(idx) >= len);
double idx = index.toNumber();
bool expectOutOfBounds = (idx < 0 || idx >= double(len));
if (!TypedArraySetElemStubExists(stub, tarr, expectOutOfBounds)) {
// Remove any existing TypedArraySetElemStub that doesn't handle out-of-bounds
@ -5340,7 +5363,6 @@ ICSetElem_TypedArray::Compiler::generateStubCode(MacroAssembler &masm)
{
Label failure;
masm.branchTestObject(Assembler::NotEqual, R0, &failure);
masm.branchTestInt32(Assembler::NotEqual, R1, &failure);
GeneralRegisterSet regs(availableGeneralRegs(2));
Register scratchReg = regs.takeAny();
@ -5350,6 +5372,24 @@ ICSetElem_TypedArray::Compiler::generateStubCode(MacroAssembler &masm)
masm.loadPtr(Address(BaselineStubReg, ICSetElem_TypedArray::offsetOfShape()), scratchReg);
masm.branchTestObjShape(Assembler::NotEqual, obj, scratchReg, &failure);
// Ensure the index is an integer.
if (cx->runtime()->jitSupportsFloatingPoint) {
Label isInt32;
masm.branchTestInt32(Assembler::Equal, R1, &isInt32);
{
// If the index is a double, try to convert it to int32. It's okay
// to convert -0 to 0: the shape check ensures the object is a typed
// array so the difference is not observable.
masm.branchTestDouble(Assembler::NotEqual, R1, &failure);
masm.unboxDouble(R1, FloatReg0);
masm.convertDoubleToInt32(FloatReg0, scratchReg, &failure, /* negZeroCheck = */false);
masm.tagValue(JSVAL_TYPE_INT32, scratchReg, R1);
}
masm.bind(&isInt32);
} else {
masm.branchTestInt32(Assembler::NotEqual, R1, &failure);
}
// Unbox key.
Register key = masm.extractInt32(R1, ExtractTemp1);

View File

@ -15,7 +15,7 @@ namespace js {
namespace jit {
inline unsigned
StartArgSlot(JSScript *script, JSFunction *fun)
StartArgSlot(JSScript *script)
{
// Reserved slots:
// Slot 0: Scope chain.
@ -37,7 +37,7 @@ CountArgSlots(JSScript *script, JSFunction *fun)
// Slot x + n: Argument n.
// Note: when updating this, please also update the assert in SnapshotWriter::startFrame
return StartArgSlot(script, fun) + (fun ? fun->nargs + 1 : 0);
return StartArgSlot(script) + (fun ? fun->nargs + 1 : 0);
}
// Contains information about the compilation source for IR being generated.
@ -58,7 +58,7 @@ class CompileInfo
JS_ASSERT(fun_->isTenured());
}
nimplicit_ = StartArgSlot(script, fun) /* scope chain and argument obj */
nimplicit_ = StartArgSlot(script) /* scope chain and argument obj */
+ (fun ? 1 : 0); /* this */
nargs_ = fun ? fun->nargs : 0;
nlocals_ = script->nfixed;
@ -209,7 +209,7 @@ class CompileInfo
uint32_t startArgSlot() const {
JS_ASSERT(script());
return StartArgSlot(script(), fun());
return StartArgSlot(script());
}
uint32_t endArgSlot() const {
JS_ASSERT(script());

View File

@ -2376,15 +2376,20 @@ InvalidateActivation(FreeOp *fop, uint8_t *ionTop, bool invalidateAll)
IonSpew(IonSpew_Invalidate, "END invalidating activation");
}
static void
StopOffThreadCompilation(JSCompartment *comp)
{
if (!comp->jitCompartment())
return;
CancelOffThreadIonCompile(comp, nullptr);
FinishAllOffThreadCompilations(comp->jitCompartment());
}
void
jit::InvalidateAll(FreeOp *fop, Zone *zone)
{
for (CompartmentsInZoneIter comp(zone); !comp.done(); comp.next()) {
if (!comp->jitCompartment())
continue;
CancelOffThreadIonCompile(comp, nullptr);
FinishAllOffThreadCompilations(comp->jitCompartment());
}
for (CompartmentsInZoneIter comp(zone); !comp.done(); comp.next())
StopOffThreadCompilation(comp);
for (JitActivationIterator iter(fop->runtime()); !iter.done(); ++iter) {
if (iter.activation()->compartment()->zone() == zone) {
@ -2543,6 +2548,16 @@ jit::FinishInvalidation(FreeOp *fop, JSScript *script)
FinishInvalidationOf(fop, script, script->parallelIonScript(), true);
}
void
jit::FinishDiscardJitCode(FreeOp *fop, JSCompartment *comp)
{
// Free optimized baseline stubs.
if (comp->jitCompartment())
comp->jitCompartment()->optimizedStubSpace()->free();
comp->types.clearCompilerOutputs(fop);
}
void
jit::MarkValueFromIon(JSRuntime *rt, Value *vp)
{
@ -2731,3 +2746,62 @@ jit::TraceIonScripts(JSTracer* trc, JSScript *script)
if (script->hasBaselineScript())
jit::BaselineScript::Trace(trc, script->baselineScript());
}
AutoDebugModeInvalidation::~AutoDebugModeInvalidation()
{
MOZ_ASSERT(!!comp_ != !!zone_);
if (needInvalidation_ == NoNeed)
return;
// Invalidate the stack if any compartments toggled from on->off, because
// we allow scripts to be on stack when turning off debug mode.
bool invalidateStack = needInvalidation_ == ToggledOff;
Zone *zone = zone_ ? zone_ : comp_->zone();
JSRuntime *rt = zone->runtimeFromMainThread();
FreeOp *fop = rt->defaultFreeOp();
if (comp_) {
StopOffThreadCompilation(comp_);
} else {
for (CompartmentsInZoneIter comp(zone_); !comp.done(); comp.next())
StopOffThreadCompilation(comp);
}
if (invalidateStack) {
jit::MarkActiveBaselineScripts(zone);
for (JitActivationIterator iter(rt); !iter.done(); ++iter) {
JSCompartment *comp = iter.activation()->compartment();
if ((comp_ && comp_ == comp) ||
(zone_ && zone_ == comp->zone() && comp->principals))
{
IonContext ictx(CompileRuntime::get(rt));
AutoFlushCache afc("AutoDebugModeInvalidation", rt->jitRuntime());
IonSpew(IonSpew_Invalidate, "Invalidating frames for debug mode toggle");
InvalidateActivation(fop, iter.jitTop(), true);
}
}
}
for (gc::CellIter i(zone, gc::FINALIZE_SCRIPT); !i.done(); i.next()) {
JSScript *script = i.get<JSScript>();
if ((comp_ && script->compartment() == comp_) ||
(zone_ && script->compartment()->principals))
{
FinishInvalidation(fop, script);
FinishDiscardBaselineScript(fop, script);
// script->clearAnalysis();
script->resetUseCount();
} else if (script->hasBaselineScript()) {
script->baselineScript()->resetActive();
}
}
if (comp_) {
FinishDiscardJitCode(fop, comp_);
} else {
for (CompartmentsInZoneIter comp(zone_); !comp.done(); comp.next())
FinishDiscardJitCode(fop, comp);
}
}

View File

@ -281,11 +281,6 @@ IonBuilder::canInlineTarget(JSFunction *target, CallInfo &callInfo)
return false;
}
if (target->getParent() != &script()->global()) {
IonSpew(IonSpew_Inlining, "Cannot inline due to scope mismatch");
return false;
}
// Allow constructing lazy scripts when performing the definite properties
// analysis, as baseline has not been used to warm the caller up yet.
if (target->isInterpreted() && info().executionMode() == DefinitePropertiesAnalysis) {
@ -4562,8 +4557,8 @@ IonBuilder::createCallObject(MDefinition *callee, MDefinition *scope)
// If the CallObject needs dynamic slots, allocate those now.
MInstruction *slots;
if (templateObj->hasDynamicSlots()) {
size_t nslots = JSObject::dynamicSlotsCount(templateObj->numFixedSlots(),
templateObj->slotSpan());
size_t nslots = JSObject::dynamicSlotsCount(templateObj->numFixedSlotsForCompilation(),
templateObj->lastProperty()->slotSpan(templateObj->getClass()));
slots = MNewSlots::New(alloc(), nslots);
} else {
slots = MConstant::New(alloc(), NullValue());
@ -4592,8 +4587,8 @@ IonBuilder::createCallObject(MDefinition *callee, MDefinition *scope)
unsigned slot = i.scopeSlot();
unsigned formal = i.frameIndex();
MDefinition *param = current->getSlot(info().argSlotUnchecked(formal));
if (slot >= templateObj->numFixedSlots())
current->add(MStoreSlot::New(alloc(), slots, slot - templateObj->numFixedSlots(), param));
if (slot >= templateObj->numFixedSlotsForCompilation())
current->add(MStoreSlot::New(alloc(), slots, slot - templateObj->numFixedSlotsForCompilation(), param));
else
current->add(MStoreFixedSlot::New(alloc(), callObj, slot, param));
}
@ -4658,15 +4653,14 @@ IonBuilder::createThisScriptedSingleton(JSFunction *target, MDefinition *callee)
if (!proto)
return nullptr;
if (!target->nonLazyScript()->types)
return nullptr;
JSObject *templateObject = inspector->getTemplateObject(pc);
if (!templateObject || !templateObject->is<JSObject>())
return nullptr;
if (templateObject->getProto() != proto)
return nullptr;
if (!target->nonLazyScript()->types)
return nullptr;
if (!types::TypeScript::ThisTypes(target->nonLazyScript())->hasType(types::Type::ObjectType(templateObject)))
return nullptr;
@ -5307,9 +5301,9 @@ IonBuilder::jsop_eval(uint32_t argc)
string->getOperand(1)->isConstant() &&
string->getOperand(1)->toConstant()->value().isString())
{
JSString *str = string->getOperand(1)->toConstant()->value().toString();
JSAtom *atom = &string->getOperand(1)->toConstant()->value().toString()->asAtom();
if (str->isLinear() && StringEqualsAscii(&str->asLinear(), "()")) {
if (StringEqualsAscii(atom, "()")) {
MDefinition *name = string->getOperand(0);
MInstruction *dynamicName = MGetDynamicName::New(alloc(), scopeChain, name);
current->add(dynamicName);
@ -5487,7 +5481,7 @@ IonBuilder::jsop_initprop(PropertyName *name)
JSObject *templateObject = obj->toNewObject()->templateObject();
Shape *shape = templateObject->nativeLookupPure(name);
Shape *shape = templateObject->lastProperty()->searchLinear(NameToId(name));
if (!shape) {
// JSOP_NEWINIT becomes an MNewObject without preconfigured properties.
@ -6327,9 +6321,6 @@ IonBuilder::setStaticName(JSObject *staticObject, PropertyName *name)
MDefinition *value = current->peek(-1);
if (staticObject->watched())
return jsop_setprop(name);
types::TypeObjectKey *staticType = types::TypeObjectKey::get(staticObject);
if (staticType->unknownProperties())
return jsop_setprop(name);
@ -6734,7 +6725,7 @@ IonBuilder::getElemTryTypedStatic(bool *emitted, MDefinition *obj, MDefinition *
return true;
TypedArrayObject *tarr = &tarrObj->as<TypedArrayObject>();
ArrayBufferView::ViewType viewType = JS_GetArrayBufferViewType(tarr);
ArrayBufferView::ViewType viewType = (ArrayBufferView::ViewType) tarr->type();
// LoadTypedArrayElementStatic currently treats uint32 arrays as int32.
if (viewType == ArrayBufferView::TYPE_UINT32)
@ -7291,7 +7282,7 @@ IonBuilder::setElemTryTypedStatic(bool *emitted, MDefinition *object,
return true;
TypedArrayObject *tarr = &tarrObj->as<TypedArrayObject>();
ArrayBufferView::ViewType viewType = JS_GetArrayBufferViewType(tarr);
ArrayBufferView::ViewType viewType = (ArrayBufferView::ViewType) tarr->type();
MDefinition *ptr = convertShiftToMaskForStaticTypedArray(index, viewType);
if (!ptr)
@ -8031,9 +8022,6 @@ bool
IonBuilder::loadSlot(MDefinition *obj, Shape *shape, MIRType rvalType,
bool barrier, types::TemporaryTypeSet *types)
{
JS_ASSERT(shape->hasDefaultGetter());
JS_ASSERT(shape->hasSlot());
return loadSlot(obj, shape->slot(), shape->numFixedSlots(), rvalType, barrier, types);
}
@ -8068,10 +8056,7 @@ bool
IonBuilder::storeSlot(MDefinition *obj, Shape *shape, MDefinition *value, bool needsBarrier,
MIRType slotType /* = MIRType_None */)
{
JS_ASSERT(shape->hasDefaultSetter());
JS_ASSERT(shape->writable());
JS_ASSERT(shape->hasSlot());
return storeSlot(obj, shape->slot(), shape->numFixedSlots(), value, needsBarrier, slotType);
}
@ -8935,11 +8920,6 @@ IonBuilder::jsop_delelem()
bool
IonBuilder::jsop_regexp(RegExpObject *reobj)
{
JSObject *prototype = reobj->getProto();
JS_ASSERT(prototype == script()->global().maybeGetRegExpPrototype());
JS_ASSERT(&reobj->JSObject::global() == &script()->global());
// JS semantics require regular expression literals to create different
// objects every time they execute. We only need to do this cloning if the
// script could actually observe the effect of such cloning, for instance
@ -8962,6 +8942,8 @@ IonBuilder::jsop_regexp(RegExpObject *reobj)
mustClone = false;
}
JSObject *prototype = reobj->getProto();
MRegExp *regexp = MRegExp::New(alloc(), reobj, prototype, mustClone);
current->add(regexp);
current->push(regexp);

View File

@ -685,7 +685,6 @@ MacroAssembler::newGCThing(const Register &result, JSObject *templateObject, Lab
{
gc::AllocKind allocKind = templateObject->tenuredGetAllocKind();
JS_ASSERT(allocKind >= gc::FINALIZE_OBJECT0 && allocKind <= gc::FINALIZE_OBJECT_LAST);
JS_ASSERT(!templateObject->hasDynamicElements());
gc::InitialHeap initialHeap = templateObject->type()->initialHeapForJITAlloc();
newGCThing(result, allocKind, fail, initialHeap);
@ -758,7 +757,6 @@ MacroAssembler::newGCThingPar(const Register &result, const Register &slice,
{
gc::AllocKind allocKind = templateObject->tenuredGetAllocKind();
JS_ASSERT(allocKind >= gc::FINALIZE_OBJECT0 && allocKind <= gc::FINALIZE_OBJECT_LAST);
JS_ASSERT(!templateObject->hasDynamicElements());
newGCThingPar(result, slice, tempReg1, tempReg2, allocKind, fail);
}
@ -784,6 +782,8 @@ MacroAssembler::initGCThing(const Register &obj, JSObject *templateObject)
{
// Fast initialization of an empty object returned by NewGCThing().
JS_ASSERT(!templateObject->hasDynamicElements());
storePtr(ImmGCPtr(templateObject->lastProperty()), Address(obj, JSObject::offsetOfShape()));
storePtr(ImmGCPtr(templateObject->type()), Address(obj, JSObject::offsetOfType()));
storePtr(ImmPtr(nullptr), Address(obj, JSObject::offsetOfSlots()));
@ -813,7 +813,8 @@ MacroAssembler::initGCThing(const Register &obj, JSObject *templateObject)
// Fixed slots of non-array objects are required to be initialized.
// Use the values currently in the template object.
size_t nslots = Min(templateObject->numFixedSlots(), templateObject->slotSpan());
size_t nslots = Min(templateObject->numFixedSlotsForCompilation(),
templateObject->lastProperty()->slotSpan(templateObject->getClass()));
for (unsigned i = 0; i < nslots; i++) {
storeValue(templateObject->getFixedSlot(i),
Address(obj, JSObject::getFixedSlotOffset(i)));

View File

@ -440,6 +440,7 @@ class JitCompartment
// Called from JSCompartment::discardJitCode().
void InvalidateAll(FreeOp *fop, JS::Zone *zone);
void FinishInvalidation(FreeOp *fop, JSScript *script);
void FinishDiscardJitCode(FreeOp *fop, JSCompartment *comp);
// On windows systems, really large frames need to be incrementally touched.
// The following constant defines the minimum increment of the touch.

View File

@ -457,11 +457,8 @@ IonBuilder::inlineArrayConcat(CallInfo &callInfo)
if (!baseThisType)
return InliningStatus_NotInlined;
types::TypeObjectKey *thisType = types::TypeObjectKey::get(baseThisType);
if (thisType->unknownProperties() ||
&thisType->proto().toObject()->global() != &script()->global())
{
if (thisType->unknownProperties())
return InliningStatus_NotInlined;
}
// Don't inline if 'this' is packed and the argument may not be packed
// (the result array will reuse the 'this' type).

View File

@ -2319,10 +2319,8 @@ MCompare::evaluateConstantOperands(bool *result)
// Fold away some String equality comparisons.
if (lhs.isString() && rhs.isString()) {
int32_t comp = 0; // Default to equal.
if (left != right) {
if (!CompareStrings(GetIonContext()->cx, lhs.toString(), rhs.toString(), &comp))
return false;
}
if (left != right)
comp = CompareAtoms(&lhs.toString()->asAtom(), &rhs.toString()->asAtom());
switch (jsop_) {
case JSOP_LT:
@ -2928,7 +2926,7 @@ jit::PropertyReadNeedsTypeBarrier(JSContext *propertycx,
JSObject *obj = object->singleton() ? object->singleton() : object->proto().toObjectOrNull();
while (obj) {
if (!obj->isNative())
if (!obj->getClass()->isNative())
break;
types::TypeObjectKey *typeObj = types::TypeObjectKey::get(obj);

View File

@ -5964,7 +5964,9 @@ class MLoadTypedArrayElementStatic
return new(alloc) MLoadTypedArrayElementStatic(typedArray, ptr);
}
ArrayBufferView::ViewType viewType() const { return JS_GetArrayBufferViewType(typedArray_); }
ArrayBufferView::ViewType viewType() const {
return (ArrayBufferView::ViewType) typedArray_->type();
}
void *base() const;
size_t length() const;
@ -6146,7 +6148,9 @@ class MStoreTypedArrayElementStatic :
return this;
}
ArrayBufferView::ViewType viewType() const { return JS_GetArrayBufferViewType(typedArray_); }
ArrayBufferView::ViewType viewType() const {
return (ArrayBufferView::ViewType) typedArray_->type();
}
bool isFloatArray() const {
return (viewType() == ArrayBufferView::TYPE_FLOAT32 ||
viewType() == ArrayBufferView::TYPE_FLOAT64);

View File

@ -258,9 +258,9 @@ CompareStringsPar(ForkJoinSlice *slice, JSString *left, JSString *right, int32_t
if (!leftInspector.ensureChars(slice) || !rightInspector.ensureChars(slice))
return false;
return CompareChars(leftInspector.chars(), left->length(),
rightInspector.chars(), right->length(),
res);
*res = CompareChars(leftInspector.chars(), left->length(),
rightInspector.chars(), right->length());
return true;
}
static bool

View File

@ -306,7 +306,7 @@ SnapshotWriter::startFrame(JSFunction *fun, JSScript *script, jsbytecode *pc, ui
// +4 to account for scope chain, return value, this value and maybe arguments_object.
JS_ASSERT(CountArgSlots(script, fun) < SNAPSHOT_MAX_NARGS + 4);
uint32_t implicit = StartArgSlot(script, fun);
uint32_t implicit = StartArgSlot(script);
uint32_t formalArgs = CountArgSlots(script, fun);
nslots_ = formalArgs + script->nfixed + exprStack;

View File

@ -6,7 +6,7 @@
PROGRAM = 'jsapi-tests'
SOURCES += [
UNIFIED_SOURCES += [
'selfTest.cpp',
'testAddPropertyPropcache.cpp',
'testArgumentsObject.cpp',

View File

@ -7,22 +7,19 @@
#include "jsapi-tests/tests.h"
/* Do the test a bunch of times, because sometimes we seem to randomly
miss the propcache */
static const int expectedCount = 100;
static int callCount = 0;
static bool
addProperty(JSContext *cx, JS::HandleObject obj, JS::HandleId id, JS::MutableHandleValue vp)
AddProperty(JSContext *cx, JS::HandleObject obj, JS::HandleId id, JS::MutableHandleValue vp)
{
callCount++;
return true;
callCount++;
return true;
}
const JSClass addPropertyClass = {
static const JSClass AddPropertyClass = {
"AddPropertyTester",
0,
addProperty,
AddProperty,
JS_DeletePropertyStub, /* delProperty */
JS_PropertyStub, /* getProperty */
JS_StrictPropertyStub, /* setProperty */
@ -33,10 +30,16 @@ const JSClass addPropertyClass = {
BEGIN_TEST(testAddPropertyHook)
{
/*
* Do the test a bunch of times, because sometimes we seem to randomly
* miss the propcache.
*/
static const int ExpectedCount = 100;
JS::RootedObject obj(cx, JS_NewObject(cx, nullptr, nullptr, nullptr));
CHECK(obj);
JS::RootedValue proto(cx, OBJECT_TO_JSVAL(obj));
JS_InitClass(cx, global, obj, &addPropertyClass, nullptr, 0, nullptr, nullptr, nullptr,
JS_InitClass(cx, global, obj, &AddPropertyClass, nullptr, 0, nullptr, nullptr, nullptr,
nullptr);
obj = JS_NewArrayObject(cx, 0, nullptr);
@ -47,8 +50,8 @@ BEGIN_TEST(testAddPropertyHook)
JS_PropertyStub, JS_StrictPropertyStub,
JSPROP_ENUMERATE));
for (int i = 0; i < expectedCount; ++i) {
obj = JS_NewObject(cx, &addPropertyClass, nullptr, nullptr);
for (int i = 0; i < ExpectedCount; ++i) {
obj = JS_NewObject(cx, &AddPropertyClass, nullptr, nullptr);
CHECK(obj);
JS::RootedValue vobj(cx, OBJECT_TO_JSVAL(obj));
JS::RootedObject arrObj(cx, JSVAL_TO_OBJECT(arr));
@ -64,7 +67,7 @@ BEGIN_TEST(testAddPropertyHook)
" arr[i].prop = 42; \n"
);
CHECK(callCount == expectedCount);
CHECK(callCount == ExpectedCount);
return true;
}

View File

@ -34,16 +34,6 @@ static const char STRICT_THREE[] =
static const char * const CALL_CODES[] =
{ "f()", "f(0)", "f(0, 1)", "f(0, 1, 2)", "f(0, 1, 2, 3)", "f(0, 1, 2, 3, 4)" };
static const size_t MAX_ELEMS = 6;
static void
ClearElements(Value elems[MAX_ELEMS])
{
for (size_t i = 0; i < MAX_ELEMS - 1; i++)
elems[i] = NullValue();
elems[MAX_ELEMS - 1] = Int32Value(42);
}
BEGIN_TEST(testArgumentsObject)
{
return ExhaustiveTest<0>(NORMAL_ZERO) &&
@ -84,6 +74,8 @@ BEGIN_TEST(testArgumentsObject)
ExhaustiveTest<5>(STRICT_THREE);
}
static const size_t MAX_ELEMS = 6;
template<size_t ArgCount> bool
ExhaustiveTest(const char funcode[])
{
@ -109,4 +101,12 @@ ExhaustiveTest(const char funcode[])
return true;
}
static void
ClearElements(Value elems[MAX_ELEMS])
{
for (size_t i = 0; i < MAX_ELEMS - 1; i++)
elems[i] = NullValue();
elems[MAX_ELEMS - 1] = Int32Value(42);
}
END_TEST(testArgumentsObject)

View File

@ -6,12 +6,12 @@
#include "jsapi-tests/tests.h"
#define NUM_TEST_BUFFERS 2
#define MAGIC_VALUE_1 3
#define MAGIC_VALUE_2 17
BEGIN_TEST(testArrayBuffer_bug720949_steal)
{
static const unsigned NUM_TEST_BUFFERS = 2;
static const unsigned MAGIC_VALUE_1 = 3;
static const unsigned MAGIC_VALUE_2 = 17;
JS::RootedObject buf_len1(cx), buf_len200(cx);
JS::RootedObject tarray_len1(cx), tarray_len200(cx);
@ -92,12 +92,6 @@ BEGIN_TEST(testArrayBuffer_bug720949_steal)
}
END_TEST(testArrayBuffer_bug720949_steal)
static void GC(JSContext *cx)
{
JS_GC(JS_GetRuntime(cx));
JS_GC(JS_GetRuntime(cx)); // Trigger another to wait for background finalization to end
}
// Varying number of views of a buffer, to test the neutering weak pointers
BEGIN_TEST(testArrayBuffer_bug720949_viewList)
{
@ -162,6 +156,12 @@ BEGIN_TEST(testArrayBuffer_bug720949_viewList)
return true;
}
static void GC(JSContext *cx)
{
JS_GC(JS_GetRuntime(cx));
JS_GC(JS_GetRuntime(cx)); // Trigger another to wait for background finalization to end
}
bool isNeutered(JS::HandleObject obj) {
JS::RootedValue v(cx);
return JS_GetProperty(cx, obj, "byteLength", &v) && v.toInt32() == 0;

View File

@ -6,11 +6,11 @@
#include "jsapi-tests/tests.h"
JSPrincipals system_principals = {
static JSPrincipals system_principals = {
1
};
const JSClass global_class = {
static const JSClass global_class = {
"global",
JSCLASS_IS_GLOBAL | JSCLASS_GLOBAL_FLAGS,
JS_PropertyStub,
@ -22,10 +22,10 @@ const JSClass global_class = {
JS_ConvertStub
};
JSObject *trusted_glob = nullptr;
JSObject *trusted_fun = nullptr;
static JSObject *trusted_glob = nullptr;
static JSObject *trusted_fun = nullptr;
bool
static bool
CallTrusted(JSContext *cx, unsigned argc, jsval *vp)
{
if (!JS_SaveFrameChain(cx))

View File

@ -9,8 +9,8 @@
#include "jsapi-tests/tests.h"
int called_test_fn;
int called_test_prop_get;
static int called_test_fn;
static int called_test_prop_get;
static bool test_prop_get( JSContext *cx, JS::HandleObject obj, JS::HandleId id, JS::MutableHandleValue vp )
{

View File

@ -50,7 +50,7 @@ BEGIN_TEST(test_cloneScript)
}
END_TEST(test_cloneScript)
void
static void
DestroyPrincipals(JSPrincipals *principals)
{
delete principals;

View File

@ -60,7 +60,6 @@ bool checkObjectFields(JSObject *savedCopy, JSObject *obj)
{
/* Ignore fields which are unstable across GCs. */
CHECK(savedCopy->lastProperty() == obj->lastProperty());
CHECK(savedCopy->getProto() == obj->getProto());
return true;
}

View File

@ -5,14 +5,14 @@
#include "js/Class.h"
#include "jsapi-tests/tests.h"
int count = 0;
static int iterCount = 0;
static bool
IterNext(JSContext *cx, unsigned argc, jsval *vp)
{
if (count++ == 100)
if (iterCount++ == 100)
return JS_ThrowStopIteration(cx);
JS_SET_RVAL(cx, vp, INT_TO_JSVAL(count));
JS_SET_RVAL(cx, vp, INT_TO_JSVAL(iterCount));
return true;
}
@ -51,7 +51,7 @@ const js::Class HasCustomIterClass = {
}
};
bool
static bool
IterClassConstructor(JSContext *cx, unsigned argc, jsval *vp)
{
JSObject *obj = JS_NewObjectForConstructor(cx, Jsvalify(&HasCustomIterClass), vp);
@ -74,7 +74,7 @@ BEGIN_TEST(testCustomIterator_bug612523)
CHECK(JSVAL_IS_INT(result));
CHECK_EQUAL(JSVAL_TO_INT(result), 100);
CHECK_EQUAL(count, 101);
CHECK_EQUAL(iterCount, 101);
return true;
}

View File

@ -10,13 +10,13 @@
#include "js/OldDebugAPI.h"
#include "jsapi-tests/tests.h"
static int callCount[2] = {0, 0};
static int callCounts[2] = {0, 0};
static void *
callCountHook(JSContext *cx, JSAbstractFramePtr frame, bool isConstructing, bool before,
bool *ok, void *closure)
{
callCount[before]++;
callCounts[before]++;
JS::RootedValue thisv(cx);
frame.getThisValue(cx, &thisv); // assert if fp is incomplete
@ -32,8 +32,8 @@ BEGIN_TEST(testDebugger_bug519719)
"function f(g) { for (var i = 0; i < 9; i++) call(g); }\n"
"f(Math.sin);\n" // record loop, starting in f
"f(Math.cos);\n"); // side exit in f -> call
CHECK_EQUAL(callCount[0], 20);
CHECK_EQUAL(callCount[1], 20);
CHECK_EQUAL(callCounts[0], 20);
CHECK_EQUAL(callCounts[1], 20);
return true;
}
END_TEST(testDebugger_bug519719)
@ -112,13 +112,13 @@ BEGIN_TEST(testDebugger_getThisStrict)
}
END_TEST(testDebugger_getThisStrict)
bool called = false;
static bool calledThrowHook = false;
static JSTrapStatus
ThrowHook(JSContext *cx, JSScript *, jsbytecode *, jsval *rval, void *closure)
{
JS_ASSERT(!closure);
called = true;
calledThrowHook = true;
JS::RootedObject global(cx, JS::CurrentGlobalOrNull(cx));
@ -140,7 +140,7 @@ BEGIN_TEST(testDebugger_throwHook)
" foo(); \n"
" } catch(e) {}\n"
"}\n");
CHECK(called);
CHECK(calledThrowHook);
CHECK(JS_SetThrowHook(rt, nullptr, nullptr));
return true;
}

View File

@ -8,26 +8,26 @@
#include "jsapi-tests/tests.h"
static bool
native(JSContext *cx, unsigned argc, jsval *vp)
NativeGetterSetter(JSContext *cx, unsigned argc, jsval *vp)
{
return true;
}
static const char PROPERTY_NAME[] = "foo";
BEGIN_TEST(testDefineGetterSetterNonEnumerable)
{
static const char PROPERTY_NAME[] = "foo";
JS::RootedValue vobj(cx);
JS::RootedObject obj(cx, JS_NewObject(cx, nullptr, nullptr, nullptr));
CHECK(obj);
vobj = OBJECT_TO_JSVAL(obj);
JSFunction *funGet = JS_NewFunction(cx, native, 0, 0, nullptr, "get");
JSFunction *funGet = JS_NewFunction(cx, NativeGetterSetter, 0, 0, nullptr, "get");
CHECK(funGet);
JS::RootedObject funGetObj(cx, JS_GetFunctionObject(funGet));
JS::RootedValue vget(cx, OBJECT_TO_JSVAL(funGetObj));
JSFunction *funSet = JS_NewFunction(cx, native, 1, 0, nullptr, "set");
JSFunction *funSet = JS_NewFunction(cx, NativeGetterSetter, 1, 0, nullptr, "set");
CHECK(funSet);
JS::RootedObject funSetObj(cx, JS_GetFunctionObject(funSet));
JS::RootedValue vset(cx, OBJECT_TO_JSVAL(funSetObj));

View File

@ -14,14 +14,14 @@
using namespace js;
JSScript *found = nullptr;
static JSScript *foundScript = nullptr;
bool
static bool
CheckEnclosing(JSContext *cx, unsigned argc, Value *vp)
{
CallArgs args = CallArgsFromVp(argc, vp);
found = js::GetOutermostEnclosingFunctionOfScriptedCaller(cx);
foundScript = js::GetOutermostEnclosingFunctionOfScriptedCaller(cx);
args.rval().set(UndefinedValue());
return true;
@ -32,7 +32,7 @@ BEGIN_TEST(test_enclosingFunction)
CHECK(JS_DefineFunction(cx, global, "checkEnclosing", CheckEnclosing, 0, 0));
EXEC("checkEnclosing()");
CHECK(found == nullptr);
CHECK(foundScript == nullptr);
RootedFunction fun(cx);
@ -44,21 +44,21 @@ BEGIN_TEST(test_enclosingFunction)
strlen(s1chars), options);
CHECK(fun);
EXEC("s1()");
CHECK(found == JS_GetFunctionScript(cx, fun));
CHECK(foundScript == JS_GetFunctionScript(cx, fun));
const char s2chars[] = "return function() { checkEnclosing() }";
fun = JS_CompileFunction(cx, global, "s2", 0, nullptr, s2chars,
strlen(s2chars), options);
CHECK(fun);
EXEC("s2()()");
CHECK(found == JS_GetFunctionScript(cx, fun));
CHECK(foundScript == JS_GetFunctionScript(cx, fun));
const char s3chars[] = "return function() { let (x) { function g() { checkEnclosing() } return g() } }";
fun = JS_CompileFunction(cx, global, "s3", 0, nullptr, s3chars,
strlen(s3chars), options);
CHECK(fun);
EXEC("s3()()");
CHECK(found == JS_GetFunctionScript(cx, fun));
CHECK(foundScript == JS_GetFunctionScript(cx, fun));
return true;
}

View File

@ -12,12 +12,6 @@
static uint32_t column = 0;
static void
my_ErrorReporter(JSContext *cx, const char *message, JSErrorReport *report)
{
column = report->column;
}
BEGIN_TEST(testErrorCopying_columnCopied)
{
//0 1 2
@ -30,4 +24,11 @@ BEGIN_TEST(testErrorCopying_columnCopied)
CHECK(column == 27);
return true;
}
static void
my_ErrorReporter(JSContext *cx, const char *message, JSErrorReport *report)
{
column = report->column;
}
END_TEST(testErrorCopying_columnCopied)

View File

@ -4,21 +4,11 @@
#include "jsapi-tests/tests.h"
const unsigned BufferSize = 20;
static const unsigned BufferSize = 20;
static unsigned FinalizeCalls = 0;
static JSFinalizeStatus StatusBuffer[BufferSize];
static bool IsCompartmentGCBuffer[BufferSize];
static void
FinalizeCallback(JSFreeOp *fop, JSFinalizeStatus status, bool isCompartmentGC)
{
if (FinalizeCalls < BufferSize) {
StatusBuffer[FinalizeCalls] = status;
IsCompartmentGCBuffer[FinalizeCalls] = isCompartmentGC;
}
++FinalizeCalls;
}
BEGIN_TEST(testGCFinalizeCallback)
{
JS_SetGCParameter(rt, JSGC_MODE, JSGC_MODE_INCREMENTAL);
@ -171,4 +161,13 @@ bool checkFinalizeIsCompartmentGC(bool isCompartmentGC)
return true;
}
static void
FinalizeCallback(JSFreeOp *fop, JSFinalizeStatus status, bool isCompartmentGC)
{
if (FinalizeCalls < BufferSize) {
StatusBuffer[FinalizeCalls] = status;
IsCompartmentGCBuffer[FinalizeCalls] = isCompartmentGC;
}
++FinalizeCalls;
}
END_TEST(testGCFinalizeCallback)

View File

@ -16,12 +16,6 @@
using mozilla::ArrayLength;
template<size_t N> JSFlatString *
NewString(JSContext *cx, const jschar (&chars)[N])
{
return js_NewStringCopyN<js::CanGC>(cx, chars, N);
}
static const struct TestPair {
uint32_t num;
const char *expected;
@ -113,4 +107,11 @@ BEGIN_TEST(testStringToPropertyName)
return true;
}
template<size_t N> static JSFlatString *
NewString(JSContext *cx, const jschar (&chars)[N])
{
return js_NewStringCopyN<js::CanGC>(cx, chars, N);
}
END_TEST(testStringToPropertyName)

View File

@ -28,13 +28,6 @@ struct StringWrapperStruct
bool strOk;
} sw;
void
FinalizeCallback(JSFreeOp *fop, JSFinalizeStatus status, bool isCompartmentGC)
{
if (status == JSFINALIZE_GROUP_START)
sw.strOk = js::gc::IsStringMarked(&sw.str);
}
BEGIN_TEST(testInternAcrossGC)
{
sw.str = JS_InternString(cx, "wrapped chars that another test shouldn't be using");
@ -45,4 +38,11 @@ BEGIN_TEST(testInternAcrossGC)
CHECK(sw.strOk);
return true;
}
static void
FinalizeCallback(JSFreeOp *fop, JSFinalizeStatus status, bool isCompartmentGC)
{
if (status == JSFINALIZE_GROUP_START)
sw.strOk = js::gc::IsStringMarked(&sw.str);
}
END_TEST(testInternAcrossGC)

View File

@ -7,9 +7,6 @@
#include "jsapi-tests/tests.h"
const size_t N = 1000;
static jsval argv[N];
static bool
constructHook(JSContext *cx, unsigned argc, jsval *vp)
{
@ -56,6 +53,9 @@ constructHook(JSContext *cx, unsigned argc, jsval *vp)
BEGIN_TEST(testNewObject_1)
{
static const size_t N = 1000;
jsval argv[N];
// Root the global argv test array. Only the first 2 entries really need to
// be rooted, since we're only putting integers in the rest.
CHECK(JS_AddNamedValueRoot(cx, &argv[0], "argv0"));

Some files were not shown because too many files have changed in this diff Show More