Merge latest green fx-team changeset and mozilla-central; a=merge

This commit is contained in:
Ed Morley 2014-08-19 14:32:54 +01:00
commit 38ce979839
451 changed files with 2815 additions and 1314 deletions

View File

@ -8,7 +8,12 @@ const CLIENT_EVENT_TYPE = "ContentSearchClient";
// Forward events from the in-content service to the test.
content.addEventListener(SERVICE_EVENT_TYPE, event => {
sendAsyncMessage(TEST_MSG, event.detail);
// The event dispatch code in content.js clones the event detail into the
// content scope. That's generally the right thing, but causes us to end
// up with an XrayWrapper to it here, which will screw us up when trying to
// serialize the object in sendAsyncMessage. Waive Xrays for the benefit of
// the test machinery.
sendAsyncMessage(TEST_MSG, Components.utils.waiveXrays(event.detail));
});
// Forward messages from the test to the in-content service.

View File

@ -2632,6 +2632,7 @@ nsContentUtils::GenerateStateKey(nsIContent* aContent,
nsIPrincipal*
nsContentUtils::SubjectPrincipal()
{
MOZ_ASSERT(IsInitialized());
JSContext* cx = GetCurrentJSContext();
if (!cx) {
return GetSystemPrincipal();
@ -4697,6 +4698,7 @@ nsContentUtils::CheckSecurityBeforeLoad(nsIURI* aURIToLoad,
bool
nsContentUtils::IsSystemPrincipal(nsIPrincipal* aPrincipal)
{
MOZ_ASSERT(IsInitialized());
return aPrincipal == sSystemPrincipal;
}
@ -4710,6 +4712,7 @@ nsContentUtils::IsExpandedPrincipal(nsIPrincipal* aPrincipal)
nsIPrincipal*
nsContentUtils::GetSystemPrincipal()
{
MOZ_ASSERT(IsInitialized());
return sSystemPrincipal;
}
@ -5521,6 +5524,7 @@ JSContext *
nsContentUtils::GetCurrentJSContext()
{
MOZ_ASSERT(NS_IsMainThread());
MOZ_ASSERT(IsInitialized());
return sXPConnect->GetCurrentJSContext();
}
@ -5529,6 +5533,7 @@ JSContext *
nsContentUtils::GetSafeJSContext()
{
MOZ_ASSERT(NS_IsMainThread());
MOZ_ASSERT(IsInitialized());
return sXPConnect->GetSafeJSContext();
}
@ -5536,6 +5541,7 @@ nsContentUtils::GetSafeJSContext()
JSContext *
nsContentUtils::GetDefaultJSContextForThread()
{
MOZ_ASSERT(IsInitialized());
if (MOZ_LIKELY(NS_IsMainThread())) {
return GetSafeJSContext();
} else {
@ -5547,6 +5553,7 @@ nsContentUtils::GetDefaultJSContextForThread()
JSContext *
nsContentUtils::GetCurrentJSContextForThread()
{
MOZ_ASSERT(IsInitialized());
if (MOZ_LIKELY(NS_IsMainThread())) {
return GetCurrentJSContext();
} else {

View File

@ -107,9 +107,7 @@ nsDOMFileReader::Init()
// Instead of grabbing some random global from the context stack,
// let's use the default one (junk scope) for now.
// We should move away from this Init...
nsCOMPtr<nsIGlobalObject> global = xpc::GetJunkScopeGlobal();
NS_ENSURE_TRUE(global, NS_ERROR_FAILURE);
BindToOwner(global);
BindToOwner(xpc::GetNativeForGlobal(xpc::PrivilegedJunkScope()));
return NS_OK;
}

View File

@ -39,6 +39,7 @@
#include "nsIDocShellTreeItem.h"
#include "nsCOMArray.h"
#include "nsDOMClassInfo.h"
#include "mozilla/Services.h"
#include "mozilla/AsyncEventDispatcher.h"
#include "mozilla/BasicEvents.h"
@ -2142,7 +2143,7 @@ nsDocument::Init()
// we use the default compartment for this document, instead of creating
// wrapper in some random compartment when the document is exposed to js
// via some events.
nsCOMPtr<nsIGlobalObject> global = xpc::GetJunkScopeGlobal();
nsCOMPtr<nsIGlobalObject> global = xpc::GetNativeForGlobal(xpc::PrivilegedJunkScope());
NS_ENSURE_TRUE(global, NS_ERROR_FAILURE);
mScopeObject = do_GetWeakReference(global);
MOZ_ASSERT(mScopeObject);
@ -4494,7 +4495,7 @@ nsDocument::SetScriptGlobalObject(nsIScriptGlobalObject *aScriptGlobalObject)
return;
}
nsCOMPtr<nsIServiceWorkerManager> swm = do_GetService(SERVICEWORKERMANAGER_CONTRACTID);
nsCOMPtr<nsIServiceWorkerManager> swm = mozilla::services::GetServiceWorkerManager();
if (swm) {
swm->MaybeStartControlling(this);
mMaybeServiceWorkerControlled = true;
@ -8526,7 +8527,7 @@ nsDocument::Destroy()
mRegistry = nullptr;
nsCOMPtr<nsIServiceWorkerManager> swm = do_GetService(SERVICEWORKERMANAGER_CONTRACTID);
nsCOMPtr<nsIServiceWorkerManager> swm = mozilla::services::GetServiceWorkerManager();
if (swm) {
swm->MaybeStopControlling(this);
}

View File

@ -352,9 +352,7 @@ nsXMLHttpRequest::Init()
// Instead of grabbing some random global from the context stack,
// let's use the default one (junk scope) for now.
// We should move away from this Init...
nsCOMPtr<nsIGlobalObject> global = xpc::GetJunkScopeGlobal();
NS_ENSURE_TRUE(global, NS_ERROR_FAILURE);
Construct(subjectPrincipal, global);
Construct(subjectPrincipal, xpc::GetNativeForGlobal(xpc::PrivilegedJunkScope()));
return NS_OK;
}

View File

@ -179,7 +179,6 @@ LOCAL_INCLUDES += [
'/dom/canvas',
'/dom/xbl',
'/editor/libeditor',
'/editor/libeditor/text',
'/editor/txmgr',
'/layout/forms',
'/layout/generic',

View File

@ -261,6 +261,24 @@ AudioNodeStream::SetChannelMixingParameters(uint32_t aNumberOfChannels,
aChannelInterpretation));
}
void
AudioNodeStream::SetPassThrough(bool aPassThrough)
{
class Message : public ControlMessage {
public:
Message(AudioNodeStream* aStream, bool aPassThrough)
: ControlMessage(aStream), mPassThrough(aPassThrough) {}
virtual void Run()
{
static_cast<AudioNodeStream*>(mStream)->mPassThrough = mPassThrough;
}
bool mPassThrough;
};
MOZ_ASSERT(this);
GraphImpl()->AppendMessage(new Message(this, aPassThrough));
}
void
AudioNodeStream::SetChannelMixingParametersImpl(uint32_t aNumberOfChannels,
ChannelCountMode aChannelCountMode,
@ -453,10 +471,15 @@ AudioNodeStream::ProcessInput(GraphTime aFrom, GraphTime aTo, uint32_t aFlags)
ObtainInputBlock(inputChunks[i], i);
}
bool finished = false;
if (maxInputs <= 1 && mEngine->OutputCount() <= 1) {
mEngine->ProcessBlock(this, inputChunks[0], &mLastChunks[0], &finished);
if (mPassThrough) {
MOZ_ASSERT(outputCount == 1, "For now, we only support nodes that have one output port");
mLastChunks[0] = inputChunks[0];
} else {
mEngine->ProcessBlocksOnPorts(this, inputChunks, mLastChunks, &finished);
if (maxInputs <= 1 && mEngine->OutputCount() <= 1) {
mEngine->ProcessBlock(this, inputChunks[0], &mLastChunks[0], &finished);
} else {
mEngine->ProcessBlocksOnPorts(this, inputChunks, mLastChunks, &finished);
}
}
for (uint16_t i = 0; i < outputCount; ++i) {
NS_ASSERTION(mLastChunks[i].GetDuration() == WEBAUDIO_BLOCK_SIZE,

View File

@ -54,7 +54,8 @@ public:
mKind(aKind),
mNumberOfInputChannels(2),
mMarkAsFinishedAfterThisBlock(false),
mAudioParamStream(false)
mAudioParamStream(false),
mPassThrough(false)
{
MOZ_ASSERT(NS_IsMainThread());
mChannelCountMode = ChannelCountMode::Max;
@ -85,6 +86,7 @@ public:
void SetChannelMixingParameters(uint32_t aNumberOfChannels,
ChannelCountMode aChannelCountMoe,
ChannelInterpretation aChannelInterpretation);
void SetPassThrough(bool aPassThrough);
ChannelInterpretation GetChannelInterpretation()
{
return mChannelInterpretation;
@ -192,6 +194,8 @@ protected:
bool mMarkAsFinishedAfterThisBlock;
// Whether the stream is an AudioParamHelper stream.
bool mAudioParamStream;
// Whether the stream just passes its input through.
bool mPassThrough;
};
}

View File

@ -159,6 +159,7 @@ public:
// Only used by WebMReader and MediaOmxReader for now, so stub here rather
// than in every reader than inherits from MediaDecoderReader.
virtual void NotifyDataArrived(const char* aBuffer, uint32_t aLength, int64_t aOffset) {}
virtual int64_t GetEvictionOffset(double aTime) { return -1; }
virtual MediaQueue<AudioData>& AudioQueue() { return mAudioQueue; }
virtual MediaQueue<VideoData>& VideoQueue() { return mVideoQueue; }

View File

@ -109,9 +109,10 @@ MP4Reader::MP4Reader(AbstractMediaDecoder* aDecoder)
, mVideo("MP4 video decoder data", Preferences::GetUint("media.mp4-video-decode-ahead", 2))
, mLastReportedNumDecodedFrames(0)
, mLayersBackendType(layers::LayersBackend::LAYERS_NONE)
, mTimeRangesMonitor("MP4Reader::TimeRanges")
, mDemuxerInitialized(false)
, mIsEncrypted(false)
, mIndexReady(false)
, mIndexMonitor("MP4 index")
{
MOZ_ASSERT(NS_IsMainThread(), "Must be on main thread.");
MOZ_COUNT_CTOR(MP4Reader);
@ -304,6 +305,11 @@ MP4Reader::ReadMetadata(MediaInfo* aInfo,
bool ok = mDemuxer->Init();
NS_ENSURE_TRUE(ok, NS_ERROR_FAILURE);
{
MonitorAutoLock mon(mIndexMonitor);
mIndexReady = true;
}
mInfo.mVideo.mHasVideo = mVideo.mActive = mDemuxer->HasValidVideo();
const VideoDecoderConfig& video = mDemuxer->VideoConfig();
// If we have video, we *only* allow H.264 to be decoded.
@ -417,6 +423,8 @@ MP4Reader::ReadMetadata(MediaInfo* aInfo,
*aInfo = mInfo;
*aTags = nullptr;
UpdateIndex();
return NS_OK;
}
@ -774,28 +782,52 @@ MP4Reader::NotifyDataArrived(const char* aBuffer, uint32_t aLength,
void
MP4Reader::UpdateIndex()
{
nsTArray<MediaByteRange> ranges;
nsTArray<Interval<Microseconds>> timeRanges;
MonitorAutoLock mon(mIndexMonitor);
if (!mIndexReady) {
return;
}
MediaResource* resource = mDecoder->GetResource();
resource->Pin();
nsTArray<MediaByteRange> ranges;
if (NS_SUCCEEDED(resource->GetCachedRanges(ranges))) {
mDemuxer->ConvertByteRangesToTime(ranges, &timeRanges);
mDemuxer->UpdateIndex(ranges);
}
resource->Unpin();
MonitorAutoLock mon(mTimeRangesMonitor);
mTimeRanges = timeRanges;
}
int64_t
MP4Reader::GetEvictionOffset(double aTime)
{
MonitorAutoLock mon(mIndexMonitor);
if (!mIndexReady) {
return 0;
}
return mDemuxer->GetEvictionOffset(aTime * 1000000.0);
}
nsresult
MP4Reader::GetBuffered(dom::TimeRanges* aBuffered, int64_t aStartTime)
{
MonitorAutoLock mon(mTimeRangesMonitor);
for (size_t i = 0; i < mTimeRanges.Length(); i++) {
aBuffered->Add((mTimeRanges[i].start - aStartTime) / 1000000.0,
(mTimeRanges[i].end - aStartTime) / 1000000.0);
MonitorAutoLock mon(mIndexMonitor);
if (!mIndexReady) {
return NS_OK;
}
MediaResource* resource = mDecoder->GetResource();
nsTArray<MediaByteRange> ranges;
resource->Pin();
nsresult rv = resource->GetCachedRanges(ranges);
resource->Unpin();
if (NS_SUCCEEDED(rv)) {
nsTArray<Interval<Microseconds>> timeRanges;
mDemuxer->ConvertByteRangesToTime(ranges, &timeRanges);
for (size_t i = 0; i < timeRanges.Length(); i++) {
aBuffered->Add((timeRanges[i].start - aStartTime) / 1000000.0,
(timeRanges[i].end - aStartTime) / 1000000.0);
}
}
return NS_OK;

View File

@ -55,6 +55,8 @@ public:
virtual void NotifyDataArrived(const char* aBuffer, uint32_t aLength,
int64_t aOffset) MOZ_OVERRIDE;
virtual int64_t GetEvictionOffset(double aTime) MOZ_OVERRIDE;
virtual nsresult GetBuffered(dom::TimeRanges* aBuffered,
int64_t aStartTime) MOZ_OVERRIDE;
@ -181,14 +183,15 @@ private:
layers::LayersBackend mLayersBackendType;
nsTArray<nsTArray<uint8_t>> mInitDataEncountered;
Monitor mTimeRangesMonitor;
nsTArray<mp4_demuxer::Interval<Microseconds>> mTimeRanges;
// True if we've read the streams' metadata.
bool mDemuxerInitialized;
// Synchronized by decoder monitor.
bool mIsEncrypted;
bool mIndexReady;
Monitor mIndexMonitor;
};
} // namespace mozilla

View File

@ -112,11 +112,16 @@ SubBufferDecoder::GetBuffered(dom::TimeRanges* aBuffered)
int64_t
SubBufferDecoder::ConvertToByteOffset(double aTime)
{
int64_t readerOffset = mReader->GetEvictionOffset(aTime);
if (readerOffset >= 0) {
return readerOffset;
}
// Uses a conversion based on (aTime/duration) * length. For the
// purposes of eviction this should be adequate since we have the
// byte threshold as well to ensure data actually gets evicted and
// we ensure we don't evict before the current playable point.
if (mMediaDuration == -1) {
if (mMediaDuration <= 0) {
return -1;
}
int64_t length = GetResource()->GetLength();

View File

@ -65,6 +65,7 @@ AudioNode::AudioNode(AudioContext* aContext,
, mChannelCountMode(aChannelCountMode)
, mChannelInterpretation(aChannelInterpretation)
, mId(gId++)
, mPassThrough(false)
#ifdef DEBUG
, mDemiseNotified(false)
#endif
@ -416,5 +417,22 @@ AudioNode::RemoveOutputParam(AudioParam* aParam)
mOutputParams.RemoveElement(aParam);
}
bool
AudioNode::PassThrough() const
{
MOZ_ASSERT(NumberOfInputs() == 1 && NumberOfOutputs() == 1);
return mPassThrough;
}
void
AudioNode::SetPassThrough(bool aPassThrough)
{
MOZ_ASSERT(NumberOfInputs() == 1 && NumberOfOutputs() == 1);
mPassThrough = aPassThrough;
AudioNodeStream* ns = static_cast<AudioNodeStream*>(mStream.get());
MOZ_ASSERT(ns, "How come we don't have a stream here?");
ns->SetPassThrough(mPassThrough);
}
}
}

View File

@ -133,6 +133,9 @@ public:
uint32_t Id() const { return mId; }
bool PassThrough() const;
void SetPassThrough(bool aPassThrough);
uint32_t ChannelCount() const { return mChannelCount; }
virtual void SetChannelCount(uint32_t aChannelCount, ErrorResult& aRv)
{
@ -267,6 +270,9 @@ private:
ChannelCountMode mChannelCountMode;
ChannelInterpretation mChannelInterpretation;
const uint32_t mId;
// Whether the node just passes through its input. This is a devtools API that
// only works for some node types.
bool mPassThrough;
#ifdef DEBUG
// In debug builds, check to make sure that the node demise notification has
// been properly sent before the node is destroyed.

View File

@ -24,6 +24,8 @@ support-files =
webaudio.js
[test_analyserNode.html]
[test_analyserNodeOutput.html]
[test_analyserNodePassThrough.html]
[test_AudioBuffer.html]
[test_audioBufferSourceNode.html]
[test_audioBufferSourceNodeEnded.html]
@ -49,6 +51,7 @@ skip-if = (toolkit == 'gonk' && !debug) || (toolkit == 'android') #bug 906752
[test_audioParamTimelineDestinationOffset.html]
[test_badConnect.html]
[test_biquadFilterNode.html]
[test_biquadFilterNodePassThrough.html]
[test_biquadFilterNodeWithGain.html]
[test_bug808374.html]
[test_bug827541.html]
@ -74,6 +77,7 @@ skip-if = (toolkit == 'gonk' && !debug) || (toolkit == 'android') #bug 906752
[test_convolverNode.html]
[test_convolverNode_mono_mono.html]
[test_convolverNodeChannelCount.html]
[test_convolverNodePassThrough.html]
[test_convolverNodeWithGain.html]
[test_currentTime.html]
[test_decodeMultichannel.html]
@ -81,6 +85,7 @@ skip-if = (toolkit == 'gonk' && !debug) || (toolkit == 'android') #bug 906752
[test_delayNodeAtMax.html]
[test_delayNodeChannelChanges.html]
[test_delayNodeCycles.html]
[test_delayNodePassThrough.html]
[test_delayNodeSmallMaxDelay.html]
[test_delayNodeTailIncrease.html]
[test_delayNodeTailWithDisconnect.html]
@ -88,8 +93,10 @@ skip-if = (toolkit == 'gonk' && !debug) || (toolkit == 'android') #bug 906752
[test_delayNodeTailWithReconnect.html]
[test_delayNodeWithGain.html]
[test_dynamicsCompressorNode.html]
[test_dynamicsCompressorNodePassThrough.html]
[test_gainNode.html]
[test_gainNodeInLoop.html]
[test_gainNodePassThrough.html]
[test_maxChannelCount.html]
[test_mediaDecoding.html]
[test_mediaElementAudioSourceNode.html]
@ -125,4 +132,5 @@ skip-if = (toolkit == 'gonk' && !debug)
[test_waveDecoder.html]
[test_waveShaper.html]
[test_waveShaperNoCurve.html]
[test_waveShaperPassThrough.html]
[test_waveShaperZeroLengthCurve.html]

View File

@ -0,0 +1,43 @@
<!DOCTYPE HTML>
<html>
<head>
<title>Test AnalyserNode</title>
<script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
<script type="text/javascript" src="webaudio.js"></script>
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
</head>
<body>
<pre id="test">
<script class="testbody" type="text/javascript">
var gTest = {
length: 2048,
numberOfChannels: 1,
createGraph: function(context) {
var source = context.createBufferSource();
var analyser = context.createAnalyser();
source.buffer = this.buffer;
source.connect(analyser);
source.start(0);
return analyser;
},
createExpectedBuffers: function(context) {
this.buffer = context.createBuffer(1, 2048, context.sampleRate);
for (var i = 0; i < 2048; ++i) {
this.buffer.getChannelData(0)[i] = Math.sin(440 * 2 * Math.PI * i / context.sampleRate);
}
return [this.buffer];
},
};
runTest();
</script>
</pre>
</body>
</html>

View File

@ -0,0 +1,47 @@
<!DOCTYPE HTML>
<html>
<head>
<title>Test AnalyserNode with passthrough</title>
<script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
<script type="text/javascript" src="webaudio.js"></script>
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
</head>
<body>
<pre id="test">
<script class="testbody" type="text/javascript">
var gTest = {
length: 2048,
numberOfChannels: 1,
createGraph: function(context) {
var source = context.createBufferSource();
var analyser = context.createAnalyser();
source.buffer = this.buffer;
source.connect(analyser);
var analyserWrapped = SpecialPowers.wrap(analyser);
ok("passThrough" in analyserWrapped, "AnalyserNode should support the passThrough API");
analyserWrapped.passThrough = true;
source.start(0);
return analyser;
},
createExpectedBuffers: function(context) {
this.buffer = context.createBuffer(1, 2048, context.sampleRate);
for (var i = 0; i < 2048; ++i) {
this.buffer.getChannelData(0)[i] = Math.sin(440 * 2 * Math.PI * i / context.sampleRate);
}
return [this.buffer];
},
};
runTest();
</script>
</pre>
</body>
</html>

View File

@ -0,0 +1,47 @@
<!DOCTYPE HTML>
<html>
<head>
<title>Test BiquadFilterNode with passthrough</title>
<script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
<script type="text/javascript" src="webaudio.js"></script>
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
</head>
<body>
<pre id="test">
<script class="testbody" type="text/javascript">
var gTest = {
length: 2048,
numberOfChannels: 1,
createGraph: function(context) {
var source = context.createBufferSource();
var filter = context.createBiquadFilter();
source.buffer = this.buffer;
source.connect(filter);
var filterWrapped = SpecialPowers.wrap(filter);
ok("passThrough" in filterWrapped, "BiquadFilterNode should support the passThrough API");
filterWrapped.passThrough = true;
source.start(0);
return filter;
},
createExpectedBuffers: function(context) {
this.buffer = context.createBuffer(1, 2048, context.sampleRate);
for (var i = 0; i < 2048; ++i) {
this.buffer.getChannelData(0)[i] = Math.sin(440 * 2 * Math.PI * i / context.sampleRate);
}
return [this.buffer];
},
};
runTest();
</script>
</pre>
</body>
</html>

View File

@ -0,0 +1,48 @@
<!DOCTYPE HTML>
<html>
<head>
<title>Test ConvolverNode with passthrough</title>
<script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
<script type="text/javascript" src="webaudio.js"></script>
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
</head>
<body>
<pre id="test">
<script class="testbody" type="text/javascript">
var gTest = {
length: 2048,
numberOfChannels: 1,
createGraph: function(context) {
var source = context.createBufferSource();
var convolver = context.createConvolver();
source.buffer = this.buffer;
convolver.buffer = this.buffer;
source.connect(convolver);
var convolverWrapped = SpecialPowers.wrap(convolver);
ok("passThrough" in convolverWrapped, "ConvolverNode should support the passThrough API");
convolverWrapped.passThrough = true;
source.start(0);
return convolver;
},
createExpectedBuffers: function(context) {
this.buffer = context.createBuffer(1, 2048, context.sampleRate);
for (var i = 0; i < 2048; ++i) {
this.buffer.getChannelData(0)[i] = Math.sin(440 * 2 * Math.PI * i / context.sampleRate);
}
return [this.buffer];
},
};
runTest();
</script>
</pre>
</body>
</html>

View File

@ -0,0 +1,53 @@
<!DOCTYPE HTML>
<html>
<head>
<title>Test DelayNode</title>
<script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
</head>
<body>
<pre id="test">
<script src="webaudio.js" type="text/javascript"></script>
<script class="testbody" type="text/javascript">
var gTest = {
length: 4096,
numberOfChannels: 1,
createGraph: function(context) {
var source = context.createBufferSource();
var delay = context.createDelay();
source.buffer = this.buffer;
source.connect(delay);
delay.delayTime.value = 0.5;
// Delay the source stream by 2048 frames
delay.delayTime.value = 2048 / context.sampleRate;
var delayWrapped = SpecialPowers.wrap(delay);
ok("passThrough" in delayWrapped, "DelayNode should support the passThrough API");
delayWrapped.passThrough = true;
source.start(0);
return delay;
},
createExpectedBuffers: function(context) {
this.buffer = context.createBuffer(1, 2048, context.sampleRate);
for (var i = 0; i < 2048; ++i) {
this.buffer.getChannelData(0)[i] = Math.sin(440 * 2 * Math.PI * i / context.sampleRate);
}
var silence = context.createBuffer(1, 2048, context.sampleRate);
return [this.buffer, silence];
},
};
runTest();
</script>
</pre>
</body>
</html>

View File

@ -0,0 +1,47 @@
<!DOCTYPE HTML>
<html>
<head>
<title>Test DynamicsCompressorNode with passthrough</title>
<script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
<script type="text/javascript" src="webaudio.js"></script>
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
</head>
<body>
<pre id="test">
<script class="testbody" type="text/javascript">
var gTest = {
length: 2048,
numberOfChannels: 1,
createGraph: function(context) {
var source = context.createBufferSource();
var compressor = context.createDynamicsCompressor();
source.buffer = this.buffer;
source.connect(compressor);
var compressorWrapped = SpecialPowers.wrap(compressor);
ok("passThrough" in compressorWrapped, "DynamicsCompressorNode should support the passThrough API");
compressorWrapped.passThrough = true;
source.start(0);
return compressor;
},
createExpectedBuffers: function(context) {
this.buffer = context.createBuffer(1, 2048, context.sampleRate);
for (var i = 0; i < 2048; ++i) {
this.buffer.getChannelData(0)[i] = Math.sin(440 * 2 * Math.PI * i / context.sampleRate);
}
return [this.buffer];
},
};
runTest();
</script>
</pre>
</body>
</html>

View File

@ -0,0 +1,49 @@
<!DOCTYPE HTML>
<html>
<head>
<title>Test GainNode with passthrough</title>
<script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
<script type="text/javascript" src="webaudio.js"></script>
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
</head>
<body>
<pre id="test">
<script class="testbody" type="text/javascript">
var gTest = {
length: 2048,
numberOfChannels: 1,
createGraph: function(context) {
var source = context.createBufferSource();
var gain = context.createGain();
source.buffer = this.buffer;
source.connect(gain);
gain.gain.value = 0.5;
var gainWrapped = SpecialPowers.wrap(gain);
ok("passThrough" in gainWrapped, "GainNode should support the passThrough API");
gainWrapped.passThrough = true;
source.start(0);
return gain;
},
createExpectedBuffers: function(context) {
this.buffer = context.createBuffer(1, 2048, context.sampleRate);
for (var i = 0; i < 2048; ++i) {
this.buffer.getChannelData(0)[i] = Math.sin(440 * 2 * Math.PI * i / context.sampleRate);
}
return [this.buffer];
},
};
runTest();
</script>
</pre>
</body>
</html>

View File

@ -0,0 +1,53 @@
<!DOCTYPE HTML>
<html>
<head>
<title>Test PannerNode with passthrough</title>
<script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
<script type="text/javascript" src="webaudio.js"></script>
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
</head>
<body>
<pre id="test">
<script class="testbody" type="text/javascript">
var gTest = {
length: 2048,
numberOfChannels: 1,
createGraph: function(context) {
var source = context.createBufferSource();
var panner = context.createPanner();
source.buffer = this.buffer;
source.connect(panner);
context.listener.setOrientation(0, 6.311749985202524e+307, 0, 0.1, 1000, 0);
context.listener.setOrientation(0, 0, -6.311749985202524e+307, 0, 0, 6.311749985202524e+307);
panner.setPosition(2, 0, 0);
panner.rolloffFactor = 0;
panner.panningModel = "equalpower";
var pannerWrapped = SpecialPowers.wrap(panner);
ok("passThrough" in pannerWrapped, "PannerNode should support the passThrough API");
pannerWrapped.passThrough = true;
source.start(0);
return panner;
},
createExpectedBuffers: function(context) {
this.buffer = context.createBuffer(1, 2048, context.sampleRate);
for (var i = 0; i < 2048; ++i) {
this.buffer.getChannelData(0)[i] = Math.sin(440 * 2 * Math.PI * i / context.sampleRate);
}
return [this.buffer];
},
};
runTest();
</script>
</pre>
</body>
</html>

View File

@ -0,0 +1,55 @@
<!DOCTYPE HTML>
<html>
<head>
<title>Test WaveShaperNode with passthrough</title>
<script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
<script type="text/javascript" src="webaudio.js"></script>
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
</head>
<body>
<pre id="test">
<script class="testbody" type="text/javascript">
var gTest = {
length: 4096,
numberOfChannels: 1,
createGraph: function(context) {
var source = context.createBufferSource();
source.buffer = this.buffer;
var shaper = context.createWaveShaper();
shaper.curve = this.curve;
var shaperWrapped = SpecialPowers.wrap(shaper);
ok("passThrough" in shaperWrapped, "WaveShaperNode should support the passThrough API");
shaperWrapped.passThrough = true;
source.connect(shaper);
source.start(0);
return shaper;
},
createExpectedBuffers: function(context) {
this.buffer = context.createBuffer(1, 4096, context.sampleRate);
for (var i = 1; i < 4095; ++i) {
this.buffer.getChannelData(0)[i] = 2 * (i / 4096) - 1;
}
// Two out of range values
this.buffer.getChannelData(0)[0] = -2;
this.buffer.getChannelData(0)[4095] = 2;
this.curve = new Float32Array(2048);
for (var i = 0; i < 2048; ++i) {
this.curve[i] = Math.sin(100 * Math.PI * (i + 1) / context.sampleRate);
}
return [this.buffer];
},
};
runTest();
</script>
</pre>
</body>
</html>

View File

@ -2531,7 +2531,7 @@ nsXULPrototypeScript::Serialize(nsIObjectOutputStream* aStream,
{
NS_ENSURE_TRUE(aProtoDoc, NS_ERROR_UNEXPECTED);
AutoSafeJSContext cx;
JS::Rooted<JSObject*> global(cx, xpc::GetCompilationScope());
JS::Rooted<JSObject*> global(cx, xpc::CompilationScope());
NS_ENSURE_TRUE(global, NS_ERROR_UNEXPECTED);
JSAutoCompartment ac(cx, global);
@ -2553,8 +2553,7 @@ nsXULPrototypeScript::Serialize(nsIObjectOutputStream* aStream,
// been set.
JS::Handle<JSScript*> script =
JS::Handle<JSScript*>::fromMarkedLocation(mScriptObject.address());
// Note - Inverting the order of these operands is a rooting hazard.
MOZ_ASSERT(xpc::GetCompilationScope() == JS::CurrentGlobalOrNull(cx));
MOZ_ASSERT(xpc::CompilationScope() == JS::CurrentGlobalOrNull(cx));
return nsContentUtils::XPConnect()->WriteScript(aStream, cx,
xpc_UnmarkGrayScript(script));
}
@ -2621,7 +2620,7 @@ nsXULPrototypeScript::Deserialize(nsIObjectInputStream* aStream,
aStream->Read32(&mLangVersion);
AutoSafeJSContext cx;
JS::Rooted<JSObject*> global(cx, xpc::GetCompilationScope());
JS::Rooted<JSObject*> global(cx, xpc::CompilationScope());
NS_ENSURE_TRUE(global, NS_ERROR_UNEXPECTED);
JSAutoCompartment ac(cx, global);
@ -2731,7 +2730,7 @@ NotifyOffThreadScriptCompletedRunnable::Run()
JSScript *script;
{
AutoSafeJSContext cx;
JSAutoCompartment ac(cx, xpc::GetCompilationScope());
JSAutoCompartment ac(cx, xpc::CompilationScope());
script = JS::FinishOffThreadScript(cx, JS_GetRuntime(cx), mToken);
}
@ -2757,9 +2756,8 @@ nsXULPrototypeScript::Compile(JS::SourceBufferHolder& aSrcBuf,
nsIOffThreadScriptReceiver *aOffThreadReceiver /* = nullptr */)
{
// We'll compile the script in the compilation scope.
NS_ENSURE_TRUE(xpc::GetCompilationScope(), NS_ERROR_UNEXPECTED);
AutoSafeJSContext cx;
JSAutoCompartment ac(cx, xpc::GetCompilationScope());
JSAutoCompartment ac(cx, xpc::CompilationScope());
nsAutoCString urlspec;
nsContentUtils::GetWrapperSafeScriptFilename(aDocument, aURI, urlspec);

View File

@ -1113,7 +1113,7 @@ Console::ProcessCallData(ConsoleCallData* aData)
// mStorage, but that's a bit fragile. Instead, we just use the junk scope,
// with explicit permission from the XPConnect module owner. If you're
// tempted to do that anywhere else, talk to said module owner first.
JSAutoCompartment ac2(cx, xpc::GetJunkScope());
JSAutoCompartment ac2(cx, xpc::PrivilegedJunkScope());
JS::Rooted<JS::Value> eventValue(cx);
if (!ToJSValue(cx, event, &eventValue)) {

View File

@ -499,7 +499,7 @@ ThreadsafeAutoJSContext::operator JSContext*() const
AutoSafeJSContext::AutoSafeJSContext(MOZ_GUARD_OBJECT_NOTIFIER_ONLY_PARAM_IN_IMPL)
: AutoJSContext(true MOZ_GUARD_OBJECT_NOTIFIER_PARAM_TO_PARENT)
, mAc(mCx, XPCJSRuntime::Get()->GetJSContextStack()->GetSafeJSContextGlobal())
, mAc(mCx, xpc::UnprivilegedJunkScope())
{
}

View File

@ -124,7 +124,7 @@ nsJSUtils::ReportPendingException(JSContext *aContext)
// The SafeJSContext has no default object associated with it.
MOZ_ASSERT(NS_IsMainThread());
MOZ_ASSERT(aContext == nsContentUtils::GetSafeJSContext());
scope = xpc::GetSafeJSContextGlobal();
scope = xpc::UnprivilegedJunkScope(); // Usage approved by bholley
}
JSAutoCompartment ac(aContext, scope);
JS_ReportPendingException(aContext);

View File

@ -81,6 +81,13 @@ GetPluginMimeTypes(const nsTArray<nsRefPtr<nsPluginElement> >& aPlugins,
}
}
static bool
operator<(const nsRefPtr<nsMimeType>& lhs, const nsRefPtr<nsMimeType>& rhs)
{
// Sort MIME types alphabetically by type name.
return lhs->Type() < rhs->Type();
}
void
nsPluginArray::GetMimeTypes(nsTArray<nsRefPtr<nsMimeType> >& aMimeTypes,
nsTArray<nsRefPtr<nsMimeType> >& aHiddenMimeTypes)
@ -96,6 +103,10 @@ nsPluginArray::GetMimeTypes(nsTArray<nsRefPtr<nsMimeType> >& aMimeTypes,
GetPluginMimeTypes(mPlugins, aMimeTypes);
GetPluginMimeTypes(mHiddenPlugins, aHiddenMimeTypes);
// Alphabetize the enumeration order of non-hidden MIME types to reduce
// fingerprintable entropy based on plugins' installation file times.
aMimeTypes.Sort();
}
nsPluginElement*
@ -297,6 +308,14 @@ IsPluginEnumerable(const nsTArray<nsCString>& enumerableNames,
return false; // hide plugin!
}
static bool
operator<(const nsRefPtr<nsPluginElement>& lhs,
const nsRefPtr<nsPluginElement>& rhs)
{
// Sort plugins alphabetically by name.
return lhs->PluginTag()->mName < rhs->PluginTag()->mName;
}
void
nsPluginArray::EnsurePlugins()
{
@ -345,6 +364,10 @@ nsPluginArray::EnsurePlugins()
pluginArray.AppendElement(new nsPluginElement(mWindow, pluginTag));
}
// Alphabetize the enumeration order of non-hidden plugins to reduce
// fingerprintable entropy based on plugins' installation file times.
mPlugins.Sort();
}
// nsPluginElement implementation.

View File

@ -11104,7 +11104,7 @@ class CGDictionary(CGThing):
AutoJSAPI jsapi;
jsapi.Init();
JSContext *cx = jsapi.cx();
JSAutoCompartment ac(cx, xpc::GetSafeJSContextGlobal()); // Usage approved by bholley
JSAutoCompartment ac(cx, xpc::UnprivilegedJunkScope()); // Usage approved by bholley
JS::Rooted<JS::Value> obj(cx);
return ToObjectInternal(cx, &obj) && StringifyToJSON(cx, &obj, aJSON);
"""))
@ -11892,7 +11892,7 @@ class CGBindingRoot(CGThing):
bindingHeaders["WrapperFactory.h"] = descriptors
bindingHeaders["mozilla/dom/DOMJSClass.h"] = descriptors
bindingHeaders["mozilla/dom/ScriptSettings.h"] = dictionaries # AutoJSAPI
bindingHeaders["xpcpublic.h"] = dictionaries ## xpc::GetSafeJSContextGlobal
bindingHeaders["xpcpublic.h"] = dictionaries ## xpc::UnprivilegedJunkScope
# Do codegen for all the dictionaries. We have to be a bit careful
# here, because we have to generate these in order from least derived

View File

@ -495,7 +495,7 @@ SmsRequestParent::DoRequest(const SendMessageRequest& aRequest)
// jsval to ::Send. Only system code should be looking at the result here,
// so we just create it in the System-Principaled Junk Scope.
AutoJSContext cx;
JSAutoCompartment ac(cx, xpc::GetJunkScope());
JSAutoCompartment ac(cx, xpc::PrivilegedJunkScope());
JS::Rooted<JS::Value> params(cx);
const SendMmsMessageRequest &req = aRequest.get_SendMmsMessageRequest();
if (!GetParamsFromSendMmsMessageRequest(cx,

View File

@ -13,6 +13,7 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=667388
<![CDATA[
// Setup.
const Cu = Components.utils;
SimpleTest.waitForExplicitFinish();
window.testObject = { myNumber: 42,
myDomain: window.location.domain };
@ -25,34 +26,34 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=667388
// Mark this frame as loaded.
framesLoaded[id] = true;
// Allow it to call |is|.
// Allow it to call various helpers.
window.frames[id].wrappedJSObject.is = is;
window.frames[id].wrappedJSObject.ok = ok;
window.frames[id].wrappedJSObject.info = info;
// If all the frames are loaded, start the test.
if (framesLoaded[1] && framesLoaded[2] && framesLoaded[3])
startTest();
}
function reject(e) {
ok(false, "Rejected Promise: " + e);
SimpleTest.finish();
}
function startTest() {
// Test interaction between chrome and content.
runChromeContentTest(window.frames[1]);
// Try same origin.
runContentContentTest(window.frames[1], window.frames[2],
true, "Should be able to clone same-origin");
// Try cross-origin.
runContentContentTest(window.frames[2], window.frames[3],
false, "Should not be able to clone cross-origin");
// Colaborate with document.domain, then try again.
frames[2].document.domain = 'example.org';
frames[3].document.domain = 'example.org';
runContentContentTest(window.frames[2], window.frames[3],
true, "Should be able to clone cross-origin with document.domain")
SimpleTest.finish();
runChromeContentTest(window.frames[1]).then(
runContentContentTest.bind(null, window.frames[1], window.frames[2],
true, "Should be able to clone same-origin"), reject).then(
runContentContentTest.bind(null, window.frames[2], window.frames[3],
false, "Should not be able to clone cross-origin"), reject).then(function() {
// Colaborate with document.domain, then try again.
frames[2].document.domain = 'example.org';
frames[3].document.domain = 'example.org';
return runContentContentTest(window.frames[2], window.frames[3],
true, "Should be able to clone cross-origin with document.domain")
}, reject).then(SimpleTest.finish.bind(SimpleTest), reject);
}
// Tests cloning between chrome and content.
@ -63,12 +64,16 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=667388
true,
"Chrome should be able to clone content object");
// Content should not be able to clone a chrome object.
//
// Note that because we're using |wrappedJSObject| here, the subject
// principal is clamed to the principal of the iframe, which is what we want.
contentWin.wrappedJSObject.tryToClone(window.testObject, false,
"Content should not be able to clone chrome object");
// COWs without __exposedProps__ silently deny property gets. So Content
// should be able to clone a COW, but the result of the clone should be empty.
var p = contentWin.wrappedJSObject.tryToClone(window.testObject, true,
"Content should be able to clone COW");
return new Promise(function(resolve) {
p.then(function(cloneResult) {
is(Cu.waiveXrays(cloneResult).toSource(), "({})", "Empty COW clone");
resolve();
});
});
}
// Test cloning between content and content.
@ -81,24 +86,19 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=667388
// long as the security wrappers check documentDomainMakesSameOrigin directly
// for the puncture case rather than checking IsTransparent(), but it still
// gives rise to a situation that wouldn't really happen in practice.
//
// A more serious issues is that we don't/can't test the Xray wrapper path,
// because the only native objects that we successfully send through
// structured clone don't force a parent in PreCreate, and so we _can't_
// have security wrappers around them (we get a new XPCWN in each
// compartment). Since the case can't happen, we can't write tests for it.
// But when it can happen (ie, we fix PreCreate for File, FileList, Blob, etc),
// we want tests right away, because this stuff is very security-sensitive.
// So we set this test up to fail when things are fixed, so that the someone
// will notice and properly augment this test to cover native objects.
function runContentContentTest(win1, win2, shouldSucceed, msg) {
win1.wrappedJSObject.tryToClone(win2.wrappedJSObject.testObject,
shouldSucceed, msg);
var fixMsg = "If this fails, you fixed PreCreate. That's a good thing, ";
fixMsg += "but now we need some test coverage. See the above comment.";
win1.wrappedJSObject.tryToClone(win2.wrappedJSObject.blob, true, fixMsg);
win1.wrappedJSObject.tryToClone(win2.wrappedJSObject.filelist, true, fixMsg);
var p = win1.wrappedJSObject.tryToClone(win2.wrappedJSObject.testObject,
shouldSucceed, msg);
if (!shouldSucceed)
return;
return new Promise(function(resolve) {
p.then(function(cloneResult) {
is(Cu.waiveXrays(cloneResult).toSource(), win2.wrappedJSObject.testObject.toSource(),
"Clone should create an identical object");
resolve();
});
});
}
function tryToClone(obj, shouldSucceed, message) {

View File

@ -3,27 +3,34 @@
<head>
<script type="application/javascript">
function waitForMessage() {
return new Promise(function(resolve) {
window.addEventListener('message', function l(evt) {
window.removeEventListener('message', l);
resolve(evt.data);
});
});
}
// Set up the objects for cloning.
function setup() {
window.testObject = { myNumber: 42,
myDomain: window.location.domain };
window.blob = new Blob([], { type: 'text/plain' });
window.fileList = document.getElementById('fileinput').files;
myString: "hello",
myImageData: new ImageData(10, 10) };
}
// Called by the chrome parent window.
function tryToClone(obj, shouldSucceed, message) {
var success = false;
var sink = window.frames[0];
try { sink.postMessage(obj, '*'); success = true; }
try { window.postMessage(obj, '*'); success = true; }
catch (e) { message = message + ' (threw: ' + e.message + ')'; }
is(success, shouldSucceed, message);
return (success && shouldSucceed) ? waitForMessage() : Promise.resolve();
}
</script>
</head>
<body onload="setup()">
<input id="fileinput" type="file"></input>
<iframe id="sink">
</body>
</html>

View File

@ -143,7 +143,7 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=633602
parent.addEventListener("click", parentClickTest);
child.addEventListener("click", childClickTest);
SimpleTest.executeSoon(function () {
synthesizeMouseAtCenter(child, {type: "click"}, window);
synthesizeMouseAtCenter(child, {}, window);
});
};

View File

@ -35,3 +35,6 @@ interface AnalyserNode : AudioNode {
};
// Mozilla extension
AnalyserNode implements AudioNodePassThrough;

View File

@ -48,4 +48,9 @@ partial interface AudioNode {
[ChromeOnly]
readonly attribute unsigned long id;
};
[NoInterfaceObject]
interface AudioNodePassThrough {
[ChromeOnly]
attribute boolean passThrough;
};

View File

@ -35,3 +35,6 @@ interface BiquadFilterNode : AudioNode {
};
// Mozilla extension
BiquadFilterNode implements AudioNodePassThrough;

View File

@ -18,3 +18,6 @@ interface ConvolverNode : AudioNode {
};
// Mozilla extension
ConvolverNode implements AudioNodePassThrough;

View File

@ -16,3 +16,6 @@ interface DelayNode : AudioNode {
};
// Mozilla extension
DelayNode implements AudioNodePassThrough;

View File

@ -21,3 +21,6 @@ interface DynamicsCompressorNode : AudioNode {
};
// Mozilla extension
DynamicsCompressorNode implements AudioNodePassThrough;

View File

@ -16,3 +16,6 @@ interface GainNode : AudioNode {
};
// Mozilla extension
GainNode implements AudioNodePassThrough;

View File

@ -44,3 +44,6 @@ interface PannerNode : AudioNode {
};
// Mozilla extension
PannerNode implements AudioNodePassThrough;

View File

@ -18,3 +18,6 @@ interface ScriptProcessorNode : AudioNode {
};
// Mozilla extension
ScriptProcessorNode implements AudioNodePassThrough;

View File

@ -23,3 +23,6 @@ interface WaveShaperNode : AudioNode {
};
// Mozilla extension
WaveShaperNode implements AudioNodePassThrough;

View File

@ -9,6 +9,7 @@
#include "nsIDocument.h"
#include "nsIServiceWorkerManager.h"
#include "nsPIDOMWindow.h"
#include "mozilla/Services.h"
#include "nsCycleCollectionParticipant.h"
#include "nsServiceManagerUtils.h"
@ -60,10 +61,9 @@ ServiceWorkerContainer::Register(const nsAString& aScriptURL,
{
nsCOMPtr<nsISupports> promise;
nsresult rv;
nsCOMPtr<nsIServiceWorkerManager> swm = do_GetService(SERVICEWORKERMANAGER_CONTRACTID, &rv);
if (NS_WARN_IF(NS_FAILED(rv))) {
aRv.Throw(rv);
nsCOMPtr<nsIServiceWorkerManager> swm = mozilla::services::GetServiceWorkerManager();
if (!swm) {
aRv.Throw(NS_ERROR_FAILURE);
return nullptr;
}
@ -83,10 +83,9 @@ ServiceWorkerContainer::Unregister(const nsAString& aScope,
{
nsCOMPtr<nsISupports> promise;
nsresult rv;
nsCOMPtr<nsIServiceWorkerManager> swm = do_GetService(SERVICEWORKERMANAGER_CONTRACTID, &rv);
if (NS_WARN_IF(NS_FAILED(rv))) {
aRv.Throw(rv);
nsCOMPtr<nsIServiceWorkerManager> swm = mozilla::services::GetServiceWorkerManager();
if (!swm) {
aRv.Throw(NS_ERROR_FAILURE);
return nullptr;
}
@ -138,8 +137,8 @@ ServiceWorkerContainer::GetController()
{
if (!mControllerWorker) {
nsresult rv;
nsCOMPtr<nsIServiceWorkerManager> swm = do_GetService(SERVICEWORKERMANAGER_CONTRACTID, &rv);
if (NS_WARN_IF(NS_FAILED(rv))) {
nsCOMPtr<nsIServiceWorkerManager> swm = mozilla::services::GetServiceWorkerManager();
if (!swm) {
return nullptr;
}
@ -177,7 +176,7 @@ ServiceWorkerContainer::GetReady(ErrorResult& aRv)
void
ServiceWorkerContainer::StartListeningForEvents()
{
nsCOMPtr<nsIServiceWorkerManager> swm = do_GetService(SERVICEWORKERMANAGER_CONTRACTID);
nsCOMPtr<nsIServiceWorkerManager> swm = mozilla::services::GetServiceWorkerManager();
if (swm) {
swm->AddContainerEventListener(mWindow->GetDocumentURI(), this);
}
@ -186,7 +185,7 @@ ServiceWorkerContainer::StartListeningForEvents()
void
ServiceWorkerContainer::StopListeningForEvents()
{
nsCOMPtr<nsIServiceWorkerManager> swm = do_GetService(SERVICEWORKERMANAGER_CONTRACTID);
nsCOMPtr<nsIServiceWorkerManager> swm = mozilla::services::GetServiceWorkerManager();
if (swm) {
swm->RemoveContainerEventListener(mWindow->GetDocumentURI(), this);
}
@ -212,8 +211,8 @@ already_AddRefed<workers::ServiceWorker>
ServiceWorkerContainer::GetWorkerReference(WhichServiceWorker aWhichOne)
{
nsresult rv;
nsCOMPtr<nsIServiceWorkerManager> swm = do_GetService(SERVICEWORKERMANAGER_CONTRACTID, &rv);
if (NS_WARN_IF(NS_FAILED(rv))) {
nsCOMPtr<nsIServiceWorkerManager> swm = mozilla::services::GetServiceWorkerManager();
if (!swm) {
return nullptr;
}
@ -254,10 +253,9 @@ ServiceWorkerContainer::GetScopeForUrl(const nsAString& aUrl,
nsString& aScope,
ErrorResult& aRv)
{
nsresult rv;
nsCOMPtr<nsIServiceWorkerManager> swm = do_GetService(SERVICEWORKERMANAGER_CONTRACTID, &rv);
if (NS_WARN_IF(NS_FAILED(rv))) {
aRv.Throw(rv);
nsCOMPtr<nsIServiceWorkerManager> swm = mozilla::services::GetServiceWorkerManager();
if (!swm) {
aRv.Throw(NS_ERROR_FAILURE);
return;
}

View File

@ -607,8 +607,7 @@ ServiceWorkerManager::Unregister(nsIDOMWindow* aWindow, const nsAString& aScope,
already_AddRefed<ServiceWorkerManager>
ServiceWorkerManager::GetInstance()
{
nsCOMPtr<nsIServiceWorkerManager> swm =
do_GetService(SERVICEWORKERMANAGER_CONTRACTID);
nsCOMPtr<nsIServiceWorkerManager> swm = mozilla::services::GetServiceWorkerManager();
nsRefPtr<ServiceWorkerManager> concrete = do_QueryObject(swm);
return concrete.forget();
}

View File

@ -359,7 +359,6 @@ void
AssertInCompilationScope()
{
AutoJSContext cx;
// Note - Inverting the order of these operands is a rooting hazard.
MOZ_ASSERT(xpc::GetCompilationScope() == JS::CurrentGlobalOrNull(cx));
MOZ_ASSERT(xpc::CompilationScope() == JS::CurrentGlobalOrNull(cx));
}
#endif

View File

@ -240,8 +240,7 @@ nsXBLProtoImpl::CompilePrototypeMembers(nsXBLPrototypeBinding* aBinding)
// bind the prototype to a real xbl instance, we'll clone the pre-compiled JS into the real instance's
// context.
AutoSafeJSContext cx;
JS::Rooted<JSObject*> compilationGlobal(cx, xpc::GetCompilationScope());
NS_ENSURE_TRUE(compilationGlobal, NS_ERROR_UNEXPECTED);
JS::Rooted<JSObject*> compilationGlobal(cx, xpc::CompilationScope());
JSAutoCompartment ac(cx, compilationGlobal);
mPrecompiledMemberHolder = JS_NewObjectWithGivenProto(cx, nullptr, JS::NullPtr(), compilationGlobal);

View File

@ -911,8 +911,7 @@ nsXBLPrototypeBinding::Read(nsIObjectInputStream* aStream,
}
AutoSafeJSContext cx;
JS::Rooted<JSObject*> compilationGlobal(cx, xpc::GetCompilationScope());
NS_ENSURE_TRUE(compilationGlobal, NS_ERROR_UNEXPECTED);
JS::Rooted<JSObject*> compilationGlobal(cx, xpc::CompilationScope());
JSAutoCompartment ac(cx, compilationGlobal);
bool isFirstBinding = aFlags & XBLBinding_Serialize_IsFirstBinding;
@ -1064,8 +1063,7 @@ nsXBLPrototypeBinding::Write(nsIObjectOutputStream* aStream)
// computed on demand.
AutoSafeJSContext cx;
JS::Rooted<JSObject*> compilationGlobal(cx, xpc::GetCompilationScope());
NS_ENSURE_TRUE(compilationGlobal, NS_ERROR_UNEXPECTED);
JS::Rooted<JSObject*> compilationGlobal(cx, xpc::CompilationScope());
JSAutoCompartment ac(cx, compilationGlobal);
uint8_t flags = mInheritStyle ? XBLBinding_Serialize_InheritStyle : 0;

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/.
include libeditor/html/crashtests/crashtests.list
include libeditor/crashtests/crashtests.list
include libeditor/text/crashtests/crashtests.list
include composer/crashtests/crashtests.list
include txmgr/tests/crashtests/crashtests.list

View File

@ -1,20 +1,60 @@
load 336081-1.xhtml
load 336104.html
load 382527-1.html
load 382778-1.html
load 402172-1.html
load 403965-1.xhtml
load 407074-1.html
load 407079-1.html
load 407256-1.html
load 407277-1.html
load 414178-1.html
load 418923-1.html
asserts(0-16) load 420439.html # Bug 439258
load 428489-1.html
load 430624-1.html
asserts(0-16) load 431086-1.xhtml # Bug 439258
load 448329-1.html
load 448329-2.html
load 448329-3.html
load 456727-1.html
load 456727-2.html
load 459613.html
needs-focus asserts(0-1) load 467647-1.html # bug 414178
load 475132-1.xhtml
load 499844-1.html
load 503709-1.xhtml
load 513375-1.xhtml
load 535632-1.xhtml
load 574558-1.xhtml
load 580151-1.xhtml
load 582138-1.xhtml
load 612565-1.html
asserts(0-6) load 615015-1.html # Bug 439258
load 615450-1.html
load 633709.xhtml
load 636074-1.html
load 639736-1.xhtml
load 643786-1.html
load 682650-1.html
load 713427-1.html
load 713427-2.xhtml
asserts(0-1) load 716456-1.html
load 759748.html
load 761861.html
load 762183.html
load 769008-1.html
load 766305.html
load 766360.html
load 766387.html
load 766413.html
load 766845.xhtml
load 766795.html
load 767169.html
load 769967.xhtml
load 768748.html
load 768765.html
needs-focus load 771749.html
load 772282.html
load 776323.html
needs-focus load 793866.html

View File

@ -1,38 +0,0 @@
load 336081-1.xhtml
load 382778-1.html
load 407074-1.html
load 407277-1.html
load 414178-1.html
load 418923-1.html
asserts(0-16) load 420439.html # Bug 439258
load 428489-1.html
asserts(0-16) load 431086-1.xhtml # Bug 439258
load 448329-1.html
load 448329-2.html
load 448329-3.html
load 456727-1.html
load 456727-2.html
needs-focus asserts(0-1) load 467647-1.html # bug 414178
load 499844-1.html
load 503709-1.xhtml
load 513375-1.xhtml
load 535632-1.xhtml
load 574558-1.xhtml
load 582138-1.xhtml
load 612565-1.html
asserts(0-6) load 615015-1.html # Bug 439258
load 615450-1.html
load 639736-1.xhtml
load 643786-1.html
load 682650-1.html
asserts(0-1) load 716456-1.html
load 759748.html
load 761861.html
load 769008-1.html
load 766305.html
load 766387.html
load 766795.html
load 767169.html
load 769967.xhtml
load 768748.html
needs-focus load 793866.html

View File

@ -1,42 +0,0 @@
# -*- Mode: python; c-basic-offset: 4; indent-tabs-mode: nil; tab-width: 40 -*-
# vim: set filetype=python:
# 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/.
TEST_DIRS += ['tests']
UNIFIED_SOURCES += [
'nsEditProperty.cpp',
'nsHTMLAbsPosition.cpp',
'nsHTMLAnonymousUtils.cpp',
'nsHTMLCSSUtils.cpp',
'nsHTMLDataTransfer.cpp',
'nsHTMLEditor.cpp',
'nsHTMLEditorEventListener.cpp',
'nsHTMLEditorStyle.cpp',
'nsHTMLEditRules.cpp',
'nsHTMLEditUtils.cpp',
'nsHTMLInlineTableEditor.cpp',
'nsHTMLObjectResizer.cpp',
'nsHTMLURIRefObject.cpp',
'nsTableEditor.cpp',
'nsWSRunObject.cpp',
'TextEditorTest.cpp',
'TypeInState.cpp',
]
FAIL_ON_WARNINGS = True
LOCAL_INCLUDES += [
'..',
'../text',
'/content/base/src',
'/editor/txmgr',
'/layout/generic',
'/layout/style',
'/layout/tables',
'/layout/xul',
]
FINAL_LIBRARY = 'xul'

View File

@ -1,12 +0,0 @@
[DEFAULT]
support-files = green.png
[test_bug366682.html]
[test_bug489202.xul]
[test_bug490879.xul]
[test_bug607584.xul]
[test_bug616590.xul]
[test_bug635636.html]
[test_bug780908.xul]
[test_contenteditable_text_input_handling.html]
[test_htmleditor_keyevent_handling.html]

View File

@ -1,110 +0,0 @@
[DEFAULT]
skip-if = buildapp == 'mulet' || buildapp == 'b2g'
support-files =
data/cfhtml-chromium.txt
data/cfhtml-firefox.txt
data/cfhtml-ie.txt
data/cfhtml-ooo.txt
data/cfhtml-nocontext.txt
file_bug549262.html
file_bug674770-1.html
file_select_all_without_body.html
green.png
[test_bug200416.html]
[test_bug289384.html]
skip-if = os != "mac"
[test_bug290026.html]
[test_bug291780.html]
[test_bug316447.html]
[test_bug332636.html]
support-files = test_bug332636.html^headers^
[test_bug372345.html]
skip-if = toolkit == 'android'
[test_bug404320.html]
[test_bug410986.html]
skip-if = toolkit == 'android' || e10s
[test_bug414526.html]
[test_bug417418.html]
[test_bug432225.html]
skip-if = toolkit == 'android' || e10s
[test_bug439808.html]
[test_bug442186.html]
[test_bug449243.html]
[test_bug455992.html]
[test_bug456244.html]
[test_bug460740.html]
[test_bug468353.html]
[test_bug478725.html]
skip-if = toolkit == 'android' || e10s
[test_bug480647.html]
[test_bug480972.html]
skip-if = toolkit == 'android' || e10s
[test_bug484181.html]
skip-if = toolkit == 'android' || e10s
[test_bug487524.html]
[test_bug520189.html]
skip-if = toolkit == 'android' || e10s
[test_bug525389.html]
skip-if = toolkit == 'android' || e10s
[test_bug537046.html]
[test_bug549262.html]
skip-if = toolkit == 'android' || e10s
[test_bug550434.html]
[test_bug551704.html]
[test_bug552782.html]
[test_bug570144.html]
[test_bug578771.html]
[test_bug587461.html]
[test_bug592592.html]
[test_bug597784.html]
[test_bug599322.html]
skip-if = toolkit == 'android' || e10s
[test_bug607584.html]
[test_bug611182.html]
skip-if = toolkit == 'android'
[test_bug612128.html]
[test_bug612447.html]
[test_bug620906.html]
skip-if = toolkit == 'android' #TIMED_OUT
[test_bug622371.html]
skip-if = toolkit == 'android' #bug 957797
[test_bug629845.html]
[test_bug640321.html]
skip-if = e10s
[test_bug668599.html]
[test_bug674770-1.html]
skip-if = toolkit == 'android' || e10s
[test_bug674770-2.html]
skip-if = toolkit == 'android' || e10s
[test_bug674861.html]
[test_bug676401.html]
[test_bug677752.html]
[test_bug686203.html]
[test_bug697842.html]
[test_bug725069.html]
[test_bug735059.html]
[test_bug738366.html]
[test_bug757371.html]
[test_bug767684.html]
[test_bug780035.html]
[test_bug787432.html]
[test_bug790475.html]
[test_bug796839.html]
[test_bug832025.html]
[test_bug857487.html]
[test_bug966155.html]
skip-if = os != "win"
[test_bug966552.html]
skip-if = os != "win"
[test_bug998188.html]
[test_CF_HTML_clipboard.html]
[test_contenteditable_focus.html]
[test_dom_input_event_on_htmleditor.html]
skip-if = toolkit == 'android' # bug 1054087
[test_keypress_untrusted_event.html]
[test_root_element_replacement.html]
[test_select_all_without_body.html]
skip-if = e10s
[test_spellcheck_pref.html]
skip-if = toolkit == 'android'

View File

@ -1,11 +0,0 @@
# -*- Mode: python; c-basic-offset: 4; indent-tabs-mode: nil; tab-width: 40 -*-
# vim: set filetype=python:
# 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/.
MOCHITEST_MANIFESTS += ['browserscope/mochitest.ini',
'mochitest.ini']
MOCHITEST_CHROME_MANIFESTS += ['chrome.ini']

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