merge mozilla-central to fx-team

This commit is contained in:
Carsten "Tomcat" Book 2013-11-05 15:52:56 +01:00
Родитель 8af62f2f10 3f9b93be91
Коммит cffda8a9da
45 изменённых файлов: 612 добавлений и 314 удалений

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

@ -1,4 +1,4 @@
{
"revision": "e9d3946c6e4c26c60f67b8efac40e14785b634d3",
"revision": "9c89bc252dca005ec14f54d6d8524b44917322b2",
"repo_path": "/integration/gaia-central"
}

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

@ -2079,8 +2079,11 @@ ia64*-hpux*)
if test "$_CC_SUITE" -ge "12"; then
dnl VS2013+ requires -FS when parallel building by make -jN.
dnl If nothing, compiler sometimes causes C1041 error.
CFLAGS="$CFLAGS -FS"
CXXFLAGS="$CXXFLAGS -FS"
dnl
dnl Visual Studio 2013 supports -Gw flags
dnl http://blogs.msdn.com/b/vcblog/archive/2013/09/11/introducing-gw-compiler-switch.aspx
CFLAGS="$CFLAGS -FS -Gw"
CXXFLAGS="$CXXFLAGS -FS -Gw"
fi
# khuey says we can safely ignore MSVC warning C4251
# MSVC warning C4244 (implicit type conversion may lose data) warns
@ -3664,7 +3667,7 @@ MOZ_ARG_WITH_BOOL(system-nss,
_USE_SYSTEM_NSS=1 )
if test -n "$_USE_SYSTEM_NSS"; then
AM_PATH_NSS(3.15, [MOZ_NATIVE_NSS=1], [AC_MSG_ERROR([you don't have NSS installed or your version is too old])])
AM_PATH_NSS(3.15.3, [MOZ_NATIVE_NSS=1], [AC_MSG_ERROR([you don't have NSS installed or your version is too old])])
fi
if test -n "$MOZ_NATIVE_NSS"; then

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

@ -1307,8 +1307,6 @@ void MediaDecoderStateMachine::StopPlayback()
{
LOG(PR_LOG_DEBUG, ("%p StopPlayback()", mDecoder.get()));
NS_ASSERTION(OnStateMachineThread() || OnDecodeThread(),
"Should be on state machine thread or the decoder thread.");
mDecoder->GetReentrantMonitor().AssertCurrentThreadIn();
mDecoder->NotifyPlaybackStopped();

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

@ -503,13 +503,11 @@ private:
void AudioLoop();
// Sets internal state which causes playback of media to pause.
// The decoder monitor must be held. Called on the state machine,
// and decode threads.
// The decoder monitor must be held.
void StopPlayback();
// Sets internal state which causes playback of media to begin or resume.
// Must be called with the decode monitor held. Called on the state machine
// and decode threads.
// Must be called with the decode monitor held.
void StartPlayback();
// Moves the decoder into decoding state. Called on the state machine

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

@ -1413,28 +1413,6 @@ private:
bool mSizeInitialized;
};
class LoadedEvent : public nsRunnable
{
public:
LoadedEvent(MediaDecoder* aDecoder) :
mDecoder(aDecoder)
{
MOZ_COUNT_CTOR(LoadedEvent);
}
~LoadedEvent()
{
MOZ_COUNT_DTOR(LoadedEvent);
}
NS_IMETHOD Run() {
mDecoder->NotifyDownloadEnded(NS_OK);
return NS_OK;
}
private:
nsRefPtr<MediaDecoder> mDecoder;
};
void FileMediaResource::EnsureSizeInitialized()
{
mLock.AssertCurrentThreadOwns();
@ -1448,7 +1426,7 @@ void FileMediaResource::EnsureSizeInitialized()
nsresult res = mInput->Available(&size);
if (NS_SUCCEEDED(res) && size <= INT64_MAX) {
mSize = (int64_t)size;
nsCOMPtr<nsIRunnable> event = new LoadedEvent(mDecoder);
nsCOMPtr<nsIRunnable> event = new DataEnded(mDecoder, NS_OK);
NS_DispatchToMainThread(event, NS_DISPATCH_NORMAL);
}
}

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

@ -0,0 +1,16 @@
<!DOCTYPE html>
<html>
<head>
<script>
function boom()
{
var ac = new window.AudioContext();
var buffer = ac.createBuffer(1, 24313, 47250);
buffer.copyFromChannel(buffer.getChannelData(0), '');
}
</script>
</head>
<body onload="boom();"></body>
</html>

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

@ -60,6 +60,7 @@ load 920987.html
load 925619-1.html
load 925619-2.html
load 926619.html
load 933151.html
load offline-buffer-source-ended-1.html
skip-if(B2G) load oscillator-ended-1.html # intermittent B2G timeouts, bug 920338
skip-if(B2G) load oscillator-ended-2.html # intermittent B2G timeouts, bug 920338

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

@ -131,7 +131,7 @@ AudioBuffer::CopyFromChannel(const Float32Array& aDestination, uint32_t aChannel
const float* sourceData = mSharedChannels ?
mSharedChannels->GetData(aChannelNumber) :
JS_GetFloat32ArrayData(mJSChannels[aChannelNumber]);
PodCopy(aDestination.Data(), sourceData + aStartInChannel, length);
PodMove(aDestination.Data(), sourceData + aStartInChannel, length);
}
void
@ -159,7 +159,7 @@ AudioBuffer::CopyToChannel(JSContext* aJSContext, const Float32Array& aSource,
return;
}
PodCopy(JS_GetFloat32ArrayData(mJSChannels[aChannelNumber]) + aStartInChannel,
PodMove(JS_GetFloat32ArrayData(mJSChannels[aChannelNumber]) + aStartInChannel,
aSource.Data(), length);
}

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

@ -136,7 +136,6 @@ SystemMessageManager.prototype = {
dispatchers[aType] = { handler: aHandler, messages: [], isHandling: false };
// Ask for the list of currently pending messages.
this.addMessageListeners("SystemMessageManager:GetPendingMessages:Return");
cpmm.sendAsyncMessage("SystemMessageManager:GetPendingMessages",
{ type: aType,
uri: this._uri,
@ -215,8 +214,6 @@ SystemMessageManager.prototype = {
manifest: this._manifest,
uri: this._uri,
msgID: msg.msgID });
} else if (aMessage.name == "SystemMessageManager:GetPendingMessages:Return") {
this.removeMessageListeners(aMessage.name);
}
let messages = (aMessage.name == "SystemMessageManager:Message")
@ -251,7 +248,8 @@ SystemMessageManager.prototype = {
// nsIDOMGlobalPropertyInitializer implementation.
init: function sysMessMgr_init(aWindow) {
debug("init");
this.initDOMRequestHelper(aWindow, ["SystemMessageManager:Message"]);
this.initDOMRequestHelper(aWindow, ["SystemMessageManager:Message",
"SystemMessageManager:GetPendingMessages:Return"]);
let principal = aWindow.document.nodePrincipal;
this._isInBrowserElement = principal.isInBrowserElement;

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

@ -50,6 +50,27 @@ RotatedBuffer::GetQuadrantRectangle(XSide aXSide, YSide aYSide) const
return mBufferRect + quadrantTranslation;
}
Rect
RotatedBuffer::GetSourceRectangle(XSide aXSide, YSide aYSide) const
{
Rect result;
if (aXSide == LEFT) {
result.x = 0;
result.width = mBufferRotation.x;
} else {
result.x = mBufferRotation.x;
result.width = mBufferRect.width - mBufferRotation.x;
}
if (aYSide == TOP) {
result.y = 0;
result.height = mBufferRotation.y;
} else {
result.y = mBufferRotation.y;
result.height = mBufferRect.height - mBufferRotation.y;
}
return result;
}
/**
* @param aXSide LEFT means we draw from the left side of the buffer (which
* is drawn on the right side of mBufferRect). RIGHT means we draw from
@ -178,6 +199,19 @@ RotatedBuffer::DrawBufferQuadrant(gfx::DrawTarget* aTarget,
gfx::Point quadrantTranslation(quadrantRect.x, quadrantRect.y);
MOZ_ASSERT(aOperator == OP_OVER || aOperator == OP_SOURCE);
// direct2d is much slower when using OP_SOURCE so use OP_OVER and
// (maybe) a clear instead. Normally we need to draw in a single operation
// (to avoid flickering) but direct2d is ok since it defers rendering.
// We should try abstract this logic in a helper when we have other use
// cases.
if (aTarget->GetType() == BACKEND_DIRECT2D && aOperator == OP_SOURCE) {
aOperator = OP_OVER;
if (mDTBuffer->GetFormat() == FORMAT_B8G8R8A8) {
aTarget->ClearRect(ToRect(fillRect));
}
}
RefPtr<SourceSurface> snapshot;
if (aSource == BUFFER_BLACK) {
snapshot = mDTBuffer->Snapshot();
@ -186,16 +220,6 @@ RotatedBuffer::DrawBufferQuadrant(gfx::DrawTarget* aTarget,
snapshot = mDTBufferOnWhite->Snapshot();
}
// Transform from user -> buffer space.
Matrix transform;
transform.Translate(quadrantTranslation.x, quadrantTranslation.y);
#ifdef MOZ_GFX_OPTIMIZE_MOBILE
SurfacePattern source(snapshot, EXTEND_CLAMP, transform, FILTER_POINT);
#else
SurfacePattern source(snapshot, EXTEND_CLAMP, transform);
#endif
if (aOperator == OP_SOURCE) {
// OP_SOURCE is unbounded in Azure, and we really don't want that behaviour here.
// We also can't do a ClearRect+FillRect since we need the drawing to happen
@ -205,14 +229,30 @@ RotatedBuffer::DrawBufferQuadrant(gfx::DrawTarget* aTarget,
}
if (aMask) {
// Transform from user -> buffer space.
Matrix transform;
transform.Translate(quadrantTranslation.x, quadrantTranslation.y);
#ifdef MOZ_GFX_OPTIMIZE_MOBILE
SurfacePattern source(snapshot, EXTEND_CLAMP, transform, FILTER_POINT);
#else
SurfacePattern source(snapshot, EXTEND_CLAMP, transform);
#endif
Matrix oldTransform = aTarget->GetTransform();
aTarget->SetTransform(*aMaskTransform);
aTarget->MaskSurface(source, aMask, Point(0, 0), DrawOptions(aOpacity, aOperator));
aTarget->SetTransform(oldTransform);
} else {
aTarget->FillRect(gfx::Rect(fillRect.x, fillRect.y,
fillRect.width, fillRect.height),
source, DrawOptions(aOpacity, aOperator));
#ifdef MOZ_GFX_OPTIMIZE_MOBILE
DrawSurfaceOptions options(FILTER_POINT);
#else
DrawSurfaceOptions options;
#endif
aTarget->DrawSurface(snapshot, ToRect(fillRect),
GetSourceRectangle(aXSide, aYSide),
options,
DrawOptions(aOpacity, aOperator));
}
if (aOperator == OP_SOURCE) {

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

@ -112,6 +112,8 @@ protected:
};
nsIntRect GetQuadrantRectangle(XSide aXSide, YSide aYSide) const;
gfx::Rect GetSourceRectangle(XSide aXSide, YSide aYSide) const;
/*
* If aMask is non-null, then it is used as an alpha mask for rendering this
* buffer. aMaskTransform must be non-null if aMask is non-null, and is used

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

@ -1532,6 +1532,10 @@ void AsyncPanZoomController::SendAsyncScrollEvent() {
void AsyncPanZoomController::UpdateScrollOffset(const CSSPoint& aScrollOffset)
{
APZC_LOG("Updating scroll offset from (%f, %f) to (%f, %f)\n",
mFrameMetrics.mScrollOffset.x, mFrameMetrics.mScrollOffset.y,
aScrollOffset.x, aScrollOffset.y);
ReentrantMonitorAutoEnter lock(mMonitor);
mFrameMetrics.mScrollOffset = aScrollOffset;
}

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

@ -15,9 +15,12 @@
#include "nsServiceManagerUtils.h"
#include "mozilla/Preferences.h"
#include "mozilla/Services.h"
#include "nsIUUIDGenerator.h"
#include "nsICharsetConverterManager.h"
#include "nsIObserverService.h"
#include "nsCRT.h"
#include "harfbuzz/hb.h"
@ -34,6 +37,7 @@
#define UNICODE_BMP_LIMIT 0x10000
using namespace mozilla;
using mozilla::services::GetObserverService;
#pragma pack(1)
@ -1425,3 +1429,107 @@ gfxFontUtils::IsCffFont(const uint8_t* aFontData)
}
#endif
NS_IMPL_ISUPPORTS1(gfxFontInfoLoader::ShutdownObserver, nsIObserver)
NS_IMETHODIMP
gfxFontInfoLoader::ShutdownObserver::Observe(nsISupports *aSubject,
const char *aTopic,
const PRUnichar *someData)
{
if (!nsCRT::strcmp(aTopic, "quit-application")) {
mLoader->CancelLoader();
} else {
NS_NOTREACHED("unexpected notification topic");
}
return NS_OK;
}
void
gfxFontInfoLoader::StartLoader(uint32_t aDelay, uint32_t aInterval)
{
mInterval = aInterval;
// sanity check
if (mState != stateInitial && mState != stateTimerOff) {
CancelLoader();
}
// set up timer
if (!mTimer) {
mTimer = do_CreateInstance("@mozilla.org/timer;1");
if (!mTimer) {
NS_WARNING("Failure to create font info loader timer");
return;
}
}
// need an initial delay?
uint32_t timerInterval;
if (aDelay) {
mState = stateTimerOnDelay;
timerInterval = aDelay;
} else {
mState = stateTimerOnInterval;
timerInterval = mInterval;
}
InitLoader();
// start timer
mTimer->InitWithFuncCallback(LoaderTimerCallback, this, timerInterval,
nsITimer::TYPE_REPEATING_SLACK);
nsCOMPtr<nsIObserverService> obs = GetObserverService();
if (obs) {
mObserver = new ShutdownObserver(this);
obs->AddObserver(mObserver, "quit-application", false);
}
}
void
gfxFontInfoLoader::CancelLoader()
{
if (mState == stateInitial) {
return;
}
mState = stateTimerOff;
if (mTimer) {
mTimer->Cancel();
mTimer = nullptr;
}
RemoveShutdownObserver();
FinishLoader();
}
void
gfxFontInfoLoader::LoaderTimerFire()
{
if (mState == stateTimerOnDelay) {
mState = stateTimerOnInterval;
mTimer->SetDelay(mInterval);
}
bool done = RunLoader();
if (done) {
CancelLoader();
}
}
gfxFontInfoLoader::~gfxFontInfoLoader()
{
RemoveShutdownObserver();
}
void
gfxFontInfoLoader::RemoveShutdownObserver()
{
if (mObserver) {
nsCOMPtr<nsIObserverService> obs = GetObserverService();
if (obs) {
obs->RemoveObserver(mObserver, "quit-application");
mObserver = nullptr;
}
}
}

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

@ -12,6 +12,7 @@
#include "nsComponentManagerUtils.h"
#include "nsTArray.h"
#include "nsAutoPtr.h"
#include "nsIObserver.h"
#include "mozilla/Likely.h"
#include "mozilla/Endian.h"
#include "mozilla/MemoryReporting.h"
@ -963,55 +964,31 @@ public:
{
}
virtual ~gfxFontInfoLoader() {}
virtual ~gfxFontInfoLoader();
// start timer with an initial delay, then call Run method at regular intervals
void StartLoader(uint32_t aDelay, uint32_t aInterval) {
mInterval = aInterval;
// sanity check
if (mState != stateInitial && mState != stateTimerOff)
CancelLoader();
// set up timer
if (!mTimer) {
mTimer = do_CreateInstance("@mozilla.org/timer;1");
if (!mTimer) {
NS_WARNING("Failure to create font info loader timer");
return;
}
}
// need an initial delay?
uint32_t timerInterval;
if (aDelay) {
mState = stateTimerOnDelay;
timerInterval = aDelay;
} else {
mState = stateTimerOnInterval;
timerInterval = mInterval;
}
InitLoader();
// start timer
mTimer->InitWithFuncCallback(LoaderTimerCallback, this, timerInterval,
nsITimer::TYPE_REPEATING_SLACK);
}
void StartLoader(uint32_t aDelay, uint32_t aInterval);
// cancel the timer and cleanup
void CancelLoader() {
if (mState == stateInitial)
return;
mState = stateTimerOff;
if (mTimer) {
mTimer->Cancel();
}
FinishLoader();
}
void CancelLoader();
protected:
class ShutdownObserver : public nsIObserver
{
public:
NS_DECL_ISUPPORTS
NS_DECL_NSIOBSERVER
ShutdownObserver(gfxFontInfoLoader *aLoader)
: mLoader(aLoader)
{ }
virtual ~ShutdownObserver()
{ }
protected:
gfxFontInfoLoader *mLoader;
};
// Init - initialization at start time after initial delay
virtual void InitLoader() = 0;
@ -1022,25 +999,18 @@ protected:
// Finish - cleanup after done
virtual void FinishLoader() = 0;
// Timer interval callbacks
static void LoaderTimerCallback(nsITimer *aTimer, void *aThis) {
gfxFontInfoLoader *loader = static_cast<gfxFontInfoLoader*>(aThis);
loader->LoaderTimerFire();
}
// start the timer, interval callbacks
void LoaderTimerFire() {
if (mState == stateTimerOnDelay) {
mState = stateTimerOnInterval;
mTimer->SetDelay(mInterval);
}
void LoaderTimerFire();
bool done = RunLoader();
if (done) {
CancelLoader();
}
}
void RemoveShutdownObserver();
nsCOMPtr<nsITimer> mTimer;
nsCOMPtr<nsIObserver> mObserver;
uint32_t mInterval;
TimerState mState;
};

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

@ -565,9 +565,6 @@ install:: $(LIBRARY_NAME).pc
install::
$(call py_action,process_install_manifest,--no-remove $(DESTDIR)$(includedir)/$(LIBRARY_NAME) _build_manifests/install/dist_include)
install:: $(EXPORTS_mozilla)
$(SYSINSTALL) $^ $(DESTDIR)$(includedir)/$(LIBRARY_NAME)/mozilla
#
# END SpiderMonkey header installation
#############################################

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

@ -1647,8 +1647,11 @@ ia64*-hpux*)
if test "$_CC_SUITE" -ge "12"; then
dnl VS2013+ requires -FS when parallel building by make -jN.
dnl If nothing, compiler sometimes causes C1041 error.
CFLAGS="$CFLAGS -FS"
CXXFLAGS="$CXXFLAGS -FS"
dnl
dnl Visual Studio 2013 supports -Gw flags
dnl http://blogs.msdn.com/b/vcblog/archive/2013/09/11/introducing-gw-compiler-switch.aspx
CFLAGS="$CFLAGS -FS -Gw"
CXXFLAGS="$CXXFLAGS -FS -Gw"
fi
# khuey says we can safely ignore MSVC warning C4251
# MSVC warning C4244 (implicit type conversion may lose data) warns

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

@ -291,9 +291,9 @@ GetObjectAllocKindForCopy(JSRuntime *rt, JSObject *obj)
return obj->as<JSFunction>().getAllocKind();
AllocKind kind = GetGCObjectFixedSlotsKind(obj->numFixedSlots());
if (CanBeFinalizedInBackground(kind, obj->getClass()))
kind = GetBackgroundAllocKind(kind);
return kind;
JS_ASSERT(!IsBackgroundFinalized(kind));
JS_ASSERT(CanBeFinalizedInBackground(kind, obj->getClass()));
return GetBackgroundAllocKind(kind);
}
void *

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

@ -860,7 +860,8 @@ class ModuleChars
uint32_t parseBeginOffset = parser.pc->maybeFunction->pn_pos.begin;
const jschar *parseBegin = parser.tokenStream.rawBase() + parseBeginOffset;
const jschar *parseLimit = parser.tokenStream.rawLimit();
if (parseLimit - parseBegin < length_)
JS_ASSERT(parseLimit >= parseBegin);
if (uint32_t(parseLimit - parseBegin) < length_)
return false;
if (!PodEqual(begin_, parseBegin, length_))
return false;

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

@ -362,7 +362,7 @@ SnapshotWriter::writeSlotHeader(JSValueType type, uint32_t regCode)
void
SnapshotWriter::addSlot(const FloatRegister &reg)
{
JS_ASSERT(reg.code() < MIN_REG_FIELD_ESC);
JS_ASSERT(uint32_t(reg.code()) < MIN_REG_FIELD_ESC);
IonSpew(IonSpew_Snapshots, " slot %u: double (reg %s)", slotsWritten_, reg.name());
writeSlotHeader(JSVAL_TYPE_DOUBLE, reg.code());
@ -519,7 +519,7 @@ SnapshotWriter::addInt32Slot(int32_t value)
void
SnapshotWriter::addFloat32Slot(const FloatRegister &reg)
{
JS_ASSERT(reg.code() < MIN_REG_FIELD_ESC);
JS_ASSERT(uint32_t(reg.code()) < MIN_REG_FIELD_ESC);
IonSpew(IonSpew_Snapshots, " slot %u: float32 (reg %s)", slotsWritten_, reg.name());
writeSlotHeader(JSVAL_TYPE_NULL, ESC_REG_FIELD_FLOAT32_REG);
writer_.writeUnsigned(reg.code());

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

@ -120,7 +120,7 @@ interface ScheduledGCCallback : nsISupports
/**
* interface of Components.utils
*/
[scriptable, uuid(08a49c33-0704-4b88-bebb-9a0cf1309f30)]
[scriptable, uuid(90019271-a0d1-439f-911c-967f8e85cd5b)]
interface nsIXPCComponents_Utils : nsISupports
{
@ -307,13 +307,45 @@ interface nsIXPCComponents_Utils : nsISupports
[implicit_jscontext]
jsval getGlobalForObject(in jsval obj);
/*
* Similar to evalInSandbox except this one is used to eval a script in the
* scope of a window. Also note, that the return value and the possible exceptions
* in the script are structured cloned, unless they are natives (then they are just
* wrapped).
* Principal of the caller must subsume the target's.
*/
[implicit_jscontext]
jsval evalInWindow(in AString source, in jsval window);
/*
* To be called from JS only.
*
* Instead of simply wrapping a function into another compartment,
* this helper function creates a native function in the target
* compartment and forwards the call to the original function.
* That call will be different than a regular JS function call in
* that, the |this| is left unbound, and all the non-native JS
* object arguments will be cloned using the structured clone
* algorithm.
* The return value is the new forwarder function, wrapped into
* the caller's compartment.
* The 3rd argument is the name of the property that will
* be set on the target scope, with the forwarder function as
* the value.
*/
[implicit_jscontext]
jsval exportFunction(in jsval vfunction, in jsval vscope, in jsval vname);
/*
* To be called from JS only.
*
* Returns an object created in |vobj|'s compartment.
* If defineAs property on the options object is a non-null ID,
* the new object will be added to vobj as a property. Also, the
* returned new object is always automatically waived (see waiveXrays).
*/
[implicit_jscontext]
jsval createObjectIn(in jsval vobj);
jsval createObjectIn(in jsval vobj, [optional] in jsval voptions);
/*
* To be called from JS only.

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

@ -215,44 +215,20 @@ CreateXMLHttpRequest(JSContext *cx, unsigned argc, jsval *vp)
return true;
}
/*
* Instead of simply wrapping a function into another compartment,
* this helper function creates a native function in the target
* compartment and forwards the call to the original function.
* That call will be different than a regular JS function call in
* that, the |this| is left unbound, and all the non-native JS
* object arguments will be cloned using the structured clone
* algorithm.
* The return value is the new forwarder function, wrapped into
* the caller's compartment.
* The 3rd argument is the name of the property that will
* be set on the target scope, with the forwarder function as
* the value.
* The principal of the caller must subsume that of the target.
*
* Expected type of the arguments and the return value:
* function exportFunction(function funToExport,
* object targetScope,
* string name)
*/
static bool
ExportFunction(JSContext *cx, unsigned argc, jsval *vp)
{
MOZ_ASSERT(cx);
if (argc < 3) {
JS_ReportError(cx, "Function requires at least 3 arguments");
return false;
}
namespace xpc {
CallArgs args = CallArgsFromVp(argc, vp);
if (!args[0].isObject() || !args[1].isObject() || !args[2].isString()) {
bool
ExportFunction(JSContext *cx, HandleValue vfunction, HandleValue vscope, HandleValue vname,
MutableHandleValue rval)
{
if (!vscope.isObject() || !vfunction.isObject() || !vname.isString()) {
JS_ReportError(cx, "Invalid argument");
return false;
}
RootedObject funObj(cx, &args[0].toObject());
RootedObject targetScope(cx, &args[1].toObject());
RootedString funName(cx, args[2].toString());
RootedObject funObj(cx, &vfunction.toObject());
RootedObject targetScope(cx, &vscope.toObject());
RootedString funName(cx, vname.toString());
// We can only export functions to scopes those are transparent for us,
// so if there is a security wrapper around targetScope we must throw.
@ -286,31 +262,51 @@ ExportFunction(JSContext *cx, unsigned argc, jsval *vp)
return false;
RootedId id(cx);
if (!JS_ValueToId(cx, args[2], id.address()))
if (!JS_ValueToId(cx, vname, id.address()))
return false;
// And now, let's create the forwarder function in the target compartment
// for the function the be exported.
if (!NewFunctionForwarder(cx, id, funObj, /* doclone = */ true, args.rval())) {
if (!NewFunctionForwarder(cx, id, funObj, /* doclone = */ true, rval)) {
JS_ReportError(cx, "Exporting function failed");
return false;
}
// We have the forwarder function in the target compartment, now
// we have to add it to the target scope as a property.
if (!JS_DefinePropertyById(cx, targetScope, id, args.rval(),
if (!JS_DefinePropertyById(cx, targetScope, id, rval,
JS_PropertyStub, JS_StrictPropertyStub,
JSPROP_ENUMERATE))
return false;
}
// Finally we have to re-wrap the exported function back to the caller compartment.
if (!JS_WrapValue(cx, args.rval()))
if (!JS_WrapValue(cx, rval))
return false;
return true;
}
/*
* Expected type of the arguments and the return value:
* function exportFunction(function funToExport,
* object targetScope,
* string name)
*/
static bool
ExportFunction(JSContext *cx, unsigned argc, jsval *vp)
{
CallArgs args = CallArgsFromVp(argc, vp);
if (args.length() < 3) {
JS_ReportError(cx, "Function requires at least 3 arguments");
return false;
}
return ExportFunction(cx, args[0], args[1],
args[2], args.rval());
}
} /* namespace xpc */
static bool
GetFilenameAndLineNumber(JSContext *cx, nsACString &filename, unsigned &lineno)
{
@ -431,37 +427,13 @@ CloneNonReflectors(JSContext *cx, MutableHandleValue val)
return true;
}
/*
* Similar to evalInSandbox except this one is used to eval a script in the
* scope of a window. Also note, that the return value and the possible exceptions
* in the script are structured cloned, unless they are natives (then they are just
* wrapped).
* Principal of the caller must subsume the target's.
*
* Expected type of the arguments:
* value evalInWindow(string script,
* object window)
*/
static bool
EvalInWindow(JSContext *cx, unsigned argc, jsval *vp)
namespace xpc {
bool
EvalInWindow(JSContext *cx, const nsAString &source, HandleObject scope, MutableHandleValue rval)
{
MOZ_ASSERT(cx);
if (argc < 2) {
JS_ReportError(cx, "Function requires two arguments");
return false;
}
CallArgs args = CallArgsFromVp(argc, vp);
if (!args[0].isString() || !args[1].isObject()) {
JS_ReportError(cx, "Invalid arguments");
return false;
}
RootedString srcString(cx, args[0].toString());
RootedObject targetScope(cx, &args[1].toObject());
// If we cannot unwrap we must not eval in it.
targetScope = CheckedUnwrap(targetScope);
RootedObject targetScope(cx, CheckedUnwrap(scope));
if (!targetScope) {
JS_ReportError(cx, "Permission denied to eval in target scope");
return false;
@ -499,9 +471,6 @@ EvalInWindow(JSContext *cx, unsigned argc, jsval *vp)
lineNo = 0;
}
nsDependentJSString srcDepString;
srcDepString.init(cx, srcString);
{
// CompileOptions must be created from the context
// we will execute this script in.
@ -516,11 +485,11 @@ EvalInWindow(JSContext *cx, unsigned argc, jsval *vp)
evaluateOptions.setReportUncaught(false);
nsresult rv = nsJSUtils::EvaluateString(wndCx,
srcDepString,
source,
targetScope,
compileOptions,
evaluateOptions,
args.rval().address());
rval.address());
if (NS_FAILED(rv)) {
// If there was an exception we get it as a return value, if
@ -528,16 +497,16 @@ EvalInWindow(JSContext *cx, unsigned argc, jsval *vp)
// exception is raised.
MOZ_ASSERT(!JS_IsExceptionPending(wndCx),
"Exception should be delivered as return value.");
if (args.rval().isUndefined()) {
if (rval.isUndefined()) {
MOZ_ASSERT(rv == NS_ERROR_OUT_OF_MEMORY);
return false;
}
// If there was an exception thrown we should set it
// on the calling context.
RootedValue exn(wndCx, args.rval());
RootedValue exn(wndCx, rval);
// First we should reset the return value.
args.rval().set(UndefinedValue());
rval.set(UndefinedValue());
// Then clone the exception.
if (CloneNonReflectors(cx, &exn))
@ -548,15 +517,45 @@ EvalInWindow(JSContext *cx, unsigned argc, jsval *vp)
}
// Let's clone the return value back to the callers compartment.
if (!CloneNonReflectors(cx, args.rval())) {
args.rval().set(UndefinedValue());
if (!CloneNonReflectors(cx, rval)) {
rval.set(UndefinedValue());
return false;
}
return true;
}
namespace xpc {
/*
* Expected type of the arguments:
* value evalInWindow(string script,
* object window)
*/
static bool
EvalInWindow(JSContext *cx, unsigned argc, jsval *vp)
{
CallArgs args = CallArgsFromVp(argc, vp);
if (args.length() < 2) {
JS_ReportError(cx, "Function requires two arguments");
return false;
}
if (!args[0].isString() || !args[1].isObject()) {
JS_ReportError(cx, "Invalid arguments");
return false;
}
RootedString srcString(cx, args[0].toString());
RootedObject targetScope(cx, &args[1].toObject());
nsDependentJSString srcDepString;
if (!srcDepString.init(cx, srcString)) {
JS_ReportError(cx, "Source string is invalid");
return false;
}
return EvalInWindow(cx, srcDepString, targetScope, args.rval());
}
static bool
CreateObjectIn(JSContext *cx, unsigned argc, jsval *vp)
{

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

@ -3025,6 +3025,7 @@ xpc::CreateObjectIn(JSContext *cx, HandleValue vobj, CreateObjectInOptions &opti
JS_ReportError(cx, "Permission denied to create object in the target scope");
return false;
}
RootedObject obj(cx);
{
JSAutoCompartment ac(cx, scope);
@ -3034,23 +3035,64 @@ xpc::CreateObjectIn(JSContext *cx, HandleValue vobj, CreateObjectInOptions &opti
if (!JSID_IS_VOID(options.defineAs) &&
!JS_DefinePropertyById(cx, scope, options.defineAs, ObjectValue(*obj),
JS_PropertyStub, JS_StrictPropertyStub,
JSPROP_ENUMERATE))
JS_PropertyStub, JS_StrictPropertyStub,
JSPROP_ENUMERATE))
return false;
}
if (!JS_WrapObject(cx, &obj))
rval.setObject(*obj);
if (!WrapperFactory::WaiveXrayAndWrap(cx, rval))
return false;
rval.setObject(*obj);
return true;
}
/* jsval createObjectIn(in jsval vobj); */
/* jsval evalInWindow(in string source, in jsval window); */
NS_IMETHODIMP
nsXPCComponents_Utils::CreateObjectIn(const Value &vobj, JSContext *cx, Value *rval)
nsXPCComponents_Utils::EvalInWindow(const nsAString &source, const Value &window,
JSContext *cx, Value *rval)
{
CreateObjectInOptions options;
if (!window.isObject())
return NS_ERROR_INVALID_ARG;
RootedObject rwindow(cx, &window.toObject());
RootedValue res(cx);
if (!xpc::EvalInWindow(cx, source, rwindow, &res))
return NS_ERROR_FAILURE;
*rval = res;
return NS_OK;
}
/* jsval exportFunction(in jsval vfunction, in jsval vscope, in jsval vname); */
NS_IMETHODIMP
nsXPCComponents_Utils::ExportFunction(const Value &vfunction, const Value &vscope,
const Value &vname, JSContext *cx, Value *rval)
{
RootedValue rfunction(cx, vfunction);
RootedValue rscope(cx, vscope);
RootedValue rname(cx, vname);
RootedValue res(cx);
if (!xpc::ExportFunction(cx, rfunction, rscope, rname, &res))
return NS_ERROR_FAILURE;
*rval = res;
return NS_OK;
}
/* jsval createObjectIn(in jsval vobj, [optional] in jsval voptions); */
NS_IMETHODIMP
nsXPCComponents_Utils::CreateObjectIn(const Value &vobj, const Value &voptions,
JSContext *cx, Value *rval)
{
RootedObject optionsObject(cx, voptions.isObject() ? &voptions.toObject()
: nullptr);
CreateObjectInOptions options(cx, optionsObject);
if (voptions.isObject() &&
!options.Parse())
{
return NS_ERROR_FAILURE;
}
RootedValue rvobj(cx, vobj);
RootedValue res(cx);
if (!xpc::CreateObjectIn(cx, rvobj, options, &res))

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

@ -3725,6 +3725,14 @@ bool
CreateObjectIn(JSContext *cx, JS::HandleValue vobj, CreateObjectInOptions &options,
JS::MutableHandleValue rval);
bool
EvalInWindow(JSContext *cx, const nsAString &source, JS::HandleObject scope,
JS::MutableHandleValue rval);
bool
ExportFunction(JSContext *cx, JS::HandleValue vscope, JS::HandleValue vfunction,
JS::HandleValue vname, JS::MutableHandleValue rval);
} /* namespace xpc */

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

@ -26,7 +26,8 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=634156
Cu.evalInSandbox("Object.defineProperty(Object.prototype, 'getProp', { get: function() { throw 'FAIL: called getter' }, set: function() { throw 'FAIL: called setter'; } })", sandbox);
var obj = Cu.createObjectIn(sandbox);
is(Object.getPrototypeOf(obj), Cu.evalInSandbox("Object.prototype", sandbox),
is(obj, Cu.waiveXrays(obj), "createObjectIn waives");
is(Object.getPrototypeOf(obj), Cu.waiveXrays(Cu.evalInSandbox("Object.prototype", sandbox)),
"Object is a sandbox object");
function genPropDesc(value) {

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

@ -51,6 +51,8 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=877673
executeIn(frame.contentDocument, "var a = 42;", function(e){ok(e.toString().indexOf("Second argument must be a window") > -1,
"Passing non-window to evalInWindow should throw.");});
// evalInWindow is also available from Cu:
is(Cu.evalInWindow("document.str", frame.contentWindow), "foobar");
testDone();
}

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

@ -6,7 +6,11 @@
MODULE_NAME = xpconnect_test
FORCE_SHARED_LIB = 1
MANIFEST_FILE = xpctest.manifest
componentdir = js/xpconnect/tests/components/native
MANIFEST = xpctest.manifest
MANIFEST_PATH = $(testxpcobjdir)/$(componentdir)
PP_TARGETS += MANIFEST
EXTRA_DSO_LDOPTS += \
$(XPCOM_GLUE_LDOPTS) \
@ -14,15 +18,8 @@ EXTRA_DSO_LDOPTS += \
$(MOZ_JS_LIBS) \
$(NULL)
include $(topsrcdir)/config/rules.mk
DEFINES += -DLIBRARY_FILENAME="$(SHARED_LIBRARY)"
componentdir = js/xpconnect/tests/components/native
libs:: $(SHARED_LIBRARY)
$(INSTALL) $^ $(testxpcobjdir)/$(componentdir)
libs:: $(MANIFEST_FILE)
$(PYTHON) $(topsrcdir)/config/Preprocessor.py $(DEFINES) $(ACDEFINES) $(XULPPFLAGS) $< > $(testxpcobjdir)/$(componentdir)/$(<F)
LIB_FILES = $(SHARED_LIBRARY)
LIB_DEST = $(testxpcobjdir)/$(componentdir)
INSTALL_TARGETS += LIB

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

@ -85,4 +85,15 @@ function run_test() {
Cu.evalInSandbox("(" + function() {
checkIfCalled();
}.toSource() + ")()", epsb);
// exportFunction and createObjectIn should be available from Cu too.
var newContentObject = Cu.createObjectIn(subsb, {defineAs:"importedObject2"});
var wasCalled = false;
Cu.exportFunction(function(arg){wasCalled = arg.wasCalled;}, newContentObject, "privMethod");
Cu.evalInSandbox("(" + function () {
importedObject2.privMethod({wasCalled: true});
}.toSource() + ")()", subsb);
do_check_true(wasCalled, true);
}

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

@ -681,16 +681,18 @@ static void RecordFrameMetrics(nsIFrame* aForFrame,
metrics.mScrollId = aScrollId;
// Only the root scrollable frame for a given presShell should pick up
// the presShell's resolution. All the other frames are 1.0.
nsIPresShell* presShell = presContext->GetPresShell();
if (metrics.mScrollId == FrameMetrics::ROOT_SCROLL_ID) {
if (aScrollFrame == presShell->GetRootScrollFrame()) {
metrics.mResolution = ParentLayerToLayerScale(presShell->GetXResolution(),
presShell->GetYResolution());
} else {
// Only the root scrollable frame for a given presShell should pick up
// the presShell's resolution. All the other subframes are 1.0.
metrics.mResolution = ParentLayerToLayerScale(1.0f);
}
// For the cumulateive resolution, multiply the resolutions of all the
// presShells back up to the root
metrics.mCumulativeResolution = LayoutDeviceToLayerScale(1.0f);
nsIPresShell* curPresShell = presShell;
while (curPresShell != nullptr) {
@ -700,15 +702,6 @@ static void RecordFrameMetrics(nsIFrame* aForFrame,
nsPresContext* parentContext = curPresShell->GetPresContext()->GetParentPresContext();
curPresShell = parentContext ? parentContext->GetPresShell() : nullptr;
}
#ifdef MOZ_WIDGET_ANDROID
if (presContext->IsRootContentDocument() && aScrollFrame == presShell->GetRootScrollFrame()) {
// On Android we set the resolution on a different presshell (bug 732971) so we
// need some special handling here to make things work properly. Once bug 732971 is
// fixed we should remove this ifdef block, and adjust any other pieces that need
// adjusting to make this work properly.
metrics.mResolution.scale = metrics.mCumulativeResolution.scale;
}
#endif
metrics.mDevPixelsPerCSSPixel = CSSToLayoutDeviceScale(
(float)nsPresContext::AppUnitsPerCSSPixel() / auPerDevPixel);

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

@ -18,6 +18,11 @@
/* a presentation of a document, part 2 */
#ifdef MOZ_LOGGING
#define FORCE_PR_LOG /* Allow logging in the release build */
#endif
#include "prlog.h"
#include "mozilla/MemoryReporting.h"
#include "mozilla/dom/TabChild.h"
#include "mozilla/Likely.h"
@ -44,7 +49,6 @@
#include "nsViewManager.h"
#include "nsView.h"
#include "nsCRTGlue.h"
#include "prlog.h"
#include "prprf.h"
#include "prinrval.h"
#include "nsTArray.h"
@ -681,8 +685,10 @@ PresShell::PresShell()
mReflowCountMgr->SetPresShell(this);
#endif
#ifdef PR_LOGGING
if (! gLog)
mLoadBegin = TimeStamp::Now();
if (!gLog) {
gLog = PR_NewLogModule("PresShell");
}
#endif
mSelectionFlags = nsISelectionDisplay::DISPLAY_TEXT | nsISelectionDisplay::DISPLAY_IMAGES;
mIsThemeSupportDisabled = false;
@ -2391,6 +2397,20 @@ void
PresShell::BeginLoad(nsIDocument *aDocument)
{
mDocumentLoading = true;
#ifdef PR_LOGGING
if (gLog && PR_LOG_TEST(gLog, PR_LOG_DEBUG)) {
mLoadBegin = TimeStamp::Now();
nsIURI* uri = mDocument->GetDocumentURI();
nsAutoCString spec;
if (uri) {
uri->GetSpec(spec);
}
PR_LOG(gLog, PR_LOG_DEBUG,
("(presshell) %p begin load [%s]\n",
this, spec.get()));
}
#endif
}
void
@ -2401,6 +2421,21 @@ PresShell::EndLoad(nsIDocument *aDocument)
RestoreRootScrollPosition();
mDocumentLoading = false;
#ifdef PR_LOGGING
// log load
if (gLog && PR_LOG_TEST(gLog, PR_LOG_DEBUG)) {
TimeDuration loadTime = TimeStamp::Now() - mLoadBegin;
nsIURI* uri = mDocument->GetDocumentURI();
nsAutoCString spec;
if (uri) {
uri->GetSpec(spec);
}
PR_LOG(gLog, PR_LOG_DEBUG,
("(presshell) %p end load time-ms: %9.2f [%s]\n",
this, loadTime.ToMilliseconds(), spec.get()));
}
#endif
}
#ifdef DEBUG

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

@ -756,6 +756,8 @@ protected:
// The `performance.now()` value when we last started to process reflows.
DOMHighResTimeStamp mLastReflowStart;
mozilla::TimeStamp mLoadBegin; // used to time loads
// Information needed to properly handle scrolling content into view if the
// pre-scroll reflow flush can be interrupted. mContentToScrollTo is
// non-null between the initial scroll attempt and the first time we finish

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

@ -15,6 +15,7 @@
#include <string>
#include "mozilla/Assertions.h"
#include "mozilla/Move.h" // Pinch hitting for <utility> and std::move
#include "mozilla/Mutex.h"
#include "mozilla/NullPtr.h"
#include <vector>
@ -43,18 +44,21 @@ namespace mozilla {
RLogRingBuffer* RLogRingBuffer::instance;
RLogRingBuffer::RLogRingBuffer()
: log_limit_(4096) {
: log_limit_(4096),
mutex_("RLogRingBuffer::mutex_") {
}
RLogRingBuffer::~RLogRingBuffer() {
}
void RLogRingBuffer::SetLogLimit(uint32_t new_limit) {
OffTheBooksMutexAutoLock lock(mutex_);
log_limit_ = new_limit;
RemoveOld();
}
void RLogRingBuffer::Log(std::string&& log) {
OffTheBooksMutexAutoLock lock(mutex_);
log_messages_.push_front(Move(log));
RemoveOld();
}
@ -106,6 +110,7 @@ inline bool AnySubstringMatches(const std::vector<std::string>& substrings,
void RLogRingBuffer::FilterAny(const std::vector<std::string>& substrings,
uint32_t limit,
std::deque<std::string>* matching_logs) {
OffTheBooksMutexAutoLock lock(mutex_);
if (limit == 0) {
// At a max, all of the log messages.
limit = log_limit_;

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

@ -59,6 +59,8 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#include <string>
#include <vector>
#include "mozilla/Mutex.h"
#include "m_cpp_utils.h"
namespace mozilla {
@ -110,6 +112,7 @@ class RLogRingBuffer {
std::deque<std::string> log_messages_;
/* Max size of log buffer (should we use time-depth instead/also?) */
uint32_t log_limit_;
OffTheBooksMutex mutex_;
DISALLOW_COPY_ASSIGN(RLogRingBuffer);
}; // class RLogRingBuffer

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

@ -133,6 +133,21 @@ PodArrayCopy(T (&dst)[N], const T (&src)[N])
PodCopy(dst, src, N);
}
/**
* Copy the memory for |nelem| T elements from |src| to |dst|. If the two
* memory ranges overlap, then the effect is as if the |nelem| elements are
* first copied from |src| to a temporary array, and then from the temporary
* array to |dst|.
*/
template<typename T>
MOZ_ALWAYS_INLINE static void
PodMove(T* dst, const T* src, size_t nelem)
{
MOZ_ASSERT(nelem <= SIZE_MAX / sizeof(T),
"trying to move an impossible number of elements");
memmove(dst, src, nelem * sizeof(T));
}
/**
* Determine whether the |len| elements at |one| are memory-identical to the
* |len| elements at |two|.

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

@ -834,9 +834,17 @@ public abstract class TreeBuilder<T> implements TokenHandler,
if (!"http://www.w3.org/TR/html4/strict.dtd".equals(systemIdentifier)) {
warn("The doctype did not contain the system identifier prescribed by the HTML 4.01 specification. Expected \u201C<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.01//EN\" \"http://www.w3.org/TR/html4/strict.dtd\">\u201D.");
}
} else if ("-//W3C//DTD XHTML 1.0 Strict//EN".equals(publicIdentifier)) {
if (!"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd".equals(systemIdentifier)) {
warn("The doctype did not contain the system identifier prescribed by the XHTML 1.0 specification. Expected \u201C<!DOCTYPE HTML PUBLIC \"-//W3C//DTD XHTML 1.0 Strict//EN\" \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd\">\u201D.");
}
} else if ("//W3C//DTD XHTML 1.1//EN".equals(publicIdentifier)) {
if (!"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd".equals(systemIdentifier)) {
warn("The doctype did not contain the system identifier prescribed by the XHTML 1.1 specification. Expected \u201C<!DOCTYPE HTML PUBLIC \"//W3C//DTD XHTML 1.1//EN\" \"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd\">\u201D.");
}
} else if (!((systemIdentifier == null || Portability.literalEqualsString(
"about:legacy-compat", systemIdentifier)) && publicIdentifier == null)) {
err("Legacy doctype. Expected e.g. \u201C<!DOCTYPE html>\u201D.");
err("Unexpected doctype. Expected, e.g., \u201C<!DOCTYPE html>\u201D.");
}
documentModeInternal(DocumentMode.STANDARDS_MODE,
publicIdentifier, systemIdentifier, html4);
@ -2901,16 +2909,15 @@ public abstract class TreeBuilder<T> implements TokenHandler,
mode = IN_FRAMESET;
attributes = null; // CPP
break starttagloop;
case BASE:
case TEMPLATE:
errFooBetweenHeadAndBody(name);
pushHeadPointerOntoStack();
appendVoidElementToCurrentMayFoster(
elementName,
attributes);
selfClosing = false;
pop(); // head
StackNode<T> headOnStack = stack[currentPtr];
startTagTemplateInHead(elementName, attributes);
removeFromStack(headOnStack);
attributes = null; // CPP
break starttagloop;
case BASE:
case LINK_OR_BASEFONT_OR_BGSOUND:
errFooBetweenHeadAndBody(name);
pushHeadPointerOntoStack();
@ -3991,6 +3998,9 @@ public abstract class TreeBuilder<T> implements TokenHandler,
}
case AFTER_HEAD:
switch (group) {
case TEMPLATE:
endTagTemplateInHead();
break endtagloop;
case HTML:
case BODY:
case BR:
@ -4317,8 +4327,11 @@ public abstract class TreeBuilder<T> implements TokenHandler,
ns = node.ns;
if (i == 0) {
if (!(contextNamespace == "http://www.w3.org/1999/xhtml" && (contextName == "td" || contextName == "th"))) {
name = contextName;
ns = contextNamespace;
if (fragment) {
// Make sure we are parsing a fragment otherwise the context element doesn't make sense.
name = contextName;
ns = contextNamespace;
}
} else {
mode = framesetOk ? FRAMESET_OK : IN_BODY; // XXX from Hixie's email
return;
@ -4353,7 +4366,6 @@ public abstract class TreeBuilder<T> implements TokenHandler,
mode = IN_CAPTION;
return;
} else if ("colgroup" == name) {
// TODO: Fragment case. Add error reporting.
mode = IN_COLUMN_GROUP;
return;
} else if ("table" == name) {
@ -4368,7 +4380,6 @@ public abstract class TreeBuilder<T> implements TokenHandler,
return;
} else if ("head" == name) {
if (name == contextName) {
// TODO: Fragment case. Add error reporting.
mode = framesetOk ? FRAMESET_OK : IN_BODY; // really
} else {
mode = IN_HEAD;

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

@ -1766,15 +1766,16 @@ nsHtml5TreeBuilder::startTag(nsHtml5ElementName* elementName, nsHtml5HtmlAttribu
attributes = nullptr;
NS_HTML5_BREAK(starttagloop);
}
case NS_HTML5TREE_BUILDER_BASE: {
case NS_HTML5TREE_BUILDER_TEMPLATE: {
errFooBetweenHeadAndBody(name);
pushHeadPointerOntoStack();
appendVoidElementToCurrentMayFoster(elementName, attributes);
selfClosing = false;
pop();
nsHtml5StackNode* headOnStack = stack[currentPtr];
startTagTemplateInHead(elementName, attributes);
removeFromStack(headOnStack);
attributes = nullptr;
NS_HTML5_BREAK(starttagloop);
}
case NS_HTML5TREE_BUILDER_BASE:
case NS_HTML5TREE_BUILDER_LINK_OR_BASEFONT_OR_BGSOUND: {
errFooBetweenHeadAndBody(name);
pushHeadPointerOntoStack();
@ -2925,6 +2926,10 @@ nsHtml5TreeBuilder::endTag(nsHtml5ElementName* elementName)
}
case NS_HTML5TREE_BUILDER_AFTER_HEAD: {
switch(group) {
case NS_HTML5TREE_BUILDER_TEMPLATE: {
endTagTemplateInHead();
NS_HTML5_BREAK(endtagloop);
}
case NS_HTML5TREE_BUILDER_HTML:
case NS_HTML5TREE_BUILDER_BODY:
case NS_HTML5TREE_BUILDER_BR: {
@ -3254,8 +3259,10 @@ nsHtml5TreeBuilder::resetTheInsertionMode()
ns = node->ns;
if (!i) {
if (!(contextNamespace == kNameSpaceID_XHTML && (contextName == nsHtml5Atoms::td || contextName == nsHtml5Atoms::th))) {
name = contextName;
ns = contextNamespace;
if (fragment) {
name = contextName;
ns = contextNamespace;
}
} else {
mode = framesetOk ? NS_HTML5TREE_BUILDER_FRAMESET_OK : NS_HTML5TREE_BUILDER_IN_BODY;
return;

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

@ -11,38 +11,37 @@ LOCAL_INCLUDES = \
EXTRA_DSO_LDOPTS += $(MOZALLOC_LIB)
# should be MOCHITEST_CHROME_FILES, see bug 770938
MOCHITEST_CHROME_TESTS = \
xpcshellTestHarnessAdaptor.js \
ctypes_worker.js \
test_ctypes.xul \
$(NULL)
include $(topsrcdir)/config/rules.mk
xpctestdir = $(testxpcobjdir)/$(relativesrcdir)/unit
chrometestdir = \
$(DEPTH)/_tests/testing/mochitest/chrome/toolkit/components/$(relativesrcdir)
# preprocess and install our unit test into the appropriate directory,
# and install the test library as well. the xpcshell test rules will
# install the .js.in from the tests srcdir, so remove it when we're done.
libs:: unit/test_jsctypes.js.in
$(PYTHON) $(MOZILLA_DIR)/config/Preprocessor.py $(DEFINES) $(ACDEFINES) \
$^ > $(xpctestdir)/test_jsctypes.js
$(INSTALL) $(SHARED_LIBRARY) $(xpctestdir)
$(INSTALL) $(SHARED_LIBRARY) $(DEPTH)/_tests/testing/mochitest/chrome/libraries
$(INSTALL) $(xpctestdir)/test_jsctypes.js $(chrometestdir)
$(INSTALL) $(xpctestdir)/$(SHARED_LIBRARY) $(chrometestdir)
$(RM) $(xpctestdir)/test_jsctypes.js.in
# should be MOCHITEST_CHROME_FILES, see bug 770938
MOCHITEST_CHROME_TESTS_FILES = \
xpcshellTestHarnessAdaptor.js \
ctypes_worker.js \
test_ctypes.xul \
$(NULL)
libs:: $(MOCHITEST_CHROME_TESTS)
$(INSTALL) $(foreach f,$^,"$f") $(chrometestdir)
MOCHITEST_CHROME_TESTS_DEST = $(chrometestdir)
INSTALL_TARGETS += MOCHITEST_CHROME_TESTS
GARBAGE += \
$(xpctestdir)/test_jsctypes.js \
$(xpctestdir)/$(SHARED_LIBRARY) \
$(chrometestdir)/test_jsctypes.js \
$(chrometestdir)/$(SHARED_LIBRARY) \
$(NULL)
TEST_JS_CTYPES = unit/test_jsctypes.js.in
TEST_JS_CTYPES_PATH = $(xpctestdir)
PP_TARGETS += TEST_JS_CTYPES
TEST_JS_CTYPES_2_FILES = $(xpctestdir)/test_jsctypes.js
TEST_JS_CTYPES_2_DEST = $(chrometestdir)
INSTALL_TARGETS += TEST_JS_CTYPES_2
LIB_1_FILES = $(SHARED_LIBRARY)
LIB_1_DEST = $(xpctestdir)
INSTALL_TARGETS += LIB_1
LIB_2_FILES = $(SHARED_LIBRARY)
LIB_2_DEST = $(DEPTH)/_tests/testing/mochitest/chrome/libraries
INSTALL_TARGETS += LIB_2
LIB_3_FILES = $(SHARED_LIBRARY)
LIB_3_DEST = $(chrometestdir)
INSTALL_TARGETS += LIB_3

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

@ -9,3 +9,8 @@ available at http://code.google.com/p/protobuf.
This import includes only files in protobuf-lite, a lighter-weight library that
does not support reflection or descriptors. Manual changes include removing all
tests, testdata, config.h, and all files not used in protobuf-lite.
Applied Patches
===============
r512.patch:
Support VS2013 (from revision r512)

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

@ -36,6 +36,8 @@
#include <google/protobuf/stubs/common.h>
#include <google/protobuf/stubs/stl_util-inl.h>
#include <algorithm>
namespace google {
namespace protobuf {
namespace io {

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

@ -0,0 +1,13 @@
Index: src/google/protobuf/io/zero_copy_stream_impl_lite.cc
===================================================================
--- src/google/protobuf/io/zero_copy_stream_impl_lite.cc (revision 511)
+++ src/google/protobuf/io/zero_copy_stream_impl_lite.cc (revision 512)
@@ -36,6 +36,8 @@
#include <google/protobuf/stubs/common.h>
#include <google/protobuf/stubs/stl_util.h>
+#include <algorithm>
+
namespace google {
namespace protobuf {
namespace io {

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

@ -0,0 +1,2 @@
#!/bin/sh
patch -p1 < r512.patch

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

@ -16,21 +16,22 @@ LOCAL_INCLUDES += \
$(NULL)
EXTRA_DSO_LDOPTS += $(LIBS_DIR) $(MOZ_COMPONENT_LIBS) $(XPCOM_GLUE_LDOPTS)
MOCHITEST_BROWSER_FILES = \
MOCHITEST_CRASHREPORTER_FILES = \
browser/head.js \
browser/crashreport.sjs \
browser/browser_aboutCrashes.js \
browser/browser_bug471404.js \
browser/browser_aboutCrashesResubmit.js \
$(NULL)
include $(topsrcdir)/config/rules.mk
MOCHITEST_CRASHREPORTER_DEST = $(DEPTH)/_tests/testing/mochitest/browser/$(relativesrcdir)/browser
INSTALL_TARGETS += MOCHITEST_CRASHREPORTER
DEFINES += -DSHARED_LIBRARY=$(SHARED_LIBRARY) -DNOMINMAX
libs:: $(MOCHITEST_BROWSER_FILES)
$(INSTALL) $(foreach f,$^,"$f") $(DEPTH)/_tests/testing/mochitest/browser/$(relativesrcdir)/browser
UNIT_FILES = $(SHARED_LIBRARY) $(EXTRA_JS_MODULES)
UNIT_DEST = $(DEPTH)/_tests/xpcshell/$(relativesrcdir)/unit/
INSTALL_TARGETS += UNIT
libs:: $(SHARED_LIBRARY) $(EXTRA_JS_MODULES)
$(INSTALL) $^ $(DEPTH)/_tests/xpcshell/$(relativesrcdir)/unit/
$(INSTALL) $^ $(DEPTH)/_tests/xpcshell/$(relativesrcdir)/unit_ipc/
UNIT_IPC_FILES = $(UNIT_FILES)
UNIT_IPC_DEST = $(DEPTH)/_tests/xpcshell/$(relativesrcdir)/unit_ipc/
INSTALL_TARGETS += UNIT_IPC

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

@ -307,7 +307,7 @@ nsUXThemeData::UpdateNativeThemeInfo()
themeName = themeName ? themeName + 1 : themeFileName;
WindowsTheme theme = WINTHEME_UNRECOGNIZED;
for (int i = 0; i < ArrayLength(knownThemes); ++i) {
for (size_t i = 0; i < ArrayLength(knownThemes); ++i) {
if (!lstrcmpiW(themeName, knownThemes[i].name)) {
theme = (WindowsTheme)knownThemes[i].type;
break;
@ -342,7 +342,7 @@ nsUXThemeData::UpdateNativeThemeInfo()
// calculate the luna color scheme
WindowsThemeColor color = WINTHEMECOLOR_UNRECOGNIZED;
for (int i = 0; i < ArrayLength(knownColors); ++i) {
for (size_t i = 0; i < ArrayLength(knownColors); ++i) {
if (!lstrcmpiW(themeColor, knownColors[i].name)) {
color = (WindowsThemeColor)knownColors[i].type;
break;

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

@ -7,7 +7,11 @@
FORCE_SHARED_LIB = 1
MANIFEST_FILE = bug656331.manifest
unittestlocation = xpcom/tests/unit
MANIFEST = bug656331.manifest
MANIFEST_PATH = $(testxpcobjdir)/$(unittestlocation)
PP_TARGETS += MANIFEST
EXTRA_DSO_LDOPTS = \
$(DIST)/lib/$(LIB_PREFIX)xpcomglue_s.$(LIB_SUFFIX) \
@ -22,14 +26,8 @@ EXTRA_DSO_LDOPTS += \
$(NULL)
endif
include $(topsrcdir)/config/rules.mk
DEFINES += -DLIBRARY_FILENAME="$(SHARED_LIBRARY)"
unittestlocation = xpcom/tests/unit
libs:: $(SHARED_LIBRARY)
$(INSTALL) $^ $(testxpcobjdir)/$(unittestlocation)
libs:: $(MANIFEST_FILE)
$(PYTHON) $(topsrcdir)/config/Preprocessor.py $(DEFINES) $(ACDEFINES) $(XULPPFLAGS) $< > $(testxpcobjdir)/$(unittestlocation)/$(<F)
LIB_FILES = $(SHARED_LIBRARY)
LIB_DEST = $(testxpcobjdir)/$(unittestlocation)
INSTALL_TARGETS += LIB

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

@ -5,7 +5,11 @@
FORCE_SHARED_LIB = 1
MANIFEST_FILE = testcomponent.manifest
unittestlocation = xpcom/tests/unit
MANIFEST = testcomponent.manifest
MANIFEST_PATH = $(testxpcobjdir)/$(unittestlocation)
PP_TARGETS += MANIFEST
EXTRA_DSO_LDOPTS = \
$(DIST)/lib/$(LIB_PREFIX)xpcomglue_s.$(LIB_SUFFIX) \
@ -20,14 +24,8 @@ EXTRA_DSO_LDOPTS += \
$(NULL)
endif
include $(topsrcdir)/config/rules.mk
DEFINES += -DLIBRARY_FILENAME="$(SHARED_LIBRARY)"
unittestlocation = xpcom/tests/unit
libs:: $(SHARED_LIBRARY)
$(INSTALL) $^ $(testxpcobjdir)/$(unittestlocation)
libs:: $(MANIFEST_FILE)
$(PYTHON) $(topsrcdir)/config/Preprocessor.py $(DEFINES) $(ACDEFINES) $(XULPPFLAGS) $< > $(testxpcobjdir)/$(unittestlocation)/$(<F)
LIB_FILES = $(SHARED_LIBRARY)
LIB_DEST = $(testxpcobjdir)/$(unittestlocation)
INSTALL_TARGETS += LIB

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

@ -5,7 +5,11 @@
FORCE_SHARED_LIB = 1
MANIFEST_FILE = testcompnoaslr.manifest
unittestlocation = xpcom/tests/unit
MANIFEST = testcompnoaslr.manifest
MANIFEST_PATH = $(testxpcobjdir)/$(unittestlocation)
PP_TARGETS += MANIFEST
EXTRA_DSO_LDOPTS = \
$(DIST)/lib/$(LIB_PREFIX)xpcomglue_s.$(LIB_SUFFIX) \
@ -20,16 +24,12 @@ EXTRA_DSO_LDOPTS += \
$(NULL)
endif
LIB_FILES = $(SHARED_LIBRARY)
LIB_DEST = $(testxpcobjdir)/$(unittestlocation)
INSTALL_TARGETS += LIB
include $(topsrcdir)/config/rules.mk
LDFLAGS := $(filter-out -DYNAMICBASE,$(LDFLAGS)) -DYNAMICBASE:NO
DEFINES += -DLIBRARY_FILENAME="$(SHARED_LIBRARY)"
unittestlocation = xpcom/tests/unit
libs:: $(SHARED_LIBRARY)
$(INSTALL) $^ $(testxpcobjdir)/$(unittestlocation)
libs:: $(MANIFEST_FILE)
$(PYTHON) $(topsrcdir)/config/Preprocessor.py $(DEFINES) $(ACDEFINES) $(XULPPFLAGS) $< > $(testxpcobjdir)/$(unittestlocation)/$(<F)