From 7c02310414e8e5eb7275696c06d28bf62cdea371 Mon Sep 17 00:00:00 2001 From: Paul Adenot Date: Thu, 9 Jul 2015 16:40:08 +0200 Subject: [PATCH 001/136] Bug 1156472 - Part 1 - Allow to capture all HTMLMediaElements and AudioContexts for a document. r=baku,padenot This is built on top of the AudioChannel infrastructure. This patch does not actually implement the capture, it just does the plumbing to be able to notify all HTMLMediaElement/AudioContext for a document. --- dom/audiochannel/AudioChannelAgent.cpp | 20 ++++++++++++++++++ dom/audiochannel/AudioChannelAgent.h | 2 ++ dom/audiochannel/AudioChannelService.cpp | 23 +++++++++++++++++++++ dom/audiochannel/AudioChannelService.h | 8 +++++++ dom/audiochannel/nsIAudioChannelAgent.idl | 7 ++++++- dom/base/nsGlobalWindow.cpp | 22 +++++++++++++++++++- dom/base/nsPIDOMWindow.h | 5 +++++ dom/fmradio/FMRadio.cpp | 6 ++++++ dom/html/HTMLMediaElement.cpp | 15 +++++++++++++- dom/media/webaudio/AudioDestinationNode.cpp | 17 +++++++++++++++ 10 files changed, 122 insertions(+), 3 deletions(-) diff --git a/dom/audiochannel/AudioChannelAgent.cpp b/dom/audiochannel/AudioChannelAgent.cpp index c02602db25de..3a68bdd371ac 100644 --- a/dom/audiochannel/AudioChannelAgent.cpp +++ b/dom/audiochannel/AudioChannelAgent.cpp @@ -35,6 +35,7 @@ NS_IMPL_CYCLE_COLLECTING_RELEASE(AudioChannelAgent) AudioChannelAgent::AudioChannelAgent() : mAudioChannelType(AUDIO_AGENT_CHANNEL_ERROR) + , mInnerWindowID(0) , mIsRegToService(false) { } @@ -104,6 +105,10 @@ AudioChannelAgent::InitInternal(nsIDOMWindow* aWindow, int32_t aChannelType, } if (aWindow) { + nsCOMPtr pInnerWindow = do_QueryInterface(aWindow); + MOZ_ASSERT(pInnerWindow->IsInnerWindow()); + mInnerWindowID = pInnerWindow->WindowID(); + nsCOMPtr topWindow; aWindow->GetScriptableTop(getter_AddRefs(topWindow)); mWindow = do_QueryInterface(topWindow); @@ -191,3 +196,18 @@ AudioChannelAgent::WindowID() const { return mWindow ? mWindow->WindowID() : 0; } + +void +AudioChannelAgent::WindowAudioCaptureChanged(uint64_t aInnerWindowID) +{ + if (aInnerWindowID != mInnerWindowID) { + return; + } + + nsCOMPtr callback = GetCallback(); + if (!callback) { + return; + } + + callback->WindowAudioCaptureChanged(); +} diff --git a/dom/audiochannel/AudioChannelAgent.h b/dom/audiochannel/AudioChannelAgent.h index 75b2fd335edc..809d34f2a1e7 100644 --- a/dom/audiochannel/AudioChannelAgent.h +++ b/dom/audiochannel/AudioChannelAgent.h @@ -34,6 +34,7 @@ public: AudioChannelAgent(); void WindowVolumeChanged(); + void WindowAudioCaptureChanged(uint64_t aInnerWindowID); nsPIDOMWindow* Window() const { @@ -61,6 +62,7 @@ private: nsWeakPtr mWeakCallback; int32_t mAudioChannelType; + uint64_t mInnerWindowID; bool mIsRegToService; }; diff --git a/dom/audiochannel/AudioChannelService.cpp b/dom/audiochannel/AudioChannelService.cpp index c3b858ab7761..b71b491c5078 100644 --- a/dom/audiochannel/AudioChannelService.cpp +++ b/dom/audiochannel/AudioChannelService.cpp @@ -546,6 +546,29 @@ AudioChannelService::RefreshAgentsVolume(nsPIDOMWindow* aWindow) } } +void +AudioChannelService::RefreshAgentsCapture(nsPIDOMWindow* aWindow, + uint64_t aInnerWindowID) +{ + MOZ_ASSERT(aWindow); + MOZ_ASSERT(aWindow->IsOuterWindow()); + + nsCOMPtr topWindow; + aWindow->GetScriptableTop(getter_AddRefs(topWindow)); + nsCOMPtr pTopWindow = do_QueryInterface(topWindow); + if (!pTopWindow) { + return; + } + + AudioChannelWindow* winData = GetWindowData(pTopWindow->WindowID()); + + nsTObserverArray::ForwardIterator + iter(winData->mAgents); + while (iter.HasMore()) { + iter.GetNext()->WindowAudioCaptureChanged(aInnerWindowID); + } +} + /* static */ const nsAttrValue::EnumTable* AudioChannelService::GetAudioChannelTable() { diff --git a/dom/audiochannel/AudioChannelService.h b/dom/audiochannel/AudioChannelService.h index a0a65d8c737a..4dc0bedb7475 100644 --- a/dom/audiochannel/AudioChannelService.h +++ b/dom/audiochannel/AudioChannelService.h @@ -102,6 +102,14 @@ public: void RefreshAgentsVolume(nsPIDOMWindow* aWindow); + // This method needs to know the inner window that wants to capture audio. We + // group agents per top outer window, but we can have multiple innerWindow per + // top outerWindow (subiframes, etc.) and we have to identify all the agents + // just for a particular innerWindow. + void RefreshAgentsCapture(nsPIDOMWindow* aWindow, + uint64_t aInnerWindowID); + + #ifdef MOZ_WIDGET_GONK void RegisterSpeakerManager(SpeakerManagerService* aSpeakerManager) { diff --git a/dom/audiochannel/nsIAudioChannelAgent.idl b/dom/audiochannel/nsIAudioChannelAgent.idl index a35f54c09530..87934d4bacc0 100644 --- a/dom/audiochannel/nsIAudioChannelAgent.idl +++ b/dom/audiochannel/nsIAudioChannelAgent.idl @@ -6,13 +6,18 @@ interface nsIDOMWindow; -[uuid(4f537c88-3722-4946-9a09-ce559fa0591d)] +[uuid(5fe83b24-38b9-4901-a4a1-d1bd57d3fe18)] interface nsIAudioChannelAgentCallback : nsISupports { /** * Notified when the window volume/mute is changed */ void windowVolumeChanged(in float aVolume, in bool aMuted); + + /** + * Notified when the capture state is changed. + */ + void windowAudioCaptureChanged(); }; /** diff --git a/dom/base/nsGlobalWindow.cpp b/dom/base/nsGlobalWindow.cpp index 3827f6b57a01..59483a458bd1 100644 --- a/dom/base/nsGlobalWindow.cpp +++ b/dom/base/nsGlobalWindow.cpp @@ -564,7 +564,7 @@ nsPIDOMWindow::nsPIDOMWindow(nsPIDOMWindow *aOuterWindow) mMayHavePointerEnterLeaveEventListener(false), mIsModalContentWindow(false), mIsActive(false), mIsBackground(false), - mAudioMuted(false), mAudioVolume(1.0), + mAudioMuted(false), mAudioVolume(1.0), mAudioCaptured(false), mDesktopModeViewport(false), mInnerWindow(nullptr), mOuterWindow(aOuterWindow), // Make sure no actual window ends up with mWindowID == 0 @@ -3745,6 +3745,26 @@ nsPIDOMWindow::RefreshMediaElements() service->RefreshAgentsVolume(GetOuterWindow()); } +bool +nsPIDOMWindow::GetAudioCaptured() const +{ + MOZ_ASSERT(IsInnerWindow()); + return mAudioCaptured; +} + +nsresult +nsPIDOMWindow::SetAudioCapture(bool aCapture) +{ + MOZ_ASSERT(IsInnerWindow()); + + mAudioCaptured = aCapture; + + nsRefPtr service = AudioChannelService::GetOrCreate(); + service->RefreshAgentsCapture(GetOuterWindow(), mWindowID); + + return NS_OK; +} + // nsISpeechSynthesisGetter #ifdef MOZ_WEBSPEECH diff --git a/dom/base/nsPIDOMWindow.h b/dom/base/nsPIDOMWindow.h index b9f17bb801a4..3e6404e9950c 100644 --- a/dom/base/nsPIDOMWindow.h +++ b/dom/base/nsPIDOMWindow.h @@ -185,6 +185,9 @@ public: float GetAudioVolume() const; nsresult SetAudioVolume(float aVolume); + bool GetAudioCaptured() const; + nsresult SetAudioCapture(bool aCapture); + virtual void SetServiceWorkersTestingEnabled(bool aEnabled) { MOZ_ASSERT(IsOuterWindow()); @@ -822,6 +825,8 @@ protected: bool mAudioMuted; float mAudioVolume; + bool mAudioCaptured; + // current desktop mode flag. bool mDesktopModeViewport; diff --git a/dom/fmradio/FMRadio.cpp b/dom/fmradio/FMRadio.cpp index 1f5d8de3f0e1..150ee703a1f7 100644 --- a/dom/fmradio/FMRadio.cpp +++ b/dom/fmradio/FMRadio.cpp @@ -471,6 +471,12 @@ FMRadio::WindowVolumeChanged(float aVolume, bool aMuted) return NS_OK; } +NS_IMETHODIMP +FMRadio::WindowAudioCaptureChanged() +{ + return NS_OK; +} + NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION_INHERITED(FMRadio) NS_INTERFACE_MAP_ENTRY(nsISupportsWeakReference) NS_INTERFACE_MAP_ENTRY(nsIAudioChannelAgentCallback) diff --git a/dom/html/HTMLMediaElement.cpp b/dom/html/HTMLMediaElement.cpp index 493bbd26678a..42c5f63f7774 100644 --- a/dom/html/HTMLMediaElement.cpp +++ b/dom/html/HTMLMediaElement.cpp @@ -4492,7 +4492,7 @@ void HTMLMediaElement::UpdateAudioChannelPlayingState() if (!mAudioChannelAgent) { return; } - mAudioChannelAgent->InitWithWeakCallback(OwnerDoc()->GetWindow(), + mAudioChannelAgent->InitWithWeakCallback(OwnerDoc()->GetInnerWindow(), static_cast(mAudioChannel), this); } @@ -4504,6 +4504,10 @@ void HTMLMediaElement::UpdateAudioChannelPlayingState() void HTMLMediaElement::NotifyAudioChannelAgent(bool aPlaying) { + // Immediately check if this should go to the MSG instead of the normal + // media playback route. + WindowAudioCaptureChanged(); + // This is needed to pass nsContentUtils::IsCallerChrome(). // AudioChannel API should not called from content but it can happen that // this method has some content JS in its stack. @@ -4674,6 +4678,15 @@ HTMLMediaElement::GetTopLevelPrincipal() } #endif // MOZ_EME +NS_IMETHODIMP HTMLMediaElement::WindowAudioCaptureChanged() +{ + MOZ_ASSERT(mAudioChannelAgent); + DebugOnly captured = OwnerDoc()->GetInnerWindow()->GetAudioCaptured(); + + // Something is going to happen here!! + return NS_OK; +} + AudioTrackList* HTMLMediaElement::AudioTracks() { diff --git a/dom/media/webaudio/AudioDestinationNode.cpp b/dom/media/webaudio/AudioDestinationNode.cpp index 95ab1b413459..3f5a3650a0df 100644 --- a/dom/media/webaudio/AudioDestinationNode.cpp +++ b/dom/media/webaudio/AudioDestinationNode.cpp @@ -505,6 +505,21 @@ AudioDestinationNode::WindowVolumeChanged(float aVolume, bool aMuted) return NS_OK; } +NS_IMETHODIMP +AudioDestinationNode::WindowAudioCaptureChanged() +{ + MOZ_ASSERT(mAudioChannelAgent); + + if (!mStream) { + return NS_OK; + } + + DebugOnly captured = GetOwner()->GetAudioCaptured(); + + // XXXtodopadenot actually capture + return NS_OK; +} + AudioChannel AudioDestinationNode::MozAudioChannelType() const { @@ -591,6 +606,8 @@ AudioDestinationNode::CreateAudioChannelAgent() // The AudioChannelAgent must start playing immediately in order to avoid // race conditions with mozinterruptbegin/end events. InputMuted(false); + + WindowAudioCaptureChanged(); } void From 70bb216009303f94d683bc9a4362745f8d0ddd14 Mon Sep 17 00:00:00 2001 From: Paul Adenot Date: Fri, 24 Jul 2015 14:28:16 +0200 Subject: [PATCH 002/136] Bug 1156472 - Part 2 - Rename MediaEngineWebRTCAudioSource to MediaEngineWebRTCMicrophoneSource. r=jesup There are now two different possible audio source, so this was getting confusing. --- dom/media/webrtc/MediaEngineWebRTC.cpp | 7 ++- dom/media/webrtc/MediaEngineWebRTC.h | 18 +++++--- dom/media/webrtc/MediaEngineWebRTCAudio.cpp | 48 +++++++++++---------- 3 files changed, 39 insertions(+), 34 deletions(-) diff --git a/dom/media/webrtc/MediaEngineWebRTC.cpp b/dom/media/webrtc/MediaEngineWebRTC.cpp index 8771ef79af7c..34adf582ed88 100644 --- a/dom/media/webrtc/MediaEngineWebRTC.cpp +++ b/dom/media/webrtc/MediaEngineWebRTC.cpp @@ -358,15 +358,14 @@ MediaEngineWebRTC::EnumerateAudioDevices(dom::MediaSourceEnum aMediaSource, strcpy(uniqueId,deviceName); // safe given assert and initialization/error-check } - nsRefPtr aSource; + nsRefPtr aSource; NS_ConvertUTF8toUTF16 uuid(uniqueId); if (mAudioSources.Get(uuid, getter_AddRefs(aSource))) { // We've already seen this device, just append. aASources->AppendElement(aSource.get()); } else { - aSource = new MediaEngineWebRTCAudioSource( - mThread, mVoiceEngine, i, deviceName, uniqueId - ); + aSource = new MediaEngineWebRTCMicrophoneSource(mThread, mVoiceEngine, i, + deviceName, uniqueId); mAudioSources.Put(uuid, aSource); // Hashtable takes ownership. aASources->AppendElement(aSource); } diff --git a/dom/media/webrtc/MediaEngineWebRTC.h b/dom/media/webrtc/MediaEngineWebRTC.h index 105cca560048..8b05480718b6 100644 --- a/dom/media/webrtc/MediaEngineWebRTC.h +++ b/dom/media/webrtc/MediaEngineWebRTC.h @@ -133,13 +133,16 @@ private: void GetCapability(size_t aIndex, webrtc::CaptureCapability& aOut) override; }; -class MediaEngineWebRTCAudioSource : public MediaEngineAudioSource, - public webrtc::VoEMediaProcess, - private MediaConstraintsHelper +class MediaEngineWebRTCMicrophoneSource : public MediaEngineAudioSource, + public webrtc::VoEMediaProcess, + private MediaConstraintsHelper { public: - MediaEngineWebRTCAudioSource(nsIThread* aThread, webrtc::VoiceEngine* aVoiceEnginePtr, - int aIndex, const char* name, const char* uuid) + MediaEngineWebRTCMicrophoneSource(nsIThread* aThread, + webrtc::VoiceEngine* aVoiceEnginePtr, + int aIndex, + const char* name, + const char* uuid) : MediaEngineAudioSource(kReleased) , mVoiceEngine(aVoiceEnginePtr) , mMonitor("WebRTCMic.Monitor") @@ -207,7 +210,7 @@ public: virtual void Shutdown() override; protected: - ~MediaEngineWebRTCAudioSource() { Shutdown(); } + ~MediaEngineWebRTCMicrophoneSource() { Shutdown(); } private: void Init(); @@ -294,7 +297,8 @@ private: // Store devices we've already seen in a hashtable for quick return. // Maps UUID to MediaEngineSource (one set for audio, one for video). nsRefPtrHashtable mVideoSources; - nsRefPtrHashtable mAudioSources; + nsRefPtrHashtable + mAudioSources; }; } diff --git a/dom/media/webrtc/MediaEngineWebRTCAudio.cpp b/dom/media/webrtc/MediaEngineWebRTCAudio.cpp index c85c5710c193..2aca1ecbbf99 100644 --- a/dom/media/webrtc/MediaEngineWebRTCAudio.cpp +++ b/dom/media/webrtc/MediaEngineWebRTCAudio.cpp @@ -41,9 +41,9 @@ extern PRLogModuleInfo* GetMediaManagerLog(); #define LOG_FRAMES(msg) MOZ_LOG(GetMediaManagerLog(), mozilla::LogLevel::Verbose, msg) /** - * Webrtc audio source. + * Webrtc microphone source source. */ -NS_IMPL_ISUPPORTS0(MediaEngineWebRTCAudioSource) +NS_IMPL_ISUPPORTS0(MediaEngineWebRTCMicrophoneSource) // XXX temp until MSG supports registration StaticRefPtr gFarendObserver; @@ -177,7 +177,7 @@ AudioOutputObserver::InsertFarEnd(const AudioDataValue *aBuffer, uint32_t aFrame } void -MediaEngineWebRTCAudioSource::GetName(nsAString& aName) +MediaEngineWebRTCMicrophoneSource::GetName(nsAString& aName) { if (mInitDone) { aName.Assign(mDeviceName); @@ -187,7 +187,7 @@ MediaEngineWebRTCAudioSource::GetName(nsAString& aName) } void -MediaEngineWebRTCAudioSource::GetUUID(nsACString& aUUID) +MediaEngineWebRTCMicrophoneSource::GetUUID(nsACString& aUUID) { if (mInitDone) { aUUID.Assign(mDeviceUUID); @@ -197,10 +197,10 @@ MediaEngineWebRTCAudioSource::GetUUID(nsACString& aUUID) } nsresult -MediaEngineWebRTCAudioSource::Config(bool aEchoOn, uint32_t aEcho, - bool aAgcOn, uint32_t aAGC, - bool aNoiseOn, uint32_t aNoise, - int32_t aPlayoutDelay) +MediaEngineWebRTCMicrophoneSource::Config(bool aEchoOn, uint32_t aEcho, + bool aAgcOn, uint32_t aAGC, + bool aNoiseOn, uint32_t aNoise, + int32_t aPlayoutDelay) { LOG(("Audio config: aec: %d, agc: %d, noise: %d", aEchoOn ? aEcho : -1, @@ -281,9 +281,9 @@ uint32_t MediaEngineWebRTCAudioSource::GetBestFitnessDistance( } nsresult -MediaEngineWebRTCAudioSource::Allocate(const dom::MediaTrackConstraints &aConstraints, - const MediaEnginePrefs &aPrefs, - const nsString& aDeviceId) +MediaEngineWebRTCMicrophoneSource::Allocate(const dom::MediaTrackConstraints &aConstraints, + const MediaEnginePrefs &aPrefs, + const nsString& aDeviceId) { if (mState == kReleased) { if (mInitDone) { @@ -309,7 +309,7 @@ MediaEngineWebRTCAudioSource::Allocate(const dom::MediaTrackConstraints &aConstr } nsresult -MediaEngineWebRTCAudioSource::Deallocate() +MediaEngineWebRTCMicrophoneSource::Deallocate() { bool empty; { @@ -331,7 +331,8 @@ MediaEngineWebRTCAudioSource::Deallocate() } nsresult -MediaEngineWebRTCAudioSource::Start(SourceMediaStream* aStream, TrackID aID) +MediaEngineWebRTCMicrophoneSource::Start(SourceMediaStream *aStream, + TrackID aID) { if (!mInitDone || !aStream) { return NS_ERROR_FAILURE; @@ -384,7 +385,7 @@ MediaEngineWebRTCAudioSource::Start(SourceMediaStream* aStream, TrackID aID) } nsresult -MediaEngineWebRTCAudioSource::Stop(SourceMediaStream *aSource, TrackID aID) +MediaEngineWebRTCMicrophoneSource::Stop(SourceMediaStream *aSource, TrackID aID) { { MonitorAutoLock lock(mMonitor); @@ -421,17 +422,17 @@ MediaEngineWebRTCAudioSource::Stop(SourceMediaStream *aSource, TrackID aID) } void -MediaEngineWebRTCAudioSource::NotifyPull(MediaStreamGraph* aGraph, - SourceMediaStream *aSource, - TrackID aID, - StreamTime aDesiredTime) +MediaEngineWebRTCMicrophoneSource::NotifyPull(MediaStreamGraph *aGraph, + SourceMediaStream *aSource, + TrackID aID, + StreamTime aDesiredTime) { // Ignore - we push audio data LOG_FRAMES(("NotifyPull, desired = %ld", (int64_t) aDesiredTime)); } void -MediaEngineWebRTCAudioSource::Init() +MediaEngineWebRTCMicrophoneSource::Init() { mVoEBase = webrtc::VoEBase::GetInterface(mVoiceEngine); @@ -496,7 +497,7 @@ MediaEngineWebRTCAudioSource::Init() } void -MediaEngineWebRTCAudioSource::Shutdown() +MediaEngineWebRTCMicrophoneSource::Shutdown() { if (!mInitDone) { // duplicate these here in case we failed during Init() @@ -551,9 +552,10 @@ MediaEngineWebRTCAudioSource::Shutdown() typedef int16_t sample; void -MediaEngineWebRTCAudioSource::Process(int channel, - webrtc::ProcessingTypes type, sample* audio10ms, - int length, int samplingFreq, bool isStereo) +MediaEngineWebRTCMicrophoneSource::Process(int channel, + webrtc::ProcessingTypes type, + sample *audio10ms, int length, + int samplingFreq, bool isStereo) { // On initial capture, throw away all far-end data except the most recent sample // since it's already irrelevant and we want to keep avoid confusing the AEC far-end From 29f6aaa101952fcab2c4279e9cd7a0fe36bd66e0 Mon Sep 17 00:00:00 2001 From: Paul Adenot Date: Fri, 24 Jul 2015 14:28:16 +0200 Subject: [PATCH 003/136] Bug 1156472 - Part 3 - Implement AudioCaptureStream. r=roc It is a ProcessMediaStream that simply mixes its inputs into a mono stream, up/down mixing appropriately. --- dom/media/AudioCaptureStream.cpp | 133 +++++++++++++++++++++++++++++++ dom/media/AudioCaptureStream.h | 40 ++++++++++ dom/media/AudioMixer.h | 6 +- dom/media/AudioSegment.cpp | 97 ++++++++++++++++++++++ dom/media/AudioSegment.h | 9 ++- dom/media/DOMMediaStream.cpp | 30 +++++++ dom/media/DOMMediaStream.h | 15 ++++ dom/media/moz.build | 1 + 8 files changed, 328 insertions(+), 3 deletions(-) create mode 100644 dom/media/AudioCaptureStream.cpp create mode 100644 dom/media/AudioCaptureStream.h diff --git a/dom/media/AudioCaptureStream.cpp b/dom/media/AudioCaptureStream.cpp new file mode 100644 index 000000000000..f22050328958 --- /dev/null +++ b/dom/media/AudioCaptureStream.cpp @@ -0,0 +1,133 @@ +/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-*/ +/* 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/. */ + +#include "MediaStreamGraphImpl.h" +#include "mozilla/MathAlgorithms.h" +#include "mozilla/unused.h" + +#include "AudioSegment.h" +#include "mozilla/Logging.h" +#include "mozilla/Attributes.h" +#include "AudioCaptureStream.h" +#include "ImageContainer.h" +#include "AudioNodeEngine.h" +#include "AudioNodeStream.h" +#include "AudioNodeExternalInputStream.h" +#include "webaudio/MediaStreamAudioDestinationNode.h" +#include +#include "DOMMediaStream.h" + +using namespace mozilla::layers; +using namespace mozilla::dom; +using namespace mozilla::gfx; + +namespace mozilla +{ + +// We are mixing to mono until PeerConnection can accept stereo +static const uint32_t MONO = 1; + +AudioCaptureStream::AudioCaptureStream(DOMMediaStream* aWrapper) + : ProcessedMediaStream(aWrapper), mTrackCreated(false) +{ + MOZ_ASSERT(NS_IsMainThread()); + MOZ_COUNT_CTOR(AudioCaptureStream); + mMixer.AddCallback(this); +} + +AudioCaptureStream::~AudioCaptureStream() +{ + MOZ_COUNT_DTOR(AudioCaptureStream); + mMixer.RemoveCallback(this); +} + +void +AudioCaptureStream::ProcessInput(GraphTime aFrom, GraphTime aTo, + uint32_t aFlags) +{ + uint32_t inputCount = mInputs.Length(); + StreamBuffer::Track* track = EnsureTrack(AUDIO_TRACK); + // Notify the DOM everything is in order. + if (!mTrackCreated) { + for (uint32_t i = 0; i < mListeners.Length(); i++) { + MediaStreamListener* l = mListeners[i]; + AudioSegment tmp; + l->NotifyQueuedTrackChanges( + Graph(), AUDIO_TRACK, 0, MediaStreamListener::TRACK_EVENT_CREATED, tmp); + l->NotifyFinishedTrackCreation(Graph()); + } + mTrackCreated = true; + } + + // If the captured stream is connected back to a object on the page (be it an + // HTMLMediaElement with a stream as source, or an AudioContext), a cycle + // situation occur. This can work if it's an AudioContext with at least one + // DelayNode, but the MSG will mute the whole cycle otherwise. + bool blocked = mFinished || mBlocked.GetAt(aFrom); + if (blocked || InMutedCycle() || inputCount == 0) { + track->Get()->AppendNullData(aTo - aFrom); + } else { + // We mix down all the tracks of all inputs, to a stereo track. Everything + // is {up,down}-mixed to stereo. + mMixer.StartMixing(); + AudioSegment output; + for (uint32_t i = 0; i < inputCount; i++) { + MediaStream* s = mInputs[i]->GetSource(); + StreamBuffer::TrackIter tracks(s->GetStreamBuffer(), MediaSegment::AUDIO); + while (!tracks.IsEnded()) { + AudioSegment* inputSegment = tracks->Get(); + StreamTime inputStart = s->GraphTimeToStreamTime(aFrom); + StreamTime inputEnd = s->GraphTimeToStreamTime(aTo); + AudioSegment toMix; + toMix.AppendSlice(*inputSegment, inputStart, inputEnd); + // Care for streams blocked in the [aTo, aFrom] range. + if (inputEnd - inputStart < aTo - aFrom) { + toMix.AppendNullData((aTo - aFrom) - (inputEnd - inputStart)); + } + toMix.Mix(mMixer, MONO, Graph()->GraphRate()); + tracks.Next(); + } + } + // This calls MixerCallback below + mMixer.FinishMixing(); + } + + // Regardless of the status of the input tracks, we go foward. + mBuffer.AdvanceKnownTracksTime(GraphTimeToStreamTime((aTo))); +} + +void +AudioCaptureStream::MixerCallback(AudioDataValue* aMixedBuffer, + AudioSampleFormat aFormat, uint32_t aChannels, + uint32_t aFrames, uint32_t aSampleRate) +{ + nsAutoTArray, MONO> output; + nsAutoTArray bufferPtrs; + output.SetLength(MONO); + bufferPtrs.SetLength(MONO); + + uint32_t written = 0; + // We need to copy here, because the mixer will reuse the storage, we should + // not hold onto it. Buffers are in planar format. + for (uint32_t channel = 0; channel < aChannels; channel++) { + AudioDataValue* out = output[channel].AppendElements(aFrames); + PodCopy(out, aMixedBuffer + written, aFrames); + bufferPtrs[channel] = out; + written += aFrames; + } + AudioChunk chunk; + chunk.mBuffer = new mozilla::SharedChannelArrayBuffer(&output); + chunk.mDuration = aFrames; + chunk.mBufferFormat = aFormat; + chunk.mVolume = 1.0f; + chunk.mChannelData.SetLength(MONO); + for (uint32_t channel = 0; channel < aChannels; channel++) { + chunk.mChannelData[channel] = bufferPtrs[channel]; + } + + // Now we have mixed data, simply append it to out track. + EnsureTrack(AUDIO_TRACK)->Get()->AppendAndConsumeChunk(&chunk); +} +} diff --git a/dom/media/AudioCaptureStream.h b/dom/media/AudioCaptureStream.h new file mode 100644 index 000000000000..322dcd880458 --- /dev/null +++ b/dom/media/AudioCaptureStream.h @@ -0,0 +1,40 @@ +/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-*/ +/* 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/. */ + +#ifndef MOZILLA_AUDIOCAPTURESTREAM_H_ +#define MOZILLA_AUDIOCAPTURESTREAM_H_ + +#include "MediaStreamGraph.h" +#include "AudioMixer.h" +#include + +namespace mozilla +{ + +class DOMMediaStream; + +/** + * See MediaStreamGraph::CreateAudioCaptureStream. + */ +class AudioCaptureStream : public ProcessedMediaStream, + public MixerCallbackReceiver +{ +public: + explicit AudioCaptureStream(DOMMediaStream* aWrapper); + virtual ~AudioCaptureStream(); + + void ProcessInput(GraphTime aFrom, GraphTime aTo, uint32_t aFlags) override; + +protected: + enum { AUDIO_TRACK = 1 }; + void MixerCallback(AudioDataValue* aMixedBuffer, AudioSampleFormat aFormat, + uint32_t aChannels, uint32_t aFrames, + uint32_t aSampleRate) override; + AudioMixer mMixer; + bool mTrackCreated; +}; +} + +#endif /* MOZILLA_AUDIOCAPTURESTREAM_H_ */ diff --git a/dom/media/AudioMixer.h b/dom/media/AudioMixer.h index c992942e25f9..c86aa33455b3 100644 --- a/dom/media/AudioMixer.h +++ b/dom/media/AudioMixer.h @@ -26,7 +26,9 @@ struct MixerCallbackReceiver { * stream. * * AudioMixer::Mix is to be called repeatedly with buffers that have the same - * length, sample rate, sample format and channel count. + * length, sample rate, sample format and channel count. This class works with + * interleaved and plannar buffers, but the buffer mixed must be of the same + * type during a mixing cycle. * * When all the tracks have been mixed, calling FinishMixing will call back with * a buffer containing the mixed audio data. @@ -71,7 +73,7 @@ public: mSampleRate = mChannels = mFrames = 0; } - /* Add a buffer to the mix. aSamples is interleaved. */ + /* Add a buffer to the mix. */ void Mix(AudioDataValue* aSamples, uint32_t aChannels, uint32_t aFrames, diff --git a/dom/media/AudioSegment.cpp b/dom/media/AudioSegment.cpp index ddd16bbe16a5..15ac13e5537b 100644 --- a/dom/media/AudioSegment.cpp +++ b/dom/media/AudioSegment.cpp @@ -146,6 +146,103 @@ void AudioSegment::ResampleChunks(SpeexResamplerState* aResampler, uint32_t aInR } } +// This helps to to safely get a pointer to the position we want to start +// writing a planar audio buffer, depending on the channel and the offset in the +// buffer. +static AudioDataValue* +PointerForOffsetInChannel(AudioDataValue* aData, size_t aLengthSamples, + uint32_t aChannelCount, uint32_t aChannel, + uint32_t aOffsetSamples) +{ + size_t samplesPerChannel = aLengthSamples / aChannelCount; + size_t beginningOfChannel = samplesPerChannel * aChannel; + MOZ_ASSERT(aChannel * samplesPerChannel + aOffsetSamples < aLengthSamples, + "Offset request out of bounds."); + return aData + beginningOfChannel + aOffsetSamples; +} + +void +AudioSegment::Mix(AudioMixer& aMixer, uint32_t aOutputChannels, + uint32_t aSampleRate) +{ + nsAutoTArray + buf; + nsAutoTArray channelData; + uint32_t offsetSamples = 0; + uint32_t duration = GetDuration(); + + if (duration <= 0) { + MOZ_ASSERT(duration == 0); + return; + } + + uint32_t outBufferLength = duration * aOutputChannels; + buf.SetLength(outBufferLength); + + for (ChunkIterator ci(*this); !ci.IsEnded(); ci.Next()) { + AudioChunk& c = *ci; + uint32_t frames = c.mDuration; + + // If the chunk is silent, simply write the right number of silence in the + // buffers. + if (c.mBufferFormat == AUDIO_FORMAT_SILENCE) { + for (uint32_t channel = 0; channel < aOutputChannels; channel++) { + AudioDataValue* ptr = + PointerForOffsetInChannel(buf.Elements(), outBufferLength, + aOutputChannels, channel, offsetSamples); + PodZero(ptr, frames); + } + } else { + // Othewise, we need to upmix or downmix appropriately, depending on the + // desired input and output channels. + channelData.SetLength(c.mChannelData.Length()); + for (uint32_t i = 0; i < channelData.Length(); ++i) { + channelData[i] = c.mChannelData[i]; + } + if (channelData.Length() < aOutputChannels) { + // Up-mix. + AudioChannelsUpMix(&channelData, aOutputChannels, gZeroChannel); + for (uint32_t channel = 0; channel < aOutputChannels; channel++) { + AudioDataValue* ptr = + PointerForOffsetInChannel(buf.Elements(), outBufferLength, + aOutputChannels, channel, offsetSamples); + PodCopy(ptr, reinterpret_cast(channelData[channel]), + frames); + } + MOZ_ASSERT(channelData.Length() == aOutputChannels); + } else if (channelData.Length() > aOutputChannels) { + // Down mix. + nsAutoTArray outChannelPtrs; + outChannelPtrs.SetLength(aOutputChannels); + uint32_t offsetSamples = 0; + for (uint32_t channel = 0; channel < aOutputChannels; channel++) { + outChannelPtrs[channel] = + PointerForOffsetInChannel(buf.Elements(), outBufferLength, + aOutputChannels, channel, offsetSamples); + } + AudioChannelsDownMix(channelData, outChannelPtrs.Elements(), + aOutputChannels, frames); + } else { + // The channel count is already what we want, just copy it over. + for (uint32_t channel = 0; channel < aOutputChannels; channel++) { + AudioDataValue* ptr = + PointerForOffsetInChannel(buf.Elements(), outBufferLength, + aOutputChannels, channel, offsetSamples); + PodCopy(ptr, reinterpret_cast(channelData[channel]), + frames); + } + } + } + offsetSamples += frames; + } + + if (offsetSamples) { + MOZ_ASSERT(offsetSamples == outBufferLength / aOutputChannels, + "We forgot to write some samples?"); + aMixer.Mix(buf.Elements(), aOutputChannels, offsetSamples, aSampleRate); + } +} + void AudioSegment::WriteTo(uint64_t aID, AudioMixer& aMixer, uint32_t aOutputChannels, uint32_t aSampleRate) { diff --git a/dom/media/AudioSegment.h b/dom/media/AudioSegment.h index 22bad4e7790a..25c0057f1b7f 100644 --- a/dom/media/AudioSegment.h +++ b/dom/media/AudioSegment.h @@ -299,7 +299,14 @@ public: return chunk; } void ApplyVolume(float aVolume); - void WriteTo(uint64_t aID, AudioMixer& aMixer, uint32_t aChannelCount, uint32_t aSampleRate); + // Mix the segment into a mixer, interleaved. This is useful to output a + // segment to a system audio callback. It up or down mixes to aChannelCount + // channels. + void WriteTo(uint64_t aID, AudioMixer& aMixer, uint32_t aChannelCount, + uint32_t aSampleRate); + // Mix the segment into a mixer, keeping it planar, up or down mixing to + // aChannelCount channels. + void Mix(AudioMixer& aMixer, uint32_t aChannelCount, uint32_t aSampleRate); int ChannelCount() { NS_WARN_IF_FALSE(!mChunks.IsEmpty(), diff --git a/dom/media/DOMMediaStream.cpp b/dom/media/DOMMediaStream.cpp index 40bdee8bd364..e75d5fbfad02 100644 --- a/dom/media/DOMMediaStream.cpp +++ b/dom/media/DOMMediaStream.cpp @@ -301,6 +301,18 @@ DOMMediaStream::InitTrackUnionStream(nsIDOMWindow* aWindow, InitStreamCommon(aGraph->CreateTrackUnionStream(this)); } +void +DOMMediaStream::InitAudioCaptureStream(nsIDOMWindow* aWindow, + MediaStreamGraph* aGraph) +{ + mWindow = aWindow; + + if (!aGraph) { + aGraph = MediaStreamGraph::GetInstance(); + } + InitStreamCommon(aGraph->CreateAudioCaptureStream(this)); +} + void DOMMediaStream::InitStreamCommon(MediaStream* aStream) { @@ -329,6 +341,15 @@ DOMMediaStream::CreateTrackUnionStream(nsIDOMWindow* aWindow, return stream.forget(); } +already_AddRefed +DOMMediaStream::CreateAudioCaptureStream(nsIDOMWindow* aWindow, + MediaStreamGraph* aGraph) +{ + nsRefPtr stream = new DOMMediaStream(); + stream->InitAudioCaptureStream(aWindow, aGraph); + return stream.forget(); +} + void DOMMediaStream::SetTrackEnabled(TrackID aTrackID, bool aEnabled) { @@ -653,6 +674,15 @@ DOMLocalMediaStream::CreateTrackUnionStream(nsIDOMWindow* aWindow, return stream.forget(); } +already_AddRefed +DOMLocalMediaStream::CreateAudioCaptureStream(nsIDOMWindow* aWindow, + MediaStreamGraph* aGraph) +{ + nsRefPtr stream = new DOMLocalMediaStream(); + stream->InitAudioCaptureStream(aWindow, aGraph); + return stream.forget(); +} + DOMAudioNodeMediaStream::DOMAudioNodeMediaStream(AudioNode* aNode) : mStreamNode(aNode) { diff --git a/dom/media/DOMMediaStream.h b/dom/media/DOMMediaStream.h index ebad4e70afbc..fb7bac8733b4 100644 --- a/dom/media/DOMMediaStream.h +++ b/dom/media/DOMMediaStream.h @@ -198,6 +198,13 @@ public: static already_AddRefed CreateTrackUnionStream(nsIDOMWindow* aWindow, MediaStreamGraph* aGraph = nullptr); + /** + * Create an nsDOMMediaStream whose underlying stream is an + * AudioCaptureStream + */ + static already_AddRefed CreateAudioCaptureStream( + nsIDOMWindow* aWindow, MediaStreamGraph* aGraph = nullptr); + void SetLogicalStreamStartTime(StreamTime aTime) { mLogicalStreamStartTime = aTime; @@ -261,6 +268,8 @@ protected: MediaStreamGraph* aGraph = nullptr); void InitTrackUnionStream(nsIDOMWindow* aWindow, MediaStreamGraph* aGraph = nullptr); + void InitAudioCaptureStream(nsIDOMWindow* aWindow, + MediaStreamGraph* aGraph = nullptr); void InitStreamCommon(MediaStream* aStream); already_AddRefed CreateAudioTrack(AudioStreamTrack* aStreamTrack); already_AddRefed CreateVideoTrack(VideoStreamTrack* aStreamTrack); @@ -351,6 +360,12 @@ public: CreateTrackUnionStream(nsIDOMWindow* aWindow, MediaStreamGraph* aGraph = nullptr); + /** + * Create an nsDOMLocalMediaStream whose underlying stream is an + * AudioCaptureStream. */ + static already_AddRefed CreateAudioCaptureStream( + nsIDOMWindow* aWindow, MediaStreamGraph* aGraph = nullptr); + protected: virtual ~DOMLocalMediaStream(); }; diff --git a/dom/media/moz.build b/dom/media/moz.build index 63c6fa3366bd..25d2dbb728d1 100644 --- a/dom/media/moz.build +++ b/dom/media/moz.build @@ -196,6 +196,7 @@ EXPORTS.mozilla.dom += [ UNIFIED_SOURCES += [ 'AbstractThread.cpp', + 'AudioCaptureStream.cpp', 'AudioChannelFormat.cpp', 'AudioCompactor.cpp', 'AudioSegment.cpp', From 672238338691a6f2be2630d841e532b4dfa72a6a Mon Sep 17 00:00:00 2001 From: Paul Adenot Date: Fri, 24 Jul 2015 14:28:16 +0200 Subject: [PATCH 004/136] Bug 1156472 - Part 4 - Add a new MediaStreamGraph API to connect a MediaStream to a capture stream. r=jesup,roc --- dom/media/MediaStreamGraph.cpp | 73 ++++++++++++++++++++++++++++++++ dom/media/MediaStreamGraph.h | 10 +++++ dom/media/MediaStreamGraphImpl.h | 17 ++++++++ 3 files changed, 100 insertions(+) diff --git a/dom/media/MediaStreamGraph.cpp b/dom/media/MediaStreamGraph.cpp index 53144c054893..a23fba28f998 100644 --- a/dom/media/MediaStreamGraph.cpp +++ b/dom/media/MediaStreamGraph.cpp @@ -18,6 +18,7 @@ #include "mozilla/Attributes.h" #include "TrackUnionStream.h" #include "ImageContainer.h" +#include "AudioCaptureStream.h" #include "AudioChannelService.h" #include "AudioNodeEngine.h" #include "AudioNodeStream.h" @@ -3192,6 +3193,17 @@ MediaStreamGraph::CreateTrackUnionStream(DOMMediaStream* aWrapper) return stream; } +ProcessedMediaStream* +MediaStreamGraph::CreateAudioCaptureStream(DOMMediaStream* aWrapper) +{ + AudioCaptureStream* stream = new AudioCaptureStream(aWrapper); + NS_ADDREF(stream); + MediaStreamGraphImpl* graph = static_cast(this); + stream->SetGraphImpl(graph); + graph->AppendMessage(new CreateMessage(stream)); + return stream; +} + AudioNodeExternalInputStream* MediaStreamGraph::CreateAudioNodeExternalInputStream(AudioNodeEngine* aEngine, TrackRate aSampleRate) { @@ -3556,4 +3568,65 @@ ProcessedMediaStream::AddInput(MediaInputPort* aPort) GraphImpl()->SetStreamOrderDirty(); } +void +MediaStreamGraph::RegisterCaptureStreamForWindow( + uint64_t aWindowId, ProcessedMediaStream* aCaptureStream) +{ + MOZ_ASSERT(NS_IsMainThread()); + MediaStreamGraphImpl* graphImpl = static_cast(this); + graphImpl->RegisterCaptureStreamForWindow(aWindowId, aCaptureStream); +} + +void +MediaStreamGraphImpl::RegisterCaptureStreamForWindow( + uint64_t aWindowId, ProcessedMediaStream* aCaptureStream) +{ + MOZ_ASSERT(NS_IsMainThread()); + WindowAndStream winAndStream; + winAndStream.mWindowId = aWindowId; + winAndStream.mCaptureStreamSink = aCaptureStream; + mWindowCaptureStreams.AppendElement(winAndStream); +} + +void +MediaStreamGraph::UnregisterCaptureStreamForWindow(uint64_t aWindowId) +{ + MOZ_ASSERT(NS_IsMainThread()); + MediaStreamGraphImpl* graphImpl = static_cast(this); + graphImpl->UnregisterCaptureStreamForWindow(aWindowId); +} + +void +MediaStreamGraphImpl::UnregisterCaptureStreamForWindow(uint64_t aWindowId) +{ + MOZ_ASSERT(NS_IsMainThread()); + for (uint32_t i = 0; i < mWindowCaptureStreams.Length(); i++) { + if (mWindowCaptureStreams[i].mWindowId == aWindowId) { + mWindowCaptureStreams.RemoveElementAt(i); + } + } +} + +already_AddRefed +MediaStreamGraph::ConnectToCaptureStream(uint64_t aWindowId, + MediaStream* aMediaStream) +{ + return aMediaStream->GraphImpl()->ConnectToCaptureStream(aWindowId, + aMediaStream); +} + +already_AddRefed +MediaStreamGraphImpl::ConnectToCaptureStream(uint64_t aWindowId, + MediaStream* aMediaStream) +{ + MOZ_ASSERT(NS_IsMainThread()); + for (uint32_t i = 0; i < mWindowCaptureStreams.Length(); i++) { + if (mWindowCaptureStreams[i].mWindowId == aWindowId) { + ProcessedMediaStream* sink = mWindowCaptureStreams[i].mCaptureStreamSink; + return sink->AllocateInputPort(aMediaStream, 0); + } + } + return nullptr; +} + } // namespace mozilla diff --git a/dom/media/MediaStreamGraph.h b/dom/media/MediaStreamGraph.h index 312aad706052..ac770fe1396a 100644 --- a/dom/media/MediaStreamGraph.h +++ b/dom/media/MediaStreamGraph.h @@ -1262,6 +1262,10 @@ public: * particular tracks of each input stream. */ ProcessedMediaStream* CreateTrackUnionStream(DOMMediaStream* aWrapper); + /** + * Create a stream that will mix all its audio input. + */ + ProcessedMediaStream* CreateAudioCaptureStream(DOMMediaStream* aWrapper); // Internal AudioNodeStreams can only pass their output to another // AudioNode, whereas external AudioNodeStreams can pass their output // to an nsAudioStream for playback. @@ -1318,6 +1322,12 @@ public: */ TrackRate GraphRate() const { return mSampleRate; } + void RegisterCaptureStreamForWindow(uint64_t aWindowId, + ProcessedMediaStream* aCaptureStream); + void UnregisterCaptureStreamForWindow(uint64_t aWindowId); + already_AddRefed ConnectToCaptureStream( + uint64_t aWindowId, MediaStream* aMediaStream); + protected: explicit MediaStreamGraph(TrackRate aSampleRate) : mNextGraphUpdateIndex(1) diff --git a/dom/media/MediaStreamGraphImpl.h b/dom/media/MediaStreamGraphImpl.h index 262cae526c2e..15ded10c470c 100644 --- a/dom/media/MediaStreamGraphImpl.h +++ b/dom/media/MediaStreamGraphImpl.h @@ -532,6 +532,13 @@ public: } } + // Capture Stream API. This allows to get a mixed-down output for a window. + void RegisterCaptureStreamForWindow(uint64_t aWindowId, + ProcessedMediaStream* aCaptureStream); + void UnregisterCaptureStreamForWindow(uint64_t aWindowId); + already_AddRefed + ConnectToCaptureStream(uint64_t aWindowId, MediaStream* aMediaStream); + // Data members // /** @@ -755,6 +762,16 @@ private: * Used to pass memory report information across threads. */ nsTArray mAudioStreamSizes; + + struct WindowAndStream + { + uint64_t mWindowId; + nsRefPtr mCaptureStreamSink; + }; + /** + * Stream for window audio capture. + */ + nsTArray mWindowCaptureStreams; /** * Indicates that the MSG thread should gather data for a memory report. */ From f692e0d9cefce648b7784a488e5205e4b4379e30 Mon Sep 17 00:00:00 2001 From: Paul Adenot Date: Fri, 24 Jul 2015 14:28:16 +0200 Subject: [PATCH 005/136] Bug 1156472 - Part 5 - Add MediaEngineWebRTCAudioCaptureSource as a new audio source, and "audioCapture" as a new MediaSource. r=jesup,bz --- dom/media/MediaManager.cpp | 117 ++++++++++++-------- dom/media/MediaManager.h | 2 +- dom/media/webrtc/MediaEngineWebRTC.cpp | 14 ++- dom/media/webrtc/MediaEngineWebRTC.h | 64 ++++++++++- dom/media/webrtc/MediaEngineWebRTCAudio.cpp | 52 +++++++++ dom/webidl/Constraints.webidl | 1 + 6 files changed, 194 insertions(+), 56 deletions(-) diff --git a/dom/media/MediaManager.cpp b/dom/media/MediaManager.cpp index 7af74e55c71a..d989563b8057 100644 --- a/dom/media/MediaManager.cpp +++ b/dom/media/MediaManager.cpp @@ -300,7 +300,8 @@ protected: NS_IMPL_ISUPPORTS(MediaDevice, nsIMediaDevice) MediaDevice::MediaDevice(MediaEngineSource* aSource, bool aIsVideo) - : mSource(aSource) + : mMediaSource(aSource->GetMediaSource()) + , mSource(aSource) , mIsVideo(aIsVideo) { mSource->GetName(mName); @@ -311,9 +312,7 @@ MediaDevice::MediaDevice(MediaEngineSource* aSource, bool aIsVideo) VideoDevice::VideoDevice(MediaEngineVideoSource* aSource) : MediaDevice(aSource, true) -{ - mMediaSource = aSource->GetMediaSource(); -} +{} /** * Helper functions that implement the constraints algorithm from @@ -439,6 +438,8 @@ MediaDevice::GetMediaSource(nsAString& aMediaSource) { if (mMediaSource == dom::MediaSourceEnum::Microphone) { aMediaSource.Assign(NS_LITERAL_STRING("microphone")); + } else if (mMediaSource == dom::MediaSourceEnum::AudioCapture) { + aMediaSource.Assign(NS_LITERAL_STRING("audioCapture")); } else if (mMediaSource == dom::MediaSourceEnum::Window) { // this will go away aMediaSource.Assign(NS_LITERAL_STRING("window")); } else { // all the rest are shared @@ -784,11 +785,52 @@ public: } } #endif - // Create a media stream. - nsRefPtr trackunion = - nsDOMUserMediaStream::CreateTrackUnionStream(window, mListener, - mAudioSource, mVideoSource); - if (!trackunion || sInShutdown) { + + MediaStreamGraph* msg = MediaStreamGraph::GetInstance(); + nsRefPtr stream = msg->CreateSourceStream(nullptr); + + nsRefPtr domStream; + // AudioCapture is a special case, here, in the sense that we're not really + // using the audio source and the SourceMediaStream, which acts as + // placeholders. We re-route a number of stream internaly in the MSG and mix + // them down instead. + if (mAudioSource && + mAudioSource->GetMediaSource() == dom::MediaSourceEnum::AudioCapture) { + domStream = DOMLocalMediaStream::CreateAudioCaptureStream(window); + msg->RegisterCaptureStreamForWindow( + mWindowID, domStream->GetStream()->AsProcessedStream()); + window->SetAudioCapture(true); + } else { + // Normal case, connect the source stream to the track union stream to + // avoid us blocking + nsRefPtr trackunion = + nsDOMUserMediaStream::CreateTrackUnionStream(window, mListener, + mAudioSource, mVideoSource); + trackunion->GetStream()->AsProcessedStream()->SetAutofinish(true); + nsRefPtr port = trackunion->GetStream()->AsProcessedStream()-> + AllocateInputPort(stream, MediaInputPort::FLAG_BLOCK_OUTPUT); + trackunion->mSourceStream = stream; + trackunion->mPort = port.forget(); + // Log the relationship between SourceMediaStream and TrackUnion stream + // Make sure logger starts before capture + AsyncLatencyLogger::Get(true); + LogLatency(AsyncLatencyLogger::MediaStreamCreate, + reinterpret_cast(stream.get()), + reinterpret_cast(trackunion->GetStream())); + + nsCOMPtr principal; + if (mPeerIdentity) { + principal = nsNullPrincipal::Create(); + trackunion->SetPeerIdentity(mPeerIdentity.forget()); + } else { + principal = window->GetExtantDoc()->NodePrincipal(); + } + trackunion->CombineWithPrincipal(principal); + + domStream = trackunion.forget(); + } + + if (!domStream || sInShutdown) { nsCOMPtr onFailure = mOnFailure.forget(); LOG(("Returning error for getUserMedia() - no stream")); @@ -802,36 +844,6 @@ public: } return NS_OK; } - trackunion->AudioConfig(aec_on, (uint32_t) aec, - agc_on, (uint32_t) agc, - noise_on, (uint32_t) noise, - playout_delay); - - - MediaStreamGraph* gm = MediaStreamGraph::GetInstance(); - nsRefPtr stream = gm->CreateSourceStream(nullptr); - - // connect the source stream to the track union stream to avoid us blocking - trackunion->GetStream()->AsProcessedStream()->SetAutofinish(true); - nsRefPtr port = trackunion->GetStream()->AsProcessedStream()-> - AllocateInputPort(stream, MediaInputPort::FLAG_BLOCK_OUTPUT); - trackunion->mSourceStream = stream; - trackunion->mPort = port.forget(); - // Log the relationship between SourceMediaStream and TrackUnion stream - // Make sure logger starts before capture - AsyncLatencyLogger::Get(true); - LogLatency(AsyncLatencyLogger::MediaStreamCreate, - reinterpret_cast(stream.get()), - reinterpret_cast(trackunion->GetStream())); - - nsCOMPtr principal; - if (mPeerIdentity) { - principal = nsNullPrincipal::Create(); - trackunion->SetPeerIdentity(mPeerIdentity.forget()); - } else { - principal = window->GetExtantDoc()->NodePrincipal(); - } - trackunion->CombineWithPrincipal(principal); // The listener was added at the beginning in an inactive state. // Activate our listener. We'll call Start() on the source when get a callback @@ -841,7 +853,7 @@ public: // Note: includes JS callbacks; must be released on MainThread TracksAvailableCallback* tracksAvailableCallback = - new TracksAvailableCallback(mManager, mOnSuccess, mWindowID, trackunion); + new TracksAvailableCallback(mManager, mOnSuccess, mWindowID, domStream); mListener->AudioConfig(aec_on, (uint32_t) aec, agc_on, (uint32_t) agc, @@ -852,11 +864,11 @@ public: // because that can take a while. // Pass ownership of trackunion to the MediaOperationTask // to ensure it's kept alive until the MediaOperationTask runs (at least). - MediaManager::PostTask(FROM_HERE, - new MediaOperationTask(MEDIA_START, mListener, trackunion, - tracksAvailableCallback, - mAudioSource, mVideoSource, false, mWindowID, - mOnFailure.forget())); + MediaManager::PostTask( + FROM_HERE, new MediaOperationTask(MEDIA_START, mListener, domStream, + tracksAvailableCallback, mAudioSource, + mVideoSource, false, mWindowID, + mOnFailure.forget())); // We won't need mOnFailure now. mOnFailure = nullptr; @@ -2075,7 +2087,7 @@ StopSharingCallback(MediaManager *aThis, listener->Invalidate(); } listener->Remove(); - listener->StopScreenWindowSharing(); + listener->StopSharing(); } aListeners->Clear(); aThis->RemoveWindowID(aWindowID); @@ -2398,7 +2410,7 @@ MediaManager::Observe(nsISupports* aSubject, const char* aTopic, uint64_t windowID = PromiseFlatString(Substring(data, strlen("screen:"))).ToInteger64(&rv); MOZ_ASSERT(NS_SUCCEEDED(rv)); if (NS_SUCCEEDED(rv)) { - LOG(("Revoking Screeen/windowCapture access for window %llu", windowID)); + LOG(("Revoking Screen/windowCapture access for window %llu", windowID)); StopScreensharing(windowID); } } else { @@ -2579,7 +2591,7 @@ StopScreensharingCallback(MediaManager *aThis, if (aListeners) { auto length = aListeners->Length(); for (size_t i = 0; i < length; ++i) { - aListeners->ElementAt(i)->StopScreenWindowSharing(); + aListeners->ElementAt(i)->StopSharing(); } } } @@ -2741,7 +2753,7 @@ GetUserMediaCallbackMediaStreamListener::Invalidate() // Doesn't kill audio // XXX refactor to combine with Invalidate()? void -GetUserMediaCallbackMediaStreamListener::StopScreenWindowSharing() +GetUserMediaCallbackMediaStreamListener::StopSharing() { NS_ASSERTION(NS_IsMainThread(), "Only call on main thread"); if (mVideoSource && !mStopped && @@ -2754,6 +2766,13 @@ GetUserMediaCallbackMediaStreamListener::StopScreenWindowSharing() this, nullptr, nullptr, nullptr, mVideoSource, mFinished, mWindowID, nullptr)); + } else if (mAudioSource && + mAudioSource->GetMediaSource() == dom::MediaSourceEnum::AudioCapture) { + nsCOMPtr window = nsGlobalWindow::GetInnerWindowWithId(mWindowID); + MOZ_ASSERT(window); + window->SetAudioCapture(false); + MediaStreamGraph::GetInstance()->UnregisterCaptureStreamForWindow(mWindowID); + mStream->Destroy(); } } diff --git a/dom/media/MediaManager.h b/dom/media/MediaManager.h index d7af9c5a7b99..68ab74269201 100644 --- a/dom/media/MediaManager.h +++ b/dom/media/MediaManager.h @@ -103,7 +103,7 @@ public: return mStream->AsSourceStream(); } - void StopScreenWindowSharing(); + void StopSharing(); void StopTrack(TrackID aID, bool aIsAudio); diff --git a/dom/media/webrtc/MediaEngineWebRTC.cpp b/dom/media/webrtc/MediaEngineWebRTC.cpp index 34adf582ed88..207e97acb33e 100644 --- a/dom/media/webrtc/MediaEngineWebRTC.cpp +++ b/dom/media/webrtc/MediaEngineWebRTC.cpp @@ -291,6 +291,13 @@ MediaEngineWebRTC::EnumerateAudioDevices(dom::MediaSourceEnum aMediaSource, // We spawn threads to handle gUM runnables, so we must protect the member vars MutexAutoLock lock(mMutex); + if (aMediaSource == dom::MediaSourceEnum::AudioCapture) { + nsRefPtr audioCaptureSource = + new MediaEngineWebRTCAudioCaptureSource(nullptr); + aASources->AppendElement(audioCaptureSource); + return; + } + #ifdef MOZ_WIDGET_ANDROID jobject context = mozilla::AndroidBridge::Bridge()->GetGlobalContextRef(); @@ -358,7 +365,7 @@ MediaEngineWebRTC::EnumerateAudioDevices(dom::MediaSourceEnum aMediaSource, strcpy(uniqueId,deviceName); // safe given assert and initialization/error-check } - nsRefPtr aSource; + nsRefPtr aSource; NS_ConvertUTF8toUTF16 uuid(uniqueId); if (mAudioSources.Get(uuid, getter_AddRefs(aSource))) { // We've already seen this device, just append. @@ -384,9 +391,8 @@ ClearVideoSource (const nsAString&, // unused } static PLDHashOperator -ClearAudioSource (const nsAString&, // unused - MediaEngineWebRTCAudioSource* aData, - void *userArg) +ClearAudioSource(const nsAString &, // unused + MediaEngineAudioSource *aData, void *userArg) { if (aData) { aData->Shutdown(); diff --git a/dom/media/webrtc/MediaEngineWebRTC.h b/dom/media/webrtc/MediaEngineWebRTC.h index 8b05480718b6..112c5134d607 100644 --- a/dom/media/webrtc/MediaEngineWebRTC.h +++ b/dom/media/webrtc/MediaEngineWebRTC.h @@ -133,6 +133,67 @@ private: void GetCapability(size_t aIndex, webrtc::CaptureCapability& aOut) override; }; +class MediaEngineWebRTCAudioCaptureSource : public MediaEngineAudioSource +{ +public: + NS_DECL_THREADSAFE_ISUPPORTS + + explicit MediaEngineWebRTCAudioCaptureSource(const char* aUuid) + : MediaEngineAudioSource(kReleased) + { + } + void GetName(nsAString& aName) override; + void GetUUID(nsACString& aUUID) override; + nsresult Allocate(const dom::MediaTrackConstraints& aConstraints, + const MediaEnginePrefs& aPrefs, + const nsString& aDeviceId) override + { + // Nothing to do here, everything is managed in MediaManager.cpp + return NS_OK; + } + nsresult Deallocate() override + { + // Nothing to do here, everything is managed in MediaManager.cpp + return NS_OK; + } + void Shutdown() override + { + // Nothing to do here, everything is managed in MediaManager.cpp + } + nsresult Start(SourceMediaStream* aMediaStream, TrackID aId) override; + nsresult Stop(SourceMediaStream* aMediaStream, TrackID aId) override; + void SetDirectListeners(bool aDirect) override + {} + nsresult Config(bool aEchoOn, uint32_t aEcho, bool aAgcOn, + uint32_t aAGC, bool aNoiseOn, uint32_t aNoise, + int32_t aPlayoutDelay) override + { + return NS_OK; + } + void NotifyPull(MediaStreamGraph* aGraph, SourceMediaStream* aSource, + TrackID aID, StreamTime aDesiredTime) override + {} + const dom::MediaSourceEnum GetMediaSource() override + { + return dom::MediaSourceEnum::AudioCapture; + } + bool IsFake() override + { + return false; + } + nsresult TakePhoto(PhotoCallback* aCallback) override + { + return NS_ERROR_NOT_IMPLEMENTED; + } + uint32_t GetBestFitnessDistance( + const nsTArray& aConstraintSets, + const nsString& aDeviceId) override; + +protected: + virtual ~MediaEngineWebRTCAudioCaptureSource() { Shutdown(); } + nsCString mUUID; +}; + class MediaEngineWebRTCMicrophoneSource : public MediaEngineAudioSource, public webrtc::VoEMediaProcess, private MediaConstraintsHelper @@ -297,8 +358,7 @@ private: // Store devices we've already seen in a hashtable for quick return. // Maps UUID to MediaEngineSource (one set for audio, one for video). nsRefPtrHashtable mVideoSources; - nsRefPtrHashtable - mAudioSources; + nsRefPtrHashtable mAudioSources; }; } diff --git a/dom/media/webrtc/MediaEngineWebRTCAudio.cpp b/dom/media/webrtc/MediaEngineWebRTCAudio.cpp index 2aca1ecbbf99..223a5acde76e 100644 --- a/dom/media/webrtc/MediaEngineWebRTCAudio.cpp +++ b/dom/media/webrtc/MediaEngineWebRTCAudio.cpp @@ -44,6 +44,7 @@ extern PRLogModuleInfo* GetMediaManagerLog(); * Webrtc microphone source source. */ NS_IMPL_ISUPPORTS0(MediaEngineWebRTCMicrophoneSource) +NS_IMPL_ISUPPORTS0(MediaEngineWebRTCAudioCaptureSource) // XXX temp until MSG supports registration StaticRefPtr gFarendObserver; @@ -620,4 +621,55 @@ MediaEngineWebRTCMicrophoneSource::Process(int channel, return; } +void +MediaEngineWebRTCAudioCaptureSource::GetName(nsAString &aName) +{ + aName.AssignLiteral("AudioCapture"); +} +void +MediaEngineWebRTCAudioCaptureSource::GetUUID(nsACString &aUUID) +{ + nsID uuid; + char uuidBuffer[NSID_LENGTH]; + nsCString asciiString; + ErrorResult rv; + + rv = nsContentUtils::GenerateUUIDInPlace(uuid); + if (rv.Failed()) { + aUUID.AssignLiteral(""); + return; + } + + + uuid.ToProvidedString(uuidBuffer); + asciiString.AssignASCII(uuidBuffer); + + // Remove {} and the null terminator + aUUID.Assign(Substring(asciiString, 1, NSID_LENGTH - 3)); +} + +nsresult +MediaEngineWebRTCAudioCaptureSource::Start(SourceMediaStream *aMediaStream, + TrackID aId) +{ + aMediaStream->AddTrack(aId, 0, new AudioSegment()); + return NS_OK; +} + +nsresult +MediaEngineWebRTCAudioCaptureSource::Stop(SourceMediaStream *aMediaStream, + TrackID aId) +{ + aMediaStream->EndAllTrackAndFinish(); + return NS_OK; +} + +uint32_t +MediaEngineWebRTCAudioCaptureSource::GetBestFitnessDistance( + const nsTArray& aConstraintSets, + const nsString& aDeviceId) +{ + // There is only one way of capturing audio for now, and it's always adequate. + return 0; +} } diff --git a/dom/webidl/Constraints.webidl b/dom/webidl/Constraints.webidl index fc6275b59b4e..f7f0c706a9d7 100644 --- a/dom/webidl/Constraints.webidl +++ b/dom/webidl/Constraints.webidl @@ -25,6 +25,7 @@ enum MediaSourceEnum { "window", "browser", "microphone", + "audioCapture", "other" }; From b195db60a73c5d0f3c961c17184ec013a215467d Mon Sep 17 00:00:00 2001 From: Paul Adenot Date: Fri, 24 Jul 2015 14:28:17 +0200 Subject: [PATCH 006/136] Bug 1156472 - Part 6 - Connect HTMLMediaElement and AudioContext to the capture stream when capturing is needed. r=roc --- dom/html/HTMLMediaElement.cpp | 45 ++++++++++++++++----- dom/html/HTMLMediaElement.h | 6 +++ dom/media/webaudio/AudioDestinationNode.cpp | 29 ++++++++----- dom/media/webaudio/AudioDestinationNode.h | 2 + 4 files changed, 64 insertions(+), 18 deletions(-) diff --git a/dom/html/HTMLMediaElement.cpp b/dom/html/HTMLMediaElement.cpp index 42c5f63f7774..81f1ed36079f 100644 --- a/dom/html/HTMLMediaElement.cpp +++ b/dom/html/HTMLMediaElement.cpp @@ -2030,6 +2030,7 @@ HTMLMediaElement::HTMLMediaElement(already_AddRefed& aNo mAllowCasting(false), mIsCasting(false), mAudioCaptured(false), + mAudioCapturedByWindow(false), mPlayingBeforeSeek(false), mPlayingThroughTheAudioChannelBeforeSeek(false), mPausedForInactiveDocumentOrChannel(false), @@ -2097,6 +2098,11 @@ HTMLMediaElement::~HTMLMediaElement() EndSrcMediaStreamPlayback(); } + if (mCaptureStreamPort) { + mCaptureStreamPort->Destroy(); + mCaptureStreamPort = nullptr; + } + NS_ASSERTION(MediaElementTableCount(this, mLoadingSrc) == 0, "Destroyed media element should no longer be in element table"); @@ -4475,8 +4481,7 @@ void HTMLMediaElement::UpdateAudioChannelPlayingState() (!mPaused && (HasAttr(kNameSpaceID_None, nsGkAtoms::loop) || (mReadyState >= nsIDOMHTMLMediaElement::HAVE_CURRENT_DATA && - !IsPlaybackEnded() && - (!mSrcStream || HasAudio())) || + !IsPlaybackEnded()) || mPlayingThroughTheAudioChannelBeforeSeek)); if (playingThroughTheAudioChannel != mPlayingThroughTheAudioChannel) { mPlayingThroughTheAudioChannel = playingThroughTheAudioChannel; @@ -4504,9 +4509,9 @@ void HTMLMediaElement::UpdateAudioChannelPlayingState() void HTMLMediaElement::NotifyAudioChannelAgent(bool aPlaying) { - // Immediately check if this should go to the MSG instead of the normal - // media playback route. - WindowAudioCaptureChanged(); + // Immediately check if this should go to the MSG instead of the normal + // media playback route. + WindowAudioCaptureChanged(); // This is needed to pass nsContentUtils::IsCallerChrome(). // AudioChannel API should not called from content but it can happen that @@ -4680,11 +4685,33 @@ HTMLMediaElement::GetTopLevelPrincipal() NS_IMETHODIMP HTMLMediaElement::WindowAudioCaptureChanged() { - MOZ_ASSERT(mAudioChannelAgent); - DebugOnly captured = OwnerDoc()->GetInnerWindow()->GetAudioCaptured(); + MOZ_ASSERT(mAudioChannelAgent); - // Something is going to happen here!! - return NS_OK; + if (!OwnerDoc()->GetInnerWindow()) { + return NS_OK; + } + bool captured = OwnerDoc()->GetInnerWindow()->GetAudioCaptured(); + + if (captured != mAudioCapturedByWindow) { + if (captured) { + mAudioCapturedByWindow = true; + nsCOMPtr window = + do_QueryInterface(OwnerDoc()->GetParentObject()); + uint64_t id = window->WindowID(); + MediaStreamGraph* msg = MediaStreamGraph::GetInstance(); + + if (!mPlaybackStream) { + nsRefPtr stream = CaptureStreamInternal(false, msg); + mCaptureStreamPort = msg->ConnectToCaptureStream(id, stream->GetStream()); + } else { + mCaptureStreamPort = msg->ConnectToCaptureStream(id, mPlaybackStream->GetStream()); + } + } else { + // TODO: uncapture + } + } + + return NS_OK; } AudioTrackList* diff --git a/dom/html/HTMLMediaElement.h b/dom/html/HTMLMediaElement.h index 84f4ed0d9cd8..406478fc507c 100644 --- a/dom/html/HTMLMediaElement.h +++ b/dom/html/HTMLMediaElement.h @@ -1074,6 +1074,9 @@ protected: // Holds a reference to a MediaInputPort connecting mSrcStream to mPlaybackStream. nsRefPtr mPlaybackStreamInputPort; + // Holds a reference to the stream connecting this stream to the capture sink. + nsRefPtr mCaptureStreamPort; + // Holds a reference to a stream with mSrcStream as input but intended for // playback. Used so we don't block playback of other video elements // playing the same mSrcStream. @@ -1283,6 +1286,9 @@ protected: // True if the sound is being captured. bool mAudioCaptured; + // True if the sound is being captured by the window. + bool mAudioCapturedByWindow; + // If TRUE then the media element was actively playing before the currently // in progress seeking. If FALSE then the media element is either not seeking // or was not actively playing before the current seek. Used to decide whether diff --git a/dom/media/webaudio/AudioDestinationNode.cpp b/dom/media/webaudio/AudioDestinationNode.cpp index 3f5a3650a0df..d37145ef547a 100644 --- a/dom/media/webaudio/AudioDestinationNode.cpp +++ b/dom/media/webaudio/AudioDestinationNode.cpp @@ -313,12 +313,9 @@ AudioDestinationNode::AudioDestinationNode(AudioContext* aContext, bool aIsOffline, AudioChannel aChannel, uint32_t aNumberOfChannels, - uint32_t aLength, - float aSampleRate) - : AudioNode(aContext, - aIsOffline ? aNumberOfChannels : 2, - ChannelCountMode::Explicit, - ChannelInterpretation::Speakers) + uint32_t aLength, float aSampleRate) + : AudioNode(aContext, aIsOffline ? aNumberOfChannels : 2, + ChannelCountMode::Explicit, ChannelInterpretation::Speakers) , mFramesToProduce(aLength) , mAudioChannel(AudioChannel::Normal) , mIsOffline(aIsOffline) @@ -326,6 +323,7 @@ AudioDestinationNode::AudioDestinationNode(AudioContext* aContext, , mExtraCurrentTime(0) , mExtraCurrentTimeSinceLastStartedBlocking(0) , mExtraCurrentTimeUpdatedSinceLastStableState(false) + , mCaptured(false) { bool startWithAudioDriver = true; MediaStreamGraph* graph = aIsOffline ? @@ -510,13 +508,25 @@ AudioDestinationNode::WindowAudioCaptureChanged() { MOZ_ASSERT(mAudioChannelAgent); - if (!mStream) { + if (!mStream || Context()->IsOffline()) { return NS_OK; } - DebugOnly captured = GetOwner()->GetAudioCaptured(); + bool captured = GetOwner()->GetAudioCaptured(); + + if (captured != mCaptured) { + if (captured) { + nsCOMPtr window = Context()->GetParentObject(); + uint64_t id = window->WindowID(); + mCaptureStreamPort = + mStream->Graph()->ConnectToCaptureStream(id, mStream); + } else { + mCaptureStreamPort->Disconnect(); + mCaptureStreamPort->Destroy(); + } + mCaptured = captured; + } - // XXXtodopadenot actually capture return NS_OK; } @@ -699,6 +709,7 @@ AudioDestinationNode::InputMuted(bool aMuted) return; } + WindowAudioCaptureChanged(); WindowVolumeChanged(volume, muted); } diff --git a/dom/media/webaudio/AudioDestinationNode.h b/dom/media/webaudio/AudioDestinationNode.h index db5418a9cb51..724e44d61d3c 100644 --- a/dom/media/webaudio/AudioDestinationNode.h +++ b/dom/media/webaudio/AudioDestinationNode.h @@ -99,6 +99,7 @@ private: uint32_t mFramesToProduce; nsCOMPtr mAudioChannelAgent; + nsRefPtr mCaptureStreamPort; nsRefPtr mOfflineRenderingPromise; @@ -111,6 +112,7 @@ private: double mExtraCurrentTime; double mExtraCurrentTimeSinceLastStartedBlocking; bool mExtraCurrentTimeUpdatedSinceLastStableState; + bool mCaptured; }; } // namespace dom From 62ea7fce4b450a3cd21a179ff078e42e339f343f Mon Sep 17 00:00:00 2001 From: Paul Adenot Date: Fri, 24 Jul 2015 14:28:17 +0200 Subject: [PATCH 007/136] Bug 1156472 - Part 7 - Allow to un-capture an HTMLMediaElement. r=pehrsons,jwwang --- dom/html/HTMLMediaElement.cpp | 18 +++++++++++++++- dom/media/DecodedStream.cpp | 8 +++++++ dom/media/DecodedStream.h | 1 + dom/media/MediaDecoder.cpp | 7 +++++++ dom/media/MediaDecoder.h | 2 ++ dom/media/MediaDecoderStateMachine.cpp | 29 ++++++++++++++++++++++++++ dom/media/MediaDecoderStateMachine.h | 3 +++ 7 files changed, 67 insertions(+), 1 deletion(-) diff --git a/dom/html/HTMLMediaElement.cpp b/dom/html/HTMLMediaElement.cpp index 81f1ed36079f..f511ef93f51c 100644 --- a/dom/html/HTMLMediaElement.cpp +++ b/dom/html/HTMLMediaElement.cpp @@ -4707,7 +4707,23 @@ NS_IMETHODIMP HTMLMediaElement::WindowAudioCaptureChanged() mCaptureStreamPort = msg->ConnectToCaptureStream(id, mPlaybackStream->GetStream()); } } else { - // TODO: uncapture + mAudioCapturedByWindow = false; + if (mDecoder) { + ProcessedMediaStream* ps = + mCaptureStreamPort->GetSource()->AsProcessedStream(); + MOZ_ASSERT(ps); + + for (uint32_t i = 0; i < mOutputStreams.Length(); i++) { + if (mOutputStreams[i].mStream->GetStream() == ps) { + mOutputStreams.RemoveElementAt(i); + break; + } + } + + mDecoder->RemoveOutputStream(ps); + } + mCaptureStreamPort->Destroy(); + mCaptureStreamPort = nullptr; } } diff --git a/dom/media/DecodedStream.cpp b/dom/media/DecodedStream.cpp index dcc950228f72..913f68203e21 100644 --- a/dom/media/DecodedStream.cpp +++ b/dom/media/DecodedStream.cpp @@ -289,6 +289,14 @@ DecodedStream::OutputStreams() return mOutputStreams; } +bool +DecodedStream::HasConsumers() const +{ + MOZ_ASSERT(NS_IsMainThread()); + ReentrantMonitorAutoEnter mon(GetReentrantMonitor()); + return mOutputStreams.IsEmpty(); +} + ReentrantMonitor& DecodedStream::GetReentrantMonitor() const { diff --git a/dom/media/DecodedStream.h b/dom/media/DecodedStream.h index 8b25b95c9f7d..ebad8330c865 100644 --- a/dom/media/DecodedStream.h +++ b/dom/media/DecodedStream.h @@ -114,6 +114,7 @@ public: int64_t AudioEndTime() const; int64_t GetPosition() const; bool IsFinished() const; + bool HasConsumers() const; // Return true if stream is finished. bool SendData(double aVolume, bool aIsSameOrigin); diff --git a/dom/media/MediaDecoder.cpp b/dom/media/MediaDecoder.cpp index 59f7e5fcc59b..3f0cdadc6a19 100644 --- a/dom/media/MediaDecoder.cpp +++ b/dom/media/MediaDecoder.cpp @@ -326,6 +326,13 @@ void MediaDecoder::AddOutputStream(ProcessedMediaStream* aStream, mDecoderStateMachine->AddOutputStream(aStream, aFinishWhenEnded); } +void MediaDecoder::RemoveOutputStream(MediaStream* aStream) +{ + MOZ_ASSERT(NS_IsMainThread()); + MOZ_ASSERT(mDecoderStateMachine, "Must be called after Load()."); + mDecoderStateMachine->RemoveOutputStream(aStream); +} + double MediaDecoder::GetDuration() { MOZ_ASSERT(NS_IsMainThread()); diff --git a/dom/media/MediaDecoder.h b/dom/media/MediaDecoder.h index c2a01bb07465..d216bf9c7666 100644 --- a/dom/media/MediaDecoder.h +++ b/dom/media/MediaDecoder.h @@ -399,6 +399,8 @@ public: // The stream is initially blocked. The decoder is responsible for unblocking // it while it is playing back. virtual void AddOutputStream(ProcessedMediaStream* aStream, bool aFinishWhenEnded); + // Remove an output stream added with AddOutputStream. + virtual void RemoveOutputStream(MediaStream* aStream); // Return the duration of the video in seconds. virtual double GetDuration(); diff --git a/dom/media/MediaDecoderStateMachine.cpp b/dom/media/MediaDecoderStateMachine.cpp index 2ca215ca06f9..9b7ab7e0e092 100644 --- a/dom/media/MediaDecoderStateMachine.cpp +++ b/dom/media/MediaDecoderStateMachine.cpp @@ -3177,6 +3177,25 @@ void MediaDecoderStateMachine::DispatchAudioCaptured() OwnerThread()->Dispatch(r.forget()); } +void MediaDecoderStateMachine::DispatchAudioUncaptured() +{ + nsRefPtr self = this; + nsCOMPtr r = NS_NewRunnableFunction([self] () -> void + { + MOZ_ASSERT(self->OnTaskQueue()); + ReentrantMonitorAutoEnter mon(self->mDecoder->GetReentrantMonitor()); + if (self->mAudioCaptured) { + // Start again the audio sink + self->mAudioCaptured = false; + if (self->IsPlaying()) { + self->StartAudioThread(); + } + self->ScheduleStateMachine(); + } + }); + OwnerThread()->Dispatch(r.forget()); +} + void MediaDecoderStateMachine::AddOutputStream(ProcessedMediaStream* aStream, bool aFinishWhenEnded) { @@ -3186,6 +3205,16 @@ void MediaDecoderStateMachine::AddOutputStream(ProcessedMediaStream* aStream, DispatchAudioCaptured(); } +void MediaDecoderStateMachine::RemoveOutputStream(MediaStream* aStream) +{ + MOZ_ASSERT(NS_IsMainThread()); + DECODER_LOG("RemoveOutputStream=%p!", aStream); + mDecodedStream->Remove(aStream); + if (!mDecodedStream->HasConsumers()) { + DispatchAudioUncaptured(); + } +} + } // namespace mozilla // avoid redefined macro in unified build diff --git a/dom/media/MediaDecoderStateMachine.h b/dom/media/MediaDecoderStateMachine.h index ea485d4e9d08..8670d0569baa 100644 --- a/dom/media/MediaDecoderStateMachine.h +++ b/dom/media/MediaDecoderStateMachine.h @@ -149,6 +149,8 @@ public: }; void AddOutputStream(ProcessedMediaStream* aStream, bool aFinishWhenEnded); + // Remove an output stream added with AddOutputStream. + void RemoveOutputStream(MediaStream* aStream); // Set/Unset dormant state. void SetDormant(bool aDormant); @@ -160,6 +162,7 @@ private: void InitializationTask(); void DispatchAudioCaptured(); + void DispatchAudioUncaptured(); void Shutdown(); public: From 373545da0dc48595216d9991bd44dbbd72aa332f Mon Sep 17 00:00:00 2001 From: Paul Adenot Date: Fri, 24 Jul 2015 14:28:17 +0200 Subject: [PATCH 008/136] Bug 1156472 - Part 8 - Use fatal asserts in AudioChannelUpmix, because it would have crashed anyways. r=roc --- dom/media/AudioChannelFormat.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/dom/media/AudioChannelFormat.cpp b/dom/media/AudioChannelFormat.cpp index a447b1dd5d73..2534851bed17 100644 --- a/dom/media/AudioChannelFormat.cpp +++ b/dom/media/AudioChannelFormat.cpp @@ -76,8 +76,8 @@ AudioChannelsUpMix(nsTArray* aChannelArray, GetAudioChannelsSuperset(aOutputChannelCount, inputChannelCount); NS_ASSERTION(outputChannelCount > inputChannelCount, "No up-mix needed"); - NS_ASSERTION(inputChannelCount > 0, "Bad number of channels"); - NS_ASSERTION(outputChannelCount > 0, "Bad number of channels"); + MOZ_ASSERT(inputChannelCount > 0, "Bad number of channels"); + MOZ_ASSERT(outputChannelCount > 0, "Bad number of channels"); aChannelArray->SetLength(outputChannelCount); From ed2dcb7e899acbb6ac1c24c8733f511c6c4634f8 Mon Sep 17 00:00:00 2001 From: Paul Adenot Date: Fri, 24 Jul 2015 14:28:17 +0200 Subject: [PATCH 009/136] Bug 1156472 - Part 9 - Implement the minimum frontend to play with the feature. r=gijs,florian --- .../locales/en-US/chrome/browser/browser.dtd | 1 + .../en-US/chrome/browser/browser.properties | 23 ++++++++- browser/modules/ContentWebRTC.jsm | 14 ++++-- browser/modules/webrtcUI.jsm | 50 +++++++++++-------- 4 files changed, 64 insertions(+), 24 deletions(-) diff --git a/browser/locales/en-US/chrome/browser/browser.dtd b/browser/locales/en-US/chrome/browser/browser.dtd index 89981e6936c4..fe7439e0a445 100644 --- a/browser/locales/en-US/chrome/browser/browser.dtd +++ b/browser/locales/en-US/chrome/browser/browser.dtd @@ -758,6 +758,7 @@ you can use these alternative items. Otherwise, their values should be empty. - + diff --git a/browser/locales/en-US/chrome/browser/browser.properties b/browser/locales/en-US/chrome/browser/browser.properties index 766446fac755..1a71d59b1b09 100644 --- a/browser/locales/en-US/chrome/browser/browser.properties +++ b/browser/locales/en-US/chrome/browser/browser.properties @@ -553,13 +553,17 @@ identity.loggedIn.signOut.accessKey = O # LOCALIZATION NOTE (getUserMedia.shareCamera.message, getUserMedia.shareMicrophone.message, # getUserMedia.shareScreen.message, getUserMedia.shareCameraAndMicrophone.message, -# getUserMedia.shareScreenAndMicrophone.message): +# getUserMedia.shareScreenAndMicrophone.message, getUserMedia.shareCameraAndAudioCapture.message, +# getUserMedia.shareAudioCapture.message, getUserMedia.shareScreenAndAudioCapture.message): # %S is the website origin (e.g. www.mozilla.org) getUserMedia.shareCamera.message = Would you like to share your camera with %S? getUserMedia.shareMicrophone.message = Would you like to share your microphone with %S? getUserMedia.shareScreen.message = Would you like to share your screen with %S? getUserMedia.shareCameraAndMicrophone.message = Would you like to share your camera and microphone with %S? +getUserMedia.shareCameraAndAudioCapture.message = Would you like to share your camera and this tab's audio with %S? getUserMedia.shareScreenAndMicrophone.message = Would you like to share your microphone and screen with %S? +getUserMedia.shareScreenAndAudioCapture.message = Would you like to share this tab's audio and your screen with %S? +getUserMedia.shareAudioCapture.message = Would you like to share this tab's audio with %S? getUserMedia.selectWindow.label=Window to share: getUserMedia.selectWindow.accesskey=W getUserMedia.selectScreen.label=Screen to share: @@ -601,6 +605,7 @@ getUserMedia.sharingApplication.message = You are currently sharing an applicati getUserMedia.sharingScreen.message = You are currently sharing your screen with this page. getUserMedia.sharingWindow.message = You are currently sharing a window with this page. getUserMedia.sharingBrowser.message = You are currently sharing a tab with this page. +getUserMedia.sharingAudioCapture.message = You are currently sharing a tab's audio with this page. getUserMedia.continueSharing.label = Continue Sharing getUserMedia.continueSharing.accesskey = C getUserMedia.stopSharing.label = Stop Sharing @@ -610,6 +615,7 @@ getUserMedia.sharingMenu.label = Tabs sharing devices getUserMedia.sharingMenu.accesskey = d # LOCALIZATION NOTE (getUserMedia.sharingMenuCamera # getUserMedia.sharingMenuMicrophone, +# getUserMedia.sharingMenuAudioCapture, # getUserMedia.sharingMenuApplication, # getUserMedia.sharingMenuScreen, # getUserMedia.sharingMenuWindow, @@ -619,6 +625,11 @@ getUserMedia.sharingMenu.accesskey = d # getUserMedia.sharingMenuCameraMicrophoneScreen, # getUserMedia.sharingMenuCameraMicrophoneWindow, # getUserMedia.sharingMenuCameraMicrophoneBrowser, +# getUserMedia.sharingMenuCameraAudioCapture, +# getUserMedia.sharingMenuCameraAudioCaptureApplication, +# getUserMedia.sharingMenuCameraAudioCaptureScreen, +# getUserMedia.sharingMenuCameraAudioCaptureWindow, +# getUserMedia.sharingMenuCameraAudioCaptureBrowser, # getUserMedia.sharingMenuCameraApplication, # getUserMedia.sharingMenuCameraScreen, # getUserMedia.sharingMenuCameraWindow, @@ -630,6 +641,7 @@ getUserMedia.sharingMenu.accesskey = d # %S is the website origin (e.g. www.mozilla.org) getUserMedia.sharingMenuCamera = %S (camera) getUserMedia.sharingMenuMicrophone = %S (microphone) +getUserMedia.sharingMenuAudioCapture = %S (tab audio) getUserMedia.sharingMenuApplication = %S (application) getUserMedia.sharingMenuScreen = %S (screen) getUserMedia.sharingMenuWindow = %S (window) @@ -639,6 +651,11 @@ getUserMedia.sharingMenuCameraMicrophoneApplication = %S (camera, microphone and getUserMedia.sharingMenuCameraMicrophoneScreen = %S (camera, microphone and screen) getUserMedia.sharingMenuCameraMicrophoneWindow = %S (camera, microphone and window) getUserMedia.sharingMenuCameraMicrophoneBrowser = %S (camera, microphone and tab) +getUserMedia.sharingMenuCameraAudioCapture = %S (camera and tab audio) +getUserMedia.sharingMenuCameraAudioCaptureApplication = %S (camera, tab audio and application) +getUserMedia.sharingMenuCameraAudioCaptureScreen = %S (camera, tab audio and screen) +getUserMedia.sharingMenuCameraAudioCaptureWindow = %S (camera, tab audio and window) +getUserMedia.sharingMenuCameraAudioCaptureBrowser = %S (camera, tab audio and tab) getUserMedia.sharingMenuCameraApplication = %S (camera and application) getUserMedia.sharingMenuCameraScreen = %S (camera and screen) getUserMedia.sharingMenuCameraWindow = %S (camera and window) @@ -647,6 +664,10 @@ getUserMedia.sharingMenuMicrophoneApplication = %S (microphone and application) getUserMedia.sharingMenuMicrophoneScreen = %S (microphone and screen) getUserMedia.sharingMenuMicrophoneWindow = %S (microphone and window) getUserMedia.sharingMenuMicrophoneBrowser = %S (microphone and tab) +getUserMedia.sharingMenuMicrophoneApplication = %S (tab audio and application) +getUserMedia.sharingMenuMicrophoneScreen = %S (tab audio and screen) +getUserMedia.sharingMenuMicrophoneWindow = %S (tab audio and window) +getUserMedia.sharingMenuMicrophoneBrowser = %S (tab audio and tab) # LOCALIZATION NOTE(getUserMedia.sharingMenuUnknownHost): this is used for the website # origin for the sharing menu if no readable origin could be deduced from the URL. getUserMedia.sharingMenuUnknownHost = Unknown origin diff --git a/browser/modules/ContentWebRTC.jsm b/browser/modules/ContentWebRTC.jsm index 5f0514170d6b..e059c60d3d2f 100644 --- a/browser/modules/ContentWebRTC.jsm +++ b/browser/modules/ContentWebRTC.jsm @@ -86,14 +86,21 @@ function prompt(aContentWindow, aWindowID, aCallID, aConstraints, aDevices, aSec // MediaStreamConstraints defines video as 'boolean or MediaTrackConstraints'. let video = aConstraints.video || aConstraints.picture; + let audio = aConstraints.audio; let sharingScreen = video && typeof(video) != "boolean" && video.mediaSource != "camera"; + let sharingAudio = audio && typeof(audio) != "boolean" && + audio.mediaSource != "microphone"; for (let device of aDevices) { device = device.QueryInterface(Ci.nsIMediaDevice); switch (device.type) { case "audio": - if (aConstraints.audio) { - audioDevices.push({name: device.name, deviceIndex: devices.length}); + // Check that if we got a microphone, we have not requested an audio + // capture, and if we have requested an audio capture, we are not + // getting a microphone instead. + if (audio && (device.mediaSource == "microphone") != sharingAudio) { + audioDevices.push({name: device.name, deviceIndex: devices.length, + mediaSource: device.mediaSource}); devices.push(device); } break; @@ -113,7 +120,7 @@ function prompt(aContentWindow, aWindowID, aCallID, aConstraints, aDevices, aSec if (videoDevices.length) requestTypes.push(sharingScreen ? "Screen" : "Camera"); if (audioDevices.length) - requestTypes.push("Microphone"); + requestTypes.push(sharingAudio ? "AudioCapture" : "Microphone"); if (!requestTypes.length) { denyRequest({callID: aCallID}, "NotFoundError"); @@ -133,6 +140,7 @@ function prompt(aContentWindow, aWindowID, aCallID, aConstraints, aDevices, aSec secure: aSecure, requestTypes: requestTypes, sharingScreen: sharingScreen, + sharingAudio: sharingAudio, audioDevices: audioDevices, videoDevices: videoDevices }; diff --git a/browser/modules/webrtcUI.jsm b/browser/modules/webrtcUI.jsm index be52cb8350f8..792c58bf1dcd 100644 --- a/browser/modules/webrtcUI.jsm +++ b/browser/modules/webrtcUI.jsm @@ -188,7 +188,8 @@ function getHost(uri, href) { function prompt(aBrowser, aRequest) { let {audioDevices: audioDevices, videoDevices: videoDevices, - sharingScreen: sharingScreen, requestTypes: requestTypes} = aRequest; + sharingScreen: sharingScreen, sharingAudio: sharingAudio, + requestTypes: requestTypes} = aRequest; let uri = Services.io.newURI(aRequest.documentURI, null, null); let host = getHost(uri); let chromeDoc = aBrowser.ownerDocument; @@ -198,10 +199,9 @@ function prompt(aBrowser, aRequest) { let message = stringBundle.getFormattedString(stringId, [host]); let mainLabel; - if (sharingScreen) { + if (sharingScreen || sharingAudio) { mainLabel = stringBundle.getString("getUserMedia.shareSelectedItems.label"); - } - else { + } else { let string = stringBundle.getString("getUserMedia.shareSelectedDevices.label"); mainLabel = PluralForm.get(requestTypes.length, string); } @@ -225,8 +225,8 @@ function prompt(aBrowser, aRequest) { } } ]; - - if (!sharingScreen) { // Bug 1037438: implement 'never' for screen sharing. + // Bug 1037438: implement 'never' for screen sharing. + if (!sharingScreen && !sharingAudio) { secondaryActions.push({ label: stringBundle.getString("getUserMedia.never.label"), accessKey: stringBundle.getString("getUserMedia.never.accesskey"), @@ -243,10 +243,10 @@ function prompt(aBrowser, aRequest) { }); } - if (aRequest.secure && !sharingScreen) { + if (aRequest.secure && !sharingScreen && !sharingAudio) { // Don't show the 'Always' action if the connection isn't secure, or for - // screen sharing (because we can't guess which window the user wants to - // share without prompting). + // screen/audio sharing (because we can't guess which window the user wants + // to share without prompting). secondaryActions.unshift({ label: stringBundle.getString("getUserMedia.always.label"), accessKey: stringBundle.getString("getUserMedia.always.accesskey"), @@ -266,7 +266,8 @@ function prompt(aBrowser, aRequest) { if (aTopic == "shown") { let PopupNotifications = chromeDoc.defaultView.PopupNotifications; let popupId = "Devices"; - if (requestTypes.length == 1 && requestTypes[0] == "Microphone") + if (requestTypes.length == 1 && (requestTypes[0] == "Microphone" || + requestTypes[0] == "AudioCapture")) popupId = "Microphone"; if (requestTypes.indexOf("Screen") != -1) popupId = "Screen"; @@ -384,7 +385,7 @@ function prompt(aBrowser, aRequest) { chromeDoc.getElementById("webRTC-selectCamera").hidden = !videoDevices.length || sharingScreen; chromeDoc.getElementById("webRTC-selectWindowOrScreen").hidden = !sharingScreen || !videoDevices.length; - chromeDoc.getElementById("webRTC-selectMicrophone").hidden = !audioDevices.length; + chromeDoc.getElementById("webRTC-selectMicrophone").hidden = !audioDevices.length || sharingAudio; let camMenupopup = chromeDoc.getElementById("webRTC-selectCamera-menupopup"); let windowMenupopup = chromeDoc.getElementById("webRTC-selectWindow-menupopup"); @@ -393,12 +394,16 @@ function prompt(aBrowser, aRequest) { listScreenShareDevices(windowMenupopup, videoDevices); else listDevices(camMenupopup, videoDevices); - listDevices(micMenupopup, audioDevices); + + if (!sharingAudio) + listDevices(micMenupopup, audioDevices); + if (requestTypes.length == 2) { let stringBundle = chromeDoc.defaultView.gNavigatorBundle; if (!sharingScreen) addDeviceToList(camMenupopup, stringBundle.getString("getUserMedia.noVideo.label"), "-1"); - addDeviceToList(micMenupopup, stringBundle.getString("getUserMedia.noAudio.label"), "-1"); + if (!sharingAudio) + addDeviceToList(micMenupopup, stringBundle.getString("getUserMedia.noAudio.label"), "-1"); } this.mainAction.callback = function(aRemember) { @@ -416,13 +421,18 @@ function prompt(aBrowser, aRequest) { } } if (audioDevices.length) { - let audioDeviceIndex = chromeDoc.getElementById("webRTC-selectMicrophone-menulist").value; - let allowMic = audioDeviceIndex != "-1"; - if (allowMic) - allowedDevices.push(audioDeviceIndex); - if (aRemember) { - perms.add(uri, "microphone", - allowMic ? perms.ALLOW_ACTION : perms.DENY_ACTION); + if (!sharingAudio) { + let audioDeviceIndex = chromeDoc.getElementById("webRTC-selectMicrophone-menulist").value; + let allowMic = audioDeviceIndex != "-1"; + if (allowMic) + allowedDevices.push(audioDeviceIndex); + if (aRemember) { + perms.add(uri, "microphone", + allowMic ? perms.ALLOW_ACTION : perms.DENY_ACTION); + } + } else { + // Only one device possible for audio capture. + allowedDevices.push(0); } } From 7d5d5b9b3cde80f2b9e422bb0d54351079333fee Mon Sep 17 00:00:00 2001 From: Paul Adenot Date: Fri, 24 Jul 2015 14:28:17 +0200 Subject: [PATCH 010/136] Bug 1156472 - Part 10 - Test AudioCaptureStream. r=pehrsons --- dom/media/tests/mochitest/head.js | 113 +++++++++++++++++- dom/media/tests/mochitest/mochitest.ini | 1 + dom/media/tests/mochitest/pc.js | 39 +----- .../test_getUserMedia_audioCapture.html | 110 +++++++++++++++++ .../test_peerConnection_replaceTrack.html | 2 +- .../test_peerConnection_webAudio.html | 2 +- 6 files changed, 228 insertions(+), 39 deletions(-) create mode 100644 dom/media/tests/mochitest/test_getUserMedia_audioCapture.html diff --git a/dom/media/tests/mochitest/head.js b/dom/media/tests/mochitest/head.js index 68158f28ee59..dfe4a2874806 100644 --- a/dom/media/tests/mochitest/head.js +++ b/dom/media/tests/mochitest/head.js @@ -20,6 +20,114 @@ try { FAKE_ENABLED = true; } +/** + * This class provides helpers around analysing the audio content in a stream + * using WebAudio AnalyserNodes. + * + * @constructor + * @param {object} stream + * A MediaStream object whose audio track we shall analyse. + */ +function AudioStreamAnalyser(ac, stream) { + if (stream.getAudioTracks().length === 0) { + throw new Error("No audio track in stream"); + } + this.audioContext = ac; + this.stream = stream; + this.sourceNode = this.audioContext.createMediaStreamSource(this.stream); + this.analyser = this.audioContext.createAnalyser(); + this.sourceNode.connect(this.analyser); + this.data = new Uint8Array(this.analyser.frequencyBinCount); +} + +AudioStreamAnalyser.prototype = { + /** + * Get an array of frequency domain data for our stream's audio track. + * + * @returns {array} A Uint8Array containing the frequency domain data. + */ + getByteFrequencyData: function() { + this.analyser.getByteFrequencyData(this.data); + return this.data; + }, + + /** + * Append a canvas to the DOM where the frequency data are drawn. + * Useful to debug tests. + */ + enableDebugCanvas: function() { + var cvs = document.createElement("canvas"); + document.getElementById("content").appendChild(cvs); + + // Easy: 1px per bin + cvs.width = this.analyser.frequencyBinCount; + cvs.height = 256; + cvs.style.border = "1px solid red"; + + var c = cvs.getContext('2d'); + + var self = this; + function render() { + c.clearRect(0, 0, cvs.width, cvs.height); + var array = self.getByteFrequencyData(); + for (var i = 0; i < array.length; i++) { + c.fillRect(i, (256 - (array[i])), 1, 256); + } + requestAnimationFrame(render); + } + requestAnimationFrame(render); + }, + + /** + * Return a Promise, that will be resolved when the function passed as + * argument, when called, returns true (meaning the analysis was a + * success). + * + * @param {function} analysisFunction + * A fonction that performs an analysis, and returns true if the + * analysis was a success (i.e. it found what it was looking for) + */ + waitForAnalysisSuccess: function(analysisFunction) { + var self = this; + return new Promise((resolve, reject) => { + function analysisLoop() { + var success = analysisFunction(self.getByteFrequencyData()); + if (success) { + resolve(); + return; + } + // else, we need more time + requestAnimationFrame(analysisLoop); + } + analysisLoop(); + }); + }, + + /** + * Return the FFT bin index for a given frequency. + * + * @param {double} frequency + * The frequency for whicht to return the bin number. + * @returns {integer} the index of the bin in the FFT array. + */ + binIndexForFrequency: function(frequency) { + return 1 + Math.round(frequency * + this.analyser.fftSize / + this.audioContext.sampleRate); + }, + + /** + * Reverse operation, get the frequency for a bin index. + * + * @param {integer} index an index in an FFT array + * @returns {double} the frequency for this bin + */ + frequencyForBinIndex: function(index) { + return (index - 1) * + this.audioContext.sampleRate / + this.analyser.fftSize; + } +}; /** * Create the necessary HTML elements for head and body as used by Mochitests @@ -136,7 +244,10 @@ function setupEnvironment() { ['media.navigator.permission.disabled', true], ['media.navigator.streams.fake', FAKE_ENABLED], ['media.getusermedia.screensharing.enabled', true], - ['media.getusermedia.screensharing.allowed_domains', "mochi.test"] + ['media.getusermedia.screensharing.allowed_domains', "mochi.test"], + ['media.getusermedia.audiocapture.enabled', true], + ['media.useAudioChannelService', true], + ['media.recorder.audio_node.enabled', true] ] }, setTestOptions); diff --git a/dom/media/tests/mochitest/mochitest.ini b/dom/media/tests/mochitest/mochitest.ini index 9d458b0e59b8..115d83b11f0f 100644 --- a/dom/media/tests/mochitest/mochitest.ini +++ b/dom/media/tests/mochitest/mochitest.ini @@ -30,6 +30,7 @@ skip-if = toolkit == 'gonk' || buildapp == 'mulet' # b2g emulator seems to be to [test_dataChannel_noOffer.html] [test_enumerateDevices.html] skip-if = buildapp == 'mulet' +[test_getUserMedia_audioCapture.html] [test_getUserMedia_basicAudio.html] skip-if = (toolkit == 'gonk' || buildapp == 'mulet' && debug) # debug-only failure [test_getUserMedia_basicVideo.html] diff --git a/dom/media/tests/mochitest/pc.js b/dom/media/tests/mochitest/pc.js index 51aa7d17ceae..645f29d153e9 100644 --- a/dom/media/tests/mochitest/pc.js +++ b/dom/media/tests/mochitest/pc.js @@ -642,39 +642,6 @@ DataChannelWrapper.prototype = { }; -/** - * This class provides helpers around analysing the audio content in a stream - * using WebAudio AnalyserNodes. - * - * @constructor - * @param {object} stream - * A MediaStream object whose audio track we shall analyse. - */ -function AudioStreamAnalyser(stream) { - if (stream.getAudioTracks().length === 0) { - throw new Error("No audio track in stream"); - } - this.stream = stream; - this.audioContext = new AudioContext(); - this.sourceNode = this.audioContext.createMediaStreamSource(this.stream); - this.analyser = this.audioContext.createAnalyser(); - this.sourceNode.connect(this.analyser); - this.data = new Uint8Array(this.analyser.frequencyBinCount); -} - -AudioStreamAnalyser.prototype = { - /** - * Get an array of frequency domain data for our stream's audio track. - * - * @returns {array} A Uint8Array containing the frequency domain data. - */ - getByteFrequencyData: function() { - this.analyser.getByteFrequencyData(this.data); - return this.data; - } -}; - - /** * This class acts as a wrapper around a PeerConnection instance. * @@ -1559,20 +1526,20 @@ PeerConnectionWrapper.prototype = { * @returns {Promise} * A promise that resolves when we're receiving the tone from |from|. */ - checkReceivingToneFrom : function(from) { + checkReceivingToneFrom : function(audiocontext, from) { var inputElem = from.localMediaElements[0]; // As input we use the stream of |from|'s first available audio sender. var inputSenderTracks = from._pc.getSenders().map(sn => sn.track); var inputAudioStream = from._pc.getLocalStreams() .find(s => s.getAudioTracks().some(t => inputSenderTracks.some(t2 => t == t2))); - var inputAnalyser = new AudioStreamAnalyser(inputAudioStream); + var inputAnalyser = new AudioStreamAnalyser(audiocontext, inputAudioStream); // It would have been nice to have a working getReceivers() here, but until // we do, let's use what remote streams we have. var outputAudioStream = this._pc.getRemoteStreams() .find(s => s.getAudioTracks().length > 0); - var outputAnalyser = new AudioStreamAnalyser(outputAudioStream); + var outputAnalyser = new AudioStreamAnalyser(audiocontext, outputAudioStream); var maxWithIndex = (a, b, i) => (b >= a.value) ? { value: b, index: i } : a; var initial = { value: -1, index: -1 }; diff --git a/dom/media/tests/mochitest/test_getUserMedia_audioCapture.html b/dom/media/tests/mochitest/test_getUserMedia_audioCapture.html new file mode 100644 index 000000000000..057d754ee292 --- /dev/null +++ b/dom/media/tests/mochitest/test_getUserMedia_audioCapture.html @@ -0,0 +1,110 @@ + + + + Test AudioCapture + + + +
+
+
+ + diff --git a/dom/media/tests/mochitest/test_peerConnection_replaceTrack.html b/dom/media/tests/mochitest/test_peerConnection_replaceTrack.html index 6d6e7be029f2..7f3a4d4bd8d0 100644 --- a/dom/media/tests/mochitest/test_peerConnection_replaceTrack.html +++ b/dom/media/tests/mochitest/test_peerConnection_replaceTrack.html @@ -136,7 +136,7 @@ ]); test.chain.append([ function PC_LOCAL_CHECK_WEBAUDIO_FLOW_PRESENT(test) { - return test.pcRemote.checkReceivingToneFrom(test.pcLocal); + return test.pcRemote.checkReceivingToneFrom(test.audioCtx, test.pcLocal); } ]); test.chain.append([ diff --git a/dom/media/tests/mochitest/test_peerConnection_webAudio.html b/dom/media/tests/mochitest/test_peerConnection_webAudio.html index f5448cc65ae8..2a8cd31f546a 100644 --- a/dom/media/tests/mochitest/test_peerConnection_webAudio.html +++ b/dom/media/tests/mochitest/test_peerConnection_webAudio.html @@ -32,7 +32,7 @@ runNetworkTest(function() { ]); test.chain.append([ function CHECK_AUDIO_FLOW(test) { - return test.pcRemote.checkReceivingToneFrom(test.pcLocal); + return test.pcRemote.checkReceivingToneFrom(test.audioContext, test.pcLocal); } ]); test.run(); From 889273bd212fa5fa7f884a282a6e5e4c6e494d83 Mon Sep 17 00:00:00 2001 From: Paul Adenot Date: Fri, 24 Jul 2015 14:28:17 +0200 Subject: [PATCH 011/136] Bug 1156472 - Part 11 - Unbitrot MediaManager.cpp over jib's changes. r=jib --- dom/media/MediaManager.cpp | 40 +++++++++++++++++---- dom/media/MediaManager.h | 8 +++-- dom/media/webrtc/MediaEngineWebRTCAudio.cpp | 2 +- modules/libpref/init/all.js | 2 ++ 4 files changed, 42 insertions(+), 10 deletions(-) diff --git a/dom/media/MediaManager.cpp b/dom/media/MediaManager.cpp index d989563b8057..a3fefcfd2fab 100644 --- a/dom/media/MediaManager.cpp +++ b/dom/media/MediaManager.cpp @@ -1257,7 +1257,9 @@ static auto& MediaManager_AnonymizeDevices = MediaManager::AnonymizeDevices; */ already_AddRefed -MediaManager::EnumerateRawDevices(uint64_t aWindowId, MediaSourceEnum aVideoType, +MediaManager::EnumerateRawDevices(uint64_t aWindowId, + MediaSourceEnum aVideoType, + MediaSourceEnum aAudioType, bool aFake, bool aFakeTracks) { MOZ_ASSERT(NS_IsMainThread()); @@ -1287,7 +1289,8 @@ MediaManager::EnumerateRawDevices(uint64_t aWindowId, MediaSourceEnum aVideoType MediaManager::PostTask(FROM_HERE, NewTaskFrom([id, aWindowId, audioLoopDev, videoLoopDev, aVideoType, - aFake, aFakeTracks]() mutable { + aAudioType, aFake, + aFakeTracks]() mutable { nsRefPtr backend; if (aFake) { backend = new MediaEngineDefault(aFakeTracks); @@ -1306,7 +1309,7 @@ MediaManager::EnumerateRawDevices(uint64_t aWindowId, MediaSourceEnum aVideoType } nsTArray> audios; - GetSources(backend, dom::MediaSourceEnum::Microphone, + GetSources(backend, aAudioType, &MediaEngine::EnumerateAudioDevices, audios, audioLoopDev); for (auto& source : audios) { result->AppendElement(source); @@ -1628,6 +1631,7 @@ MediaManager::GetUserMedia(nsPIDOMWindow* aWindow, } MediaSourceEnum videoType = dom::MediaSourceEnum::Camera; + MediaSourceEnum audioType = dom::MediaSourceEnum::Microphone; if (c.mVideo.IsMediaTrackConstraints()) { auto& vc = c.mVideo.GetAsMediaTrackConstraints(); @@ -1716,6 +1720,23 @@ MediaManager::GetUserMedia(nsPIDOMWindow* aWindow, privileged = false; } } + + if (c.mAudio.IsMediaTrackConstraints()) { + auto& ac = c.mAudio.GetAsMediaTrackConstraints(); + audioType = StringToEnum(dom::MediaSourceEnumValues::strings, + ac.mMediaSource, + audioType); + // Only enable AudioCapture if the pref is enabled. If it's not, we can deny + // right away. + if (audioType == dom::MediaSourceEnum::AudioCapture && + !Preferences::GetBool("media.getusermedia.audiocapture.enabled")) { + nsRefPtr error = + new MediaStreamError(aWindow, + NS_LITERAL_STRING("PermissionDeniedError")); + onFailure->OnError(error); + return NS_OK; + } + } StreamListeners* listeners = AddWindowID(windowID); // Create a disabled listener to act as a placeholder @@ -1778,7 +1799,8 @@ MediaManager::GetUserMedia(nsPIDOMWindow* aWindow, (!fake || Preferences::GetBool("media.navigator.permission.fake")); nsRefPtr p = EnumerateDevicesImpl(windowID, videoType, - fake, fakeTracks); + audioType, fake, + fakeTracks); p->Then([this, onSuccess, onFailure, windowID, c, listener, askPermission, prefs, isHTTPS, callID, origin](SourceSet*& aDevices) mutable { ScopedDeletePtr devices(aDevices); // grab result @@ -1934,7 +1956,9 @@ MediaManager::ToJSArray(SourceSet& aDevices) } already_AddRefed -MediaManager::EnumerateDevicesImpl(uint64_t aWindowId, MediaSourceEnum aVideoType, +MediaManager::EnumerateDevicesImpl(uint64_t aWindowId, + MediaSourceEnum aVideoType, + MediaSourceEnum aAudioType, bool aFake, bool aFakeTracks) { MOZ_ASSERT(NS_IsMainThread()); @@ -1963,12 +1987,13 @@ MediaManager::EnumerateDevicesImpl(uint64_t aWindowId, MediaSourceEnum aVideoTyp nsRefPtr> p = media::GetOriginKey(origin, privateBrowsing, persist); - p->Then([id, aWindowId, aVideoType, + p->Then([id, aWindowId, aVideoType, aAudioType, aFake, aFakeTracks](const nsCString& aOriginKey) mutable { MOZ_ASSERT(NS_IsMainThread()); nsRefPtr mgr = MediaManager_GetInstance(); - nsRefPtr p = mgr->EnumerateRawDevices(aWindowId, aVideoType, + nsRefPtr p = mgr->EnumerateRawDevices(aWindowId, + aVideoType, aAudioType, aFake, aFakeTracks); p->Then([id, aWindowId, aOriginKey](SourceSet*& aDevices) mutable { ScopedDeletePtr devices(aDevices); // secondary result @@ -2007,6 +2032,7 @@ MediaManager::EnumerateDevices(nsPIDOMWindow* aWindow, nsRefPtr p = EnumerateDevicesImpl(windowId, dom::MediaSourceEnum::Camera, + dom::MediaSourceEnum::Microphone, fake); p->Then([onSuccess](SourceSet*& aDevices) mutable { ScopedDeletePtr devices(aDevices); // grab result diff --git a/dom/media/MediaManager.h b/dom/media/MediaManager.h index 68ab74269201..d35f4bf40ece 100644 --- a/dom/media/MediaManager.h +++ b/dom/media/MediaManager.h @@ -597,10 +597,14 @@ public: // TODO: make private once we upgrade to GCC 4.8+ on linux. static already_AddRefed ToJSArray(SourceSet& aDevices); private: already_AddRefed - EnumerateRawDevices(uint64_t aWindowId, dom::MediaSourceEnum aSrcType, + EnumerateRawDevices(uint64_t aWindowId, + dom::MediaSourceEnum aVideoType, + dom::MediaSourceEnum aAudioType, bool aFake, bool aFakeTracks); already_AddRefed - EnumerateDevicesImpl(uint64_t aWindowId, dom::MediaSourceEnum aSrcType, + EnumerateDevicesImpl(uint64_t aWindowId, + dom::MediaSourceEnum aVideoSrcType, + dom::MediaSourceEnum aAudioSrcType, bool aFake = false, bool aFakeTracks = false); StreamListeners* AddWindowID(uint64_t aWindowId); diff --git a/dom/media/webrtc/MediaEngineWebRTCAudio.cpp b/dom/media/webrtc/MediaEngineWebRTCAudio.cpp index 223a5acde76e..c45beae4ce24 100644 --- a/dom/media/webrtc/MediaEngineWebRTCAudio.cpp +++ b/dom/media/webrtc/MediaEngineWebRTCAudio.cpp @@ -268,7 +268,7 @@ MediaEngineWebRTCMicrophoneSource::Config(bool aEchoOn, uint32_t aEcho, // Infinity = UINT32_MAX e.g. device cannot satisfy accumulated ConstraintSets. // A finite result may be used to calculate this device's ranking as a choice. -uint32_t MediaEngineWebRTCAudioSource::GetBestFitnessDistance( +uint32_t MediaEngineWebRTCMicrophoneSource::GetBestFitnessDistance( const nsTArray& aConstraintSets, const nsString& aDeviceId) { diff --git a/modules/libpref/init/all.js b/modules/libpref/init/all.js index fbbab15fb332..576b7680a6a9 100644 --- a/modules/libpref/init/all.js +++ b/modules/libpref/init/all.js @@ -445,6 +445,8 @@ pref("media.getusermedia.screensharing.allowed_domains", "mozilla.github.io,webe // OS/X 10.6 and XP have screen/window sharing off by default due to various issues - Caveat emptor pref("media.getusermedia.screensharing.allow_on_old_platforms", false); +pref("media.getusermedia.audiocapture.enabled", false); + // TextTrack support pref("media.webvtt.enabled", true); pref("media.webvtt.regions.enabled", false); From 8290e5cb5d3294d21b2beebcc628f18d2875aefa Mon Sep 17 00:00:00 2001 From: Paul Adenot Date: Fri, 24 Jul 2015 14:28:17 +0200 Subject: [PATCH 012/136] Bug 1156472 - Part 12 - Allow to pipe the AudioCaptureStream into an AudioContext. r=mt,roc --- dom/media/MediaManager.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/dom/media/MediaManager.cpp b/dom/media/MediaManager.cpp index a3fefcfd2fab..5b9d252f6a6a 100644 --- a/dom/media/MediaManager.cpp +++ b/dom/media/MediaManager.cpp @@ -797,6 +797,9 @@ public: if (mAudioSource && mAudioSource->GetMediaSource() == dom::MediaSourceEnum::AudioCapture) { domStream = DOMLocalMediaStream::CreateAudioCaptureStream(window); + // It should be possible to pipe the capture stream to anything. CORS is + // not a problem here, we got explicit user content. + domStream->SetPrincipal(window->GetExtantDoc()->NodePrincipal()); msg->RegisterCaptureStreamForWindow( mWindowID, domStream->GetStream()->AsProcessedStream()); window->SetAudioCapture(true); From d4408094a6debc8a3d03c58e3b823d36bd4209b1 Mon Sep 17 00:00:00 2001 From: Paul Adenot Date: Fri, 24 Jul 2015 14:28:17 +0200 Subject: [PATCH 013/136] Bug 1156472 - Part 13 - Make necessary adjustments for integer audio. r=jesup --- dom/media/AudioChannelFormat.cpp | 108 -------------------------- dom/media/AudioChannelFormat.h | 129 ++++++++++++++++++++++++++++--- dom/media/AudioSegment.cpp | 6 +- 3 files changed, 120 insertions(+), 123 deletions(-) diff --git a/dom/media/AudioChannelFormat.cpp b/dom/media/AudioChannelFormat.cpp index 2534851bed17..1a1ce9d61ac7 100644 --- a/dom/media/AudioChannelFormat.cpp +++ b/dom/media/AudioChannelFormat.cpp @@ -4,26 +4,11 @@ * You can obtain one at http://mozilla.org/MPL/2.0/. */ #include "AudioChannelFormat.h" -#include "nsTArray.h" #include namespace mozilla { -enum { - SURROUND_L, - SURROUND_R, - SURROUND_C, - SURROUND_LFE, - SURROUND_SL, - SURROUND_SR -}; - -static const uint32_t CUSTOM_CHANNEL_LAYOUTS = 6; - -static const int IGNORE = CUSTOM_CHANNEL_LAYOUTS; -static const float IGNORE_F = 0.0f; - uint32_t GetAudioChannelsSuperset(uint32_t aChannels1, uint32_t aChannels2) { @@ -63,9 +48,6 @@ gUpMixMatrices[CUSTOM_CHANNEL_LAYOUTS*(CUSTOM_CHANNEL_LAYOUTS - 1)/2] = { { 0, 1, 2, 3, 4, IGNORE } } }; -static const int gMixingMatrixIndexByChannels[CUSTOM_CHANNEL_LAYOUTS - 1] = - { 0, 5, 9, 12, 14 }; - void AudioChannelsUpMix(nsTArray* aChannelArray, uint32_t aOutputChannelCount, @@ -108,94 +90,4 @@ AudioChannelsUpMix(nsTArray* aChannelArray, } } -/** - * DownMixMatrix represents a conversion matrix efficiently by exploiting the - * fact that each input channel contributes to at most one output channel, - * except possibly for the C input channel in layouts that have one. Also, - * every input channel is multiplied by the same coefficient for every output - * channel it contributes to. - */ -struct DownMixMatrix { - // Every input channel c is copied to output channel mInputDestination[c] - // after multiplying by mInputCoefficient[c]. - uint8_t mInputDestination[CUSTOM_CHANNEL_LAYOUTS]; - // If not IGNORE, then the C channel is copied to this output channel after - // multiplying by its coefficient. - uint8_t mCExtraDestination; - float mInputCoefficient[CUSTOM_CHANNEL_LAYOUTS]; -}; - -static const DownMixMatrix -gDownMixMatrices[CUSTOM_CHANNEL_LAYOUTS*(CUSTOM_CHANNEL_LAYOUTS - 1)/2] = -{ - // Downmixes to mono - { { 0, 0 }, IGNORE, { 0.5f, 0.5f } }, - { { 0, IGNORE, IGNORE }, IGNORE, { 1.0f, IGNORE_F, IGNORE_F } }, - { { 0, 0, 0, 0 }, IGNORE, { 0.25f, 0.25f, 0.25f, 0.25f } }, - { { 0, IGNORE, IGNORE, IGNORE, IGNORE }, IGNORE, { 1.0f, IGNORE_F, IGNORE_F, IGNORE_F, IGNORE_F } }, - { { 0, 0, 0, IGNORE, 0, 0 }, IGNORE, { 0.7071f, 0.7071f, 1.0f, IGNORE_F, 0.5f, 0.5f } }, - // Downmixes to stereo - { { 0, 1, IGNORE }, IGNORE, { 1.0f, 1.0f, IGNORE_F } }, - { { 0, 1, 0, 1 }, IGNORE, { 0.5f, 0.5f, 0.5f, 0.5f } }, - { { 0, 1, IGNORE, IGNORE, IGNORE }, IGNORE, { 1.0f, 1.0f, IGNORE_F, IGNORE_F, IGNORE_F } }, - { { 0, 1, 0, IGNORE, 0, 1 }, 1, { 1.0f, 1.0f, 0.7071f, IGNORE_F, 0.7071f, 0.7071f } }, - // Downmixes to 3-channel - { { 0, 1, 2, IGNORE }, IGNORE, { 1.0f, 1.0f, 1.0f, IGNORE_F } }, - { { 0, 1, 2, IGNORE, IGNORE }, IGNORE, { 1.0f, 1.0f, 1.0f, IGNORE_F, IGNORE_F } }, - { { 0, 1, 2, IGNORE, IGNORE, IGNORE }, IGNORE, { 1.0f, 1.0f, 1.0f, IGNORE_F, IGNORE_F, IGNORE_F } }, - // Downmixes to quad - { { 0, 1, 2, 3, IGNORE }, IGNORE, { 1.0f, 1.0f, 1.0f, 1.0f, IGNORE_F } }, - { { 0, 1, 0, IGNORE, 2, 3 }, 1, { 1.0f, 1.0f, 0.7071f, IGNORE_F, 1.0f, 1.0f } }, - // Downmixes to 5-channel - { { 0, 1, 2, 3, 4, IGNORE }, IGNORE, { 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, IGNORE_F } } -}; - -void -AudioChannelsDownMix(const nsTArray& aChannelArray, - float** aOutputChannels, - uint32_t aOutputChannelCount, - uint32_t aDuration) -{ - uint32_t inputChannelCount = aChannelArray.Length(); - const void* const* inputChannels = aChannelArray.Elements(); - NS_ASSERTION(inputChannelCount > aOutputChannelCount, "Nothing to do"); - - if (inputChannelCount > 6) { - // Just drop the unknown channels. - for (uint32_t o = 0; o < aOutputChannelCount; ++o) { - memcpy(aOutputChannels[o], inputChannels[o], aDuration*sizeof(float)); - } - return; - } - - // Ignore unknown channels, they're just dropped. - inputChannelCount = std::min(6, inputChannelCount); - - const DownMixMatrix& m = gDownMixMatrices[ - gMixingMatrixIndexByChannels[aOutputChannelCount - 1] + - inputChannelCount - aOutputChannelCount - 1]; - - // This is slow, but general. We can define custom code for special - // cases later. - for (uint32_t s = 0; s < aDuration; ++s) { - // Reserve an extra junk channel at the end for the cases where we - // want an input channel to contribute to nothing - float outputChannels[CUSTOM_CHANNEL_LAYOUTS + 1]; - memset(outputChannels, 0, sizeof(float)*(CUSTOM_CHANNEL_LAYOUTS)); - for (uint32_t c = 0; c < inputChannelCount; ++c) { - outputChannels[m.mInputDestination[c]] += - m.mInputCoefficient[c]*(static_cast(inputChannels[c]))[s]; - } - // Utilize the fact that in every layout, C is the third channel. - if (m.mCExtraDestination != IGNORE) { - outputChannels[m.mCExtraDestination] += - m.mInputCoefficient[SURROUND_C]*(static_cast(inputChannels[SURROUND_C]))[s]; - } - - for (uint32_t c = 0; c < aOutputChannelCount; ++c) { - aOutputChannels[c][s] = outputChannels[c]; - } - } -} - } // namespace mozilla diff --git a/dom/media/AudioChannelFormat.h b/dom/media/AudioChannelFormat.h index 99a201456aa5..d5aef21c5668 100644 --- a/dom/media/AudioChannelFormat.h +++ b/dom/media/AudioChannelFormat.h @@ -9,6 +9,8 @@ #include #include "nsTArrayForwardDeclare.h" +#include "AudioSampleFormat.h" +#include "nsTArray.h" namespace mozilla { @@ -29,6 +31,26 @@ namespace mozilla { * Only 1, 2, 4 and 6 are currently defined in Web Audio. */ +enum { + SURROUND_L, + SURROUND_R, + SURROUND_C, + SURROUND_LFE, + SURROUND_SL, + SURROUND_SR +}; + +const uint32_t CUSTOM_CHANNEL_LAYOUTS = 6; + +// This is defined by some Windows SDK header. +#undef IGNORE + +const int IGNORE = CUSTOM_CHANNEL_LAYOUTS; +const float IGNORE_F = 0.0f; + +const int gMixingMatrixIndexByChannels[CUSTOM_CHANNEL_LAYOUTS - 1] = + { 0, 5, 9, 12, 14 }; + /** * Return a channel count whose channel layout includes all the channels from * aChannels1 and aChannels2. @@ -53,19 +75,102 @@ AudioChannelsUpMix(nsTArray* aChannelArray, uint32_t aOutputChannelCount, const void* aZeroChannel); -/** - * Given an array of input channels (which must be float format!), - * downmix to aOutputChannelCount, and copy the results to the - * channel buffers in aOutputChannels. - * Don't call this with input count <= output count. - */ -void -AudioChannelsDownMix(const nsTArray& aChannelArray, - float** aOutputChannels, - uint32_t aOutputChannelCount, - uint32_t aDuration); -// A version of AudioChannelsDownMix that downmixes int16_ts may be required. +/** + * DownMixMatrix represents a conversion matrix efficiently by exploiting the + * fact that each input channel contributes to at most one output channel, + * except possibly for the C input channel in layouts that have one. Also, + * every input channel is multiplied by the same coefficient for every output + * channel it contributes to. + */ +struct DownMixMatrix { + // Every input channel c is copied to output channel mInputDestination[c] + // after multiplying by mInputCoefficient[c]. + uint8_t mInputDestination[CUSTOM_CHANNEL_LAYOUTS]; + // If not IGNORE, then the C channel is copied to this output channel after + // multiplying by its coefficient. + uint8_t mCExtraDestination; + float mInputCoefficient[CUSTOM_CHANNEL_LAYOUTS]; +}; + +static const DownMixMatrix +gDownMixMatrices[CUSTOM_CHANNEL_LAYOUTS*(CUSTOM_CHANNEL_LAYOUTS - 1)/2] = +{ + // Downmixes to mono + { { 0, 0 }, IGNORE, { 0.5f, 0.5f } }, + { { 0, IGNORE, IGNORE }, IGNORE, { 1.0f, IGNORE_F, IGNORE_F } }, + { { 0, 0, 0, 0 }, IGNORE, { 0.25f, 0.25f, 0.25f, 0.25f } }, + { { 0, IGNORE, IGNORE, IGNORE, IGNORE }, IGNORE, { 1.0f, IGNORE_F, IGNORE_F, IGNORE_F, IGNORE_F } }, + { { 0, 0, 0, IGNORE, 0, 0 }, IGNORE, { 0.7071f, 0.7071f, 1.0f, IGNORE_F, 0.5f, 0.5f } }, + // Downmixes to stereo + { { 0, 1, IGNORE }, IGNORE, { 1.0f, 1.0f, IGNORE_F } }, + { { 0, 1, 0, 1 }, IGNORE, { 0.5f, 0.5f, 0.5f, 0.5f } }, + { { 0, 1, IGNORE, IGNORE, IGNORE }, IGNORE, { 1.0f, 1.0f, IGNORE_F, IGNORE_F, IGNORE_F } }, + { { 0, 1, 0, IGNORE, 0, 1 }, 1, { 1.0f, 1.0f, 0.7071f, IGNORE_F, 0.7071f, 0.7071f } }, + // Downmixes to 3-channel + { { 0, 1, 2, IGNORE }, IGNORE, { 1.0f, 1.0f, 1.0f, IGNORE_F } }, + { { 0, 1, 2, IGNORE, IGNORE }, IGNORE, { 1.0f, 1.0f, 1.0f, IGNORE_F, IGNORE_F } }, + { { 0, 1, 2, IGNORE, IGNORE, IGNORE }, IGNORE, { 1.0f, 1.0f, 1.0f, IGNORE_F, IGNORE_F, IGNORE_F } }, + // Downmixes to quad + { { 0, 1, 2, 3, IGNORE }, IGNORE, { 1.0f, 1.0f, 1.0f, 1.0f, IGNORE_F } }, + { { 0, 1, 0, IGNORE, 2, 3 }, 1, { 1.0f, 1.0f, 0.7071f, IGNORE_F, 1.0f, 1.0f } }, + // Downmixes to 5-channel + { { 0, 1, 2, 3, 4, IGNORE }, IGNORE, { 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, IGNORE_F } } +}; + +/** + * Given an array of input channels, downmix to aOutputChannelCount, and copy + * the results to the channel buffers in aOutputChannels. Don't call this with + * input count <= output count. + */ +template +void AudioChannelsDownMix(const nsTArray& aChannelArray, + T** aOutputChannels, + uint32_t aOutputChannelCount, + uint32_t aDuration) +{ + uint32_t inputChannelCount = aChannelArray.Length(); + const void* const* inputChannels = aChannelArray.Elements(); + NS_ASSERTION(inputChannelCount > aOutputChannelCount, "Nothing to do"); + + if (inputChannelCount > 6) { + // Just drop the unknown channels. + for (uint32_t o = 0; o < aOutputChannelCount; ++o) { + memcpy(aOutputChannels[o], inputChannels[o], aDuration*sizeof(T)); + } + return; + } + + // Ignore unknown channels, they're just dropped. + inputChannelCount = std::min(6, inputChannelCount); + + const DownMixMatrix& m = gDownMixMatrices[ + gMixingMatrixIndexByChannels[aOutputChannelCount - 1] + + inputChannelCount - aOutputChannelCount - 1]; + + // This is slow, but general. We can define custom code for special + // cases later. + for (uint32_t s = 0; s < aDuration; ++s) { + // Reserve an extra junk channel at the end for the cases where we + // want an input channel to contribute to nothing + T outputChannels[CUSTOM_CHANNEL_LAYOUTS + 1]; + memset(outputChannels, 0, sizeof(T)*(CUSTOM_CHANNEL_LAYOUTS)); + for (uint32_t c = 0; c < inputChannelCount; ++c) { + outputChannels[m.mInputDestination[c]] += + m.mInputCoefficient[c]*(static_cast(inputChannels[c]))[s]; + } + // Utilize the fact that in every layout, C is the third channel. + if (m.mCExtraDestination != IGNORE) { + outputChannels[m.mCExtraDestination] += + m.mInputCoefficient[SURROUND_C]*(static_cast(inputChannels[SURROUND_C]))[s]; + } + + for (uint32_t c = 0; c < aOutputChannelCount; ++c) { + aOutputChannels[c][s] = outputChannels[c]; + } + } +} + } // namespace mozilla diff --git a/dom/media/AudioSegment.cpp b/dom/media/AudioSegment.cpp index 15ac13e5537b..c4162842d360 100644 --- a/dom/media/AudioSegment.cpp +++ b/dom/media/AudioSegment.cpp @@ -206,13 +206,13 @@ AudioSegment::Mix(AudioMixer& aMixer, uint32_t aOutputChannels, AudioDataValue* ptr = PointerForOffsetInChannel(buf.Elements(), outBufferLength, aOutputChannels, channel, offsetSamples); - PodCopy(ptr, reinterpret_cast(channelData[channel]), + PodCopy(ptr, reinterpret_cast(channelData[channel]), frames); } MOZ_ASSERT(channelData.Length() == aOutputChannels); } else if (channelData.Length() > aOutputChannels) { // Down mix. - nsAutoTArray outChannelPtrs; + nsAutoTArray outChannelPtrs; outChannelPtrs.SetLength(aOutputChannels); uint32_t offsetSamples = 0; for (uint32_t channel = 0; channel < aOutputChannels; channel++) { @@ -228,7 +228,7 @@ AudioSegment::Mix(AudioMixer& aMixer, uint32_t aOutputChannels, AudioDataValue* ptr = PointerForOffsetInChannel(buf.Elements(), outBufferLength, aOutputChannels, channel, offsetSamples); - PodCopy(ptr, reinterpret_cast(channelData[channel]), + PodCopy(ptr, reinterpret_cast(channelData[channel]), frames); } } From 8b7785c0a1620523c5a146d0cf6fe6b2ec6c402f Mon Sep 17 00:00:00 2001 From: Paul Adenot Date: Fri, 24 Jul 2015 14:28:17 +0200 Subject: [PATCH 014/136] Bug 1156472 - Part 14 - Null check the window, because it can be different during the window's shutdown. r=baku In which case everything is cleaned up properly by the HTMLMediaElement themselves. --- dom/audiochannel/AudioChannelService.cpp | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/dom/audiochannel/AudioChannelService.cpp b/dom/audiochannel/AudioChannelService.cpp index b71b491c5078..93a916b07b43 100644 --- a/dom/audiochannel/AudioChannelService.cpp +++ b/dom/audiochannel/AudioChannelService.cpp @@ -562,6 +562,15 @@ AudioChannelService::RefreshAgentsCapture(nsPIDOMWindow* aWindow, AudioChannelWindow* winData = GetWindowData(pTopWindow->WindowID()); + // This can happen, but only during shutdown, because the the outer window + // changes ScriptableTop, so that its ID is different. + // In this case either we are capturing, and it's too late because the window + // has been closed anyways, or we are un-capturing, and everything has already + // been cleaned up by the HTMLMediaElements or the AudioContexts. + if (!winData) { + return; + } + nsTObserverArray::ForwardIterator iter(winData->mAgents); while (iter.HasMore()) { From 3a4c2d822a069903a64802883b45721928795c48 Mon Sep 17 00:00:00 2001 From: David Keeler Date: Wed, 15 Jul 2015 16:20:54 -0700 Subject: [PATCH 015/136] bug 1179660 - define 'now' as the first second of the current year for pycert r=Cykesiopka This is to avoid a dependency on the buildid so we don't have to regenerate all of the test certificate with every ./mach build. This can cause problems very near midnight on New Year's Eve. If this happens, kick off a new build and get back to the party. --- security/manager/ssl/tests/unit/pycert.py | 38 ++++++++++--------- .../ssl/tests/unit/test_cert_eku/generate.py | 2 +- .../ssl/tests/unit/test_cert_eku/moz.build | 2 +- .../tests/unit/test_cert_keyUsage/moz.build | 2 +- .../ssl/tests/unit/test_cert_trust/moz.build | 2 +- .../tests/unit/test_cert_version/moz.build | 2 +- .../moz.build | 2 +- .../ssl/tests/unit/test_ocsp_url/moz.build | 2 +- .../tests/unit/test_pinning_dynamic/moz.build | 2 +- 9 files changed, 29 insertions(+), 25 deletions(-) diff --git a/security/manager/ssl/tests/unit/pycert.py b/security/manager/ssl/tests/unit/pycert.py index 0da1e71b5516..77c8a600e40c 100755 --- a/security/manager/ssl/tests/unit/pycert.py +++ b/security/manager/ssl/tests/unit/pycert.py @@ -175,13 +175,15 @@ class Certificate: """Utility class for reading a certificate specification and generating a signed x509 certificate""" - def __init__(self, paramStream, now=datetime.datetime.utcnow()): + def __init__(self, paramStream): self.versionValue = 2 # a value of 2 is X509v3 self.signature = 'sha256WithRSAEncryption' self.issuer = 'Default Issuer' - oneYear = datetime.timedelta(days=365) - self.notBefore = now - oneYear - self.notAfter = now + oneYear + now = datetime.datetime.utcnow() + currentYear = datetime.datetime.strptime(str(now.year), '%Y') + aYearAndAWhile = datetime.timedelta(days=550) + self.notBefore = currentYear - aYearAndAWhile + self.notAfter = currentYear + aYearAndAWhile self.subject = 'Default Subject' self.signatureAlgorithm = 'sha256WithRSAEncryption' self.extensions = None @@ -409,20 +411,22 @@ class Certificate: return output -# The build harness will call this function with an output file-like -# object, a path to a file containing a specification, and the path to -# the directory containing the buildid file. This will read the -# specification and output the certificate as PEM. The purpose of the -# buildid file is to provide a single definition of 'now'. This is -# particularly important when building on OS X, where we generate -# everything twice for unified builds. During the unification step, if -# any pair of input files differ, the build system throws an error. -def main(output, inputPath, buildIDPath): - with open(buildIDPath) as buildidFile: - buildid = buildidFile.read().strip() - now = datetime.datetime.strptime(buildid, '%Y%m%d%H%M%S') +# The build harness will call this function with an output +# file-like object and a path to a file containing a +# specification. This will read the specification and output +# the certificate as PEM. +# This utility tries as hard as possible to ensure that two +# runs with the same input will have the same output. This is +# particularly important when building on OS X, where we +# generate everything twice for unified builds. During the +# unification step, if any pair of input files differ, the build +# system throws an error. +# The one concrete failure mode is if one run happens before +# midnight on New Year's Eve and the next run happens after +# midnight. +def main(output, inputPath): with open(inputPath) as configStream: - output.write(Certificate(configStream, now=now).toPEM()) + output.write(Certificate(configStream).toPEM()) # When run as a standalone program, this will read a specification from # stdin and output the certificate as PEM to stdout. diff --git a/security/manager/ssl/tests/unit/test_cert_eku/generate.py b/security/manager/ssl/tests/unit/test_cert_eku/generate.py index d3d6453c9363..76a1a428d3ac 100755 --- a/security/manager/ssl/tests/unit/test_cert_eku/generate.py +++ b/security/manager/ssl/tests/unit/test_cert_eku/generate.py @@ -227,7 +227,7 @@ for test_certificate in test_certificates: GENERATED_FILES += [test_certificate] props = GENERATED_FILES[test_certificate] props.script = '../pycert.py' - props.inputs = [input_file, '!/config/buildid'] + props.inputs = [input_file] TEST_HARNESS_FILES.xpcshell.security.manager.ssl.tests.unit.test_cert_eku += ['!%s' % test_certificate] """ diff --git a/security/manager/ssl/tests/unit/test_cert_eku/moz.build b/security/manager/ssl/tests/unit/test_cert_eku/moz.build index e15c9beddde3..102f6015fb75 100644 --- a/security/manager/ssl/tests/unit/test_cert_eku/moz.build +++ b/security/manager/ssl/tests/unit/test_cert_eku/moz.build @@ -566,5 +566,5 @@ for test_certificate in test_certificates: GENERATED_FILES += [test_certificate] props = GENERATED_FILES[test_certificate] props.script = '../pycert.py' - props.inputs = [input_file, '!/config/buildid'] + props.inputs = [input_file] TEST_HARNESS_FILES.xpcshell.security.manager.ssl.tests.unit.test_cert_eku += ['!%s' % test_certificate] diff --git a/security/manager/ssl/tests/unit/test_cert_keyUsage/moz.build b/security/manager/ssl/tests/unit/test_cert_keyUsage/moz.build index 851a8e7abea5..e8425c2073bc 100644 --- a/security/manager/ssl/tests/unit/test_cert_keyUsage/moz.build +++ b/security/manager/ssl/tests/unit/test_cert_keyUsage/moz.build @@ -27,5 +27,5 @@ for test_certificate in test_certificates: GENERATED_FILES += [test_certificate] props = GENERATED_FILES[test_certificate] props.script = '../pycert.py' - props.inputs = [input_file, '!/config/buildid'] + props.inputs = [input_file] TEST_HARNESS_FILES.xpcshell.security.manager.ssl.tests.unit.test_cert_keyUsage += ['!%s' % test_certificate] diff --git a/security/manager/ssl/tests/unit/test_cert_trust/moz.build b/security/manager/ssl/tests/unit/test_cert_trust/moz.build index b71d069595a3..8a9682b09a80 100644 --- a/security/manager/ssl/tests/unit/test_cert_trust/moz.build +++ b/security/manager/ssl/tests/unit/test_cert_trust/moz.build @@ -15,5 +15,5 @@ for test_certificate in test_certificates: GENERATED_FILES += [test_certificate] props = GENERATED_FILES[test_certificate] props.script = '../pycert.py' - props.inputs = [input_file, '!/config/buildid'] + props.inputs = [input_file] TEST_HARNESS_FILES.xpcshell.security.manager.ssl.tests.unit.test_cert_trust += ['!%s' % test_certificate] diff --git a/security/manager/ssl/tests/unit/test_cert_version/moz.build b/security/manager/ssl/tests/unit/test_cert_version/moz.build index 5d40dbcd869a..b50b8a609cc6 100644 --- a/security/manager/ssl/tests/unit/test_cert_version/moz.build +++ b/security/manager/ssl/tests/unit/test_cert_version/moz.build @@ -61,5 +61,5 @@ for test_certificate in test_certificates: GENERATED_FILES += [test_certificate] props = GENERATED_FILES[test_certificate] props.script = '../pycert.py' - props.inputs = [input_file, '!/config/buildid'] + props.inputs = [input_file] TEST_HARNESS_FILES.xpcshell.security.manager.ssl.tests.unit.test_cert_version += ['!%s' % test_certificate] diff --git a/security/manager/ssl/tests/unit/test_intermediate_basic_usage_constraints/moz.build b/security/manager/ssl/tests/unit/test_intermediate_basic_usage_constraints/moz.build index 4ce880756cd9..ef86d582b2f1 100644 --- a/security/manager/ssl/tests/unit/test_intermediate_basic_usage_constraints/moz.build +++ b/security/manager/ssl/tests/unit/test_intermediate_basic_usage_constraints/moz.build @@ -35,5 +35,5 @@ for test_certificate in test_certificates: GENERATED_FILES += [test_certificate] props = GENERATED_FILES[test_certificate] props.script = '../pycert.py' - props.inputs = [input_file, '!/config/buildid'] + props.inputs = [input_file] TEST_HARNESS_FILES.xpcshell.security.manager.ssl.tests.unit.test_intermediate_basic_usage_constraints += ['!%s' % test_certificate] diff --git a/security/manager/ssl/tests/unit/test_ocsp_url/moz.build b/security/manager/ssl/tests/unit/test_ocsp_url/moz.build index 5cf49a7f9946..d01168b64848 100644 --- a/security/manager/ssl/tests/unit/test_ocsp_url/moz.build +++ b/security/manager/ssl/tests/unit/test_ocsp_url/moz.build @@ -26,7 +26,7 @@ for test_certificate in test_certificates: GENERATED_FILES += [test_certificate] props = GENERATED_FILES[test_certificate] props.script = '../pycert.py' - props.inputs = [input_file, '!/config/buildid'] + props.inputs = [input_file] TEST_HARNESS_FILES.xpcshell.security.manager.ssl.tests.unit.test_ocsp_url += ['!%s' % test_certificate] test_keys = ( diff --git a/security/manager/ssl/tests/unit/test_pinning_dynamic/moz.build b/security/manager/ssl/tests/unit/test_pinning_dynamic/moz.build index 5a4260131ecd..86d581529346 100644 --- a/security/manager/ssl/tests/unit/test_pinning_dynamic/moz.build +++ b/security/manager/ssl/tests/unit/test_pinning_dynamic/moz.build @@ -24,5 +24,5 @@ for test_certificate in test_certificates: GENERATED_FILES += [test_certificate] props = GENERATED_FILES[test_certificate] props.script = '../pycert.py' - props.inputs = [input_file, '!/config/buildid'] + props.inputs = [input_file] TEST_HARNESS_FILES.xpcshell.security.manager.ssl.tests.unit.test_pinning_dynamic += ['!%s' % test_certificate] From 2ce73b774cc84b7ef04c938d5a814cf15d2efedb Mon Sep 17 00:00:00 2001 From: Bas Schouten Date: Fri, 24 Jul 2015 16:41:02 +0000 Subject: [PATCH 016/136] Bug 1187075: Implement cairo atomics for Win32. r=jrmuizel --- gfx/cairo/cairo/src/cairo-atomic-private.h | 26 +++++++++++++++++++ gfx/cairo/cairo/src/cairo-compiler-private.h | 3 +++ .../cairo/src/cairo-reference-count-private.h | 2 +- 3 files changed, 30 insertions(+), 1 deletion(-) diff --git a/gfx/cairo/cairo/src/cairo-atomic-private.h b/gfx/cairo/cairo/src/cairo-atomic-private.h index dd42a8ad135c..c45d4506e966 100644 --- a/gfx/cairo/cairo/src/cairo-atomic-private.h +++ b/gfx/cairo/cairo/src/cairo-atomic-private.h @@ -45,6 +45,10 @@ #include "config.h" #endif +#if HAVE_WIN32_ATOMIC_PRIMITIVES +#include +#endif + /* The autoconf on OpenBSD 4.5 produces the malformed constant name * SIZEOF_VOID__ rather than SIZEOF_VOID_P. Work around that here. */ #if !defined(SIZEOF_VOID_P) && defined(SIZEOF_VOID__) @@ -143,6 +147,28 @@ _cairo_atomic_ptr_cmpxchg_return_old_impl(void **x, void *oldv, void *newv) #endif +#if HAVE_WIN32_ATOMIC_PRIMITIVES + +#define HAS_ATOMIC_OPS 1 + +typedef volatile long cairo_atomic_int_t; + +# define _cairo_atomic_int_get(x) ((int)*x) +# define _cairo_atomic_ptr_get(x) ((void*)*x) + +# define _cairo_atomic_int_inc(x) ((void) InterlockedIncrement(x)) +# define _cairo_atomic_int_dec(x) ((void) InterlockedDecrement(x)) +# define _cairo_atomic_int_dec_and_test(x) (InterlockedDecrement(x) == 0) +# define _cairo_atomic_int_cmpxchg(x, oldv, newv) (InterlockedCompareExchange(x, newv, oldv) == oldv) +# define _cairo_atomic_int_cmpxchg_return_old(x, oldv, newv) InterlockedCompareExchange(x, newv, oldv) + +typedef volatile void* cairo_atomic_intptr_t; + +#define _cairo_atomic_ptr_cmpxchg(x, oldv, newv) (InterlockedCompareExchangePointer(x, newv, oldv) == oldv) +#define _cairo_atomic_ptr_cmpxchg_return_old(x, oldv, newv) (InterlockedCompareExchangePointer(x, newv, oldv)) + +#endif + #if HAVE_INTEL_ATOMIC_PRIMITIVES #define HAS_ATOMIC_OPS 1 diff --git a/gfx/cairo/cairo/src/cairo-compiler-private.h b/gfx/cairo/cairo/src/cairo-compiler-private.h index 246f0a775bf8..18dc661bda29 100644 --- a/gfx/cairo/cairo/src/cairo-compiler-private.h +++ b/gfx/cairo/cairo/src/cairo-compiler-private.h @@ -214,6 +214,9 @@ #endif #ifdef _MSC_VER + +#define HAVE_WIN32_ATOMIC_PRIMITIVES 1 + #ifndef __cplusplus #undef inline #define inline __inline diff --git a/gfx/cairo/cairo/src/cairo-reference-count-private.h b/gfx/cairo/cairo/src/cairo-reference-count-private.h index 0cb5695dd063..0d91488ee85b 100644 --- a/gfx/cairo/cairo/src/cairo-reference-count-private.h +++ b/gfx/cairo/cairo/src/cairo-reference-count-private.h @@ -51,7 +51,7 @@ typedef struct { #define CAIRO_REFERENCE_COUNT_GET_VALUE(RC) _cairo_atomic_int_get (&(RC)->ref_count) -#define CAIRO_REFERENCE_COUNT_INVALID_VALUE ((cairo_atomic_int_t) -1) +#define CAIRO_REFERENCE_COUNT_INVALID_VALUE (-1) #define CAIRO_REFERENCE_COUNT_INVALID {CAIRO_REFERENCE_COUNT_INVALID_VALUE} #define CAIRO_REFERENCE_COUNT_IS_INVALID(RC) (CAIRO_REFERENCE_COUNT_GET_VALUE (RC) == CAIRO_REFERENCE_COUNT_INVALID_VALUE) From a24ed9cc241488a3e66b18d917e772192279e30b Mon Sep 17 00:00:00 2001 From: Eric Rahm Date: Fri, 24 Jul 2015 09:47:51 -0700 Subject: [PATCH 017/136] Bug 1180036 - Replace the warning that anonymous nodes should not be in child lists with an assert plus whitelisting of known-OK cases. r=bz --- layout/base/RestyleManager.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/layout/base/RestyleManager.cpp b/layout/base/RestyleManager.cpp index 411a1b877f15..9ca42f6662b4 100644 --- a/layout/base/RestyleManager.cpp +++ b/layout/base/RestyleManager.cpp @@ -1470,7 +1470,8 @@ RestyleManager::RestyleForRemove(Element* aContainer, // This should be an assert, but this is called incorrectly in // nsHTMLEditor::DeleteRefToAnonymousNode and the assertions were clogging // up the logs. Make it an assert again when that's fixed. - NS_WARNING("anonymous nodes should not be in child lists (bug 439258)"); + MOZ_ASSERT(aOldChild->GetProperty(nsGkAtoms::restylableAnonymousNode), + "anonymous nodes should not be in child lists (bug 439258)"); } uint32_t selectorFlags = aContainer ? (aContainer->GetFlags() & NODE_ALL_SELECTOR_FLAGS) : 0; From 5506155fa1b44e1830fd54e12b57a1bdb3448316 Mon Sep 17 00:00:00 2001 From: Nathan Froyd Date: Wed, 22 Jul 2015 15:10:03 -0400 Subject: [PATCH 018/136] Bug 1186561 - add #include to a protobuf header to work around problems on Android; r=fitzgen Compiling Gecko with libc++ and GCC 4.9 on Android runs into a problem. The protobuf #includes and libc++ result in preprocessed code that looks something like: /* via */ namespace std { namespace __1 { } using namespace __1 __attribute__((__strong__)); } namespace std { namespace __1 { template class __wrap_iter { ... template friend class vector; ... }; } // namespace __1 } // namespace std /* via */ namespace std { namespace __1 { template class _LIBCPP_TYPE_VIS_ONLY vector : ... { ... }; } // namespace __1 } // namespace std and the problem is that GCC doesn't understand that the forward declaration of vector inside __wrap_iter is forward-declaring the actual vector class; it thinks it's declaring something else. Hacking to include _LIBCPP_TYPE_VIS_ONLY for the forward declaration doesn't help. What does help is including earlier than , so the __wrap_iter forward declaration picks up the correct definition of std::vector, and makes everything happy. It's possible that there are other places that could get this same treatment, but this one place was the only one I needed to modify to make things go. --- toolkit/components/protobuf/m-c-changes.patch | 20 +++++++++++++++++++ .../protobuf/io/zero_copy_stream_impl_lite.h | 1 + 2 files changed, 21 insertions(+) diff --git a/toolkit/components/protobuf/m-c-changes.patch b/toolkit/components/protobuf/m-c-changes.patch index 20a1368a4c2d..81c72fbc1a3b 100644 --- a/toolkit/components/protobuf/m-c-changes.patch +++ b/toolkit/components/protobuf/m-c-changes.patch @@ -363,3 +363,23 @@ // This is the slow-path case where "length" may be too large to // safely allocate. We read as much as we can into *values // without pre-allocating "length" bytes. +--- a/toolkit/components/protobuf/src/google/protobuf/io/zero_copy_stream_impl_lite.h ++++ b/toolkit/components/protobuf/src/google/protobuf/io/zero_copy_stream_impl_lite.h +@@ -39,16 +39,17 @@ + // streams. Of course, many users will probably want to write their own + // implementations of these interfaces specific to the particular I/O + // abstractions they prefer to use, but these should cover the most common + // cases. + + #ifndef GOOGLE_PROTOBUF_IO_ZERO_COPY_STREAM_IMPL_LITE_H__ + #define GOOGLE_PROTOBUF_IO_ZERO_COPY_STREAM_IMPL_LITE_H__ + ++#include /* See Bug 1186561 */ + #include + #include + #include + #include + #include + + + namespace google { diff --git a/toolkit/components/protobuf/src/google/protobuf/io/zero_copy_stream_impl_lite.h b/toolkit/components/protobuf/src/google/protobuf/io/zero_copy_stream_impl_lite.h index e18da72ca12f..44c6e7727f70 100644 --- a/toolkit/components/protobuf/src/google/protobuf/io/zero_copy_stream_impl_lite.h +++ b/toolkit/components/protobuf/src/google/protobuf/io/zero_copy_stream_impl_lite.h @@ -44,6 +44,7 @@ #ifndef GOOGLE_PROTOBUF_IO_ZERO_COPY_STREAM_IMPL_LITE_H__ #define GOOGLE_PROTOBUF_IO_ZERO_COPY_STREAM_IMPL_LITE_H__ +#include /* See Bug 1186561 */ #include #include #include From 1d9965d8ee4cbfd494ecb6b540e233725331f0e7 Mon Sep 17 00:00:00 2001 From: Steve Fink Date: Tue, 12 May 2015 17:02:10 -0700 Subject: [PATCH 019/136] Bug 1164294 - Move OrderedHashTable to ds/ --HG-- extra : rebase_source : 432263c710eac78b08df3698359faa30b48e3a97 extra : source : 73295b7527cd5a0fcc754620d8f40f78c30bcc85 extra : histedit_source : 42dfcca08c90b95a5fa26185d1dc8823f8231e01 --- js/src/builtin/MapObject.cpp | 748 +--------------------------------- js/src/ds/OrderedHashTable.h | 755 +++++++++++++++++++++++++++++++++++ 2 files changed, 756 insertions(+), 747 deletions(-) create mode 100644 js/src/ds/OrderedHashTable.h diff --git a/js/src/builtin/MapObject.cpp b/js/src/builtin/MapObject.cpp index 60504bcb0393..9a2533af56d1 100644 --- a/js/src/builtin/MapObject.cpp +++ b/js/src/builtin/MapObject.cpp @@ -6,12 +6,11 @@ #include "builtin/MapObject.h" -#include "mozilla/Move.h" - #include "jscntxt.h" #include "jsiter.h" #include "jsobj.h" +#include "ds/OrderedHashTable.h" #include "gc/Marking.h" #include "js/Utility.h" #include "vm/GlobalObject.h" @@ -25,757 +24,12 @@ using namespace js; using mozilla::ArrayLength; -using mozilla::Forward; using mozilla::IsNaN; -using mozilla::Move; using mozilla::NumberEqualsInt32; using JS::DoubleNaNValue; using JS::ForOfIterator; - -/*** OrderedHashTable ****************************************************************************/ - -/* - * Define two collection templates, js::OrderedHashMap and js::OrderedHashSet. - * They are like js::HashMap and js::HashSet except that: - * - * - Iterating over an Ordered hash table visits the entries in the order in - * which they were inserted. This means that unlike a HashMap, the behavior - * of an OrderedHashMap is deterministic (as long as the HashPolicy methods - * are effect-free and consistent); the hashing is a pure performance - * optimization. - * - * - Range objects over Ordered tables remain valid even when entries are - * added or removed or the table is resized. (However in the case of - * removing entries, note the warning on class Range below.) - * - * - The API is a little different, so it's not a drop-in replacement. - * In particular, the hash policy is a little different. - * Also, the Ordered templates lack the Ptr and AddPtr types. - * - * Hash policies - * - * See the comment about "Hash policy" in HashTable.h for general features that - * hash policy classes must provide. Hash policies for OrderedHashMaps and Sets - * must additionally provide a distinguished "empty" key value and the - * following static member functions: - * bool isEmpty(const Key&); - * void makeEmpty(Key*); - */ - -namespace js { - -namespace detail { - -/* - * detail::OrderedHashTable is the underlying data structure used to implement both - * OrderedHashMap and OrderedHashSet. Programs should use one of those two - * templates rather than OrderedHashTable. - */ -template -class OrderedHashTable -{ - public: - typedef typename Ops::KeyType Key; - typedef typename Ops::Lookup Lookup; - - struct Data - { - T element; - Data* chain; - - Data(const T& e, Data* c) : element(e), chain(c) {} - Data(T&& e, Data* c) : element(Move(e)), chain(c) {} - }; - - class Range; - friend class Range; - - private: - Data** hashTable; // hash table (has hashBuckets() elements) - Data* data; // data vector, an array of Data objects - // data[0:dataLength] are constructed - uint32_t dataLength; // number of constructed elements in data - uint32_t dataCapacity; // size of data, in elements - uint32_t liveCount; // dataLength less empty (removed) entries - uint32_t hashShift; // multiplicative hash shift - Range* ranges; // list of all live Ranges on this table - AllocPolicy alloc; - - public: - explicit OrderedHashTable(AllocPolicy& ap) - : hashTable(nullptr), data(nullptr), dataLength(0), ranges(nullptr), alloc(ap) {} - - bool init() { - MOZ_ASSERT(!hashTable, "init must be called at most once"); - - uint32_t buckets = initialBuckets(); - Data** tableAlloc = alloc.template pod_malloc(buckets); - if (!tableAlloc) - return false; - for (uint32_t i = 0; i < buckets; i++) - tableAlloc[i] = nullptr; - - uint32_t capacity = uint32_t(buckets * fillFactor()); - Data* dataAlloc = alloc.template pod_malloc(capacity); - if (!dataAlloc) { - alloc.free_(tableAlloc); - return false; - } - - // clear() requires that members are assigned only after all allocation - // has succeeded, and that this->ranges is left untouched. - hashTable = tableAlloc; - data = dataAlloc; - dataLength = 0; - dataCapacity = capacity; - liveCount = 0; - hashShift = HashNumberSizeBits - initialBucketsLog2(); - MOZ_ASSERT(hashBuckets() == buckets); - return true; - } - - ~OrderedHashTable() { - for (Range* r = ranges; r; ) { - Range* next = r->next; - r->onTableDestroyed(); - r = next; - } - alloc.free_(hashTable); - freeData(data, dataLength); - } - - /* Return the number of elements in the table. */ - uint32_t count() const { return liveCount; } - - /* True if any element matches l. */ - bool has(const Lookup& l) const { - return lookup(l) != nullptr; - } - - /* Return a pointer to the element, if any, that matches l, or nullptr. */ - T* get(const Lookup& l) { - Data* e = lookup(l, prepareHash(l)); - return e ? &e->element : nullptr; - } - - /* Return a pointer to the element, if any, that matches l, or nullptr. */ - const T* get(const Lookup& l) const { - return const_cast(this)->get(l); - } - - /* - * If the table already contains an entry that matches |element|, - * replace that entry with |element|. Otherwise add a new entry. - * - * On success, return true, whether there was already a matching element or - * not. On allocation failure, return false. If this returns false, it - * means the element was not added to the table. - */ - template - bool put(ElementInput&& element) { - HashNumber h = prepareHash(Ops::getKey(element)); - if (Data* e = lookup(Ops::getKey(element), h)) { - e->element = Forward(element); - return true; - } - - if (dataLength == dataCapacity) { - // If the hashTable is more than 1/4 deleted data, simply rehash in - // place to free up some space. Otherwise, grow the table. - uint32_t newHashShift = liveCount >= dataCapacity * 0.75 ? hashShift - 1 : hashShift; - if (!rehash(newHashShift)) - return false; - } - - h >>= hashShift; - liveCount++; - Data* e = &data[dataLength++]; - new (e) Data(Forward(element), hashTable[h]); - hashTable[h] = e; - return true; - } - - /* - * If the table contains an element matching l, remove it and set *foundp - * to true. Otherwise set *foundp to false. - * - * Return true on success, false if we tried to shrink the table and hit an - * allocation failure. Even if this returns false, *foundp is set correctly - * and the matching element was removed. Shrinking is an optimization and - * it's OK for it to fail. - */ - bool remove(const Lookup& l, bool* foundp) { - // Note: This could be optimized so that removing the last entry, - // data[dataLength - 1], decrements dataLength. LIFO use cases would - // benefit. - - // If a matching entry exists, empty it. - Data* e = lookup(l, prepareHash(l)); - if (e == nullptr) { - *foundp = false; - return true; - } - - *foundp = true; - liveCount--; - Ops::makeEmpty(&e->element); - - // Update active Ranges. - uint32_t pos = e - data; - for (Range* r = ranges; r; r = r->next) - r->onRemove(pos); - - // If many entries have been removed, try to shrink the table. - if (hashBuckets() > initialBuckets() && liveCount < dataLength * minDataFill()) { - if (!rehash(hashShift + 1)) - return false; - } - return true; - } - - /* - * Remove all entries. - * - * Returns false on OOM, leaving the OrderedHashTable and any live Ranges - * in the old state. - * - * The effect on live Ranges is the same as removing all entries; in - * particular, those Ranges are still live and will see any entries added - * after a successful clear(). - */ - bool clear() { - if (dataLength != 0) { - Data** oldHashTable = hashTable; - Data* oldData = data; - uint32_t oldDataLength = dataLength; - - hashTable = nullptr; - if (!init()) { - // init() only mutates members on success; see comment above. - hashTable = oldHashTable; - return false; - } - - alloc.free_(oldHashTable); - freeData(oldData, oldDataLength); - for (Range* r = ranges; r; r = r->next) - r->onClear(); - } - - MOZ_ASSERT(hashTable); - MOZ_ASSERT(data); - MOZ_ASSERT(dataLength == 0); - MOZ_ASSERT(liveCount == 0); - return true; - } - - /* - * Ranges are used to iterate over OrderedHashTables. - * - * Suppose 'Map' is some instance of OrderedHashMap, and 'map' is a Map. - * Then you can walk all the key-value pairs like this: - * - * for (Map::Range r = map.all(); !r.empty(); r.popFront()) { - * Map::Entry& pair = r.front(); - * ... do something with pair ... - * } - * - * Ranges remain valid for the lifetime of the OrderedHashTable, even if - * entries are added or removed or the table is resized. Don't do anything - * to a Range, except destroy it, after the OrderedHashTable has been - * destroyed. (We support destroying the two objects in either order to - * humor the GC, bless its nondeterministic heart.) - * - * Warning: The behavior when the current front() entry is removed from the - * table is subtly different from js::HashTable<>::Enum::removeFront()! - * HashTable::Enum doesn't skip any entries when you removeFront() and then - * popFront(). OrderedHashTable::Range does! (This is useful for using a - * Range to implement JS Map.prototype.iterator.) - * - * The workaround is to call popFront() as soon as possible, - * before there's any possibility of modifying the table: - * - * for (Map::Range r = map.all(); !r.empty(); ) { - * Key key = r.front().key; // this won't modify map - * Value val = r.front().value; // this won't modify map - * r.popFront(); - * // ...do things that might modify map... - * } - */ - class Range - { - friend class OrderedHashTable; - - OrderedHashTable& ht; - - /* The index of front() within ht.data. */ - uint32_t i; - - /* - * The number of nonempty entries in ht.data to the left of front(). - * This is used when the table is resized or compacted. - */ - uint32_t count; - - /* - * Links in the doubly-linked list of active Ranges on ht. - * - * prevp points to the previous Range's .next field; - * or to ht.ranges if this is the first Range in the list. - * next points to the next Range; - * or nullptr if this is the last Range in the list. - * - * Invariant: *prevp == this. - */ - Range** prevp; - Range* next; - - /* - * Create a Range over all the entries in ht. - * (This is private on purpose. End users must use ht.all().) - */ - explicit Range(OrderedHashTable& ht) : ht(ht), i(0), count(0), prevp(&ht.ranges), next(ht.ranges) { - *prevp = this; - if (next) - next->prevp = &next; - seek(); - } - - public: - Range(const Range& other) - : ht(other.ht), i(other.i), count(other.count), prevp(&ht.ranges), next(ht.ranges) - { - *prevp = this; - if (next) - next->prevp = &next; - } - - ~Range() { - *prevp = next; - if (next) - next->prevp = prevp; - } - - private: - // Prohibit copy assignment. - Range& operator=(const Range& other) = delete; - - void seek() { - while (i < ht.dataLength && Ops::isEmpty(Ops::getKey(ht.data[i].element))) - i++; - } - - /* - * The hash table calls this when an entry is removed. - * j is the index of the removed entry. - */ - void onRemove(uint32_t j) { - MOZ_ASSERT(valid()); - if (j < i) - count--; - if (j == i) - seek(); - } - - /* - * The hash table calls this when the table is resized or compacted. - * Since |count| is the number of nonempty entries to the left of - * front(), discarding the empty entries will not affect count, and it - * will make i and count equal. - */ - void onCompact() { - MOZ_ASSERT(valid()); - i = count; - } - - /* The hash table calls this when cleared. */ - void onClear() { - MOZ_ASSERT(valid()); - i = count = 0; - } - - bool valid() const { - return next != this; - } - - void onTableDestroyed() { - MOZ_ASSERT(valid()); - prevp = &next; - next = this; - } - - public: - bool empty() const { - MOZ_ASSERT(valid()); - return i >= ht.dataLength; - } - - /* - * Return the first element in the range. This must not be called if - * this->empty(). - * - * Warning: Removing an entry from the table also removes it from any - * live Ranges, and a Range can become empty that way, rendering - * front() invalid. If in doubt, check empty() before calling front(). - */ - T& front() { - MOZ_ASSERT(valid()); - MOZ_ASSERT(!empty()); - return ht.data[i].element; - } - - /* - * Remove the first element from this range. - * This must not be called if this->empty(). - * - * Warning: Removing an entry from the table also removes it from any - * live Ranges, and a Range can become empty that way, rendering - * popFront() invalid. If in doubt, check empty() before calling - * popFront(). - */ - void popFront() { - MOZ_ASSERT(valid()); - MOZ_ASSERT(!empty()); - MOZ_ASSERT(!Ops::isEmpty(Ops::getKey(ht.data[i].element))); - count++; - i++; - seek(); - } - - /* - * Change the key of the front entry. - * - * This calls Ops::hash on both the current key and the new key. - * Ops::hash on the current key must return the same hash code as - * when the entry was added to the table. - */ - void rekeyFront(const Key& k) { - MOZ_ASSERT(valid()); - Data& entry = ht.data[i]; - HashNumber oldHash = prepareHash(Ops::getKey(entry.element)) >> ht.hashShift; - HashNumber newHash = prepareHash(k) >> ht.hashShift; - Ops::setKey(entry.element, k); - if (newHash != oldHash) { - // Remove this entry from its old hash chain. (If this crashes - // reading nullptr, it would mean we did not find this entry on - // the hash chain where we expected it. That probably means the - // key's hash code changed since it was inserted, breaking the - // hash code invariant.) - Data** ep = &ht.hashTable[oldHash]; - while (*ep != &entry) - ep = &(*ep)->chain; - *ep = entry.chain; - - // Add it to the new hash chain. We could just insert it at the - // beginning of the chain. Instead, we do a bit of work to - // preserve the invariant that hash chains always go in reverse - // insertion order (descending memory order). No code currently - // depends on this invariant, so it's fine to kill it if - // needed. - ep = &ht.hashTable[newHash]; - while (*ep && *ep > &entry) - ep = &(*ep)->chain; - entry.chain = *ep; - *ep = &entry; - } - } - }; - - Range all() { return Range(*this); } - - /* - * Change the value of the given key. - * - * This calls Ops::hash on both the current key and the new key. - * Ops::hash on the current key must return the same hash code as - * when the entry was added to the table. - */ - void rekeyOneEntry(const Key& current, const Key& newKey, const T& element) { - if (current == newKey) - return; - - Data* entry = lookup(current, prepareHash(current)); - if (!entry) - return; - - HashNumber oldHash = prepareHash(current) >> hashShift; - HashNumber newHash = prepareHash(newKey) >> hashShift; - - entry->element = element; - - // Remove this entry from its old hash chain. (If this crashes - // reading nullptr, it would mean we did not find this entry on - // the hash chain where we expected it. That probably means the - // key's hash code changed since it was inserted, breaking the - // hash code invariant.) - Data** ep = &hashTable[oldHash]; - while (*ep != entry) - ep = &(*ep)->chain; - *ep = entry->chain; - - // Add it to the new hash chain. We could just insert it at the - // beginning of the chain. Instead, we do a bit of work to - // preserve the invariant that hash chains always go in reverse - // insertion order (descending memory order). No code currently - // depends on this invariant, so it's fine to kill it if - // needed. - ep = &hashTable[newHash]; - while (*ep && *ep > entry) - ep = &(*ep)->chain; - entry->chain = *ep; - *ep = entry; - } - - private: - /* Logarithm base 2 of the number of buckets in the hash table initially. */ - static uint32_t initialBucketsLog2() { return 1; } - static uint32_t initialBuckets() { return 1 << initialBucketsLog2(); } - - /* - * The maximum load factor (mean number of entries per bucket). - * It is an invariant that - * dataCapacity == floor(hashBuckets() * fillFactor()). - * - * The fill factor should be between 2 and 4, and it should be chosen so that - * the fill factor times sizeof(Data) is close to but <= a power of 2. - * This fixed fill factor was chosen to make the size of the data - * array, in bytes, close to a power of two when sizeof(T) is 16. - */ - static double fillFactor() { return 8.0 / 3.0; } - - /* - * The minimum permitted value of (liveCount / dataLength). - * If that ratio drops below this value, we shrink the table. - */ - static double minDataFill() { return 0.25; } - - static HashNumber prepareHash(const Lookup& l) { - return ScrambleHashCode(Ops::hash(l)); - } - - /* The size of hashTable, in elements. Always a power of two. */ - uint32_t hashBuckets() const { - return 1 << (HashNumberSizeBits - hashShift); - } - - static void destroyData(Data* data, uint32_t length) { - for (Data* p = data + length; p != data; ) - (--p)->~Data(); - } - - void freeData(Data* data, uint32_t length) { - destroyData(data, length); - alloc.free_(data); - } - - Data* lookup(const Lookup& l, HashNumber h) { - for (Data* e = hashTable[h >> hashShift]; e; e = e->chain) { - if (Ops::match(Ops::getKey(e->element), l)) - return e; - } - return nullptr; - } - - const Data* lookup(const Lookup& l) const { - return const_cast(this)->lookup(l, prepareHash(l)); - } - - /* This is called after rehashing the table. */ - void compacted() { - // If we had any empty entries, compacting may have moved live entries - // to the left within |data|. Notify all live Ranges of the change. - for (Range* r = ranges; r; r = r->next) - r->onCompact(); - } - - /* Compact the entries in |data| and rehash them. */ - void rehashInPlace() { - for (uint32_t i = 0, N = hashBuckets(); i < N; i++) - hashTable[i] = nullptr; - Data* wp = data; - Data* end = data + dataLength; - for (Data* rp = data; rp != end; rp++) { - if (!Ops::isEmpty(Ops::getKey(rp->element))) { - HashNumber h = prepareHash(Ops::getKey(rp->element)) >> hashShift; - if (rp != wp) - wp->element = Move(rp->element); - wp->chain = hashTable[h]; - hashTable[h] = wp; - wp++; - } - } - MOZ_ASSERT(wp == data + liveCount); - - while (wp != end) - (--end)->~Data(); - dataLength = liveCount; - compacted(); - } - - /* - * Grow, shrink, or compact both |hashTable| and |data|. - * - * On success, this returns true, dataLength == liveCount, and there are no - * empty elements in data[0:dataLength]. On allocation failure, this - * leaves everything as it was and returns false. - */ - bool rehash(uint32_t newHashShift) { - // If the size of the table is not changing, rehash in place to avoid - // allocating memory. - if (newHashShift == hashShift) { - rehashInPlace(); - return true; - } - - size_t newHashBuckets = 1 << (HashNumberSizeBits - newHashShift); - Data** newHashTable = alloc.template pod_malloc(newHashBuckets); - if (!newHashTable) - return false; - for (uint32_t i = 0; i < newHashBuckets; i++) - newHashTable[i] = nullptr; - - uint32_t newCapacity = uint32_t(newHashBuckets * fillFactor()); - Data* newData = alloc.template pod_malloc(newCapacity); - if (!newData) { - alloc.free_(newHashTable); - return false; - } - - Data* wp = newData; - Data* end = data + dataLength; - for (Data* p = data; p != end; p++) { - if (!Ops::isEmpty(Ops::getKey(p->element))) { - HashNumber h = prepareHash(Ops::getKey(p->element)) >> newHashShift; - new (wp) Data(Move(p->element), newHashTable[h]); - newHashTable[h] = wp; - wp++; - } - } - MOZ_ASSERT(wp == newData + liveCount); - - alloc.free_(hashTable); - freeData(data, dataLength); - - hashTable = newHashTable; - data = newData; - dataLength = liveCount; - dataCapacity = newCapacity; - hashShift = newHashShift; - MOZ_ASSERT(hashBuckets() == newHashBuckets); - - compacted(); - return true; - } - - // Not copyable. - OrderedHashTable& operator=(const OrderedHashTable&) = delete; - OrderedHashTable(const OrderedHashTable&) = delete; -}; - -} // namespace detail - -template -class OrderedHashMap -{ - public: - class Entry - { - template friend class detail::OrderedHashTable; - void operator=(const Entry& rhs) { - const_cast(key) = rhs.key; - value = rhs.value; - } - - void operator=(Entry&& rhs) { - MOZ_ASSERT(this != &rhs, "self-move assignment is prohibited"); - const_cast(key) = Move(rhs.key); - value = Move(rhs.value); - } - - public: - Entry() : key(), value() {} - Entry(const Key& k, const Value& v) : key(k), value(v) {} - Entry(Entry&& rhs) : key(Move(rhs.key)), value(Move(rhs.value)) {} - - const Key key; - Value value; - }; - - private: - struct MapOps : OrderedHashPolicy - { - typedef Key KeyType; - static void makeEmpty(Entry* e) { - OrderedHashPolicy::makeEmpty(const_cast(&e->key)); - - // Clear the value. Destroying it is another possibility, but that - // would complicate class Entry considerably. - e->value = Value(); - } - static const Key& getKey(const Entry& e) { return e.key; } - static void setKey(Entry& e, const Key& k) { const_cast(e.key) = k; } - }; - - typedef detail::OrderedHashTable Impl; - Impl impl; - - public: - typedef typename Impl::Range Range; - - explicit OrderedHashMap(AllocPolicy ap = AllocPolicy()) : impl(ap) {} - bool init() { return impl.init(); } - uint32_t count() const { return impl.count(); } - bool has(const Key& key) const { return impl.has(key); } - Range all() { return impl.all(); } - const Entry* get(const Key& key) const { return impl.get(key); } - Entry* get(const Key& key) { return impl.get(key); } - bool put(const Key& key, const Value& value) { return impl.put(Entry(key, value)); } - bool remove(const Key& key, bool* foundp) { return impl.remove(key, foundp); } - bool clear() { return impl.clear(); } - - void rekeyOneEntry(const Key& current, const Key& newKey) { - const Entry* e = get(current); - if (!e) - return; - return impl.rekeyOneEntry(current, newKey, Entry(newKey, e->value)); - } -}; - -template -class OrderedHashSet -{ - private: - struct SetOps : OrderedHashPolicy - { - typedef const T KeyType; - static const T& getKey(const T& v) { return v; } - static void setKey(const T& e, const T& v) { const_cast(e) = v; } - }; - - typedef detail::OrderedHashTable Impl; - Impl impl; - - public: - typedef typename Impl::Range Range; - - explicit OrderedHashSet(AllocPolicy ap = AllocPolicy()) : impl(ap) {} - bool init() { return impl.init(); } - uint32_t count() const { return impl.count(); } - bool has(const T& value) const { return impl.has(value); } - Range all() { return impl.all(); } - bool put(const T& value) { return impl.put(value); } - bool remove(const T& value, bool* foundp) { return impl.remove(value, foundp); } - bool clear() { return impl.clear(); } - - void rekeyOneEntry(const T& current, const T& newKey) { - return impl.rekeyOneEntry(current, newKey, newKey); - } -}; - -} // namespace js - /*** HashableValue *******************************************************************************/ diff --git a/js/src/ds/OrderedHashTable.h b/js/src/ds/OrderedHashTable.h new file mode 100644 index 000000000000..8b12367e554f --- /dev/null +++ b/js/src/ds/OrderedHashTable.h @@ -0,0 +1,755 @@ +/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- + * vim: set ts=8 sts=4 et sw=4 tw=99: + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ + +#ifndef ds_OrderedHashTable_h +#define ds_OrderedHashTable_h + +/* + * Define two collection templates, js::OrderedHashMap and js::OrderedHashSet. + * They are like js::HashMap and js::HashSet except that: + * + * - Iterating over an Ordered hash table visits the entries in the order in + * which they were inserted. This means that unlike a HashMap, the behavior + * of an OrderedHashMap is deterministic (as long as the HashPolicy methods + * are effect-free and consistent); the hashing is a pure performance + * optimization. + * + * - Range objects over Ordered tables remain valid even when entries are + * added or removed or the table is resized. (However in the case of + * removing entries, note the warning on class Range below.) + * + * - The API is a little different, so it's not a drop-in replacement. + * In particular, the hash policy is a little different. + * Also, the Ordered templates lack the Ptr and AddPtr types. + * + * Hash policies + * + * See the comment about "Hash policy" in HashTable.h for general features that + * hash policy classes must provide. Hash policies for OrderedHashMaps and Sets + * must additionally provide a distinguished "empty" key value and the + * following static member functions: + * bool isEmpty(const Key&); + * void makeEmpty(Key*); + */ + +#include "mozilla/Move.h" + +using mozilla::Forward; +using mozilla::Move; + +namespace js { + +namespace detail { + +/* + * detail::OrderedHashTable is the underlying data structure used to implement both + * OrderedHashMap and OrderedHashSet. Programs should use one of those two + * templates rather than OrderedHashTable. + */ +template +class OrderedHashTable +{ + public: + typedef typename Ops::KeyType Key; + typedef typename Ops::Lookup Lookup; + + struct Data + { + T element; + Data* chain; + + Data(const T& e, Data* c) : element(e), chain(c) {} + Data(T&& e, Data* c) : element(Move(e)), chain(c) {} + }; + + class Range; + friend class Range; + + private: + Data** hashTable; // hash table (has hashBuckets() elements) + Data* data; // data vector, an array of Data objects + // data[0:dataLength] are constructed + uint32_t dataLength; // number of constructed elements in data + uint32_t dataCapacity; // size of data, in elements + uint32_t liveCount; // dataLength less empty (removed) entries + uint32_t hashShift; // multiplicative hash shift + Range* ranges; // list of all live Ranges on this table + AllocPolicy alloc; + + public: + explicit OrderedHashTable(AllocPolicy& ap) + : hashTable(nullptr), data(nullptr), dataLength(0), ranges(nullptr), alloc(ap) {} + + bool init() { + MOZ_ASSERT(!hashTable, "init must be called at most once"); + + uint32_t buckets = initialBuckets(); + Data** tableAlloc = alloc.template pod_malloc(buckets); + if (!tableAlloc) + return false; + for (uint32_t i = 0; i < buckets; i++) + tableAlloc[i] = nullptr; + + uint32_t capacity = uint32_t(buckets * fillFactor()); + Data* dataAlloc = alloc.template pod_malloc(capacity); + if (!dataAlloc) { + alloc.free_(tableAlloc); + return false; + } + + // clear() requires that members are assigned only after all allocation + // has succeeded, and that this->ranges is left untouched. + hashTable = tableAlloc; + data = dataAlloc; + dataLength = 0; + dataCapacity = capacity; + liveCount = 0; + hashShift = HashNumberSizeBits - initialBucketsLog2(); + MOZ_ASSERT(hashBuckets() == buckets); + return true; + } + + ~OrderedHashTable() { + for (Range* r = ranges; r; ) { + Range* next = r->next; + r->onTableDestroyed(); + r = next; + } + alloc.free_(hashTable); + freeData(data, dataLength); + } + + /* Return the number of elements in the table. */ + uint32_t count() const { return liveCount; } + + /* True if any element matches l. */ + bool has(const Lookup& l) const { + return lookup(l) != nullptr; + } + + /* Return a pointer to the element, if any, that matches l, or nullptr. */ + T* get(const Lookup& l) { + Data* e = lookup(l, prepareHash(l)); + return e ? &e->element : nullptr; + } + + /* Return a pointer to the element, if any, that matches l, or nullptr. */ + const T* get(const Lookup& l) const { + return const_cast(this)->get(l); + } + + /* + * If the table already contains an entry that matches |element|, + * replace that entry with |element|. Otherwise add a new entry. + * + * On success, return true, whether there was already a matching element or + * not. On allocation failure, return false. If this returns false, it + * means the element was not added to the table. + */ + template + bool put(ElementInput&& element) { + HashNumber h = prepareHash(Ops::getKey(element)); + if (Data* e = lookup(Ops::getKey(element), h)) { + e->element = Forward(element); + return true; + } + + if (dataLength == dataCapacity) { + // If the hashTable is more than 1/4 deleted data, simply rehash in + // place to free up some space. Otherwise, grow the table. + uint32_t newHashShift = liveCount >= dataCapacity * 0.75 ? hashShift - 1 : hashShift; + if (!rehash(newHashShift)) + return false; + } + + h >>= hashShift; + liveCount++; + Data* e = &data[dataLength++]; + new (e) Data(Forward(element), hashTable[h]); + hashTable[h] = e; + return true; + } + + /* + * If the table contains an element matching l, remove it and set *foundp + * to true. Otherwise set *foundp to false. + * + * Return true on success, false if we tried to shrink the table and hit an + * allocation failure. Even if this returns false, *foundp is set correctly + * and the matching element was removed. Shrinking is an optimization and + * it's OK for it to fail. + */ + bool remove(const Lookup& l, bool* foundp) { + // Note: This could be optimized so that removing the last entry, + // data[dataLength - 1], decrements dataLength. LIFO use cases would + // benefit. + + // If a matching entry exists, empty it. + Data* e = lookup(l, prepareHash(l)); + if (e == nullptr) { + *foundp = false; + return true; + } + + *foundp = true; + liveCount--; + Ops::makeEmpty(&e->element); + + // Update active Ranges. + uint32_t pos = e - data; + for (Range* r = ranges; r; r = r->next) + r->onRemove(pos); + + // If many entries have been removed, try to shrink the table. + if (hashBuckets() > initialBuckets() && liveCount < dataLength * minDataFill()) { + if (!rehash(hashShift + 1)) + return false; + } + return true; + } + + /* + * Remove all entries. + * + * Returns false on OOM, leaving the OrderedHashTable and any live Ranges + * in the old state. + * + * The effect on live Ranges is the same as removing all entries; in + * particular, those Ranges are still live and will see any entries added + * after a successful clear(). + */ + bool clear() { + if (dataLength != 0) { + Data** oldHashTable = hashTable; + Data* oldData = data; + uint32_t oldDataLength = dataLength; + + hashTable = nullptr; + if (!init()) { + // init() only mutates members on success; see comment above. + hashTable = oldHashTable; + return false; + } + + alloc.free_(oldHashTable); + freeData(oldData, oldDataLength); + for (Range* r = ranges; r; r = r->next) + r->onClear(); + } + + MOZ_ASSERT(hashTable); + MOZ_ASSERT(data); + MOZ_ASSERT(dataLength == 0); + MOZ_ASSERT(liveCount == 0); + return true; + } + + /* + * Ranges are used to iterate over OrderedHashTables. + * + * Suppose 'Map' is some instance of OrderedHashMap, and 'map' is a Map. + * Then you can walk all the key-value pairs like this: + * + * for (Map::Range r = map.all(); !r.empty(); r.popFront()) { + * Map::Entry& pair = r.front(); + * ... do something with pair ... + * } + * + * Ranges remain valid for the lifetime of the OrderedHashTable, even if + * entries are added or removed or the table is resized. Don't do anything + * to a Range, except destroy it, after the OrderedHashTable has been + * destroyed. (We support destroying the two objects in either order to + * humor the GC, bless its nondeterministic heart.) + * + * Warning: The behavior when the current front() entry is removed from the + * table is subtly different from js::HashTable<>::Enum::removeFront()! + * HashTable::Enum doesn't skip any entries when you removeFront() and then + * popFront(). OrderedHashTable::Range does! (This is useful for using a + * Range to implement JS Map.prototype.iterator.) + * + * The workaround is to call popFront() as soon as possible, + * before there's any possibility of modifying the table: + * + * for (Map::Range r = map.all(); !r.empty(); ) { + * Key key = r.front().key; // this won't modify map + * Value val = r.front().value; // this won't modify map + * r.popFront(); + * // ...do things that might modify map... + * } + */ + class Range + { + friend class OrderedHashTable; + + OrderedHashTable& ht; + + /* The index of front() within ht.data. */ + uint32_t i; + + /* + * The number of nonempty entries in ht.data to the left of front(). + * This is used when the table is resized or compacted. + */ + uint32_t count; + + /* + * Links in the doubly-linked list of active Ranges on ht. + * + * prevp points to the previous Range's .next field; + * or to ht.ranges if this is the first Range in the list. + * next points to the next Range; + * or nullptr if this is the last Range in the list. + * + * Invariant: *prevp == this. + */ + Range** prevp; + Range* next; + + /* + * Create a Range over all the entries in ht. + * (This is private on purpose. End users must use ht.all().) + */ + explicit Range(OrderedHashTable& ht) : ht(ht), i(0), count(0), prevp(&ht.ranges), next(ht.ranges) { + *prevp = this; + if (next) + next->prevp = &next; + seek(); + } + + public: + Range(const Range& other) + : ht(other.ht), i(other.i), count(other.count), prevp(&ht.ranges), next(ht.ranges) + { + *prevp = this; + if (next) + next->prevp = &next; + } + + ~Range() { + *prevp = next; + if (next) + next->prevp = prevp; + } + + private: + // Prohibit copy assignment. + Range& operator=(const Range& other) = delete; + + void seek() { + while (i < ht.dataLength && Ops::isEmpty(Ops::getKey(ht.data[i].element))) + i++; + } + + /* + * The hash table calls this when an entry is removed. + * j is the index of the removed entry. + */ + void onRemove(uint32_t j) { + MOZ_ASSERT(valid()); + if (j < i) + count--; + if (j == i) + seek(); + } + + /* + * The hash table calls this when the table is resized or compacted. + * Since |count| is the number of nonempty entries to the left of + * front(), discarding the empty entries will not affect count, and it + * will make i and count equal. + */ + void onCompact() { + MOZ_ASSERT(valid()); + i = count; + } + + /* The hash table calls this when cleared. */ + void onClear() { + MOZ_ASSERT(valid()); + i = count = 0; + } + + bool valid() const { + return next != this; + } + + void onTableDestroyed() { + MOZ_ASSERT(valid()); + prevp = &next; + next = this; + } + + public: + bool empty() const { + MOZ_ASSERT(valid()); + return i >= ht.dataLength; + } + + /* + * Return the first element in the range. This must not be called if + * this->empty(). + * + * Warning: Removing an entry from the table also removes it from any + * live Ranges, and a Range can become empty that way, rendering + * front() invalid. If in doubt, check empty() before calling front(). + */ + T& front() { + MOZ_ASSERT(valid()); + MOZ_ASSERT(!empty()); + return ht.data[i].element; + } + + /* + * Remove the first element from this range. + * This must not be called if this->empty(). + * + * Warning: Removing an entry from the table also removes it from any + * live Ranges, and a Range can become empty that way, rendering + * popFront() invalid. If in doubt, check empty() before calling + * popFront(). + */ + void popFront() { + MOZ_ASSERT(valid()); + MOZ_ASSERT(!empty()); + MOZ_ASSERT(!Ops::isEmpty(Ops::getKey(ht.data[i].element))); + count++; + i++; + seek(); + } + + /* + * Change the key of the front entry. + * + * This calls Ops::hash on both the current key and the new key. + * Ops::hash on the current key must return the same hash code as + * when the entry was added to the table. + */ + void rekeyFront(const Key& k) { + MOZ_ASSERT(valid()); + Data& entry = ht.data[i]; + HashNumber oldHash = prepareHash(Ops::getKey(entry.element)) >> ht.hashShift; + HashNumber newHash = prepareHash(k) >> ht.hashShift; + Ops::setKey(entry.element, k); + if (newHash != oldHash) { + // Remove this entry from its old hash chain. (If this crashes + // reading nullptr, it would mean we did not find this entry on + // the hash chain where we expected it. That probably means the + // key's hash code changed since it was inserted, breaking the + // hash code invariant.) + Data** ep = &ht.hashTable[oldHash]; + while (*ep != &entry) + ep = &(*ep)->chain; + *ep = entry.chain; + + // Add it to the new hash chain. We could just insert it at the + // beginning of the chain. Instead, we do a bit of work to + // preserve the invariant that hash chains always go in reverse + // insertion order (descending memory order). No code currently + // depends on this invariant, so it's fine to kill it if + // needed. + ep = &ht.hashTable[newHash]; + while (*ep && *ep > &entry) + ep = &(*ep)->chain; + entry.chain = *ep; + *ep = &entry; + } + } + }; + + Range all() { return Range(*this); } + + /* + * Change the value of the given key. + * + * This calls Ops::hash on both the current key and the new key. + * Ops::hash on the current key must return the same hash code as + * when the entry was added to the table. + */ + void rekeyOneEntry(const Key& current, const Key& newKey, const T& element) { + if (current == newKey) + return; + + Data* entry = lookup(current, prepareHash(current)); + if (!entry) + return; + + HashNumber oldHash = prepareHash(current) >> hashShift; + HashNumber newHash = prepareHash(newKey) >> hashShift; + + entry->element = element; + + // Remove this entry from its old hash chain. (If this crashes + // reading nullptr, it would mean we did not find this entry on + // the hash chain where we expected it. That probably means the + // key's hash code changed since it was inserted, breaking the + // hash code invariant.) + Data** ep = &hashTable[oldHash]; + while (*ep != entry) + ep = &(*ep)->chain; + *ep = entry->chain; + + // Add it to the new hash chain. We could just insert it at the + // beginning of the chain. Instead, we do a bit of work to + // preserve the invariant that hash chains always go in reverse + // insertion order (descending memory order). No code currently + // depends on this invariant, so it's fine to kill it if + // needed. + ep = &hashTable[newHash]; + while (*ep && *ep > entry) + ep = &(*ep)->chain; + entry->chain = *ep; + *ep = entry; + } + + private: + /* Logarithm base 2 of the number of buckets in the hash table initially. */ + static uint32_t initialBucketsLog2() { return 1; } + static uint32_t initialBuckets() { return 1 << initialBucketsLog2(); } + + /* + * The maximum load factor (mean number of entries per bucket). + * It is an invariant that + * dataCapacity == floor(hashBuckets() * fillFactor()). + * + * The fill factor should be between 2 and 4, and it should be chosen so that + * the fill factor times sizeof(Data) is close to but <= a power of 2. + * This fixed fill factor was chosen to make the size of the data + * array, in bytes, close to a power of two when sizeof(T) is 16. + */ + static double fillFactor() { return 8.0 / 3.0; } + + /* + * The minimum permitted value of (liveCount / dataLength). + * If that ratio drops below this value, we shrink the table. + */ + static double minDataFill() { return 0.25; } + + static HashNumber prepareHash(const Lookup& l) { + return ScrambleHashCode(Ops::hash(l)); + } + + /* The size of hashTable, in elements. Always a power of two. */ + uint32_t hashBuckets() const { + return 1 << (HashNumberSizeBits - hashShift); + } + + static void destroyData(Data* data, uint32_t length) { + for (Data* p = data + length; p != data; ) + (--p)->~Data(); + } + + void freeData(Data* data, uint32_t length) { + destroyData(data, length); + alloc.free_(data); + } + + Data* lookup(const Lookup& l, HashNumber h) { + for (Data* e = hashTable[h >> hashShift]; e; e = e->chain) { + if (Ops::match(Ops::getKey(e->element), l)) + return e; + } + return nullptr; + } + + const Data* lookup(const Lookup& l) const { + return const_cast(this)->lookup(l, prepareHash(l)); + } + + /* This is called after rehashing the table. */ + void compacted() { + // If we had any empty entries, compacting may have moved live entries + // to the left within |data|. Notify all live Ranges of the change. + for (Range* r = ranges; r; r = r->next) + r->onCompact(); + } + + /* Compact the entries in |data| and rehash them. */ + void rehashInPlace() { + for (uint32_t i = 0, N = hashBuckets(); i < N; i++) + hashTable[i] = nullptr; + Data* wp = data; + Data* end = data + dataLength; + for (Data* rp = data; rp != end; rp++) { + if (!Ops::isEmpty(Ops::getKey(rp->element))) { + HashNumber h = prepareHash(Ops::getKey(rp->element)) >> hashShift; + if (rp != wp) + wp->element = Move(rp->element); + wp->chain = hashTable[h]; + hashTable[h] = wp; + wp++; + } + } + MOZ_ASSERT(wp == data + liveCount); + + while (wp != end) + (--end)->~Data(); + dataLength = liveCount; + compacted(); + } + + /* + * Grow, shrink, or compact both |hashTable| and |data|. + * + * On success, this returns true, dataLength == liveCount, and there are no + * empty elements in data[0:dataLength]. On allocation failure, this + * leaves everything as it was and returns false. + */ + bool rehash(uint32_t newHashShift) { + // If the size of the table is not changing, rehash in place to avoid + // allocating memory. + if (newHashShift == hashShift) { + rehashInPlace(); + return true; + } + + size_t newHashBuckets = 1 << (HashNumberSizeBits - newHashShift); + Data** newHashTable = alloc.template pod_malloc(newHashBuckets); + if (!newHashTable) + return false; + for (uint32_t i = 0; i < newHashBuckets; i++) + newHashTable[i] = nullptr; + + uint32_t newCapacity = uint32_t(newHashBuckets * fillFactor()); + Data* newData = alloc.template pod_malloc(newCapacity); + if (!newData) { + alloc.free_(newHashTable); + return false; + } + + Data* wp = newData; + Data* end = data + dataLength; + for (Data* p = data; p != end; p++) { + if (!Ops::isEmpty(Ops::getKey(p->element))) { + HashNumber h = prepareHash(Ops::getKey(p->element)) >> newHashShift; + new (wp) Data(Move(p->element), newHashTable[h]); + newHashTable[h] = wp; + wp++; + } + } + MOZ_ASSERT(wp == newData + liveCount); + + alloc.free_(hashTable); + freeData(data, dataLength); + + hashTable = newHashTable; + data = newData; + dataLength = liveCount; + dataCapacity = newCapacity; + hashShift = newHashShift; + MOZ_ASSERT(hashBuckets() == newHashBuckets); + + compacted(); + return true; + } + + // Not copyable. + OrderedHashTable& operator=(const OrderedHashTable&) = delete; + OrderedHashTable(const OrderedHashTable&) = delete; +}; + +} // namespace detail + +template +class OrderedHashMap +{ + public: + class Entry + { + template friend class detail::OrderedHashTable; + void operator=(const Entry& rhs) { + const_cast(key) = rhs.key; + value = rhs.value; + } + + void operator=(Entry&& rhs) { + MOZ_ASSERT(this != &rhs, "self-move assignment is prohibited"); + const_cast(key) = Move(rhs.key); + value = Move(rhs.value); + } + + public: + Entry() : key(), value() {} + Entry(const Key& k, const Value& v) : key(k), value(v) {} + Entry(Entry&& rhs) : key(Move(rhs.key)), value(Move(rhs.value)) {} + + const Key key; + Value value; + }; + + private: + struct MapOps : OrderedHashPolicy + { + typedef Key KeyType; + static void makeEmpty(Entry* e) { + OrderedHashPolicy::makeEmpty(const_cast(&e->key)); + + // Clear the value. Destroying it is another possibility, but that + // would complicate class Entry considerably. + e->value = Value(); + } + static const Key& getKey(const Entry& e) { return e.key; } + static void setKey(Entry& e, const Key& k) { const_cast(e.key) = k; } + }; + + typedef detail::OrderedHashTable Impl; + Impl impl; + + public: + typedef typename Impl::Range Range; + + explicit OrderedHashMap(AllocPolicy ap = AllocPolicy()) : impl(ap) {} + bool init() { return impl.init(); } + uint32_t count() const { return impl.count(); } + bool has(const Key& key) const { return impl.has(key); } + Range all() { return impl.all(); } + const Entry* get(const Key& key) const { return impl.get(key); } + Entry* get(const Key& key) { return impl.get(key); } + bool put(const Key& key, const Value& value) { return impl.put(Entry(key, value)); } + bool remove(const Key& key, bool* foundp) { return impl.remove(key, foundp); } + bool clear() { return impl.clear(); } + + void rekeyOneEntry(const Key& current, const Key& newKey) { + const Entry* e = get(current); + if (!e) + return; + return impl.rekeyOneEntry(current, newKey, Entry(newKey, e->value)); + } +}; + +template +class OrderedHashSet +{ + private: + struct SetOps : OrderedHashPolicy + { + typedef const T KeyType; + static const T& getKey(const T& v) { return v; } + static void setKey(const T& e, const T& v) { const_cast(e) = v; } + }; + + typedef detail::OrderedHashTable Impl; + Impl impl; + + public: + typedef typename Impl::Range Range; + + explicit OrderedHashSet(AllocPolicy ap = AllocPolicy()) : impl(ap) {} + bool init() { return impl.init(); } + uint32_t count() const { return impl.count(); } + bool has(const T& value) const { return impl.has(value); } + Range all() { return impl.all(); } + bool put(const T& value) { return impl.put(value); } + bool remove(const T& value, bool* foundp) { return impl.remove(value, foundp); } + bool clear() { return impl.clear(); } + + void rekeyOneEntry(const T& current, const T& newKey) { + return impl.rekeyOneEntry(current, newKey, newKey); + } +}; + +} // namespace js + +#endif /* ds_OrderedHashTable_h */ From 7905fa06eb3134ce20b0d2f5efbf38b3e65abdf5 Mon Sep 17 00:00:00 2001 From: Sotaro Ikeda Date: Fri, 24 Jul 2015 10:56:05 -0700 Subject: [PATCH 020/136] Bug 1187048 - Code clean up around nsScreenGonk's EGLSurface handling r=mwu --- gfx/layers/opengl/CompositorOGL.cpp | 5 +++++ widget/gonk/HwcComposer2D.cpp | 8 ++++---- widget/gonk/hwchal/HwcHALBase.h | 4 ++-- widget/gonk/hwchal/HwcICS.cpp | 14 +++++++------- widget/gonk/hwchal/HwcICS.h | 8 ++++---- widget/gonk/nsScreenManagerGonk.cpp | 21 +++++++++++++-------- widget/gonk/nsScreenManagerGonk.h | 12 +++++++----- widget/gonk/nsWindow.cpp | 7 ++++++- 8 files changed, 48 insertions(+), 31 deletions(-) diff --git a/gfx/layers/opengl/CompositorOGL.cpp b/gfx/layers/opengl/CompositorOGL.cpp index c1447cfebde4..9c9ab080f9bd 100644 --- a/gfx/layers/opengl/CompositorOGL.cpp +++ b/gfx/layers/opengl/CompositorOGL.cpp @@ -167,6 +167,11 @@ CompositorOGL::CleanupResources() if (!mGLContext) return; +#ifdef MOZ_WIDGET_GONK + mWidget->SetNativeData(NS_NATIVE_OPENGL_CONTEXT, + reinterpret_cast(nullptr)); +#endif + nsRefPtr ctx = mGLContext->GetSharedContext(); if (!ctx) { ctx = mGLContext; diff --git a/widget/gonk/HwcComposer2D.cpp b/widget/gonk/HwcComposer2D.cpp index 334adace3fee..d20a12d2f07b 100644 --- a/widget/gonk/HwcComposer2D.cpp +++ b/widget/gonk/HwcComposer2D.cpp @@ -709,7 +709,7 @@ HwcComposer2D::TryHwComposition(nsScreenGonk* aScreen) return false; } else if (blitComposite) { // BLIT Composition, flip DispSurface target - GetGonkDisplay()->UpdateDispSurface(aScreen->GetDpy(), aScreen->GetSur()); + GetGonkDisplay()->UpdateDispSurface(aScreen->GetEGLDisplay(), aScreen->GetEGLSurface()); DisplaySurface* dispSurface = aScreen->GetDisplaySurface(); if (!dispSurface) { LOGE("H/W Composition failed. NULL DispSurface."); @@ -731,7 +731,7 @@ HwcComposer2D::Render(nsIWidget* aWidget) // HWC module does not exist or mList is not created yet. if (!mHal->HasHwc() || !mList) { - return GetGonkDisplay()->SwapBuffers(screen->GetDpy(), screen->GetSur()); + return GetGonkDisplay()->SwapBuffers(screen->GetEGLDisplay(), screen->GetEGLSurface()); } else if (!mList && !ReallocLayerList()) { LOGE("Cannot realloc layer list"); return false; @@ -829,7 +829,7 @@ HwcComposer2D::Commit(nsScreenGonk* aScreen) bool HwcComposer2D::TryHwComposition(nsScreenGonk* aScreen) { - mHal->SetEGLInfo(aScreen->GetDpy(), aScreen->GetSur()); + mHal->SetEGLInfo(aScreen->GetEGLDisplay(), aScreen->GetEGLSurface()); return !mHal->Set(mList, aScreen->GetDisplayType()); } @@ -837,7 +837,7 @@ bool HwcComposer2D::Render(nsIWidget* aWidget) { nsScreenGonk* screen = static_cast(aWidget)->GetScreen(); - GetGonkDisplay()->SwapBuffers(screen->GetDpy(), screen->GetSur()); + GetGonkDisplay()->SwapBuffers(screen->GetEGLDisplay(), screen->GetEGLSurface()); if (!mHal->HasHwc()) { return true; diff --git a/widget/gonk/hwchal/HwcHALBase.h b/widget/gonk/hwchal/HwcHALBase.h index 8257c96f5159..6a07ddd91574 100644 --- a/widget/gonk/hwchal/HwcHALBase.h +++ b/widget/gonk/hwchal/HwcHALBase.h @@ -89,8 +89,8 @@ public: virtual const hwc_rect_t GetHwcRect() const = 0; // Set EGL info (only ICS need this info) - virtual void SetEGLInfo(hwc_display_t aDpy, - hwc_surface_t aSur) = 0; + virtual void SetEGLInfo(hwc_display_t aEGLDisplay, + hwc_surface_t aEGLSurface) = 0; // HwcDevice query properties virtual bool Query(QueryType aType) = 0; diff --git a/widget/gonk/hwchal/HwcICS.cpp b/widget/gonk/hwchal/HwcICS.cpp index c37f94dbc61f..92e953555de1 100644 --- a/widget/gonk/hwchal/HwcICS.cpp +++ b/widget/gonk/hwchal/HwcICS.cpp @@ -34,16 +34,16 @@ HwcICS::HwcICS() HwcICS::~HwcICS() { mHwc = nullptr; - mDpy = nullptr; - mSur = nullptr; + mEGLDisplay = nullptr; + mEGLSurface = nullptr; } void -HwcICS::SetEGLInfo(hwc_display_t aDpy, - hwc_surface_t aSur) +HwcICS::SetEGLInfo(hwc_display_t aEGLDisplay, + hwc_surface_t aEGLSurface) { - mDpy = aDpy; - mSur = aSur; + mEGLDisplay = aEGLDisplay; + mEGLSurface = aEGLSurface; } bool @@ -74,7 +74,7 @@ HwcICS::Set(HwcList* aList, if (!mHwc) { return -1; } - return mHwc->set(mHwc, mDpy, mSur, aList); + return mHwc->set(mHwc, mEGLDisplay, mEGLSurface, aList); } int diff --git a/widget/gonk/hwchal/HwcICS.h b/widget/gonk/hwchal/HwcICS.h index 97d149959995..015b79a410dc 100644 --- a/widget/gonk/hwchal/HwcICS.h +++ b/widget/gonk/hwchal/HwcICS.h @@ -33,8 +33,8 @@ public: virtual const hwc_rect_t GetHwcRect() const override { return {0}; } - virtual void SetEGLInfo(hwc_display_t aDpy, - hwc_surface_t aSur) override; + virtual void SetEGLInfo(hwc_display_t aEGLDisplay, + hwc_surface_t aEGLSurface) override; virtual bool Query(QueryType aType) override; @@ -61,8 +61,8 @@ public: private: HwcDevice *mHwc = nullptr; - hwc_display_t mDpy = nullptr; - hwc_surface_t mSur = nullptr; + hwc_display_t mEGLDisplay = nullptr; + hwc_surface_t mEGLSurface = nullptr; }; } // namespace mozilla diff --git a/widget/gonk/nsScreenManagerGonk.cpp b/widget/gonk/nsScreenManagerGonk.cpp index 8165d312764f..607e7c729707 100644 --- a/widget/gonk/nsScreenManagerGonk.cpp +++ b/widget/gonk/nsScreenManagerGonk.cpp @@ -26,6 +26,7 @@ #include "HwcComposer2D.h" #include "VsyncSource.h" #include "nsWindow.h" +#include "mozilla/layers/CompositorParent.h" #include "mozilla/Services.h" #include "mozilla/ProcessPriorityManager.h" #include "nsIdleService.h" @@ -47,6 +48,7 @@ using namespace mozilla; using namespace mozilla::hal; using namespace mozilla::gfx; using namespace mozilla::gl; +using namespace mozilla::layers; using namespace mozilla::dom; namespace { @@ -120,8 +122,8 @@ nsScreenGonk::nsScreenGonk(uint32_t aId, , mDisplaySurface(aNativeData.mDisplaySurface) #endif , mDisplayType(aDisplayType) - , mDpy(EGL_NO_DISPLAY) - , mSur(EGL_NO_SURFACE) + , mEGLDisplay(EGL_NO_DISPLAY) + , mEGLSurface(EGL_NO_SURFACE) , mGLContext(nullptr) { if (mNativeWindow->query(mNativeWindow.get(), NATIVE_WINDOW_WIDTH, &mVirtualBounds.width) || @@ -360,21 +362,24 @@ void nsScreenGonk::SetEGLInfo(hwc_display_t aDisplay, hwc_surface_t aSurface, gl::GLContext* aGLContext) { - mDpy = aDisplay; - mSur = aSurface; + MOZ_ASSERT(CompositorParent::IsInCompositorThread()); + mEGLDisplay = aDisplay; + mEGLSurface = aSurface; mGLContext = aGLContext; } hwc_display_t -nsScreenGonk::GetDpy() +nsScreenGonk::GetEGLDisplay() { - return mDpy; + MOZ_ASSERT(CompositorParent::IsInCompositorThread()); + return mEGLDisplay; } hwc_surface_t -nsScreenGonk::GetSur() +nsScreenGonk::GetEGLSurface() { - return mSur; + MOZ_ASSERT(CompositorParent::IsInCompositorThread()); + return mEGLSurface; } NS_IMPL_ISUPPORTS(nsScreenManagerGonk, nsIScreenManager) diff --git a/widget/gonk/nsScreenManagerGonk.h b/widget/gonk/nsScreenManagerGonk.h index eccb9fb4a75d..247c6874b473 100644 --- a/widget/gonk/nsScreenManagerGonk.h +++ b/widget/gonk/nsScreenManagerGonk.h @@ -90,8 +90,8 @@ public: // Set EGL info of primary display. Used for BLIT Composition. void SetEGLInfo(hwc_display_t aDisplay, hwc_surface_t aSurface, mozilla::gl::GLContext* aGLContext); - hwc_display_t GetDpy(); - hwc_surface_t GetSur(); + hwc_display_t GetEGLDisplay(); + hwc_surface_t GetEGLSurface(); protected: uint32_t mId; @@ -107,10 +107,12 @@ protected: #if ANDROID_VERSION >= 17 android::sp mDisplaySurface; #endif + + // Accessed and updated only on compositor thread GonkDisplay::DisplayType mDisplayType; - hwc_display_t mDpy; // Store for BLIT Composition and GonkDisplayICS - hwc_surface_t mSur; // Store for BLIT Composition and GonkDisplayICS - mozilla::gl::GLContext* mGLContext; // Store for BLIT Composition + hwc_display_t mEGLDisplay; + hwc_surface_t mEGLSurface; + mozilla::gl::GLContext* mGLContext; }; class nsScreenManagerGonk final : public nsIScreenManager diff --git a/widget/gonk/nsWindow.cpp b/widget/gonk/nsWindow.cpp index bc2c5c603dd5..c182f9d73c32 100644 --- a/widget/gonk/nsWindow.cpp +++ b/widget/gonk/nsWindow.cpp @@ -546,8 +546,13 @@ nsWindow::SetNativeData(uint32_t aDataType, uintptr_t aVal) { switch (aDataType) { case NS_NATIVE_OPENGL_CONTEXT: - // Called after primary display's GLContextEGL creation. GLContext* context = reinterpret_cast(aVal); + if (!context) { + mScreen->SetEGLInfo(EGL_NO_DISPLAY, + EGL_NO_SURFACE, + nullptr); + return; + } mScreen->SetEGLInfo(GLContextEGL::Cast(context)->GetEGLDisplay(), GLContextEGL::Cast(context)->GetEGLSurface(), context); From 4671f1556a4f25e1432a940f9b96ac492eb9d62b Mon Sep 17 00:00:00 2001 From: "Byron Campen [:bwc]" Date: Tue, 14 Jul 2015 09:20:28 -0500 Subject: [PATCH 021/136] Bug 1182289: Clean up dispatches in WebrtcGmpVideoEncoder/Decoder. r=jesup, a=abillings --HG-- extra : rebase_source : 0dd07ceb55830a323e17d7ca86794c07cc5ba375 --- .../src/media-conduit/GmpVideoCodec.cpp | 4 +- .../src/media-conduit/WebrtcGmpVideoCodec.cpp | 537 +++++++++++------- .../src/media-conduit/WebrtcGmpVideoCodec.h | 482 ++++++++++------ .../peerconnection/MediaPipelineFactory.cpp | 12 + .../src/peerconnection/PeerConnectionImpl.cpp | 7 + .../src/peerconnection/PeerConnectionImpl.h | 2 + 6 files changed, 667 insertions(+), 377 deletions(-) diff --git a/media/webrtc/signaling/src/media-conduit/GmpVideoCodec.cpp b/media/webrtc/signaling/src/media-conduit/GmpVideoCodec.cpp index 7cb81fa86766..0c4d81e44751 100644 --- a/media/webrtc/signaling/src/media-conduit/GmpVideoCodec.cpp +++ b/media/webrtc/signaling/src/media-conduit/GmpVideoCodec.cpp @@ -8,11 +8,11 @@ namespace mozilla { VideoEncoder* GmpVideoCodec::CreateEncoder() { - return static_cast(new WebrtcGmpVideoEncoder()); + return static_cast(new WebrtcVideoEncoderProxy()); } VideoDecoder* GmpVideoCodec::CreateDecoder() { - return static_cast(new WebrtcGmpVideoDecoder()); + return static_cast(new WebrtcVideoDecoderProxy()); } } diff --git a/media/webrtc/signaling/src/media-conduit/WebrtcGmpVideoCodec.cpp b/media/webrtc/signaling/src/media-conduit/WebrtcGmpVideoCodec.cpp index 618cbd1bcb23..b7a87cb3f51c 100644 --- a/media/webrtc/signaling/src/media-conduit/WebrtcGmpVideoCodec.cpp +++ b/media/webrtc/signaling/src/media-conduit/WebrtcGmpVideoCodec.cpp @@ -18,6 +18,7 @@ #include "nsServiceManagerUtils.h" #include "GMPVideoDecoderProxy.h" #include "GMPVideoEncoderProxy.h" +#include "MainThreadUtils.h" #include "gmp-video-host.h" #include "gmp-video-frame-i420.h" @@ -47,31 +48,61 @@ GetGMPLog() #define LOGD(msg) MOZ_LOG(GetGMPLog(), mozilla::LogLevel::Debug, msg) #define LOG(level, msg) MOZ_LOG(GetGMPLog(), (level), msg) +WebrtcGmpPCHandleSetter::WebrtcGmpPCHandleSetter(const std::string& aPCHandle) +{ + if (!NS_IsMainThread()) { + MOZ_ASSERT(false, "WebrtcGmpPCHandleSetter can only be used on main"); + return; + } + MOZ_ASSERT(sCurrentHandle.empty()); + sCurrentHandle = aPCHandle; +} + +WebrtcGmpPCHandleSetter::~WebrtcGmpPCHandleSetter() +{ + if (!NS_IsMainThread()) { + MOZ_ASSERT(false, "WebrtcGmpPCHandleSetter can only be used on main"); + return; + } + + sCurrentHandle.clear(); +} + +/* static */ std::string +WebrtcGmpPCHandleSetter::GetCurrentHandle() +{ + if (!NS_IsMainThread()) { + MOZ_ASSERT(false, "WebrtcGmpPCHandleSetter can only be used on main"); + return ""; + } + + return sCurrentHandle; +} + +std::string WebrtcGmpPCHandleSetter::sCurrentHandle = ""; + // Encoder. WebrtcGmpVideoEncoder::WebrtcGmpVideoEncoder() : mGMP(nullptr) + , mInitting(false) , mHost(nullptr) + , mMaxPayloadSize(0) + , mCallbackMutex("WebrtcGmpVideoEncoder encoded callback mutex") , mCallback(nullptr) , mCachedPluginId(0) -{} - -static void -Encoder_Close_g(GMPVideoEncoderProxy* aGMP) { - aGMP->Close(); +#ifdef MOZILLA_INTERNAL_API + if (mPCHandle.empty()) { + mPCHandle = WebrtcGmpPCHandleSetter::GetCurrentHandle(); + } + MOZ_ASSERT(!mPCHandle.empty()); +#endif } WebrtcGmpVideoEncoder::~WebrtcGmpVideoEncoder() { - // Note: we only use SyncRunnables to access mGMP - // Callbacks may occur at any time until we call Close (or receive - // Terminated()), so call Close here synchronously. - // Do NOT touch the refcount of 'this'! - if (mGMPThread && mGMP) { - mozilla::SyncRunnable::DispatchToThread(mGMPThread, - WrapRunnableNM(&Encoder_Close_g, mGMP)); - mGMP = nullptr; - } + // We should not have been destroyed if we never closed our GMP + MOZ_ASSERT(!mGMP); } static int @@ -146,85 +177,135 @@ WebrtcGmpVideoEncoder::InitEncode(const webrtc::VideoCodec* aCodecSettings, } } - nsCOMPtr currentThread(do_GetCurrentThread()); - MOZ_ASSERT(currentThread != mGMPThread); - - nsRefPtr initDone(new InitDoneRunnable()); - mGMPThread->Dispatch(WrapRunnable(this, - &WebrtcGmpVideoEncoder::InitEncode_g, - aCodecSettings, - aNumberOfCores, - aMaxPayloadSize, - initDone), - NS_DISPATCH_NORMAL); - - - while (!initDone->IsDone()) { - NS_ProcessNextEvent(currentThread, true); - } - - return initDone->Result(); -} - -void -WebrtcGmpVideoEncoder::InitEncode_g(const webrtc::VideoCodec* aCodecSettings, - int32_t aNumberOfCores, - uint32_t aMaxPayloadSize, - InitDoneRunnable* aInitDone) -{ - nsTArray tags; - tags.AppendElement(NS_LITERAL_CSTRING("h264")); - UniquePtr callback( - new InitDoneCallback(this, aInitDone, aCodecSettings, aMaxPayloadSize)); - nsresult rv = mMPS->GetGMPVideoEncoder(&tags, - NS_LITERAL_CSTRING(""), - Move(callback)); - if (NS_WARN_IF(NS_FAILED(rv))) { - mMPS = nullptr; - mGMP = nullptr; - mGMPThread = nullptr; - mHost = nullptr; - aInitDone->Dispatch(WEBRTC_VIDEO_CODEC_ERROR); - return; - } -} - -int32_t -WebrtcGmpVideoEncoder::GmpInitDone(GMPVideoEncoderProxy* aGMP, - GMPVideoHost* aHost, - const webrtc::VideoCodec* aCodecSettings, - uint32_t aMaxPayloadSize) -{ - mGMP = aGMP; - mHost = aHost; - if (!mGMP || !mHost) { - return WEBRTC_VIDEO_CODEC_ERROR; - } - // Bug XXXXXX: transfer settings from codecSettings to codec. - memset(&mCodecParams, 0, sizeof(mCodecParams)); + GMPVideoCodec codecParams; + memset(&codecParams, 0, sizeof(codecParams)); - mCodecParams.mGMPApiVersion = 33; - mCodecParams.mStartBitrate = aCodecSettings->startBitrate; - mCodecParams.mMinBitrate = aCodecSettings->minBitrate; - mCodecParams.mMaxBitrate = aCodecSettings->maxBitrate; - mCodecParams.mMaxFramerate = aCodecSettings->maxFramerate; + codecParams.mGMPApiVersion = 33; + codecParams.mStartBitrate = aCodecSettings->startBitrate; + codecParams.mMinBitrate = aCodecSettings->minBitrate; + codecParams.mMaxBitrate = aCodecSettings->maxBitrate; + codecParams.mMaxFramerate = aCodecSettings->maxFramerate; mMaxPayloadSize = aMaxPayloadSize; if (aCodecSettings->codecSpecific.H264.packetizationMode == 1) { mMaxPayloadSize = 0; // No limit. } if (aCodecSettings->mode == webrtc::kScreensharing) { - mCodecParams.mMode = kGMPScreensharing; + codecParams.mMode = kGMPScreensharing; } else { - mCodecParams.mMode = kGMPRealtimeVideo; + codecParams.mMode = kGMPRealtimeVideo; } - return InitEncoderForSize(aCodecSettings->width, aCodecSettings->height); + codecParams.mWidth = aCodecSettings->width; + codecParams.mHeight = aCodecSettings->height; + + nsRefPtr initDone(new GmpInitDoneRunnable(mPCHandle)); + mGMPThread->Dispatch(WrapRunnableNM(WebrtcGmpVideoEncoder::InitEncode_g, + nsRefPtr(this), + codecParams, + aNumberOfCores, + aMaxPayloadSize, + initDone), + NS_DISPATCH_NORMAL); + + // Since init of the GMP encoder is a multi-step async dispatch (including + // dispatches to main), and since this function is invoked on main, there's + // no safe way to block until this init is done. If an error occurs, we'll + // handle it later. + return WEBRTC_VIDEO_CODEC_OK; +} + +/* static */ +void +WebrtcGmpVideoEncoder::InitEncode_g( + const nsRefPtr& aThis, + const GMPVideoCodec& aCodecParams, + int32_t aNumberOfCores, + uint32_t aMaxPayloadSize, + const nsRefPtr& aInitDone) +{ + nsTArray tags; + tags.AppendElement(NS_LITERAL_CSTRING("h264")); + UniquePtr callback( + new InitDoneCallback(aThis, aInitDone, aCodecParams, aMaxPayloadSize)); + aThis->mInitting = true; + nsresult rv = aThis->mMPS->GetGMPVideoEncoder(&tags, + NS_LITERAL_CSTRING(""), + Move(callback)); + if (NS_WARN_IF(NS_FAILED(rv))) { + LOGD(("GMP Encode: GetGMPVideoEncoder failed")); + aThis->Close_g(); + aInitDone->Dispatch(WEBRTC_VIDEO_CODEC_ERROR, + "GMP Encode: GetGMPVideoEncoder failed"); + } } int32_t -WebrtcGmpVideoEncoder::InitEncoderForSize(unsigned short aWidth, unsigned short aHeight) +WebrtcGmpVideoEncoder::GmpInitDone(GMPVideoEncoderProxy* aGMP, + GMPVideoHost* aHost, + std::string* aErrorOut) +{ + if (!mInitting || !aGMP || !aHost) { + *aErrorOut = "GMP Encode: Either init was aborted, " + "or init failed to supply either a GMP Encoder or GMP host."; + if (aGMP) { + // This could destroy us, since aGMP may be the last thing holding a ref + // Return immediately. + aGMP->Close(); + } + return WEBRTC_VIDEO_CODEC_ERROR; + } + + mInitting = false; + + if (mGMP && mGMP != aGMP) { + Close_g(); + } + + mGMP = aGMP; + mHost = aHost; + mCachedPluginId = mGMP->GetPluginId(); + return WEBRTC_VIDEO_CODEC_OK; +} + +int32_t +WebrtcGmpVideoEncoder::GmpInitDone(GMPVideoEncoderProxy* aGMP, + GMPVideoHost* aHost, + const GMPVideoCodec& aCodecParams, + uint32_t aMaxPayloadSize, + std::string* aErrorOut) +{ + int32_t r = GmpInitDone(aGMP, aHost, aErrorOut); + if (r != WEBRTC_VIDEO_CODEC_OK) { + // We might have been destroyed if GmpInitDone failed. + // Return immediately. + return r; + } + mCodecParams = aCodecParams; + return InitEncoderForSize(aCodecParams.mWidth, + aCodecParams.mHeight, + aErrorOut); +} + +void +WebrtcGmpVideoEncoder::Close_g() +{ + GMPVideoEncoderProxy* gmp(mGMP); + mGMP = nullptr; + mHost = nullptr; + mInitting = false; + + if (gmp) { + // Do this last, since this could cause us to be destroyed + gmp->Close(); + } +} + +int32_t +WebrtcGmpVideoEncoder::InitEncoderForSize(unsigned short aWidth, + unsigned short aHeight, + std::string* aErrorOut) { mCodecParams.mWidth = aWidth; mCodecParams.mHeight = aHeight; @@ -233,6 +314,7 @@ WebrtcGmpVideoEncoder::InitEncoderForSize(unsigned short aWidth, unsigned short GMPErr err = mGMP->InitEncode(mCodecParams, codecSpecific, this, 1, mMaxPayloadSize); if (err != GMPNoErr) { + *aErrorOut = "GMP Encode: InitEncode failed"; return WEBRTC_VIDEO_CODEC_ERROR; } @@ -245,69 +327,45 @@ WebrtcGmpVideoEncoder::Encode(const webrtc::I420VideoFrame& aInputImage, const webrtc::CodecSpecificInfo* aCodecSpecificInfo, const std::vector* aFrameTypes) { - MOZ_ASSERT(mHost); - if (!mGMP) { - // destroyed via Terminate() - return WEBRTC_VIDEO_CODEC_ERROR; - } - MOZ_ASSERT(aInputImage.width() >= 0 && aInputImage.height() >= 0); - if (static_cast(aInputImage.width()) != mCodecParams.mWidth || - static_cast(aInputImage.height()) != mCodecParams.mHeight) { - LOGD(("GMP Encode: resolution change from %ux%u to %dx%d", - mCodecParams.mWidth, mCodecParams.mHeight, aInputImage.width(), aInputImage.height())); - - nsRefPtr initDone(new InitDoneRunnable()); - nsCOMPtr task( + // Would be really nice to avoid this sync dispatch, but it would require a + // copy of the frame, since it doesn't appear to actually have a refcount. + mGMPThread->Dispatch( WrapRunnable(this, - &WebrtcGmpVideoEncoder::RegetEncoderForResolutionChange, + &WebrtcGmpVideoEncoder::Encode_g, &aInputImage, - initDone)); - mGMPThread->Dispatch(task, NS_DISPATCH_NORMAL); + aCodecSpecificInfo, + aFrameTypes), + NS_DISPATCH_SYNC); - nsCOMPtr currentThread(do_GetCurrentThread()); - while (!initDone->IsDone()) { - NS_ProcessNextEvent(currentThread, true); - } - - if (initDone->Result() != WEBRTC_VIDEO_CODEC_OK) { - return initDone->Result(); - } - } - - int32_t ret; - mozilla::SyncRunnable::DispatchToThread(mGMPThread, - WrapRunnableRet(&ret, this, - &WebrtcGmpVideoEncoder::Encode_g, - &aInputImage, - aCodecSpecificInfo, - aFrameTypes)); - - return ret; + return WEBRTC_VIDEO_CODEC_OK; } void -WebrtcGmpVideoEncoder::RegetEncoderForResolutionChange(const webrtc::I420VideoFrame* aInputImage, - InitDoneRunnable* aInitDone) +WebrtcGmpVideoEncoder::RegetEncoderForResolutionChange( + uint32_t aWidth, + uint32_t aHeight, + const nsRefPtr& aInitDone) { - mGMP->Close(); + Close_g(); UniquePtr callback( - new InitDoneForResolutionChangeCallback(this, aInitDone, - aInputImage->width(), - aInputImage->height())); + new InitDoneForResolutionChangeCallback(this, + aInitDone, + aWidth, + aHeight)); // OpenH264 codec (at least) can't handle dynamic input resolution changes // re-init the plugin when the resolution changes // XXX allow codec to indicate it doesn't need re-init! nsTArray tags; tags.AppendElement(NS_LITERAL_CSTRING("h264")); + mInitting = true; if (NS_WARN_IF(NS_FAILED(mMPS->GetGMPVideoEncoder(&tags, NS_LITERAL_CSTRING(""), Move(callback))))) { - mGMP = nullptr; - mHost = nullptr; - aInitDone->Dispatch(WEBRTC_VIDEO_CODEC_ERROR); + aInitDone->Dispatch(WEBRTC_VIDEO_CODEC_ERROR, + "GMP Encode: GetGMPVideoEncoder failed"); } } @@ -316,8 +374,27 @@ WebrtcGmpVideoEncoder::Encode_g(const webrtc::I420VideoFrame* aInputImage, const webrtc::CodecSpecificInfo* aCodecSpecificInfo, const std::vector* aFrameTypes) { + if (!mGMP) { + // destroyed via Terminate(), failed to init, or just not initted yet + LOGD(("GMP Encode: not initted yet")); + return WEBRTC_VIDEO_CODEC_ERROR; + } MOZ_ASSERT(mHost); - MOZ_ASSERT(mGMP); + + if (static_cast(aInputImage->width()) != mCodecParams.mWidth || + static_cast(aInputImage->height()) != mCodecParams.mHeight) { + LOGD(("GMP Encode: resolution change from %ux%u to %dx%d", + mCodecParams.mWidth, mCodecParams.mHeight, aInputImage->width(), aInputImage->height())); + + nsRefPtr initDone(new GmpInitDoneRunnable(mPCHandle)); + RegetEncoderForResolutionChange(aInputImage->width(), + aInputImage->height(), + initDone); + if (!mGMP) { + // We needed to go async to re-get the encoder. Bail. + return WEBRTC_VIDEO_CODEC_ERROR; + } + } GMPVideoFrame* ftmp = nullptr; GMPErr err = mHost->CreateFrame(kGMPI420VideoFrame, &ftmp); @@ -374,26 +451,28 @@ WebrtcGmpVideoEncoder::Encode_g(const webrtc::I420VideoFrame* aInputImage, int32_t WebrtcGmpVideoEncoder::RegisterEncodeCompleteCallback(webrtc::EncodedImageCallback* aCallback) { + MutexAutoLock lock(mCallbackMutex); mCallback = aCallback; return WEBRTC_VIDEO_CODEC_OK; } +/* static */ void +WebrtcGmpVideoEncoder::ReleaseGmp_g(nsRefPtr& aEncoder) +{ + aEncoder->Close_g(); +} + int32_t -WebrtcGmpVideoEncoder::Release() +WebrtcGmpVideoEncoder::ReleaseGmp() { LOGD(("GMP Released:")); - // Note: we only use SyncRunnables to access mGMP - // Callbacks may occur at any time until we call Close (or receive - // Terminated()), so call Close here synchronously. - if (mGMPThread && mGMP) { - mozilla::SyncRunnable::DispatchToThread(mGMPThread, - WrapRunnableNM(&Encoder_Close_g, mGMP)); + if (mGMPThread) { + mGMPThread->Dispatch( + WrapRunnableNM(&WebrtcGmpVideoEncoder::ReleaseGmp_g, + nsRefPtr(this)), + NS_DISPATCH_NORMAL); } - // Now safe to forget things - mMPS = nullptr; - mGMP = nullptr; - mHost = nullptr; return WEBRTC_VIDEO_CODEC_OK; } @@ -406,25 +485,28 @@ WebrtcGmpVideoEncoder::SetChannelParameters(uint32_t aPacketLoss, int aRTT) int32_t WebrtcGmpVideoEncoder::SetRates(uint32_t aNewBitRate, uint32_t aFrameRate) { - int32_t ret; MOZ_ASSERT(mGMPThread); - mozilla::SyncRunnable::DispatchToThread(mGMPThread, - WrapRunnableRet(&ret, this, - &WebrtcGmpVideoEncoder::SetRates_g, - aNewBitRate, aFrameRate)); + MOZ_ASSERT(!NS_IsMainThread()); + mGMPThread->Dispatch(WrapRunnableNM(&WebrtcGmpVideoEncoder::SetRates_g, + nsRefPtr(this), + aNewBitRate, + aFrameRate), + NS_DISPATCH_NORMAL); return WEBRTC_VIDEO_CODEC_OK; } -int32_t -WebrtcGmpVideoEncoder::SetRates_g(uint32_t aNewBitRate, uint32_t aFrameRate) +/* static */ int32_t +WebrtcGmpVideoEncoder::SetRates_g(nsRefPtr aThis, + uint32_t aNewBitRate, + uint32_t aFrameRate) { - if (!mGMP) { + if (!aThis->mGMP) { // destroyed via Terminate() return WEBRTC_VIDEO_CODEC_ERROR; } - GMPErr err = mGMP->SetRates(aNewBitRate, aFrameRate); + GMPErr err = aThis->mGMP->SetRates(aNewBitRate, aFrameRate); if (err != GMPNoErr) { return WEBRTC_VIDEO_CODEC_ERROR; } @@ -437,11 +519,11 @@ void WebrtcGmpVideoEncoder::Terminated() { LOGD(("GMP Encoder Terminated: %p", (void *)this)); - mCachedPluginId = PluginID(); - // We need to drop our reference to this mGMP->Close(); mGMP = nullptr; + mHost = nullptr; + mInitting = false; // Could now notify that it's dead } @@ -449,7 +531,8 @@ void WebrtcGmpVideoEncoder::Encoded(GMPVideoEncodedFrame* aEncodedFrame, const nsTArray& aCodecSpecificInfo) { - if (mCallback) { // paranoia + MutexAutoLock lock(mCallbackMutex); + if (mCallback) { webrtc::VideoFrameType ft; GmpFrameTypeToWebrtcFrameType(aEncodedFrame->FrameType(), &ft); uint32_t timestamp = (aEncodedFrame->TimeStamp() * 90ll + 999)/1000; @@ -559,7 +642,6 @@ WebrtcGmpVideoEncoder::Encoded(GMPVideoEncodedFrame* aEncodedFrame, unit._completeFrame = true; mCallback->Encoded(unit, nullptr, &fragmentation); - } } } @@ -567,35 +649,34 @@ WebrtcGmpVideoEncoder::Encoded(GMPVideoEncodedFrame* aEncodedFrame, // Decoder. WebrtcGmpVideoDecoder::WebrtcGmpVideoDecoder() : mGMP(nullptr), + mInitting(false), mHost(nullptr), + mCallbackMutex("WebrtcGmpVideoDecoder decoded callback mutex"), mCallback(nullptr), mCachedPluginId(0), - mDecoderStatus(GMPNoErr){} - -static void -Decoder_Close_g(GMPVideoDecoderProxy* aGMP) + mDecoderStatus(GMPNoErr) { - aGMP->Close(); +#ifdef MOZILLA_INTERNAL_API + if (mPCHandle.empty()) { + mPCHandle = WebrtcGmpPCHandleSetter::GetCurrentHandle(); + } + MOZ_ASSERT(!mPCHandle.empty()); +#endif } WebrtcGmpVideoDecoder::~WebrtcGmpVideoDecoder() { - // Note: we only use SyncRunnables to access mGMP - // Callbacks may occur at any time until we call Close (or receive - // Terminated()), so call Close here synchronously. - // Do NOT touch the refcount of 'this'! - if (mGMPThread && mGMP) { - mozilla::SyncRunnable::DispatchToThread(mGMPThread, - WrapRunnableNM(&Decoder_Close_g, mGMP)); - mGMP = nullptr; - } + // We should not have been destroyed if we never closed our GMP + MOZ_ASSERT(!mGMP); } int32_t WebrtcGmpVideoDecoder::InitDecode(const webrtc::VideoCodec* aCodecSettings, int32_t aNumberOfCores) { - mMPS = do_GetService("@mozilla.org/gecko-media-plugin-service;1"); + if (!mMPS) { + mMPS = do_GetService("@mozilla.org/gecko-media-plugin-service;1"); + } MOZ_ASSERT(mMPS); if (!mGMPThread) { @@ -604,54 +685,65 @@ WebrtcGmpVideoDecoder::InitDecode(const webrtc::VideoCodec* aCodecSettings, } } - nsRefPtr initDone(new InitDoneRunnable()); - mGMPThread->Dispatch(WrapRunnable(this, - &WebrtcGmpVideoDecoder::InitDecode_g, - aCodecSettings, - aNumberOfCores, - initDone.get()), + nsRefPtr initDone(new GmpInitDoneRunnable(mPCHandle)); + mGMPThread->Dispatch(WrapRunnableNM(&WebrtcGmpVideoDecoder::InitDecode_g, + nsRefPtr(this), + aCodecSettings, + aNumberOfCores, + initDone), NS_DISPATCH_NORMAL); - nsCOMPtr currentThread(do_GetCurrentThread()); - while (!initDone->IsDone()) { - NS_ProcessNextEvent(currentThread, true); - } - - return initDone->Result(); + return WEBRTC_VIDEO_CODEC_OK; } -void -WebrtcGmpVideoDecoder::InitDecode_g(const webrtc::VideoCodec* aCodecSettings, - int32_t aNumberOfCores, - InitDoneRunnable* aInitDone) +/* static */ void +WebrtcGmpVideoDecoder::InitDecode_g( + const nsRefPtr& aThis, + const webrtc::VideoCodec* aCodecSettings, + int32_t aNumberOfCores, + const nsRefPtr& aInitDone) { nsTArray tags; tags.AppendElement(NS_LITERAL_CSTRING("h264")); UniquePtr callback( - new InitDoneCallback(this, aInitDone)); - if (NS_WARN_IF(NS_FAILED(mMPS->GetGMPVideoDecoder(&tags, - NS_LITERAL_CSTRING(""), - Move(callback))))) { - mMPS = nullptr; - mGMP = nullptr; - mGMPThread = nullptr; - mHost = nullptr; - aInitDone->Dispatch(WEBRTC_VIDEO_CODEC_ERROR); + new InitDoneCallback(aThis, aInitDone)); + aThis->mInitting = true; + nsresult rv = aThis->mMPS->GetGMPVideoDecoder(&tags, + NS_LITERAL_CSTRING(""), + Move(callback)); + if (NS_WARN_IF(NS_FAILED(rv))) { + LOGD(("GMP Decode: GetGMPVideoDecoder failed")); + aThis->Close_g(); + aInitDone->Dispatch(WEBRTC_VIDEO_CODEC_ERROR, + "GMP Decode: GetGMPVideoDecoder failed."); } } int32_t WebrtcGmpVideoDecoder::GmpInitDone(GMPVideoDecoderProxy* aGMP, - GMPVideoHost* aHost) + GMPVideoHost* aHost, + std::string* aErrorOut) { - mGMP = aGMP; - mHost = aHost; - mMPS = nullptr; - - if (!mGMP || !mHost) { + if (!mInitting || !aGMP || !aHost) { + *aErrorOut = "GMP Decode: Either init was aborted, " + "or init failed to supply either a GMP decoder or GMP host."; + if (aGMP) { + // This could destroy us, since aGMP may be the last thing holding a ref + // Return immediately. + aGMP->Close(); + } return WEBRTC_VIDEO_CODEC_ERROR; } + mInitting = false; + + if (mGMP && mGMP != aGMP) { + Close_g(); + } + + mGMP = aGMP; + mHost = aHost; + mCachedPluginId = mGMP->GetPluginId(); // Bug XXXXXX: transfer settings from codecSettings to codec. GMPVideoCodec codec; memset(&codec, 0, sizeof(codec)); @@ -663,12 +755,27 @@ WebrtcGmpVideoDecoder::GmpInitDone(GMPVideoDecoderProxy* aGMP, nsTArray codecSpecific; nsresult rv = mGMP->InitDecode(codec, codecSpecific, this, 1); if (NS_FAILED(rv)) { + *aErrorOut = "GMP Decode: InitDecode failed"; return WEBRTC_VIDEO_CODEC_ERROR; } return WEBRTC_VIDEO_CODEC_OK; } +void +WebrtcGmpVideoDecoder::Close_g() +{ + GMPVideoDecoderProxy* gmp(mGMP); + mGMP = nullptr; + mHost = nullptr; + mInitting = false; + + if (gmp) { + // Do this last, since this could cause us to be destroyed + gmp->Close(); + } +} + int32_t WebrtcGmpVideoDecoder::Decode(const webrtc::EncodedImage& aInputImage, bool aMissingFrames, @@ -678,6 +785,9 @@ WebrtcGmpVideoDecoder::Decode(const webrtc::EncodedImage& aInputImage, { int32_t ret; MOZ_ASSERT(mGMPThread); + MOZ_ASSERT(!NS_IsMainThread()); + // Would be really nice to avoid this sync dispatch, but it would require a + // copy of the frame, since it doesn't appear to actually have a refcount. mozilla::SyncRunnable::DispatchToThread(mGMPThread, WrapRunnableRet(&ret, this, &WebrtcGmpVideoDecoder::Decode_g, @@ -697,11 +807,12 @@ WebrtcGmpVideoDecoder::Decode_g(const webrtc::EncodedImage& aInputImage, const webrtc::CodecSpecificInfo* aCodecSpecificInfo, int64_t aRenderTimeMs) { - MOZ_ASSERT(mHost); if (!mGMP) { - // destroyed via Terminate() + // destroyed via Terminate(), failed to init, or just not initted yet + LOGD(("GMP Decode: not initted yet")); return WEBRTC_VIDEO_CODEC_ERROR; } + MOZ_ASSERT(mHost); if (!aInputImage._length) { return WEBRTC_VIDEO_CODEC_ERROR; @@ -764,27 +875,29 @@ WebrtcGmpVideoDecoder::Decode_g(const webrtc::EncodedImage& aInputImage, int32_t WebrtcGmpVideoDecoder::RegisterDecodeCompleteCallback( webrtc::DecodedImageCallback* aCallback) { + MutexAutoLock lock(mCallbackMutex); mCallback = aCallback; return WEBRTC_VIDEO_CODEC_OK; } -int32_t -WebrtcGmpVideoDecoder::Release() +/* static */ void +WebrtcGmpVideoDecoder::ReleaseGmp_g(nsRefPtr& aDecoder) { - // Note: we only use SyncRunnables to access mGMP - // Callbacks may occur at any time until we call Close (or receive - // Terminated()), so call Close here synchronously. - if (mGMPThread && mGMP) { - mozilla::SyncRunnable::DispatchToThread(mGMPThread, - WrapRunnableNM(&Decoder_Close_g, mGMP)); + aDecoder->Close_g(); +} + +int32_t +WebrtcGmpVideoDecoder::ReleaseGmp() +{ + LOGD(("GMP Released:")); + if (mGMPThread) { + mGMPThread->Dispatch( + WrapRunnableNM(&WebrtcGmpVideoDecoder::ReleaseGmp_g, + nsRefPtr(this)), + NS_DISPATCH_NORMAL); } - // Now safe to forget things - mMPS = nullptr; - mGMP = nullptr; - mGMPThread = nullptr; - mHost = nullptr; return WEBRTC_VIDEO_CODEC_OK; } @@ -799,17 +912,19 @@ void WebrtcGmpVideoDecoder::Terminated() { LOGD(("GMP Decoder Terminated: %p", (void *)this)); - mCachedPluginId = PluginID(); mGMP->Close(); mGMP = nullptr; + mHost = nullptr; + mInitting = false; // Could now notify that it's dead } void WebrtcGmpVideoDecoder::Decoded(GMPVideoi420Frame* aDecodedFrame) { - if (mCallback) { // paranioa + MutexAutoLock lock(mCallbackMutex); + if (mCallback) { webrtc::I420VideoFrame image; int ret = image.CreateFrame(aDecodedFrame->AllocatedSize(kGMPYPlane), aDecodedFrame->Buffer(kGMPYPlane), diff --git a/media/webrtc/signaling/src/media-conduit/WebrtcGmpVideoCodec.h b/media/webrtc/signaling/src/media-conduit/WebrtcGmpVideoCodec.h index a4f6f8fc1332..efbd9c3ed17e 100644 --- a/media/webrtc/signaling/src/media-conduit/WebrtcGmpVideoCodec.h +++ b/media/webrtc/signaling/src/media-conduit/WebrtcGmpVideoCodec.h @@ -35,6 +35,7 @@ #include #include +#include #include "nsThreadUtils.h" #include "mozilla/Monitor.h" @@ -50,77 +51,67 @@ #include "GMPVideoDecoderProxy.h" #include "GMPVideoEncoderProxy.h" +#include "PeerConnectionImpl.h" + namespace mozilla { -class WebrtcGmpVideoEncoder : public WebrtcVideoEncoder, - public GMPVideoEncoderCallbackProxy +// Class that allows code on the other side of webrtc.org to tell +// WebrtcGmpVideoEncoder/Decoder what PC they should send errors to. +// This is necessary because webrtc.org gives us no way to plumb the handle +// through, nor does it give us any way to inform it of an error that will +// make it back to the PC that cares (except for errors encountered +// synchronously in functions like InitEncode/Decode, which will not happen +// because GMP init is async). +// Right now, this is used in MediaPipelineFactory. +class WebrtcGmpPCHandleSetter { -public: - WebrtcGmpVideoEncoder(); - virtual ~WebrtcGmpVideoEncoder(); - - // Implement VideoEncoder interface. - virtual const uint64_t PluginID() override - { - return mGMP ? mGMP->GetPluginId() : mCachedPluginId; - } - - virtual void Terminated() override; - - virtual int32_t InitEncode(const webrtc::VideoCodec* aCodecSettings, - int32_t aNumberOfCores, - uint32_t aMaxPayloadSize) override; - - virtual int32_t Encode(const webrtc::I420VideoFrame& aInputImage, - const webrtc::CodecSpecificInfo* aCodecSpecificInfo, - const std::vector* aFrameTypes) override; - - virtual int32_t RegisterEncodeCompleteCallback( - webrtc::EncodedImageCallback* aCallback) override; - - virtual int32_t Release() override; - - virtual int32_t SetChannelParameters(uint32_t aPacketLoss, - int aRTT) override; - - virtual int32_t SetRates(uint32_t aNewBitRate, - uint32_t aFrameRate) override; - - // GMPVideoEncoderCallback virtual functions. - virtual void Encoded(GMPVideoEncodedFrame* aEncodedFrame, - const nsTArray& aCodecSpecificInfo) override; - - virtual void Error(GMPErr aError) override { - } - -private: - class InitDoneRunnable : public nsRunnable - { public: - InitDoneRunnable() - : mInitDone(false), - mResult(WEBRTC_VIDEO_CODEC_OK), - mThread(do_GetCurrentThread()) + explicit WebrtcGmpPCHandleSetter(const std::string& aPCHandle); + + ~WebrtcGmpPCHandleSetter(); + + static std::string GetCurrentHandle(); + + private: + static std::string sCurrentHandle; +}; + +class GmpInitDoneRunnable : public nsRunnable +{ + public: + explicit GmpInitDoneRunnable(const std::string& aPCHandle) : + mResult(WEBRTC_VIDEO_CODEC_OK), + mPCHandle(aPCHandle) { } NS_IMETHOD Run() { - MOZ_ASSERT(mThread == nsCOMPtr(do_GetCurrentThread())); - mInitDone = true; + if (mResult == WEBRTC_VIDEO_CODEC_OK) { + // Might be useful to notify the PeerConnection about successful init + // someday. + return NS_OK; + } + + PeerConnectionWrapper wrapper(mPCHandle); + if (wrapper.impl()) { + wrapper.impl()->OnMediaError(mError); + } return NS_OK; } - void Dispatch(int32_t aResult) + void Dispatch(int32_t aResult, const std::string& aError = "") { mResult = aResult; - mThread->Dispatch(this, NS_DISPATCH_NORMAL); - } - - bool IsDone() - { - MOZ_ASSERT(nsCOMPtr(do_GetCurrentThread()) == mThread); - return mInitDone; + mError = aError; + nsCOMPtr mainThread(do_GetMainThread()); + if (mainThread) { + // For some reason, the compiler on CI is treating |this| as a const + // pointer, despite the fact that we're in a non-const function. And, + // interestingly enough, correcting this doesn't require a const_cast. + mainThread->Dispatch(do_AddRef(static_cast(this)), + NS_DISPATCH_NORMAL); + } } int32_t Result() @@ -129,69 +120,122 @@ private: } private: - bool mInitDone; int32_t mResult; - nsCOMPtr mThread; - }; + std::string mPCHandle; + std::string mError; +}; - void InitEncode_g(const webrtc::VideoCodec* aCodecSettings, - int32_t aNumberOfCores, - uint32_t aMaxPayloadSize, - InitDoneRunnable* aInitDone); +class WebrtcGmpVideoEncoder : public GMPVideoEncoderCallbackProxy +{ +public: + WebrtcGmpVideoEncoder(); + NS_INLINE_DECL_THREADSAFE_REFCOUNTING(WebrtcGmpVideoEncoder); + + // Implement VideoEncoder interface, sort of. + // (We cannot use |Release|, since that's needed for nsRefPtr) + virtual const uint64_t PluginID() + { + return mCachedPluginId; + } + + virtual int32_t InitEncode(const webrtc::VideoCodec* aCodecSettings, + int32_t aNumberOfCores, + uint32_t aMaxPayloadSize); + + virtual int32_t Encode(const webrtc::I420VideoFrame& aInputImage, + const webrtc::CodecSpecificInfo* aCodecSpecificInfo, + const std::vector* aFrameTypes); + + virtual int32_t RegisterEncodeCompleteCallback( + webrtc::EncodedImageCallback* aCallback); + + virtual int32_t ReleaseGmp(); + + virtual int32_t SetChannelParameters(uint32_t aPacketLoss, + int aRTT); + + virtual int32_t SetRates(uint32_t aNewBitRate, + uint32_t aFrameRate); + + // GMPVideoEncoderCallback virtual functions. + virtual void Terminated() override; + + virtual void Encoded(GMPVideoEncodedFrame* aEncodedFrame, + const nsTArray& aCodecSpecificInfo) override; + + virtual void Error(GMPErr aError) override { + } + +private: + virtual ~WebrtcGmpVideoEncoder(); + + static void InitEncode_g(const nsRefPtr& aThis, + const GMPVideoCodec& aCodecParams, + int32_t aNumberOfCores, + uint32_t aMaxPayloadSize, + const nsRefPtr& aInitDone); int32_t GmpInitDone(GMPVideoEncoderProxy* aGMP, GMPVideoHost* aHost, - const webrtc::VideoCodec* aCodecSettings, - uint32_t aMaxPayloadSize); - int32_t InitEncoderForSize(unsigned short aWidth, unsigned short aHeight); + const GMPVideoCodec& aCodecParams, + uint32_t aMaxPayloadSize, + std::string* aErrorOut); + int32_t GmpInitDone(GMPVideoEncoderProxy* aGMP, + GMPVideoHost* aHost, + std::string* aErrorOut); + int32_t InitEncoderForSize(unsigned short aWidth, + unsigned short aHeight, + std::string* aErrorOut); + static void ReleaseGmp_g(nsRefPtr& aEncoder); + void Close_g(); class InitDoneCallback : public GetGMPVideoEncoderCallback { public: - InitDoneCallback(WebrtcGmpVideoEncoder* aEncoder, - InitDoneRunnable* aInitDone, - const webrtc::VideoCodec* aCodecSettings, + InitDoneCallback(const nsRefPtr& aEncoder, + const nsRefPtr& aInitDone, + const GMPVideoCodec& aCodecParams, uint32_t aMaxPayloadSize) : mEncoder(aEncoder), mInitDone(aInitDone), - mCodecSettings(aCodecSettings), + mCodecParams(aCodecParams), mMaxPayloadSize(aMaxPayloadSize) { } virtual void Done(GMPVideoEncoderProxy* aGMP, GMPVideoHost* aHost) override { - mEncoder->mGMP = aGMP; - mEncoder->mHost = aHost; - int32_t result; - if (aGMP || aHost) { - result = mEncoder->GmpInitDone(aGMP, aHost, mCodecSettings, - mMaxPayloadSize); - } else { - result = WEBRTC_VIDEO_CODEC_ERROR; - } + std::string errorOut; + int32_t result = mEncoder->GmpInitDone(aGMP, + aHost, + mCodecParams, + mMaxPayloadSize, + &errorOut); - mInitDone->Dispatch(result); + mInitDone->Dispatch(result, errorOut); } private: - WebrtcGmpVideoEncoder* mEncoder; - nsRefPtr mInitDone; - const webrtc::VideoCodec* mCodecSettings; + nsRefPtr mEncoder; + nsRefPtr mInitDone; + GMPVideoCodec mCodecParams; uint32_t mMaxPayloadSize; }; int32_t Encode_g(const webrtc::I420VideoFrame* aInputImage, const webrtc::CodecSpecificInfo* aCodecSpecificInfo, const std::vector* aFrameTypes); - void RegetEncoderForResolutionChange(const webrtc::I420VideoFrame* aInputImage, - InitDoneRunnable* aInitDone); + void RegetEncoderForResolutionChange( + uint32_t aWidth, + uint32_t aHeight, + const nsRefPtr& aInitDone); class InitDoneForResolutionChangeCallback : public GetGMPVideoEncoderCallback { public: - InitDoneForResolutionChangeCallback(WebrtcGmpVideoEncoder* aEncoder, - InitDoneRunnable* aInitDone, - uint32_t aWidth, - uint32_t aHeight) + InitDoneForResolutionChangeCallback( + const nsRefPtr& aEncoder, + const nsRefPtr& aInitDone, + uint32_t aWidth, + uint32_t aHeight) : mEncoder(aEncoder), mInitDone(aInitDone), mWidth(aWidth), @@ -201,66 +245,140 @@ private: virtual void Done(GMPVideoEncoderProxy* aGMP, GMPVideoHost* aHost) override { - mEncoder->mGMP = aGMP; - mEncoder->mHost = aHost; - int32_t result; - if (aGMP && aHost) { - result = mEncoder->InitEncoderForSize(mWidth, mHeight); - } else { - result = WEBRTC_VIDEO_CODEC_ERROR; + std::string errorOut; + int32_t result = mEncoder->GmpInitDone(aGMP, aHost, &errorOut); + if (result != WEBRTC_VIDEO_CODEC_OK) { + mInitDone->Dispatch(result, errorOut); + return; } - mInitDone->Dispatch(result); + result = mEncoder->InitEncoderForSize(mWidth, mHeight, &errorOut); + mInitDone->Dispatch(result, errorOut); } private: - WebrtcGmpVideoEncoder* mEncoder; - nsRefPtr mInitDone; + nsRefPtr mEncoder; + nsRefPtr mInitDone; uint32_t mWidth; uint32_t mHeight; }; - virtual int32_t SetRates_g(uint32_t aNewBitRate, + static int32_t SetRates_g(nsRefPtr aThis, + uint32_t aNewBitRate, uint32_t aFrameRate); nsCOMPtr mMPS; nsCOMPtr mGMPThread; GMPVideoEncoderProxy* mGMP; + // Used to handle a race where Release() is called while init is in progress + bool mInitting; GMPVideoHost* mHost; GMPVideoCodec mCodecParams; uint32_t mMaxPayloadSize; + // Protects mCallback + Mutex mCallbackMutex; webrtc::EncodedImageCallback* mCallback; uint64_t mCachedPluginId; + std::string mPCHandle; }; -class WebrtcGmpVideoDecoder : public WebrtcVideoDecoder, - public GMPVideoDecoderCallbackProxy +// Basically a strong ref to a WebrtcGmpVideoEncoder, that also translates +// from Release() to WebrtcGmpVideoEncoder::ReleaseGmp(), since we need +// WebrtcGmpVideoEncoder::Release() for managing the refcount. +// The webrtc.org code gets one of these, so it doesn't unilaterally delete +// the "real" encoder. +class WebrtcVideoEncoderProxy : public WebrtcVideoEncoder +{ + public: + WebrtcVideoEncoderProxy() : + mEncoderImpl(new WebrtcGmpVideoEncoder) + {} + + virtual ~WebrtcVideoEncoderProxy() + { + RegisterEncodeCompleteCallback(nullptr); + } + + const uint64_t PluginID() override + { + return mEncoderImpl->PluginID(); + } + + int32_t InitEncode(const webrtc::VideoCodec* aCodecSettings, + int32_t aNumberOfCores, + uint32_t aMaxPayloadSize) override + { + return mEncoderImpl->InitEncode(aCodecSettings, + aNumberOfCores, + aMaxPayloadSize); + } + + int32_t Encode( + const webrtc::I420VideoFrame& aInputImage, + const webrtc::CodecSpecificInfo* aCodecSpecificInfo, + const std::vector* aFrameTypes) override + { + return mEncoderImpl->Encode(aInputImage, + aCodecSpecificInfo, + aFrameTypes); + } + + int32_t RegisterEncodeCompleteCallback( + webrtc::EncodedImageCallback* aCallback) override + { + return mEncoderImpl->RegisterEncodeCompleteCallback(aCallback); + } + + int32_t Release() override + { + return mEncoderImpl->ReleaseGmp(); + } + + int32_t SetChannelParameters(uint32_t aPacketLoss, + int aRTT) override + { + return mEncoderImpl->SetChannelParameters(aPacketLoss, aRTT); + } + + int32_t SetRates(uint32_t aNewBitRate, + uint32_t aFrameRate) override + { + return mEncoderImpl->SetRates(aNewBitRate, aFrameRate); + } + + private: + nsRefPtr mEncoderImpl; +}; + +class WebrtcGmpVideoDecoder : public GMPVideoDecoderCallbackProxy { public: WebrtcGmpVideoDecoder(); - virtual ~WebrtcGmpVideoDecoder(); + NS_INLINE_DECL_THREADSAFE_REFCOUNTING(WebrtcGmpVideoDecoder); - // Implement VideoDecoder interface. - virtual const uint64_t PluginID() override + // Implement VideoEncoder interface, sort of. + // (We cannot use |Release|, since that's needed for nsRefPtr) + virtual const uint64_t PluginID() { - return mGMP ? mGMP->GetPluginId() : mCachedPluginId; + return mCachedPluginId; } - virtual void Terminated() override; - virtual int32_t InitDecode(const webrtc::VideoCodec* aCodecSettings, - int32_t aNumberOfCores) override; + int32_t aNumberOfCores); virtual int32_t Decode(const webrtc::EncodedImage& aInputImage, bool aMissingFrames, const webrtc::RTPFragmentationHeader* aFragmentation, - const webrtc::CodecSpecificInfo* aCodecSpecificInfo = nullptr, - int64_t aRenderTimeMs = -1) override; - virtual int32_t RegisterDecodeCompleteCallback(webrtc::DecodedImageCallback* aCallback) override; + const webrtc::CodecSpecificInfo* aCodecSpecificInfo, + int64_t aRenderTimeMs); + virtual int32_t RegisterDecodeCompleteCallback(webrtc::DecodedImageCallback* aCallback); - virtual int32_t Release() override; + virtual int32_t ReleaseGmp(); - virtual int32_t Reset() override; + virtual int32_t Reset(); + + // GMPVideoDecoderCallbackProxy + virtual void Terminated() override; virtual void Decoded(GMPVideoi420Frame* aDecodedFrame) override; @@ -286,56 +404,24 @@ public: } private: - class InitDoneRunnable : public nsRunnable - { - public: - InitDoneRunnable() - : mInitDone(false), - mResult(WEBRTC_VIDEO_CODEC_OK), - mThread(do_GetCurrentThread()) - { - } + virtual ~WebrtcGmpVideoDecoder(); - NS_IMETHOD Run() - { - MOZ_ASSERT(mThread == nsCOMPtr(do_GetCurrentThread())); - mInitDone = true; - return NS_OK; - } - - void Dispatch(int32_t aResult) - { - mResult = aResult; - mThread->Dispatch(this, NS_DISPATCH_NORMAL); - } - - bool IsDone() - { - MOZ_ASSERT(nsCOMPtr(do_GetCurrentThread()) == mThread); - return mInitDone; - } - - int32_t Result() - { - return mResult; - } - - private: - bool mInitDone; - int32_t mResult; - nsCOMPtr mThread; - }; - - void InitDecode_g(const webrtc::VideoCodec* aCodecSettings, - int32_t aNumberOfCores, - InitDoneRunnable* aInitDone); - int32_t GmpInitDone(GMPVideoDecoderProxy* aGMP, GMPVideoHost* aHost); + static void InitDecode_g( + const nsRefPtr& aThis, + const webrtc::VideoCodec* aCodecSettings, + int32_t aNumberOfCores, + const nsRefPtr& aInitDone); + int32_t GmpInitDone(GMPVideoDecoderProxy* aGMP, + GMPVideoHost* aHost, + std::string* aErrorOut); + static void ReleaseGmp_g(nsRefPtr& aDecoder); + void Close_g(); class InitDoneCallback : public GetGMPVideoDecoderCallback { public: explicit InitDoneCallback(WebrtcGmpVideoDecoder* aDecoder, - InitDoneRunnable* aInitDone) + const nsRefPtr& aInitDone) : mDecoder(aDecoder), mInitDone(aInitDone) { @@ -343,15 +429,16 @@ private: virtual void Done(GMPVideoDecoderProxy* aGMP, GMPVideoHost* aHost) { - int32_t result = mDecoder->GmpInitDone(aGMP, aHost); + std::string errorOut; + int32_t result = mDecoder->GmpInitDone(aGMP, aHost, &errorOut); - mInitDone->Dispatch(result); + mInitDone->Dispatch(result, errorOut); } private: WebrtcGmpVideoDecoder* mDecoder; - nsRefPtr mInitDone; -}; + nsRefPtr mInitDone; + }; virtual int32_t Decode_g(const webrtc::EncodedImage& aInputImage, bool aMissingFrames, @@ -362,10 +449,77 @@ private: nsCOMPtr mMPS; nsCOMPtr mGMPThread; GMPVideoDecoderProxy* mGMP; // Addref is held for us + // Used to handle a race where Release() is called while init is in progress + bool mInitting; GMPVideoHost* mHost; + // Protects mCallback + Mutex mCallbackMutex; webrtc::DecodedImageCallback* mCallback; - uint64_t mCachedPluginId; + Atomic mCachedPluginId; GMPErr mDecoderStatus; + std::string mPCHandle; +}; + +// Basically a strong ref to a WebrtcGmpVideoDecoder, that also translates +// from Release() to WebrtcGmpVideoDecoder::ReleaseGmp(), since we need +// WebrtcGmpVideoDecoder::Release() for managing the refcount. +// The webrtc.org code gets one of these, so it doesn't unilaterally delete +// the "real" encoder. +class WebrtcVideoDecoderProxy : public WebrtcVideoDecoder +{ + public: + WebrtcVideoDecoderProxy() : + mDecoderImpl(new WebrtcGmpVideoDecoder) + {} + + virtual ~WebrtcVideoDecoderProxy() + { + RegisterDecodeCompleteCallback(nullptr); + } + + const uint64_t PluginID() override + { + return mDecoderImpl->PluginID(); + } + + int32_t InitDecode(const webrtc::VideoCodec* aCodecSettings, + int32_t aNumberOfCores) override + { + return mDecoderImpl->InitDecode(aCodecSettings, aNumberOfCores); + } + + int32_t Decode( + const webrtc::EncodedImage& aInputImage, + bool aMissingFrames, + const webrtc::RTPFragmentationHeader* aFragmentation, + const webrtc::CodecSpecificInfo* aCodecSpecificInfo, + int64_t aRenderTimeMs) override + { + return mDecoderImpl->Decode(aInputImage, + aMissingFrames, + aFragmentation, + aCodecSpecificInfo, + aRenderTimeMs); + } + + int32_t RegisterDecodeCompleteCallback( + webrtc::DecodedImageCallback* aCallback) override + { + return mDecoderImpl->RegisterDecodeCompleteCallback(aCallback); + } + + int32_t Release() override + { + return mDecoderImpl->ReleaseGmp(); + } + + int32_t Reset() override + { + return mDecoderImpl->Reset(); + } + + private: + nsRefPtr mDecoderImpl; }; } diff --git a/media/webrtc/signaling/src/peerconnection/MediaPipelineFactory.cpp b/media/webrtc/signaling/src/peerconnection/MediaPipelineFactory.cpp index df063637fb9d..eef414c71b20 100644 --- a/media/webrtc/signaling/src/peerconnection/MediaPipelineFactory.cpp +++ b/media/webrtc/signaling/src/peerconnection/MediaPipelineFactory.cpp @@ -40,6 +40,10 @@ #include "mozilla/Preferences.h" #endif +#if !defined(MOZILLA_EXTERNAL_LINKAGE) +#include "WebrtcGmpVideoCodec.h" +#endif + #include namespace mozilla { @@ -315,6 +319,14 @@ MediaPipelineFactory::CreateOrUpdateMediaPipeline( const JsepTrackPair& aTrackPair, const JsepTrack& aTrack) { +#if !defined(MOZILLA_EXTERNAL_LINKAGE) + // The GMP code is all the way on the other side of webrtc.org, and it is not + // feasible to plumb this information all the way through. So, we set it (for + // the duration of this call) in a global variable. This allows the GMP code + // to report errors to the PC. + WebrtcGmpPCHandleSetter setter(mPC->GetHandle()); +#endif + MOZ_ASSERT(aTrackPair.mRtpTransport); bool receiving = diff --git a/media/webrtc/signaling/src/peerconnection/PeerConnectionImpl.cpp b/media/webrtc/signaling/src/peerconnection/PeerConnectionImpl.cpp index 770471ceb240..e7c12469db93 100644 --- a/media/webrtc/signaling/src/peerconnection/PeerConnectionImpl.cpp +++ b/media/webrtc/signaling/src/peerconnection/PeerConnectionImpl.cpp @@ -2030,6 +2030,13 @@ PeerConnectionImpl::GetStreamId(const DOMMediaStream& aStream) #endif } +void +PeerConnectionImpl::OnMediaError(const std::string& aError) +{ + CSFLogError(logTag, "Encountered media error! %s", aError.c_str()); + // TODO: Let content know about this somehow. +} + nsresult PeerConnectionImpl::AddTrack(MediaStreamTrack& aTrack, const Sequence>& aStreams) diff --git a/media/webrtc/signaling/src/peerconnection/PeerConnectionImpl.h b/media/webrtc/signaling/src/peerconnection/PeerConnectionImpl.h index c7f03959cfde..9052f6d9e525 100644 --- a/media/webrtc/signaling/src/peerconnection/PeerConnectionImpl.h +++ b/media/webrtc/signaling/src/peerconnection/PeerConnectionImpl.h @@ -618,6 +618,8 @@ public: static std::string GetStreamId(const DOMMediaStream& aStream); static std::string GetTrackId(const dom::MediaStreamTrack& track); + void OnMediaError(const std::string& aError); + private: virtual ~PeerConnectionImpl(); PeerConnectionImpl(const PeerConnectionImpl&rhs); From 07a783a7bb219d46a1aea2729302a66ecdd043d7 Mon Sep 17 00:00:00 2001 From: Sotaro Ikeda Date: Fri, 24 Jul 2015 11:28:28 -0700 Subject: [PATCH 022/136] Bug 1187345 - Fix HwcComposer2D::mCompositorParent handling r=mwu --- widget/gonk/HwcComposer2D.h | 2 +- widget/gonk/nsWindow.cpp | 10 ++++++++++ widget/gonk/nsWindow.h | 1 + widget/nsBaseWidget.h | 2 +- 4 files changed, 13 insertions(+), 2 deletions(-) diff --git a/widget/gonk/HwcComposer2D.h b/widget/gonk/HwcComposer2D.h index a9d667b2db2e..4da7cf85cf23 100644 --- a/widget/gonk/HwcComposer2D.h +++ b/widget/gonk/HwcComposer2D.h @@ -111,7 +111,7 @@ private: nsTArray mHwcLayerMap; bool mPrepared; bool mHasHWVsync; - nsRefPtr mCompositorParent; + layers::CompositorParent* mCompositorParent; Mutex mLock; }; diff --git a/widget/gonk/nsWindow.cpp b/widget/gonk/nsWindow.cpp index c182f9d73c32..36b7ceff5bbe 100644 --- a/widget/gonk/nsWindow.cpp +++ b/widget/gonk/nsWindow.cpp @@ -763,6 +763,16 @@ nsWindow::GetLayerManager(PLayerTransactionChild* aShadowManager, return mLayerManager; } +void +nsWindow::DestroyCompositor() +{ + if (mCompositorParent && mScreen->IsPrimaryScreen()) { + // Unset CompositorParent + mComposer2D->SetCompositorParent(nullptr); + } + nsBaseWidget::DestroyCompositor(); +} + void nsWindow::BringToTop() { diff --git a/widget/gonk/nsWindow.h b/widget/gonk/nsWindow.h index 7f6d527d1d62..ab3a3cc3fedf 100644 --- a/widget/gonk/nsWindow.h +++ b/widget/gonk/nsWindow.h @@ -113,6 +113,7 @@ public: LayersBackend aBackendHint = mozilla::layers::LayersBackend::LAYERS_NONE, LayerManagerPersistence aPersistence = LAYER_MANAGER_CURRENT, bool* aAllowRetaining = nullptr); + virtual void DestroyCompositor(); NS_IMETHOD_(void) SetInputContext(const InputContext& aContext, const InputContextAction& aAction); diff --git a/widget/nsBaseWidget.h b/widget/nsBaseWidget.h index 8e2edef8d5e8..3bf9ec9c7217 100644 --- a/widget/nsBaseWidget.h +++ b/widget/nsBaseWidget.h @@ -484,7 +484,7 @@ protected: * require the compositor to be destroyed before ~nsBaseWidget is * reached (This is the case with gtk2 for instance). */ - void DestroyCompositor(); + virtual void DestroyCompositor(); void DestroyLayerManager(); void FreeShutdownObserver(); From 61b7978daf558944e996e792900afc7f0c4faa37 Mon Sep 17 00:00:00 2001 From: Kartikaya Gupta Date: Fri, 24 Jul 2015 14:33:47 -0400 Subject: [PATCH 023/136] Bug 1134917 - Hoist assertion into the one callsite where it is actually valid. r=botond --- gfx/layers/apz/util/APZEventState.cpp | 11 ++++++----- gfx/layers/apz/util/APZEventState.h | 3 +-- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/gfx/layers/apz/util/APZEventState.cpp b/gfx/layers/apz/util/APZEventState.cpp index 656d29e13ddb..0c67d71b0622 100644 --- a/gfx/layers/apz/util/APZEventState.cpp +++ b/gfx/layers/apz/util/APZEventState.cpp @@ -216,7 +216,7 @@ APZEventState::ProcessLongTap(const nsCOMPtr& aPresShell, return; } - SendPendingTouchPreventedResponse(false, aGuid); + SendPendingTouchPreventedResponse(false); // Converting the modifiers to DOM format for the DispatchMouseEvent call // is the most useless thing ever because nsDOMWindowUtils::SendMouseEvent @@ -290,7 +290,10 @@ APZEventState::ProcessTouchEvent(const WidgetTouchEvent& aEvent, mActiveElementManager->HandleTouchEndEvent(mEndTouchIsClick); // fall through case NS_TOUCH_MOVE: { - sentContentResponse = SendPendingTouchPreventedResponse(isTouchPrevented, aGuid); + if (mPendingTouchPreventedResponse) { + MOZ_ASSERT(aGuid == mPendingTouchPreventedGuid); + } + sentContentResponse = SendPendingTouchPreventedResponse(isTouchPrevented); break; } @@ -396,11 +399,9 @@ APZEventState::ProcessAPZStateChange(const nsCOMPtr& aDocument, } bool -APZEventState::SendPendingTouchPreventedResponse(bool aPreventDefault, - const ScrollableLayerGuid& aGuid) +APZEventState::SendPendingTouchPreventedResponse(bool aPreventDefault) { if (mPendingTouchPreventedResponse) { - MOZ_ASSERT(aGuid == mPendingTouchPreventedGuid); mContentReceivedInputBlockCallback->Run(mPendingTouchPreventedGuid, mPendingTouchPreventedBlockId, aPreventDefault); mPendingTouchPreventedResponse = false; diff --git a/gfx/layers/apz/util/APZEventState.h b/gfx/layers/apz/util/APZEventState.h index 9a099f4cf670..539363d37c49 100644 --- a/gfx/layers/apz/util/APZEventState.h +++ b/gfx/layers/apz/util/APZEventState.h @@ -71,8 +71,7 @@ public: int aArg); private: ~APZEventState(); - bool SendPendingTouchPreventedResponse(bool aPreventDefault, - const ScrollableLayerGuid& aGuid); + bool SendPendingTouchPreventedResponse(bool aPreventDefault); already_AddRefed GetWidget() const; private: nsWeakPtr mWidget; From 3b6e0b8b2cda5ae533dacac07eb3f90f3fedb287 Mon Sep 17 00:00:00 2001 From: Sean Stangl Date: Thu, 23 Jul 2015 15:26:52 -0700 Subject: [PATCH 024/136] Bug 1187094 - Move Lowering's visitConstant() to shared code. r=nbp --- js/src/jit/arm/Lowering-arm.cpp | 25 ------------------- js/src/jit/arm/Lowering-arm.h | 3 --- js/src/jit/arm64/Lowering-arm64.cpp | 18 ------------- js/src/jit/arm64/Lowering-arm64.h | 3 --- js/src/jit/mips/Lowering-mips.cpp | 25 ------------------- js/src/jit/mips/Lowering-mips.h | 3 --- js/src/jit/shared/Lowering-shared.cpp | 11 ++++++++ js/src/jit/shared/Lowering-shared.h | 7 ++++++ js/src/jit/x86-shared/Lowering-x86-shared.cpp | 25 ------------------- js/src/jit/x86-shared/Lowering-x86-shared.h | 3 --- 10 files changed, 18 insertions(+), 105 deletions(-) diff --git a/js/src/jit/arm/Lowering-arm.cpp b/js/src/jit/arm/Lowering-arm.cpp index aa5726957b04..6b5d8cb31409 100644 --- a/js/src/jit/arm/Lowering-arm.cpp +++ b/js/src/jit/arm/Lowering-arm.cpp @@ -47,31 +47,6 @@ LIRGeneratorARM::tempByteOpRegister() return temp(); } -void -LIRGeneratorARM::lowerConstantDouble(double d, MInstruction* mir) -{ - define(new(alloc()) LDouble(d), mir); -} - -void -LIRGeneratorARM::lowerConstantFloat32(float d, MInstruction* mir) -{ - define(new(alloc()) LFloat32(d), mir); -} - -void -LIRGeneratorARM::visitConstant(MConstant* ins) -{ - if (ins->type() == MIRType_Double) - lowerConstantDouble(ins->value().toDouble(), ins); - else if (ins->type() == MIRType_Float32) - lowerConstantFloat32(ins->value().toDouble(), ins); - else if (ins->canEmitAtUses()) - emitAtUses(ins); - else - LIRGeneratorShared::visitConstant(ins); -} - void LIRGeneratorARM::visitBox(MBox* box) { diff --git a/js/src/jit/arm/Lowering-arm.h b/js/src/jit/arm/Lowering-arm.h index 6ecd141333f9..e03e9a9b7f05 100644 --- a/js/src/jit/arm/Lowering-arm.h +++ b/js/src/jit/arm/Lowering-arm.h @@ -66,8 +66,6 @@ class LIRGeneratorARM : public LIRGeneratorShared void lowerForBitAndAndBranch(LBitAndAndBranch* baab, MInstruction* mir, MDefinition* lhs, MDefinition* rhs); - void lowerConstantDouble(double d, MInstruction* ins); - void lowerConstantFloat32(float d, MInstruction* ins); void lowerTruncateDToInt32(MTruncateToInt32* ins); void lowerTruncateFToInt32(MTruncateToInt32* ins); void lowerDivI(MDiv* div); @@ -83,7 +81,6 @@ class LIRGeneratorARM : public LIRGeneratorShared LTableSwitchV* newLTableSwitchV(MTableSwitch* ins); public: - void visitConstant(MConstant* ins); void visitBox(MBox* box); void visitUnbox(MUnbox* unbox); void visitReturn(MReturn* ret); diff --git a/js/src/jit/arm64/Lowering-arm64.cpp b/js/src/jit/arm64/Lowering-arm64.cpp index 6a2c700b0108..63a837249daf 100644 --- a/js/src/jit/arm64/Lowering-arm64.cpp +++ b/js/src/jit/arm64/Lowering-arm64.cpp @@ -42,24 +42,6 @@ LIRGeneratorARM64::useByteOpRegisterOrNonDoubleConstant(MDefinition* mir) MOZ_CRASH("useByteOpRegisterOrNonDoubleConstant"); } -void -LIRGeneratorARM64::lowerConstantDouble(double d, MInstruction* mir) -{ - MOZ_CRASH("lowerConstantDouble"); -} - -void -LIRGeneratorARM64::lowerConstantFloat32(float d, MInstruction* mir) -{ - MOZ_CRASH("lowerConstantFloat32"); -} - -void -LIRGeneratorARM64::visitConstant(MConstant* ins) -{ - MOZ_CRASH("visitConstant"); -} - void LIRGeneratorARM64::visitBox(MBox* box) { diff --git a/js/src/jit/arm64/Lowering-arm64.h b/js/src/jit/arm64/Lowering-arm64.h index 5c26534f631b..d71cedc239f2 100644 --- a/js/src/jit/arm64/Lowering-arm64.h +++ b/js/src/jit/arm64/Lowering-arm64.h @@ -70,8 +70,6 @@ class LIRGeneratorARM64 : public LIRGeneratorShared void lowerForBitAndAndBranch(LBitAndAndBranch* baab, MInstruction* mir, MDefinition* lhs, MDefinition* rhs); - void lowerConstantDouble(double d, MInstruction* ins); - void lowerConstantFloat32(float d, MInstruction* ins); void lowerTruncateDToInt32(MTruncateToInt32* ins); void lowerTruncateFToInt32(MTruncateToInt32* ins); void lowerDivI(MDiv* div); @@ -88,7 +86,6 @@ class LIRGeneratorARM64 : public LIRGeneratorShared MTableSwitch* ins); public: - void visitConstant(MConstant* ins); void visitBox(MBox* box); void visitUnbox(MUnbox* unbox); void visitReturn(MReturn* ret); diff --git a/js/src/jit/mips/Lowering-mips.cpp b/js/src/jit/mips/Lowering-mips.cpp index 36309b9bcfe6..15d7fde0c1c3 100644 --- a/js/src/jit/mips/Lowering-mips.cpp +++ b/js/src/jit/mips/Lowering-mips.cpp @@ -48,31 +48,6 @@ LIRGeneratorMIPS::tempByteOpRegister() return temp(); } -void -LIRGeneratorMIPS::lowerConstantDouble(double d, MInstruction* mir) -{ - return define(new(alloc()) LDouble(d), mir); -} - -void -LIRGeneratorMIPS::lowerConstantFloat32(float d, MInstruction* mir) -{ - define(new(alloc()) LFloat32(d), mir); -} - -void -LIRGeneratorMIPS::visitConstant(MConstant* ins) -{ - if (ins->type() == MIRType_Double) - lowerConstantDouble(ins->value().toDouble(), ins); - else if (ins->type() == MIRType_Float32) - lowerConstantFloat32(ins->value().toDouble(), ins); - else if (ins->canEmitAtUses()) - emitAtUses(ins); - else - LIRGeneratorShared::visitConstant(ins); -} - void LIRGeneratorMIPS::visitBox(MBox* box) { diff --git a/js/src/jit/mips/Lowering-mips.h b/js/src/jit/mips/Lowering-mips.h index a53417ec7977..00a001121ff8 100644 --- a/js/src/jit/mips/Lowering-mips.h +++ b/js/src/jit/mips/Lowering-mips.h @@ -66,8 +66,6 @@ class LIRGeneratorMIPS : public LIRGeneratorShared void lowerForBitAndAndBranch(LBitAndAndBranch* baab, MInstruction* mir, MDefinition* lhs, MDefinition* rhs); - void lowerConstantDouble(double d, MInstruction* ins); - void lowerConstantFloat32(float d, MInstruction* ins); void lowerTruncateDToInt32(MTruncateToInt32* ins); void lowerTruncateFToInt32(MTruncateToInt32* ins); void lowerDivI(MDiv* div); @@ -83,7 +81,6 @@ class LIRGeneratorMIPS : public LIRGeneratorShared LTableSwitchV* newLTableSwitchV(MTableSwitch* ins); public: - void visitConstant(MConstant* ins); void visitBox(MBox* box); void visitUnbox(MUnbox* unbox); void visitReturn(MReturn* ret); diff --git a/js/src/jit/shared/Lowering-shared.cpp b/js/src/jit/shared/Lowering-shared.cpp index a60e7fc02943..4e3286331c76 100644 --- a/js/src/jit/shared/Lowering-shared.cpp +++ b/js/src/jit/shared/Lowering-shared.cpp @@ -74,8 +74,19 @@ LIRGeneratorShared::ReorderCommutative(MDefinition** lhsp, MDefinition** rhsp, M void LIRGeneratorShared::visitConstant(MConstant* ins) { + if (!IsFloatingPointType(ins->type()) && ins->canEmitAtUses()) { + emitAtUses(ins); + return; + } + const Value& v = ins->value(); switch (ins->type()) { + case MIRType_Double: + define(new(alloc()) LDouble(v.toDouble()), ins); + break; + case MIRType_Float32: + define(new(alloc()) LFloat32(v.toDouble()), ins); + break; case MIRType_Boolean: define(new(alloc()) LInteger(v.toBoolean()), ins); break; diff --git a/js/src/jit/shared/Lowering-shared.h b/js/src/jit/shared/Lowering-shared.h index e9b39bb6ddec..1f22336bfff8 100644 --- a/js/src/jit/shared/Lowering-shared.h +++ b/js/src/jit/shared/Lowering-shared.h @@ -208,6 +208,13 @@ class LIRGeneratorShared : public MDefinitionVisitor BailoutKind kind = Bailout_DuringVMCall); public: + void lowerConstantDouble(double d, MInstruction* mir) { + define(new(alloc()) LDouble(d), mir); + } + void lowerConstantFloat32(float f, MInstruction* mir) { + define(new(alloc()) LFloat32(f), mir); + } + void visitConstant(MConstant* ins); // Whether to generate typed reads for element accesses with hole checks. diff --git a/js/src/jit/x86-shared/Lowering-x86-shared.cpp b/js/src/jit/x86-shared/Lowering-x86-shared.cpp index d16b3f1ebdb0..2eccb198439b 100644 --- a/js/src/jit/x86-shared/Lowering-x86-shared.cpp +++ b/js/src/jit/x86-shared/Lowering-x86-shared.cpp @@ -353,31 +353,6 @@ LIRGeneratorX86Shared::lowerUrshD(MUrsh* mir) define(lir, mir); } -void -LIRGeneratorX86Shared::lowerConstantDouble(double d, MInstruction* mir) -{ - define(new(alloc()) LDouble(d), mir); -} - -void -LIRGeneratorX86Shared::lowerConstantFloat32(float f, MInstruction* mir) -{ - define(new(alloc()) LFloat32(f), mir); -} - -void -LIRGeneratorX86Shared::visitConstant(MConstant* ins) -{ - if (ins->type() == MIRType_Double) - lowerConstantDouble(ins->value().toDouble(), ins); - else if (ins->type() == MIRType_Float32) - lowerConstantFloat32(ins->value().toDouble(), ins); - else if (ins->canEmitAtUses()) - emitAtUses(ins); // Emit non-double constants at their uses. - else - LIRGeneratorShared::visitConstant(ins); -} - void LIRGeneratorX86Shared::lowerTruncateDToInt32(MTruncateToInt32* ins) { diff --git a/js/src/jit/x86-shared/Lowering-x86-shared.h b/js/src/jit/x86-shared/Lowering-x86-shared.h index 1c613b579bde..8e9ca8c6ae85 100644 --- a/js/src/jit/x86-shared/Lowering-x86-shared.h +++ b/js/src/jit/x86-shared/Lowering-x86-shared.h @@ -40,7 +40,6 @@ class LIRGeneratorX86Shared : public LIRGeneratorShared MDefinition* lhs, MDefinition* rhs); void lowerForBitAndAndBranch(LBitAndAndBranch* baab, MInstruction* mir, MDefinition* lhs, MDefinition* rhs); - void visitConstant(MConstant* ins); void visitAsmJSNeg(MAsmJSNeg* ins); void lowerMulI(MMul* mul, MDefinition* lhs, MDefinition* rhs); void lowerDivI(MDiv* div); @@ -48,8 +47,6 @@ class LIRGeneratorX86Shared : public LIRGeneratorShared void lowerUDiv(MDiv* div); void lowerUMod(MMod* mod); void lowerUrshD(MUrsh* mir); - void lowerConstantDouble(double d, MInstruction* ins); - void lowerConstantFloat32(float d, MInstruction* ins); void lowerTruncateDToInt32(MTruncateToInt32* ins); void lowerTruncateFToInt32(MTruncateToInt32* ins); void visitSimdBinaryArith(MSimdBinaryArith* ins); From 9628075cb4a8f90887f594410a291ebd81b7b9b5 Mon Sep 17 00:00:00 2001 From: George Wright Date: Fri, 24 Jul 2015 14:52:20 -0400 Subject: [PATCH 025/136] Bug 1184276 - Add some logging and don't bail if we can't find an nsPluginTag in RecvGetBlocklistState to try and get more diagnostic info r=billm --- dom/ipc/ContentParent.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/dom/ipc/ContentParent.cpp b/dom/ipc/ContentParent.cpp index a1eca72b5ba8..aef9a0096683 100755 --- a/dom/ipc/ContentParent.cpp +++ b/dom/ipc/ContentParent.cpp @@ -1121,12 +1121,15 @@ ContentParent::RecvGetBlocklistState(const uint32_t& aPluginId, nsRefPtr pluginHost = nsPluginHost::GetInst(); if (!pluginHost) { + NS_WARNING("Plugin host not found"); return false; } nsPluginTag* tag = pluginHost->PluginWithId(aPluginId); if (!tag) { - return false; + // Default state is blocked anyway + NS_WARNING("Plugin tag not found. This should never happen, but to avoid a crash we're forcibly blocking it"); + return true; } return NS_SUCCEEDED(tag->GetBlocklistState(aState)); From 68b4da0a7f80d3bc3c4393e34f01d5ac7b6e2ba8 Mon Sep 17 00:00:00 2001 From: Eric Rahm Date: Fri, 24 Jul 2015 12:08:26 -0700 Subject: [PATCH 026/136] Bug 1184285 - Stop warning if RemoveObserver() is called for unregistered observer. r=dhylands Bug 789130 swapped out an assert for a warning, but in the discussion it's clear that the API was intentionally loosened to allow for this condition. Here the warning is removed as this is expected behavior. --- hal/Hal.cpp | 1 - 1 file changed, 1 deletion(-) diff --git a/hal/Hal.cpp b/hal/Hal.cpp index 316de7e69ceb..e1f2d937fab5 100644 --- a/hal/Hal.cpp +++ b/hal/Hal.cpp @@ -202,7 +202,6 @@ public: void RemoveObserver(Observer* aObserver) { bool removed = mObservers && mObservers->RemoveObserver(aObserver); if (!removed) { - NS_WARNING("RemoveObserver() called for unregistered observer"); return; } From 9ffc1fbec28e52809e79543cb1a1d2fd55cab26b Mon Sep 17 00:00:00 2001 From: Wes Kocher Date: Fri, 24 Jul 2015 12:11:13 -0700 Subject: [PATCH 027/136] Backed out changeset 8a1df23b6a3f (bug 1187094) for build failures --- js/src/jit/arm/Lowering-arm.cpp | 25 +++++++++++++++++++ js/src/jit/arm/Lowering-arm.h | 3 +++ js/src/jit/arm64/Lowering-arm64.cpp | 18 +++++++++++++ js/src/jit/arm64/Lowering-arm64.h | 3 +++ js/src/jit/mips/Lowering-mips.cpp | 25 +++++++++++++++++++ js/src/jit/mips/Lowering-mips.h | 3 +++ js/src/jit/shared/Lowering-shared.cpp | 11 -------- js/src/jit/shared/Lowering-shared.h | 7 ------ js/src/jit/x86-shared/Lowering-x86-shared.cpp | 25 +++++++++++++++++++ js/src/jit/x86-shared/Lowering-x86-shared.h | 3 +++ 10 files changed, 105 insertions(+), 18 deletions(-) diff --git a/js/src/jit/arm/Lowering-arm.cpp b/js/src/jit/arm/Lowering-arm.cpp index 6b5d8cb31409..aa5726957b04 100644 --- a/js/src/jit/arm/Lowering-arm.cpp +++ b/js/src/jit/arm/Lowering-arm.cpp @@ -47,6 +47,31 @@ LIRGeneratorARM::tempByteOpRegister() return temp(); } +void +LIRGeneratorARM::lowerConstantDouble(double d, MInstruction* mir) +{ + define(new(alloc()) LDouble(d), mir); +} + +void +LIRGeneratorARM::lowerConstantFloat32(float d, MInstruction* mir) +{ + define(new(alloc()) LFloat32(d), mir); +} + +void +LIRGeneratorARM::visitConstant(MConstant* ins) +{ + if (ins->type() == MIRType_Double) + lowerConstantDouble(ins->value().toDouble(), ins); + else if (ins->type() == MIRType_Float32) + lowerConstantFloat32(ins->value().toDouble(), ins); + else if (ins->canEmitAtUses()) + emitAtUses(ins); + else + LIRGeneratorShared::visitConstant(ins); +} + void LIRGeneratorARM::visitBox(MBox* box) { diff --git a/js/src/jit/arm/Lowering-arm.h b/js/src/jit/arm/Lowering-arm.h index e03e9a9b7f05..6ecd141333f9 100644 --- a/js/src/jit/arm/Lowering-arm.h +++ b/js/src/jit/arm/Lowering-arm.h @@ -66,6 +66,8 @@ class LIRGeneratorARM : public LIRGeneratorShared void lowerForBitAndAndBranch(LBitAndAndBranch* baab, MInstruction* mir, MDefinition* lhs, MDefinition* rhs); + void lowerConstantDouble(double d, MInstruction* ins); + void lowerConstantFloat32(float d, MInstruction* ins); void lowerTruncateDToInt32(MTruncateToInt32* ins); void lowerTruncateFToInt32(MTruncateToInt32* ins); void lowerDivI(MDiv* div); @@ -81,6 +83,7 @@ class LIRGeneratorARM : public LIRGeneratorShared LTableSwitchV* newLTableSwitchV(MTableSwitch* ins); public: + void visitConstant(MConstant* ins); void visitBox(MBox* box); void visitUnbox(MUnbox* unbox); void visitReturn(MReturn* ret); diff --git a/js/src/jit/arm64/Lowering-arm64.cpp b/js/src/jit/arm64/Lowering-arm64.cpp index 63a837249daf..6a2c700b0108 100644 --- a/js/src/jit/arm64/Lowering-arm64.cpp +++ b/js/src/jit/arm64/Lowering-arm64.cpp @@ -42,6 +42,24 @@ LIRGeneratorARM64::useByteOpRegisterOrNonDoubleConstant(MDefinition* mir) MOZ_CRASH("useByteOpRegisterOrNonDoubleConstant"); } +void +LIRGeneratorARM64::lowerConstantDouble(double d, MInstruction* mir) +{ + MOZ_CRASH("lowerConstantDouble"); +} + +void +LIRGeneratorARM64::lowerConstantFloat32(float d, MInstruction* mir) +{ + MOZ_CRASH("lowerConstantFloat32"); +} + +void +LIRGeneratorARM64::visitConstant(MConstant* ins) +{ + MOZ_CRASH("visitConstant"); +} + void LIRGeneratorARM64::visitBox(MBox* box) { diff --git a/js/src/jit/arm64/Lowering-arm64.h b/js/src/jit/arm64/Lowering-arm64.h index d71cedc239f2..5c26534f631b 100644 --- a/js/src/jit/arm64/Lowering-arm64.h +++ b/js/src/jit/arm64/Lowering-arm64.h @@ -70,6 +70,8 @@ class LIRGeneratorARM64 : public LIRGeneratorShared void lowerForBitAndAndBranch(LBitAndAndBranch* baab, MInstruction* mir, MDefinition* lhs, MDefinition* rhs); + void lowerConstantDouble(double d, MInstruction* ins); + void lowerConstantFloat32(float d, MInstruction* ins); void lowerTruncateDToInt32(MTruncateToInt32* ins); void lowerTruncateFToInt32(MTruncateToInt32* ins); void lowerDivI(MDiv* div); @@ -86,6 +88,7 @@ class LIRGeneratorARM64 : public LIRGeneratorShared MTableSwitch* ins); public: + void visitConstant(MConstant* ins); void visitBox(MBox* box); void visitUnbox(MUnbox* unbox); void visitReturn(MReturn* ret); diff --git a/js/src/jit/mips/Lowering-mips.cpp b/js/src/jit/mips/Lowering-mips.cpp index 15d7fde0c1c3..36309b9bcfe6 100644 --- a/js/src/jit/mips/Lowering-mips.cpp +++ b/js/src/jit/mips/Lowering-mips.cpp @@ -48,6 +48,31 @@ LIRGeneratorMIPS::tempByteOpRegister() return temp(); } +void +LIRGeneratorMIPS::lowerConstantDouble(double d, MInstruction* mir) +{ + return define(new(alloc()) LDouble(d), mir); +} + +void +LIRGeneratorMIPS::lowerConstantFloat32(float d, MInstruction* mir) +{ + define(new(alloc()) LFloat32(d), mir); +} + +void +LIRGeneratorMIPS::visitConstant(MConstant* ins) +{ + if (ins->type() == MIRType_Double) + lowerConstantDouble(ins->value().toDouble(), ins); + else if (ins->type() == MIRType_Float32) + lowerConstantFloat32(ins->value().toDouble(), ins); + else if (ins->canEmitAtUses()) + emitAtUses(ins); + else + LIRGeneratorShared::visitConstant(ins); +} + void LIRGeneratorMIPS::visitBox(MBox* box) { diff --git a/js/src/jit/mips/Lowering-mips.h b/js/src/jit/mips/Lowering-mips.h index 00a001121ff8..a53417ec7977 100644 --- a/js/src/jit/mips/Lowering-mips.h +++ b/js/src/jit/mips/Lowering-mips.h @@ -66,6 +66,8 @@ class LIRGeneratorMIPS : public LIRGeneratorShared void lowerForBitAndAndBranch(LBitAndAndBranch* baab, MInstruction* mir, MDefinition* lhs, MDefinition* rhs); + void lowerConstantDouble(double d, MInstruction* ins); + void lowerConstantFloat32(float d, MInstruction* ins); void lowerTruncateDToInt32(MTruncateToInt32* ins); void lowerTruncateFToInt32(MTruncateToInt32* ins); void lowerDivI(MDiv* div); @@ -81,6 +83,7 @@ class LIRGeneratorMIPS : public LIRGeneratorShared LTableSwitchV* newLTableSwitchV(MTableSwitch* ins); public: + void visitConstant(MConstant* ins); void visitBox(MBox* box); void visitUnbox(MUnbox* unbox); void visitReturn(MReturn* ret); diff --git a/js/src/jit/shared/Lowering-shared.cpp b/js/src/jit/shared/Lowering-shared.cpp index 4e3286331c76..a60e7fc02943 100644 --- a/js/src/jit/shared/Lowering-shared.cpp +++ b/js/src/jit/shared/Lowering-shared.cpp @@ -74,19 +74,8 @@ LIRGeneratorShared::ReorderCommutative(MDefinition** lhsp, MDefinition** rhsp, M void LIRGeneratorShared::visitConstant(MConstant* ins) { - if (!IsFloatingPointType(ins->type()) && ins->canEmitAtUses()) { - emitAtUses(ins); - return; - } - const Value& v = ins->value(); switch (ins->type()) { - case MIRType_Double: - define(new(alloc()) LDouble(v.toDouble()), ins); - break; - case MIRType_Float32: - define(new(alloc()) LFloat32(v.toDouble()), ins); - break; case MIRType_Boolean: define(new(alloc()) LInteger(v.toBoolean()), ins); break; diff --git a/js/src/jit/shared/Lowering-shared.h b/js/src/jit/shared/Lowering-shared.h index 1f22336bfff8..e9b39bb6ddec 100644 --- a/js/src/jit/shared/Lowering-shared.h +++ b/js/src/jit/shared/Lowering-shared.h @@ -208,13 +208,6 @@ class LIRGeneratorShared : public MDefinitionVisitor BailoutKind kind = Bailout_DuringVMCall); public: - void lowerConstantDouble(double d, MInstruction* mir) { - define(new(alloc()) LDouble(d), mir); - } - void lowerConstantFloat32(float f, MInstruction* mir) { - define(new(alloc()) LFloat32(f), mir); - } - void visitConstant(MConstant* ins); // Whether to generate typed reads for element accesses with hole checks. diff --git a/js/src/jit/x86-shared/Lowering-x86-shared.cpp b/js/src/jit/x86-shared/Lowering-x86-shared.cpp index 2eccb198439b..d16b3f1ebdb0 100644 --- a/js/src/jit/x86-shared/Lowering-x86-shared.cpp +++ b/js/src/jit/x86-shared/Lowering-x86-shared.cpp @@ -353,6 +353,31 @@ LIRGeneratorX86Shared::lowerUrshD(MUrsh* mir) define(lir, mir); } +void +LIRGeneratorX86Shared::lowerConstantDouble(double d, MInstruction* mir) +{ + define(new(alloc()) LDouble(d), mir); +} + +void +LIRGeneratorX86Shared::lowerConstantFloat32(float f, MInstruction* mir) +{ + define(new(alloc()) LFloat32(f), mir); +} + +void +LIRGeneratorX86Shared::visitConstant(MConstant* ins) +{ + if (ins->type() == MIRType_Double) + lowerConstantDouble(ins->value().toDouble(), ins); + else if (ins->type() == MIRType_Float32) + lowerConstantFloat32(ins->value().toDouble(), ins); + else if (ins->canEmitAtUses()) + emitAtUses(ins); // Emit non-double constants at their uses. + else + LIRGeneratorShared::visitConstant(ins); +} + void LIRGeneratorX86Shared::lowerTruncateDToInt32(MTruncateToInt32* ins) { diff --git a/js/src/jit/x86-shared/Lowering-x86-shared.h b/js/src/jit/x86-shared/Lowering-x86-shared.h index 8e9ca8c6ae85..1c613b579bde 100644 --- a/js/src/jit/x86-shared/Lowering-x86-shared.h +++ b/js/src/jit/x86-shared/Lowering-x86-shared.h @@ -40,6 +40,7 @@ class LIRGeneratorX86Shared : public LIRGeneratorShared MDefinition* lhs, MDefinition* rhs); void lowerForBitAndAndBranch(LBitAndAndBranch* baab, MInstruction* mir, MDefinition* lhs, MDefinition* rhs); + void visitConstant(MConstant* ins); void visitAsmJSNeg(MAsmJSNeg* ins); void lowerMulI(MMul* mul, MDefinition* lhs, MDefinition* rhs); void lowerDivI(MDiv* div); @@ -47,6 +48,8 @@ class LIRGeneratorX86Shared : public LIRGeneratorShared void lowerUDiv(MDiv* div); void lowerUMod(MMod* mod); void lowerUrshD(MUrsh* mir); + void lowerConstantDouble(double d, MInstruction* ins); + void lowerConstantFloat32(float d, MInstruction* ins); void lowerTruncateDToInt32(MTruncateToInt32* ins); void lowerTruncateFToInt32(MTruncateToInt32* ins); void visitSimdBinaryArith(MSimdBinaryArith* ins); From 6331d6f7c0e1238b3201b45a63908fae7f91451e Mon Sep 17 00:00:00 2001 From: Aaron Klotz Date: Wed, 22 Jul 2015 17:39:32 -0600 Subject: [PATCH 028/136] Bug 1184068: Ensure that mShutdown is not incorrectly set from true to false if plugin crashes during CallNP_Shutdown; r=jimm --- dom/plugins/ipc/PluginModuleParent.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/dom/plugins/ipc/PluginModuleParent.cpp b/dom/plugins/ipc/PluginModuleParent.cpp index fde3ce2ee7dd..4fba995ec05c 100755 --- a/dom/plugins/ipc/PluginModuleParent.cpp +++ b/dom/plugins/ipc/PluginModuleParent.cpp @@ -2412,7 +2412,10 @@ PluginModuleParent::DoShutdown(NPError* error) // CallNP_Shutdown() message Close(); - mShutdown = ok; + // mShutdown should either be initialized to false, or be transitiong from + // false to true. It is never ok to go from true to false. Using OR for + // the following assignment to ensure this. + mShutdown |= ok; if (!ok) { *error = NPERR_GENERIC_ERROR; } From cf6e7ed78b7fe2e11a10a2e9beaf368fa3eb6861 Mon Sep 17 00:00:00 2001 From: Nikhil Marathe Date: Thu, 23 Jul 2015 08:30:15 -0700 Subject: [PATCH 029/136] Bug 1184574 - Allow access to PushManager on ServiceWorker. r=kitcambridge,smaug,catalinb Refactoring to allow access to PushManager in ServiceWorkerGlobalScope. See comment in PushManager.h for details. --HG-- extra : commitid : A7RvB9rm8av extra : transplant_source : %20%99%CA%B0%EB%B9%82%27D%F7e%B8UQ%12%E6%9B%18%BB5 --- b2g/installer/package-manifest.in | 1 + browser/installer/package-manifest.in | 1 + dom/bindings/Bindings.conf | 19 + dom/interfaces/push/moz.build | 1 + dom/interfaces/push/nsIPushClient.idl | 53 ++ dom/push/Push.js | 210 +---- dom/push/Push.manifest | 6 +- dom/push/PushClient.js | 149 ++++ dom/push/PushManager.cpp | 839 ++++++++++++++++++ dom/push/PushManager.h | 227 +++++ dom/push/moz.build | 15 + .../mochitest/general/test_interfaces.html | 2 + dom/webidl/PushManager.webidl | 19 +- dom/webidl/PushSubscription.webidl | 9 +- dom/webidl/ServiceWorkerRegistration.webidl | 2 +- dom/workers/ServiceWorkerRegistration.cpp | 34 +- dom/workers/ServiceWorkerRegistration.h | 8 + .../test_serviceworker_interfaces.js | 4 + 18 files changed, 1414 insertions(+), 185 deletions(-) create mode 100644 dom/interfaces/push/nsIPushClient.idl create mode 100644 dom/push/PushClient.js create mode 100644 dom/push/PushManager.cpp create mode 100644 dom/push/PushManager.h diff --git a/b2g/installer/package-manifest.in b/b2g/installer/package-manifest.in index ce470b54f141..a29a55ab21dd 100644 --- a/b2g/installer/package-manifest.in +++ b/b2g/installer/package-manifest.in @@ -644,6 +644,7 @@ @RESPATH@/components/AppsService.manifest @RESPATH@/components/Push.js @RESPATH@/components/Push.manifest +@RESPATH@/components/PushClient.js @RESPATH@/components/PushNotificationService.js @RESPATH@/components/PushServiceLauncher.js diff --git a/browser/installer/package-manifest.in b/browser/installer/package-manifest.in index 48e5d17b7485..40c08b0c9baf 100644 --- a/browser/installer/package-manifest.in +++ b/browser/installer/package-manifest.in @@ -558,6 +558,7 @@ @RESPATH@/components/AlarmsManager.manifest @RESPATH@/components/Push.js @RESPATH@/components/Push.manifest +@RESPATH@/components/PushClient.js @RESPATH@/components/PushNotificationService.js @RESPATH@/components/SlowScriptDebug.manifest diff --git a/dom/bindings/Bindings.conf b/dom/bindings/Bindings.conf index f98d6df2fefa..78480ef0c777 100644 --- a/dom/bindings/Bindings.conf +++ b/dom/bindings/Bindings.conf @@ -960,6 +960,25 @@ DOMInterfaces = { 'workers': True }, +'PushManager': [{ + 'workers': False, + 'headerFile': 'mozilla/dom/PushManager.h', + 'nativeType': 'mozilla::dom::PushManager', +}, { + 'workers': True, + 'headerFile': 'mozilla/dom/PushManager.h', + 'nativeType': 'mozilla::dom::WorkerPushManager', +}], + +'PushSubscription': [{ + 'workers': False, + 'headerFile': 'mozilla/dom/PushManager.h', +}, { + 'workers': True, + 'headerFile': 'mozilla/dom/PushManager.h', + 'nativeType': 'mozilla::dom::WorkerPushSubscription', +}], + 'Range': { 'nativeType': 'nsRange', 'binaryNames': { diff --git a/dom/interfaces/push/moz.build b/dom/interfaces/push/moz.build index 879a078c1657..541fd1af53ff 100644 --- a/dom/interfaces/push/moz.build +++ b/dom/interfaces/push/moz.build @@ -5,6 +5,7 @@ # file, You can obtain one at http://mozilla.org/MPL/2.0/. XPIDL_SOURCES += [ + 'nsIPushClient.idl', 'nsIPushNotificationService.idl', 'nsIPushObserverNotification.idl', ] diff --git a/dom/interfaces/push/nsIPushClient.idl b/dom/interfaces/push/nsIPushClient.idl new file mode 100644 index 000000000000..5c9bdf627e2c --- /dev/null +++ b/dom/interfaces/push/nsIPushClient.idl @@ -0,0 +1,53 @@ +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* 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/. */ + +#include "nsISupports.idl" + +interface nsIPrincipal; + +/** + * Satisfies contracts similar to the Push API specification. + * + * If status is not NS_OK, endpoint should be ignored. When subscribing to + * a new endpoint, endpoint will be a valid URL on success, when querying for + * the presence of an existing subscription, this will be an empty string if + * the calling {scope+principal} does not currently have an associated + * endpoint. + */ + +[scriptable, uuid(0bcac389-a3ac-44a4-97fb-b50e41a46146)] +interface nsIPushEndpointCallback : nsISupports +{ + void onPushEndpoint(in nsresult status, in DOMString endpoint); +}; + +/** + * Satisfies contracts similar to the Push API specification. + * + * If status is not NS_OK, there was a problem unsubscribing and success should + * be ignored. success is true if unsubscribing was successful and false if + * there was no subscription. + */ +[scriptable, uuid(9522934d-e844-4f2f-81e8-48c3947b44de)] +interface nsIUnsubscribeResultCallback : nsISupports +{ + void onUnsubscribe(in nsresult status, in bool success); +}; + +/** + * Provides an XPIDL component to interact with the PushService from content + * processes. Unlike PushManager, this has no relationship to the DOM and is + * not exposed to web content. This was added to allow ServiceWorkers to use + * it by dispatching appropriate runnables to the main thread. + */ +[scriptable, uuid(6622d599-439e-4ad1-af32-c941bd2b9968)] +interface nsIPushClient : nsISupports +{ + void subscribe(in DOMString scope, in nsIPrincipal principal, in nsIPushEndpointCallback callback); + + void unsubscribe(in DOMString scope, in nsIPrincipal principal, in nsIUnsubscribeResultCallback callback); + + void getSubscription(in DOMString scope, in nsIPrincipal principal, in nsIPushEndpointCallback callback); +}; diff --git a/dom/push/Push.js b/dom/push/Push.js index 695f28cf0d6b..bbf7dcf8d7fa 100644 --- a/dom/push/Push.js +++ b/dom/push/Push.js @@ -15,99 +15,11 @@ function debug(s) { const Cc = Components.classes; const Ci = Components.interfaces; const Cu = Components.utils; +const Cr = Components.results; Cu.import("resource://gre/modules/XPCOMUtils.jsm"); Cu.import("resource://gre/modules/Services.jsm"); Cu.import("resource://gre/modules/DOMRequestHelper.jsm"); -Cu.import("resource://gre/modules/AppsUtils.jsm"); - -const PUSH_SUBSCRIPTION_CID = Components.ID("{CA86B665-BEDA-4212-8D0F-5C9F65270B58}"); - -function PushSubscription(pushEndpoint, scope, principal) { - debug("PushSubscription Constructor"); - this._pushEndpoint = pushEndpoint; - this._scope = scope; - this._principal = principal; -} - -PushSubscription.prototype = { - __proto__: DOMRequestIpcHelper.prototype, - - contractID: "@mozilla.org/push/PushSubscription;1", - - classID : PUSH_SUBSCRIPTION_CID, - - QueryInterface : XPCOMUtils.generateQI([Ci.nsIDOMGlobalPropertyInitializer, - Ci.nsISupportsWeakReference, - Ci.nsIObserver]), - - init: function(aWindow) { - debug("PushSubscription init()"); - - this.initDOMRequestHelper(aWindow, [ - "PushService:Unregister:OK", - "PushService:Unregister:KO", - ]); - - this._cpmm = Cc["@mozilla.org/childprocessmessagemanager;1"] - .getService(Ci.nsISyncMessageSender); - }, - - __init: function(endpoint, scope, principal) { - this._pushEndpoint = endpoint; - this._scope = scope; - this._principal = principal; - }, - - get endpoint() { - return this._pushEndpoint; - }, - - unsubscribe: function() { - debug("unsubscribe! ") - - let promiseInit = function(resolve, reject) { - let resolverId = this.getPromiseResolverId({resolve: resolve, - reject: reject }); - - this._cpmm.sendAsyncMessage("Push:Unregister", { - scope: this._scope, - pushEndpoint: this._pushEndpoint, - requestID: resolverId - }, null, this._principal); - }.bind(this); - - return this.createPromise(promiseInit); - }, - - receiveMessage: function(aMessage) { - debug("push subscription receiveMessage(): " + JSON.stringify(aMessage)) - - let json = aMessage.data; - let resolver = this.takePromiseResolver(json.requestID); - if (resolver == null) { - return; - } - - switch (aMessage.name) { - case "PushService:Unregister:OK": - if (typeof json.result !== "boolean") { - debug("Expected boolean result from PushService!"); - resolve.reject("NetworkError"); - return; - } - - resolver.resolve(json.result); - break; - case "PushService:Unregister:KO": - resolver.reject("NetworkError"); - break; - default: - debug("NOT IMPLEMENTED! receiveMessage for " + aMessage.name); - } - }, - -}; const PUSH_CID = Components.ID("{cde1d019-fad8-4044-b141-65fb4fb7a245}"); @@ -140,16 +52,11 @@ Push.prototype = { this._window = aWindow; - this.initDOMRequestHelper(aWindow, [ - "PushService:Register:OK", - "PushService:Register:KO", - "PushService:Registration:OK", - "PushService:Registration:KO" - ]); + this.initDOMRequestHelper(aWindow); - this._cpmm = Cc["@mozilla.org/childprocessmessagemanager;1"] - .getService(Ci.nsISyncMessageSender); this._principal = aWindow.document.nodePrincipal; + + this._client = Cc["@mozilla.org/push/PushClient;1"].createInstance(Ci.nsIPushClient); }, setScope: function(scope){ @@ -199,7 +106,6 @@ Push.prototype = { window: this._window }; - debug("asking the window utils about permission...") // Using askPermission from nsIDOMWindowUtils that takes care of the // remoting if needed. let windowUtils = this._window.QueryInterface(Ci.nsIInterfaceRequestor) @@ -207,92 +113,46 @@ Push.prototype = { windowUtils.askPermission(request); }, + getEndpointResponse: function(fn) { + debug("GetEndpointResponse " + fn.toSource()); + let that = this; + let p = this.createPromise(function(resolve, reject) { + this.askPermission( + () => { + fn(that._scope, that._principal, { + QueryInterface: XPCOMUtils.generateQI([Ci.nsIPushEndpointCallback]), + onPushEndpoint: function(ok, endpoint) { + if (ok === Cr.NS_OK) { + if (endpoint) { + let sub = new that._window.PushSubscription(endpoint, that._scope); + sub.setPrincipal(that._principal); + resolve(sub); + } else { + resolve(null); + } + } else { + reject("AbortError"); + } + } + }); + }, - - receiveMessage: function(aMessage) { - debug("push receiveMessage(): " + JSON.stringify(aMessage)) - - let json = aMessage.data; - let resolver = this.takePromiseResolver(json.requestID); - - if (!resolver) { - return; - } - - switch (aMessage.name) { - case "PushService:Register:OK": - { - let subscription = - new this._window.PushSubscription(json.pushEndpoint, this._scope, - this._principal); - resolver.resolve(subscription); - break; - } - case "PushService:Register:KO": - resolver.reject(null); - break; - case "PushService:Registration:OK": - { - let subscription = null; - try { - subscription = - new this._window.PushSubscription(json.registration.pushEndpoint, - this._scope, this._principal); - } catch(error) { + () => { + reject("PermissionDeniedError"); } - resolver.resolve(subscription); - break; - } - case "PushService:Registration:KO": - resolver.reject(null); - break; - default: - debug("NOT IMPLEMENTED! receiveMessage for " + aMessage.name); - } + ); + }.bind(this)); + return p; }, subscribe: function() { debug("subscribe()"); - let p = this.createPromise(function(resolve, reject) { - let resolverId = this.getPromiseResolverId({ resolve: resolve, reject: reject }); - - this.askPermission( - function() { - this._cpmm.sendAsyncMessage("Push:Register", { - scope: this._scope, - requestID: resolverId - }, null, this._principal); - }.bind(this), - - function() { - reject("PermissionDeniedError"); - } - ); - }.bind(this)); - return p; + return this.getEndpointResponse(this._client.subscribe.bind(this._client)); }, getSubscription: function() { debug("getSubscription()" + this._scope); - - let p = this.createPromise(function(resolve, reject) { - - let resolverId = this.getPromiseResolverId({ resolve: resolve, reject: reject }); - - this.askPermission( - function() { - this._cpmm.sendAsyncMessage("Push:Registration", { - scope: this._scope, - requestID: resolverId - }, null, this._principal); - }.bind(this), - - function() { - reject("PermissionDeniedError"); - } - ); - }.bind(this)); - return p; + return this.getEndpointResponse(this._client.getSubscription.bind(this._client)); }, permissionState: function() { @@ -324,4 +184,4 @@ Push.prototype = { }, } -this.NSGetFactory = XPCOMUtils.generateNSGetFactory([Push, PushSubscription]); +this.NSGetFactory = XPCOMUtils.generateNSGetFactory([Push]); diff --git a/dom/push/Push.manifest b/dom/push/Push.manifest index d20f13e93287..49ba27bf1271 100644 --- a/dom/push/Push.manifest +++ b/dom/push/Push.manifest @@ -2,9 +2,6 @@ component {cde1d019-fad8-4044-b141-65fb4fb7a245} Push.js contract @mozilla.org/push/PushManager;1 {cde1d019-fad8-4044-b141-65fb4fb7a245} -component {CA86B665-BEDA-4212-8D0F-5C9F65270B58} Push.js -contract @mozilla.org/push/PushSubscription;1 {CA86B665-BEDA-4212-8D0F-5C9F65270B58} - # XPCOM component; initializes the PushService on startup. component {32028e38-903b-4a64-a180-5857eb4cb3dd} PushNotificationService.js contract @mozilla.org/push/NotificationService;1 {32028e38-903b-4a64-a180-5857eb4cb3dd} @@ -12,3 +9,6 @@ category app-startup PushNotificationService @mozilla.org/push/NotificationServi component {66a87970-6dc9-46e0-ac61-adb4a13791de} PushNotificationService.js contract @mozilla.org/push/ObserverNotification;1 {66a87970-6dc9-46e0-ac61-adb4a13791de} + +component {16042199-bec0-484a-9640-25ecc0c0a149} PushClient.js +contract @mozilla.org/push/PushClient;1 {16042199-bec0-484a-9640-25ecc0c0a149} diff --git a/dom/push/PushClient.js b/dom/push/PushClient.js new file mode 100644 index 000000000000..dd03380ed5a0 --- /dev/null +++ b/dom/push/PushClient.js @@ -0,0 +1,149 @@ +/* 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/. */ + +"use strict"; + +// Don't modify this, instead set dom.push.debug. +let gDebuggingEnabled = true; + +function debug(s) { + if (gDebuggingEnabled) + dump("-*- PushClient.js: " + s + "\n"); +} + +const Cc = Components.classes; +const Ci = Components.interfaces; +const Cu = Components.utils; +const Cr = Components.results; + +Cu.import("resource://gre/modules/XPCOMUtils.jsm"); +Cu.import("resource://gre/modules/Services.jsm"); + +const kMessages = [ + "PushService:Register:OK", + "PushService:Register:KO", + "PushService:Registration:OK", + "PushService:Registration:KO", + "PushService:Unregister:OK", + "PushService:Unregister:KO", +]; + +this.PushClient = function PushClient() { + debug("PushClient created!"); + this._cpmm = Cc["@mozilla.org/childprocessmessagemanager;1"] + .getService(Ci.nsISyncMessageSender); + this._requests = {}; + this.addListeners(); +}; + +PushClient.prototype = { + classID: Components.ID("{16042199-bec0-484a-9640-25ecc0c0a149}"), + + contractID: "@mozilla.org/push/PushClient;1", + + QueryInterface: XPCOMUtils.generateQI([Ci.nsISupportsWeakReference, + Ci.nsIPushClient, + Ci.nsIMessageListener,]), + + + _getRandomId: function() { + return Cc["@mozilla.org/uuid-generator;1"] + .getService(Ci.nsIUUIDGenerator).generateUUID().toString(); + }, + + addRequest: function(data) { + let id = this._getRandomId(); + this._requests[id] = data; + return id; + }, + + takeRequest: function(requestId) { + let d = this._requests[requestId]; + delete this._requests[requestId]; + return d; + }, + + addListeners: function() { + for (let message of kMessages) { + this._cpmm.addWeakMessageListener(message, this); + } + }, + + subscribe: function(scope, principal, callback) { + debug("subscribe() " + scope); + let requestId = this.addRequest(callback); + this._cpmm.sendAsyncMessage("Push:Register", { + scope: scope, + requestID: requestId, + }, null, principal); + }, + + unsubscribe: function(scope, principal, callback) { + debug("unsubscribe() " + scope); + let requestId = this.addRequest(callback); + this._cpmm.sendAsyncMessage("Push:Unregister", { + scope: scope, + requestID: requestId, + }, null, principal); + }, + + getSubscription: function(scope, principal, callback) { + debug("getSubscription()" + scope); + let requestId = this.addRequest(callback); + debug("Going to send " + scope + " " + principal + " " + requestId); + this._cpmm.sendAsyncMessage("Push:Registration", { + scope: scope, + requestID: requestId, + }, null, principal); + }, + + receiveMessage: function(aMessage) { + + let json = aMessage.data; + let request = this.takeRequest(json.requestID); + + if (!request) { + return; + } + + debug("receiveMessage(): " + JSON.stringify(aMessage)) + switch (aMessage.name) { + case "PushService:Register:OK": + { + request.onPushEndpoint(Cr.NS_OK, json.pushEndpoint); + break; + } + case "PushService:Register:KO": + request.onPushEndpoint(Cr.NS_ERROR_FAILURE, ""); + break; + case "PushService:Registration:OK": + { + let endpoint = ""; + if (json.registration) + endpoint = json.registration.pushEndpoint; + request.onPushEndpoint(Cr.NS_OK, endpoint); + break; + } + case "PushService:Registration:KO": + request.onPushEndpoint(Cr.NS_ERROR_FAILURE, ""); + break; + case "PushService:Unregister:OK": + if (typeof json.result !== "boolean") { + debug("Expected boolean result from PushService!"); + request.onUnsubscribe(Cr.NS_ERROR_FAILURE, false); + return; + } + + request.onUnsubscribe(Cr.NS_OK, json.result); + break; + case "PushService:Unregister:KO": + request.onUnsubscribe(Cr.NS_ERROR_FAILURE, false); + break; + default: + debug("NOT IMPLEMENTED! receiveMessage for " + aMessage.name); + } + }, +}; + +this.NSGetFactory = XPCOMUtils.generateNSGetFactory([PushClient]); diff --git a/dom/push/PushManager.cpp b/dom/push/PushManager.cpp new file mode 100644 index 000000000000..33d96b24765d --- /dev/null +++ b/dom/push/PushManager.cpp @@ -0,0 +1,839 @@ +/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* vim: set ts=8 sts=2 et sw=2 tw=80: */ +/* 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/. */ + +#include "mozilla/dom/PushManager.h" + +#include "mozilla/Preferences.h" +#include "mozilla/Services.h" +#include "mozilla/dom/PushManagerBinding.h" +#include "mozilla/dom/PushSubscriptionBinding.h" +#include "mozilla/dom/ServiceWorkerGlobalScopeBinding.h" + +#include "mozilla/dom/Promise.h" +#include "mozilla/dom/PromiseWorkerProxy.h" + +#include "nsIGlobalObject.h" +#include "nsIPermissionManager.h" +#include "nsIPrincipal.h" +#include "nsIPushClient.h" + +#include "nsFrameMessageManager.h" +#include "nsContentCID.h" + +#include "WorkerRunnable.h" +#include "WorkerPrivate.h" +#include "WorkerScope.h" + +namespace mozilla { +namespace dom { + +using namespace workers; + +class UnsubscribeResultCallback final : public nsIUnsubscribeResultCallback +{ +public: + NS_DECL_ISUPPORTS + + explicit UnsubscribeResultCallback(Promise* aPromise) + : mPromise(aPromise) + { + AssertIsOnMainThread(); + } + + NS_IMETHOD + OnUnsubscribe(nsresult aStatus, bool aSuccess) override + { + if (NS_SUCCEEDED(aStatus)) { + mPromise->MaybeResolve(aSuccess); + } else { + mPromise->MaybeReject(NS_ERROR_DOM_NETWORK_ERR); + } + + return NS_OK; + } + +private: + ~UnsubscribeResultCallback() + {} + + nsRefPtr mPromise; +}; + +NS_IMPL_ISUPPORTS(UnsubscribeResultCallback, nsIUnsubscribeResultCallback) + +already_AddRefed +PushSubscription::Unsubscribe(ErrorResult& aRv) +{ + MOZ_ASSERT(mPrincipal); + + nsCOMPtr client = + do_CreateInstance("@mozilla.org/push/PushClient;1"); + if (NS_WARN_IF(!client)) { + aRv = NS_ERROR_FAILURE; + return nullptr; + } + + nsRefPtr p = Promise::Create(mGlobal, aRv); + if (NS_WARN_IF(aRv.Failed())) { + return nullptr; + } + + nsRefPtr callback = + new UnsubscribeResultCallback(p); + client->Unsubscribe(mScope, mPrincipal, callback); + return p.forget(); +} + +PushSubscription::PushSubscription(nsIGlobalObject* aGlobal, + const nsAString& aEndpoint, + const nsAString& aScope) + : mGlobal(aGlobal), mEndpoint(aEndpoint), mScope(aScope) +{ +} + +PushSubscription::~PushSubscription() +{} + +JSObject* +PushSubscription::WrapObject(JSContext* aCx, JS::Handle aGivenProto) +{ + return PushSubscriptionBinding::Wrap(aCx, this, aGivenProto); +} + +void +PushSubscription::SetPrincipal(nsIPrincipal* aPrincipal) +{ + MOZ_ASSERT(!mPrincipal); + mPrincipal = aPrincipal; +} + +// static +already_AddRefed +PushSubscription::Constructor(GlobalObject& aGlobal, const nsAString& aEndpoint, const nsAString& aScope, ErrorResult& aRv) +{ + MOZ_ASSERT(!aEndpoint.IsEmpty()); + MOZ_ASSERT(!aScope.IsEmpty()); + nsCOMPtr global = do_QueryInterface(aGlobal.GetAsSupports()); + nsRefPtr sub = new PushSubscription(global, aEndpoint, aScope); + return sub.forget(); +} + +NS_IMPL_CYCLE_COLLECTION_WRAPPERCACHE(PushSubscription, mGlobal, mPrincipal) +NS_IMPL_CYCLE_COLLECTING_ADDREF(PushSubscription) +NS_IMPL_CYCLE_COLLECTING_RELEASE(PushSubscription) +NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION(PushSubscription) + NS_WRAPPERCACHE_INTERFACE_MAP_ENTRY + NS_INTERFACE_MAP_ENTRY(nsISupports) +NS_INTERFACE_MAP_END + +// PushManager +// static +bool +PushManager::Enabled(JSContext* aCx, JSObject* aObj) +{ + if (NS_IsMainThread()) { + return Preferences::GetBool("dom.push.enabled", false); + } + + // XXXnsm: As of this patch it seems like Push will be enabled before or with + // ServiceWorkers, so this seems OK for now. + ServiceWorkerGlobalScope* scope = nullptr; + nsresult rv = UnwrapObject(aObj, scope); + return NS_SUCCEEDED(rv); +} + +PushManager::PushManager(nsIGlobalObject* aGlobal, const nsAString& aScope) + : mGlobal(aGlobal), mScope(aScope) +{ + AssertIsOnMainThread(); +} + +PushManager::~PushManager() +{} + +JSObject* +PushManager::WrapObject(JSContext* aCx, JS::Handle aGivenProto) +{ + // XXXnsm I don't know if this is the right way to do it, but I want to assert + // that an implementation has been set before this object gets exposed to JS. + MOZ_ASSERT(mImpl); + return PushManagerBinding::Wrap(aCx, this, aGivenProto); +} + +void +PushManager::SetPushManagerImpl(PushManagerImpl& foo, ErrorResult& aRv) +{ + MOZ_ASSERT(NS_IsMainThread()); + MOZ_ASSERT(!mImpl); + mImpl = &foo; +} + +already_AddRefed +PushManager::Subscribe(ErrorResult& aRv) +{ + MOZ_ASSERT(mImpl); + return mImpl->Subscribe(aRv); +} + +already_AddRefed +PushManager::GetSubscription(ErrorResult& aRv) +{ + MOZ_ASSERT(mImpl); + return mImpl->GetSubscription(aRv); +} + +already_AddRefed +PushManager::PermissionState(ErrorResult& aRv) +{ + MOZ_ASSERT(mImpl); + return mImpl->PermissionState(aRv); +} + +NS_IMPL_CYCLE_COLLECTION_WRAPPERCACHE(PushManager, mGlobal, mImpl) +NS_IMPL_CYCLE_COLLECTING_ADDREF(PushManager) +NS_IMPL_CYCLE_COLLECTING_RELEASE(PushManager) +NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION(PushManager) + NS_WRAPPERCACHE_INTERFACE_MAP_ENTRY + NS_INTERFACE_MAP_ENTRY(nsISupports) +NS_INTERFACE_MAP_END + +// WorkerPushSubscription + +WorkerPushSubscription::WorkerPushSubscription(const nsAString& aEndpoint, + const nsAString& aScope) + : mEndpoint(aEndpoint), mScope(aScope) +{ + MOZ_ASSERT(!aScope.IsEmpty()); + MOZ_ASSERT(!aEndpoint.IsEmpty()); +} + +WorkerPushSubscription::~WorkerPushSubscription() +{} + +JSObject* +WorkerPushSubscription::WrapObject(JSContext* aCx, JS::Handle aGivenProto) +{ + return PushSubscriptionBinding_workers::Wrap(aCx, this, aGivenProto); +} + +// static +already_AddRefed +WorkerPushSubscription::Constructor(GlobalObject& aGlobal, const nsAString& aEndpoint, const nsAString& aScope, ErrorResult& aRv) +{ + WorkerPrivate* worker = GetCurrentThreadWorkerPrivate(); + MOZ_ASSERT(worker); + worker->AssertIsOnWorkerThread(); + + nsRefPtr sub = new WorkerPushSubscription(aEndpoint, aScope); + return sub.forget(); +} + +class MOZ_STACK_CLASS AutoReleasePromiseWorkerProxy final +{ +public: + explicit AutoReleasePromiseWorkerProxy(PromiseWorkerProxy* aProxy) + : mProxy(aProxy) + { + AssertIsOnMainThread(); + MOZ_ASSERT(aProxy); + aProxy->GetCleanUpLock().AssertCurrentThreadOwns(); + if (aProxy->IsClean()) { + mProxy = nullptr; + } + } + + ~AutoReleasePromiseWorkerProxy() + { + if (mProxy) { + AutoJSAPI jsapi; + jsapi.Init(); + + nsRefPtr cr = + new PromiseWorkerProxyControlRunnable(mProxy->GetWorkerPrivate(), + mProxy); + + DebugOnly ok = cr->Dispatch(jsapi.cx()); + MOZ_ASSERT(ok); + mProxy = nullptr; + } + } +private: + nsRefPtr mProxy; +}; + +class UnsubscribeResultRunnable final : public WorkerRunnable +{ +public: + UnsubscribeResultRunnable(PromiseWorkerProxy* aProxy, + nsresult aStatus, + bool aSuccess) + : WorkerRunnable(aProxy->GetWorkerPrivate(), WorkerThreadModifyBusyCount) + , mProxy(aProxy) + , mStatus(aStatus) + , mSuccess(aSuccess) + { + AssertIsOnMainThread(); + } + + bool + WorkerRun(JSContext* aCx, WorkerPrivate* aWorkerPrivate) override + { + MOZ_ASSERT(aWorkerPrivate); + aWorkerPrivate->AssertIsOnWorkerThread(); + + nsRefPtr proxy = mProxy.forget(); + nsRefPtr promise = proxy->GetWorkerPromise(); + if (NS_SUCCEEDED(mStatus)) { + promise->MaybeResolve(mSuccess); + } else { + promise->MaybeReject(NS_ERROR_DOM_NETWORK_ERR); + } + + proxy->CleanUp(aCx); + return true; + } +private: + ~UnsubscribeResultRunnable() + { + if (mProxy) { + AutoReleasePromiseWorkerProxy autoRelease(mProxy); + mProxy = nullptr; + } + } + + nsRefPtr mProxy; + nsresult mStatus; + bool mSuccess; +}; + +class WorkerUnsubscribeResultCallback final : public nsIUnsubscribeResultCallback +{ +public: + NS_DECL_ISUPPORTS + + explicit WorkerUnsubscribeResultCallback(PromiseWorkerProxy* aProxy) + : mProxy(aProxy) + { + AssertIsOnMainThread(); + } + + NS_IMETHOD + OnUnsubscribe(nsresult aStatus, bool aSuccess) override + { + AssertIsOnMainThread(); + if (!mProxy) { + return NS_OK; + } + + MutexAutoLock lock(mProxy->GetCleanUpLock()); + if (mProxy->IsClean()) { + return NS_OK; + } + + AutoJSAPI jsapi; + jsapi.Init(); + + nsRefPtr r = + new UnsubscribeResultRunnable(mProxy, aStatus, aSuccess); + mProxy = nullptr; + + r->Dispatch(jsapi.cx()); + return NS_OK; + } + +private: + ~WorkerUnsubscribeResultCallback() + { + if (mProxy) { + AutoReleasePromiseWorkerProxy autoRelease(mProxy); + mProxy = nullptr; + } + } + + nsRefPtr mProxy; +}; + +NS_IMPL_ISUPPORTS(WorkerUnsubscribeResultCallback, nsIUnsubscribeResultCallback) + +class UnsubscribeRunnable final : public nsRunnable +{ +public: + UnsubscribeRunnable(PromiseWorkerProxy* aProxy, + const nsAString& aScope) + : mProxy(aProxy) + , mScope(aScope) + { + MOZ_ASSERT(aProxy); + MOZ_ASSERT(!aScope.IsEmpty()); + } + + NS_IMETHOD + Run() override + { + AssertIsOnMainThread(); + MutexAutoLock lock(mProxy->GetCleanUpLock()); + if (mProxy->IsClean()) { + return NS_OK; + } + + nsCOMPtr client = + do_CreateInstance("@mozilla.org/push/PushClient;1"); + if (!client) { + AutoJSAPI jsapi; + jsapi.Init(); + + nsRefPtr r = + new UnsubscribeResultRunnable(mProxy, NS_ERROR_FAILURE, false); + mProxy = nullptr; + + r->Dispatch(jsapi.cx()); + return NS_OK; + } + + nsCOMPtr principal = mProxy->GetWorkerPrivate()->GetPrincipal(); + nsRefPtr callback = + new WorkerUnsubscribeResultCallback(mProxy); + mProxy = nullptr; + client->Unsubscribe(mScope, principal, callback); + return NS_OK; + } + +private: + ~UnsubscribeRunnable() + { + if (mProxy) { + AutoReleasePromiseWorkerProxy autoRelease(mProxy); + mProxy = nullptr; + } + } + nsRefPtr mProxy; + nsString mScope; +}; + +already_AddRefed +WorkerPushSubscription::Unsubscribe(ErrorResult &aRv) +{ + WorkerPrivate* worker = GetCurrentThreadWorkerPrivate(); + MOZ_ASSERT(worker); + worker->AssertIsOnWorkerThread(); + + nsCOMPtr global = worker->GlobalScope(); + nsRefPtr p = Promise::Create(global, aRv); + if (NS_WARN_IF(aRv.Failed())) { + return nullptr; + } + + nsRefPtr proxy = PromiseWorkerProxy::Create(worker, p); + if (!proxy) { + p->MaybeReject(NS_ERROR_DOM_NETWORK_ERR); + return p.forget(); + } + + nsRefPtr r = + new UnsubscribeRunnable(proxy, mScope); + NS_DispatchToMainThread(r); + + return p.forget(); +} + +NS_IMPL_CYCLE_COLLECTION_WRAPPERCACHE_0(WorkerPushSubscription) +NS_IMPL_CYCLE_COLLECTING_ADDREF(WorkerPushSubscription) +NS_IMPL_CYCLE_COLLECTING_RELEASE(WorkerPushSubscription) +NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION(WorkerPushSubscription) + NS_WRAPPERCACHE_INTERFACE_MAP_ENTRY + NS_INTERFACE_MAP_ENTRY(nsISupports) +NS_INTERFACE_MAP_END + +// WorkerPushManager + +WorkerPushManager::WorkerPushManager(const nsAString& aScope) + : mScope(aScope) +{ +} + +JSObject* +WorkerPushManager::WrapObject(JSContext* aCx, JS::Handle aGivenProto) +{ + return PushManagerBinding_workers::Wrap(aCx, this, aGivenProto); +} + +class GetSubscriptionResultRunnable final : public WorkerRunnable +{ +public: + GetSubscriptionResultRunnable(PromiseWorkerProxy* aProxy, + nsresult aStatus, + const nsAString& aEndpoint, + const nsAString& aScope) + : WorkerRunnable(aProxy->GetWorkerPrivate(), WorkerThreadModifyBusyCount) + , mProxy(aProxy) + , mStatus(aStatus) + , mEndpoint(aEndpoint) + , mScope(aScope) + { } + + bool + WorkerRun(JSContext* aCx, WorkerPrivate* aWorkerPrivate) override + { + nsRefPtr proxy = mProxy.forget(); + nsRefPtr promise = proxy->GetWorkerPromise(); + if (NS_SUCCEEDED(mStatus)) { + nsRefPtr sub = + new WorkerPushSubscription(mEndpoint, mScope); + promise->MaybeResolve(sub); + } else { + promise->MaybeReject(NS_ERROR_DOM_ABORT_ERR); + } + + proxy->CleanUp(aCx); + return true; + } +private: + ~GetSubscriptionResultRunnable() + { + if (mProxy) { + AutoReleasePromiseWorkerProxy autoRelease(mProxy); + mProxy = nullptr; + } + } + + nsRefPtr mProxy; + nsresult mStatus; + nsString mEndpoint; + nsString mScope; +}; + +class GetSubscriptionCallback final : public nsIPushEndpointCallback +{ +public: + NS_DECL_ISUPPORTS + + explicit GetSubscriptionCallback(PromiseWorkerProxy* aProxy, + const nsAString& aScope) + : mProxy(aProxy) + , mScope(aScope) + {} + + NS_IMETHOD + OnPushEndpoint(nsresult aStatus, const nsAString& aEndpoint) override + { + AssertIsOnMainThread(); + if (!mProxy) { + return NS_OK; + } + + MutexAutoLock lock(mProxy->GetCleanUpLock()); + if (mProxy->IsClean()) { + return NS_OK; + } + + AutoJSAPI jsapi; + jsapi.Init(); + + nsRefPtr r = + new GetSubscriptionResultRunnable(mProxy, aStatus, aEndpoint, mScope); + mProxy = nullptr; + + r->Dispatch(jsapi.cx()); + return NS_OK; + } + +protected: + ~GetSubscriptionCallback() + { + if (mProxy) { + AutoReleasePromiseWorkerProxy autoRelease(mProxy); + mProxy = nullptr; + } + } + +private: + nsRefPtr mProxy; + nsString mScope; +}; + +NS_IMPL_ISUPPORTS(GetSubscriptionCallback, nsIPushEndpointCallback) + +class GetSubscriptionRunnable final : public nsRunnable +{ +public: + GetSubscriptionRunnable(PromiseWorkerProxy* aProxy, + const nsAString& aScope, + WorkerPushManager::SubscriptionAction aAction) + : mProxy(aProxy) + , mScope(aScope), mAction(aAction) + {} + + NS_IMETHOD + Run() override + { + AssertIsOnMainThread(); + MutexAutoLock lock(mProxy->GetCleanUpLock()); + if (mProxy->IsClean()) { + return NS_OK; + } + + nsCOMPtr permManager = + mozilla::services::GetPermissionManager(); + + AutoJSAPI jsapi; + jsapi.Init(); + + if (!permManager) { + Fail(jsapi.cx()); + return NS_OK; + } + + uint32_t permission = nsIPermissionManager::DENY_ACTION; + nsresult rv = permManager->TestExactPermissionFromPrincipal( + mProxy->GetWorkerPrivate()->GetPrincipal(), + "push", + &permission); + + if (NS_WARN_IF(NS_FAILED(rv)) || permission != nsIPermissionManager::ALLOW_ACTION) { + Fail(jsapi.cx()); + return NS_OK; + } + + nsCOMPtr client = + do_CreateInstance("@mozilla.org/push/PushClient;1"); + if (!client) { + Fail(jsapi.cx()); + return NS_OK; + } + + nsCOMPtr principal = mProxy->GetWorkerPrivate()->GetPrincipal(); + nsRefPtr callback = new GetSubscriptionCallback(mProxy, mScope); + mProxy = nullptr; + + if (mAction == WorkerPushManager::SubscribeAction) { + return client->Subscribe(mScope, principal, callback); + } else { + MOZ_ASSERT(mAction == WorkerPushManager::GetSubscriptionAction); + return client->GetSubscription(mScope, principal, callback); + } + } + +private: + void + Fail(JSContext* aCx) + { + nsRefPtr r = + new GetSubscriptionResultRunnable(mProxy, NS_ERROR_FAILURE, EmptyString(), mScope); + mProxy = nullptr; + + r->Dispatch(aCx); + } + + ~GetSubscriptionRunnable() + { + if (mProxy) { + AutoReleasePromiseWorkerProxy autoRelease(mProxy); + mProxy = nullptr; + } + } + + nsRefPtr mProxy; + nsString mScope; + WorkerPushManager::SubscriptionAction mAction; +}; + +already_AddRefed +WorkerPushManager::PerformSubscriptionAction(SubscriptionAction aAction, ErrorResult& aRv) +{ + WorkerPrivate* worker = GetCurrentThreadWorkerPrivate(); + MOZ_ASSERT(worker); + worker->AssertIsOnWorkerThread(); + + nsCOMPtr global = worker->GlobalScope(); + nsRefPtr p = Promise::Create(global, aRv); + if (NS_WARN_IF(aRv.Failed())) { + return nullptr; + } + + nsRefPtr proxy = PromiseWorkerProxy::Create(worker, p); + if (!proxy) { + p->MaybeReject(NS_ERROR_DOM_ABORT_ERR); + return p.forget(); + } + + nsRefPtr r = + new GetSubscriptionRunnable(proxy, mScope, aAction); + NS_DispatchToMainThread(r); + + return p.forget(); +} + +already_AddRefed +WorkerPushManager::Subscribe(ErrorResult& aRv) +{ + return PerformSubscriptionAction(SubscribeAction, aRv); +} + +already_AddRefed +WorkerPushManager::GetSubscription(ErrorResult& aRv) +{ + return PerformSubscriptionAction(GetSubscriptionAction, aRv); +} + +class PermissionResultRunnable final : public WorkerRunnable +{ +public: + PermissionResultRunnable(PromiseWorkerProxy *aProxy, + nsresult aStatus, + PushPermissionState aState) + : WorkerRunnable(aProxy->GetWorkerPrivate(), WorkerThreadModifyBusyCount) + , mProxy(aProxy) + , mStatus(aStatus) + , mState(aState) + { + AssertIsOnMainThread(); + } + + bool + WorkerRun(JSContext* aCx, WorkerPrivate* aWorkerPrivate) override + { + MOZ_ASSERT(aWorkerPrivate); + aWorkerPrivate->AssertIsOnWorkerThread(); + + nsRefPtr proxy = mProxy.forget(); + nsRefPtr promise = proxy->GetWorkerPromise(); + if (NS_SUCCEEDED(mStatus)) { + MOZ_ASSERT(uint32_t(mState) < ArrayLength(PushPermissionStateValues::strings)); + nsAutoCString stringState(PushPermissionStateValues::strings[uint32_t(mState)].value, PushPermissionStateValues::strings[uint32_t(mState)].length); + promise->MaybeResolve(NS_ConvertUTF8toUTF16(stringState)); + } else { + promise->MaybeReject(aCx, JS::UndefinedHandleValue); + } + + proxy->CleanUp(aCx); + return true; + } + +private: + ~PermissionResultRunnable() + { + if (mProxy) { + AutoReleasePromiseWorkerProxy autoRelease(mProxy); + mProxy = nullptr; + } + } + + nsRefPtr mProxy; + nsresult mStatus; + PushPermissionState mState; +}; + +class PermissionStateRunnable final : public nsRunnable +{ +public: + explicit PermissionStateRunnable(PromiseWorkerProxy* aProxy) + : mProxy(aProxy) + {} + + NS_IMETHOD + Run() override + { + AssertIsOnMainThread(); + MutexAutoLock lock(mProxy->GetCleanUpLock()); + if (mProxy->IsClean()) { + return NS_OK; + } + + nsCOMPtr permManager = + mozilla::services::GetPermissionManager(); + + PushPermissionState state = PushPermissionState::Denied; + + AutoJSAPI jsapi; + jsapi.Init(); + + if (!permManager) { + nsRefPtr r = + new PermissionResultRunnable(mProxy, NS_ERROR_FAILURE, state); + mProxy = nullptr; + + r->Dispatch(jsapi.cx()); + return NS_OK; + } + + uint32_t permission = nsIPermissionManager::DENY_ACTION; + nsresult rv = permManager->TestExactPermissionFromPrincipal( + mProxy->GetWorkerPrivate()->GetPrincipal(), + "push", + &permission); + + switch (permission) { + case nsIPermissionManager::ALLOW_ACTION: + state = PushPermissionState::Granted; + break; + case nsIPermissionManager::DENY_ACTION: + state = PushPermissionState::Denied; + break; + case nsIPermissionManager::PROMPT_ACTION: + state = PushPermissionState::Prompt; + break; + default: + MOZ_CRASH("Unexpected case!"); + } + + nsRefPtr r = + new PermissionResultRunnable(mProxy, rv, state); + mProxy = nullptr; + r->Dispatch(jsapi.cx()); + return NS_OK; + } + +private: + ~PermissionStateRunnable() + { + if (mProxy) { + AutoReleasePromiseWorkerProxy autoRelease(mProxy); + mProxy = nullptr; + } + } + + nsRefPtr mProxy; +}; + +already_AddRefed +WorkerPushManager::PermissionState(ErrorResult& aRv) +{ + WorkerPrivate* worker = GetCurrentThreadWorkerPrivate(); + MOZ_ASSERT(worker); + worker->AssertIsOnWorkerThread(); + + nsCOMPtr global = worker->GlobalScope(); + nsRefPtr p = Promise::Create(global, aRv); + if (NS_WARN_IF(aRv.Failed())) { + return nullptr; + } + + nsRefPtr proxy = PromiseWorkerProxy::Create(worker, p); + if (!proxy) { + p->MaybeReject(worker->GetJSContext(), JS::UndefinedHandleValue); + return p.forget(); + } + + nsRefPtr r = + new PermissionStateRunnable(proxy); + NS_DispatchToMainThread(r); + + return p.forget(); +} + +WorkerPushManager::~WorkerPushManager() +{} + +NS_IMPL_CYCLE_COLLECTION_WRAPPERCACHE_0(WorkerPushManager) +NS_IMPL_CYCLE_COLLECTING_ADDREF(WorkerPushManager) +NS_IMPL_CYCLE_COLLECTING_RELEASE(WorkerPushManager) +NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION(WorkerPushManager) + NS_WRAPPERCACHE_INTERFACE_MAP_ENTRY + NS_INTERFACE_MAP_ENTRY(nsISupports) +NS_INTERFACE_MAP_END +} // namespace dom +} // namespace mozilla diff --git a/dom/push/PushManager.h b/dom/push/PushManager.h new file mode 100644 index 000000000000..5e92314aef94 --- /dev/null +++ b/dom/push/PushManager.h @@ -0,0 +1,227 @@ +/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* vim: set ts=8 sts=2 et sw=2 tw=80: */ +/* 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/. */ + +/** + * We would like to expose PushManager and PushSubscription on window and + * workers. Parts of the Push API is implemented in JS out of necessity due to: + * 1) Using frame message managers, in which + * nsIMessageListener::receiveMessage() must be in JS. + * 2) It is easier to use certain APIs like the permission prompt and Promises + * from JS. + * + * Unfortunately, JS-implemented WebIDL is not supported off the main thread. To + * aid in fixing this, the nsIPushClient is introduced which deals with part (1) + * above. Part (2) is handled by PushManagerImpl on the main thread. PushManager + * wraps this in C++ since our bindings code cannot accomodate "JS-implemented + * on the main thread, C++ on the worker" bindings. PushManager simply forwards + * the calls to the JS component. + * + * On the worker threads, we don't have to deal with permission prompts, instead + * we just reject calls if the principal does not have permission. On workers + * WorkerPushManager dispatches runnables to the main thread which directly call + * nsIPushClient. + * + * PushSubscription is in C++ on both threads since it isn't particularly + * verbose to implement in C++ compared to JS. + */ + +#ifndef mozilla_dom_PushManager_h +#define mozilla_dom_PushManager_h + +#include "nsWrapperCache.h" + +#include "mozilla/AlreadyAddRefed.h" +#include "mozilla/ErrorResult.h" +#include "mozilla/dom/BindingDeclarations.h" + +#include "nsCOMPtr.h" +#include "nsRefPtr.h" +#include "jsapi.h" + +class nsIGlobalObject; +class nsIPrincipal; + +namespace mozilla { +namespace dom { + +namespace workers { +class WorkerPrivate; +} + +class Promise; +class PushManagerImpl; + +class PushSubscription final : public nsISupports + , public nsWrapperCache +{ +public: + NS_DECL_CYCLE_COLLECTING_ISUPPORTS + NS_DECL_CYCLE_COLLECTION_SCRIPT_HOLDER_CLASS(PushSubscription) + + explicit PushSubscription(nsIGlobalObject* aGlobal, + const nsAString& aEndpoint, + const nsAString& aScope); + + JSObject* + WrapObject(JSContext* aCx, JS::Handle aGivenProto) override; + + nsIGlobalObject* + GetParentObject() const + { + return mGlobal; + } + + void + GetEndpoint(nsAString& aEndpoint) const + { + aEndpoint = mEndpoint; + } + + static already_AddRefed + Constructor(GlobalObject& aGlobal, const nsAString& aEndpoint, const nsAString& aScope, ErrorResult& aRv); + + void + SetPrincipal(nsIPrincipal* aPrincipal); + + already_AddRefed + Unsubscribe(ErrorResult& aRv); + +protected: + ~PushSubscription(); + +private: + nsCOMPtr mGlobal; + nsCOMPtr mPrincipal; + nsString mEndpoint; + nsString mScope; +}; + +class PushManager final : public nsISupports + , public nsWrapperCache +{ +public: + NS_DECL_CYCLE_COLLECTING_ISUPPORTS + NS_DECL_CYCLE_COLLECTION_SCRIPT_HOLDER_CLASS(PushManager) + + static bool + Enabled(JSContext* aCx, JSObject* aObj); + + explicit PushManager(nsIGlobalObject* aGlobal, const nsAString& aScope); + + nsIGlobalObject* + GetParentObject() const + { + return mGlobal; + } + + JSObject* + WrapObject(JSContext* aCx, JS::Handle aGivenProto) override; + + already_AddRefed + Subscribe(ErrorResult& aRv); + + already_AddRefed + GetSubscription(ErrorResult& aRv); + + already_AddRefed + PermissionState(ErrorResult& aRv); + + void + SetPushManagerImpl(PushManagerImpl& foo, ErrorResult& aRv); + +protected: + ~PushManager(); + +private: + nsCOMPtr mGlobal; + nsRefPtr mImpl; + nsString mScope; +}; + +class WorkerPushSubscription final : public nsISupports + , public nsWrapperCache +{ +public: + NS_DECL_CYCLE_COLLECTING_ISUPPORTS + NS_DECL_CYCLE_COLLECTION_SCRIPT_HOLDER_CLASS(WorkerPushSubscription) + + explicit WorkerPushSubscription(const nsAString& aEndpoint, + const nsAString& aScope); + + nsIGlobalObject* + GetParentObject() const + { + return nullptr; + } + + JSObject* + WrapObject(JSContext* aCx, JS::Handle aGivenProto) override; + + static already_AddRefed + Constructor(GlobalObject& aGlobal, const nsAString& aEndpoint, const nsAString& aScope, ErrorResult& aRv); + + void + GetEndpoint(nsAString& aEndpoint) const + { + aEndpoint = mEndpoint; + } + + already_AddRefed + Unsubscribe(ErrorResult& aRv); + +protected: + ~WorkerPushSubscription(); + +private: + nsString mEndpoint; + nsString mScope; +}; + +class WorkerPushManager final : public nsISupports + , public nsWrapperCache +{ +public: + NS_DECL_CYCLE_COLLECTING_ISUPPORTS + NS_DECL_CYCLE_COLLECTION_SCRIPT_HOLDER_CLASS(WorkerPushManager) + + enum SubscriptionAction { + SubscribeAction, + GetSubscriptionAction, + }; + + explicit WorkerPushManager(const nsAString& aScope); + + nsIGlobalObject* + GetParentObject() const + { + return nullptr; + } + + JSObject* + WrapObject(JSContext* aCx, JS::Handle aGivenProto) override; + + already_AddRefed + PerformSubscriptionAction(SubscriptionAction aAction, ErrorResult& aRv); + + already_AddRefed + Subscribe(ErrorResult& aRv); + + already_AddRefed + GetSubscription(ErrorResult& aRv); + + already_AddRefed + PermissionState(ErrorResult& aRv); + +protected: + ~WorkerPushManager(); + +private: + nsString mScope; +}; +} // namespace dom +} // namespace mozilla + +#endif // mozilla_dom_PushManager_h diff --git a/dom/push/moz.build b/dom/push/moz.build index 9a0bfe74b0da..17471715aa47 100644 --- a/dom/push/moz.build +++ b/dom/push/moz.build @@ -6,6 +6,7 @@ EXTRA_COMPONENTS += [ 'Push.js', 'Push.manifest', + 'PushClient.js', 'PushNotificationService.js', ] @@ -27,3 +28,17 @@ MOCHITEST_MANIFESTS += [ XPCSHELL_TESTS_MANIFESTS += [ 'test/xpcshell/xpcshell.ini', ] + +EXPORTS.mozilla.dom += [ + 'PushManager.h', +] + +UNIFIED_SOURCES += [ + 'PushManager.cpp', +] + +LOCAL_INCLUDES += [ + '../workers', +] + +FINAL_LIBRARY = 'xul' diff --git a/dom/tests/mochitest/general/test_interfaces.html b/dom/tests/mochitest/general/test_interfaces.html index 569dd83165e7..f44709a3f725 100644 --- a/dom/tests/mochitest/general/test_interfaces.html +++ b/dom/tests/mochitest/general/test_interfaces.html @@ -923,6 +923,8 @@ var interfaceNamesInGlobalScope = "PropertyNodeList", // IMPORTANT: Do not change this list without review from a DOM peer! {name: "PushManager", b2g: false, android: false, release: false}, +// IMPORTANT: Do not change this list without review from a DOM peer! + {name: "PushSubscription", b2g: false, android: false, release: false}, // IMPORTANT: Do not change this list without review from a DOM peer! "RadioNodeList", // IMPORTANT: Do not change this list without review from a DOM peer! diff --git a/dom/webidl/PushManager.webidl b/dom/webidl/PushManager.webidl index 26420d7bf5ff..a1ae9d4fdf36 100644 --- a/dom/webidl/PushManager.webidl +++ b/dom/webidl/PushManager.webidl @@ -7,9 +7,11 @@ * https://w3c.github.io/push-api/ */ +// Please see comments in dom/push/PushManager.h for the split between +// PushManagerImpl and PushManager. [JSImplementation="@mozilla.org/push/PushManager;1", - Pref="dom.push.enabled"] -interface PushManager { + NoInterfaceObject] +interface PushManagerImpl { Promise subscribe(); Promise getSubscription(); Promise permissionState(); @@ -20,6 +22,19 @@ interface PushManager { [Func="ServiceWorkerRegistration::WebPushMethodHider"] void setScope(DOMString scope); }; +[Exposed=(Window,Worker), Func="mozilla::dom::PushManager::Enabled"] +interface PushManager { + [ChromeOnly, Throws, Exposed=Window] + void setPushManagerImpl(PushManagerImpl store); + + [Throws] + Promise subscribe(); + [Throws] + Promise getSubscription(); + [Throws] + Promise permissionState(); +}; + enum PushPermissionState { "granted", diff --git a/dom/webidl/PushSubscription.webidl b/dom/webidl/PushSubscription.webidl index d97acd2cd867..37b7776234e3 100644 --- a/dom/webidl/PushSubscription.webidl +++ b/dom/webidl/PushSubscription.webidl @@ -9,11 +9,16 @@ interface Principal; -[JSImplementation="@mozilla.org/push/PushSubscription;1", - Constructor(DOMString pushEndpoint, DOMString scope, Principal principal), ChromeOnly] +[Exposed=(Window,Worker), Func="mozilla::dom::PushManager::Enabled", + ChromeConstructor(DOMString pushEndpoint, DOMString scope)] interface PushSubscription { readonly attribute USVString endpoint; + [Throws] Promise unsubscribe(); jsonifier; + + // Used to set the principal from the JS implemented PushManager. + [Exposed=Window,ChromeOnly] + void setPrincipal(Principal principal); }; diff --git a/dom/webidl/ServiceWorkerRegistration.webidl b/dom/webidl/ServiceWorkerRegistration.webidl index bbf357440cc6..2f220a8eaaab 100644 --- a/dom/webidl/ServiceWorkerRegistration.webidl +++ b/dom/webidl/ServiceWorkerRegistration.webidl @@ -28,7 +28,7 @@ interface ServiceWorkerRegistration : EventTarget { partial interface ServiceWorkerRegistration { #ifndef MOZ_SIMPLEPUSH - [Throws, Exposed=Window, Pref="dom.push.enabled"] + [Throws, Exposed=(Window,Worker), Func="mozilla::dom::PushManager::Enabled"] readonly attribute PushManager pushManager; #endif }; diff --git a/dom/workers/ServiceWorkerRegistration.cpp b/dom/workers/ServiceWorkerRegistration.cpp index 07f943c35295..afb74a6603a3 100644 --- a/dom/workers/ServiceWorkerRegistration.cpp +++ b/dom/workers/ServiceWorkerRegistration.cpp @@ -29,6 +29,7 @@ #ifndef MOZ_SIMPLEPUSH #include "mozilla/dom/PushManagerBinding.h" +#include "mozilla/dom/PushManager.h" #endif using namespace mozilla::dom::workers; @@ -677,9 +678,15 @@ ServiceWorkerRegistrationMainThread::GetPushManager(ErrorResult& aRv) if (aRv.Failed()) { return nullptr; } - mPushManager = new PushManager(jsImplObj, globalObject); + mPushManager = new PushManager(globalObject, mScope); - mPushManager->SetScope(mScope, aRv); + nsRefPtr impl = new PushManagerImpl(jsImplObj, globalObject); + impl->SetScope(mScope, aRv); + if (aRv.Failed()) { + mPushManager = nullptr; + return nullptr; + } + mPushManager->SetPushManagerImpl(*impl, aRv); if (aRv.Failed()) { mPushManager = nullptr; return nullptr; @@ -807,10 +814,16 @@ NS_IMPL_CYCLE_COLLECTION_CLASS(ServiceWorkerRegistrationWorkerThread) NS_IMPL_CYCLE_COLLECTION_TRAVERSE_BEGIN_INHERITED(ServiceWorkerRegistrationWorkerThread, ServiceWorkerRegistrationBase) +#ifndef MOZ_SIMPLEPUSH + NS_IMPL_CYCLE_COLLECTION_TRAVERSE(mPushManager) +#endif NS_IMPL_CYCLE_COLLECTION_TRAVERSE_END NS_IMPL_CYCLE_COLLECTION_UNLINK_BEGIN_INHERITED(ServiceWorkerRegistrationWorkerThread, ServiceWorkerRegistrationBase) +#ifndef MOZ_SIMPLEPUSH + NS_IMPL_CYCLE_COLLECTION_UNLINK(mPushManager) +#endif tmp->ReleaseListener(RegistrationIsGoingAway); NS_IMPL_CYCLE_COLLECTION_UNLINK_END @@ -1075,5 +1088,22 @@ ServiceWorkerRegistrationWorkerThread::GetNotifications(const GetNotificationOpt return Notification::WorkerGet(mWorkerPrivate, aOptions, mScope, aRv); } +already_AddRefed +ServiceWorkerRegistrationWorkerThread::GetPushManager(ErrorResult& aRv) +{ +#ifdef MOZ_SIMPLEPUSH + return nullptr; +#else + + if (!mPushManager) { + mPushManager = new WorkerPushManager(mScope); + } + + nsRefPtr ret = mPushManager; + return ret.forget(); + + #endif /* ! MOZ_SIMPLEPUSH */ +} + } // dom namespace } // mozilla namespace diff --git a/dom/workers/ServiceWorkerRegistration.h b/dom/workers/ServiceWorkerRegistration.h index b696b3d3dc48..72abe132e04e 100644 --- a/dom/workers/ServiceWorkerRegistration.h +++ b/dom/workers/ServiceWorkerRegistration.h @@ -22,6 +22,7 @@ namespace dom { class Promise; class PushManager; +class WorkerPushManager; class WorkerListener; namespace workers { @@ -231,6 +232,9 @@ public: bool Notify(JSContext* aCx, workers::Status aStatus) override; + already_AddRefed + GetPushManager(ErrorResult& aRv); + private: enum Reason { @@ -248,6 +252,10 @@ private: workers::WorkerPrivate* mWorkerPrivate; nsRefPtr mListener; + +#ifndef MOZ_SIMPLEPUSH + nsRefPtr mPushManager; +#endif }; } // namespace dom diff --git a/dom/workers/test/serviceworkers/test_serviceworker_interfaces.js b/dom/workers/test/serviceworkers/test_serviceworker_interfaces.js index 8c229aae1bce..09c8100b6616 100644 --- a/dom/workers/test/serviceworkers/test_serviceworker_interfaces.js +++ b/dom/workers/test/serviceworkers/test_serviceworker_interfaces.js @@ -171,6 +171,10 @@ var interfaceNamesInGlobalScope = "PerformanceMeasure", // IMPORTANT: Do not change this list without review from a DOM peer! "Promise", +// IMPORTANT: Do not change this list without review from a DOM peer! + "PushManager", +// IMPORTANT: Do not change this list without review from a DOM peer! + "PushSubscription", // IMPORTANT: Do not change this list without review from a DOM peer! "Request", // IMPORTANT: Do not change this list without review from a DOM peer! From 3055640112ffb6c56b3e885133709fffbab94a68 Mon Sep 17 00:00:00 2001 From: Eitan Isaacson Date: Fri, 17 Jul 2015 14:54:38 -0700 Subject: [PATCH 030/136] Bug 1184626 - Add a per-process push message listener. r=smaug --HG-- rename : dom/push/PushServiceChildPreload.js => dom/push/PushServiceChildPreload.jsm extra : commitid : JVUONa2Klhc extra : transplant_source : %8D%A86%94%B2%D7%3F%99%D6%C0%BE/%D8%8A%60%95%EE4%CCt --- dom/ipc/jar.mn | 1 - dom/push/PushService.jsm | 16 +++++----------- ...ildPreload.js => PushServiceChildPreload.jsm} | 9 +++++++-- dom/push/moz.build | 1 + dom/workers/ServiceWorkerManager.cpp | 2 +- toolkit/content/process-content.js | 3 +++ 6 files changed, 17 insertions(+), 15 deletions(-) rename dom/push/{PushServiceChildPreload.js => PushServiceChildPreload.jsm} (71%) diff --git a/dom/ipc/jar.mn b/dom/ipc/jar.mn index 57395c39c222..e009460ae90f 100644 --- a/dom/ipc/jar.mn +++ b/dom/ipc/jar.mn @@ -11,5 +11,4 @@ toolkit.jar: content/global/BrowserElementPanning.js (../browser-element/BrowserElementPanning.js) * content/global/BrowserElementPanningAPZDisabled.js (../browser-element/BrowserElementPanningAPZDisabled.js) content/global/manifestMessages.js (manifestMessages.js) - content/global/PushServiceChildPreload.js (../push/PushServiceChildPreload.js) content/global/preload.js (preload.js) diff --git a/dom/push/PushService.jsm b/dom/push/PushService.jsm index 37198d7d6328..88ba57a7d2fd 100644 --- a/dom/push/PushService.jsm +++ b/dom/push/PushService.jsm @@ -406,12 +406,6 @@ this.PushService = { this._setState(PUSH_SERVICE_ACTIVATING); - var globalMM = Cc["@mozilla.org/globalmessagemanager;1"] - .getService(Ci.nsIFrameScriptLoader); - - globalMM.loadFrameScript("chrome://global/content/PushServiceChildPreload.js", - true); - // Debugging prefs.observe("debug", this); @@ -662,8 +656,6 @@ this.PushService = { }, _notifySubscriptionChangeObservers: function(record) { - let globalMM = Cc['@mozilla.org/globalmessagemanager;1'] - .getService(Ci.nsIMessageListenerManager); // Notify XPCOM observers. Services.obs.notifyObservers( null, @@ -676,7 +668,9 @@ this.PushService = { scope: record.scope }; - globalMM.broadcastAsyncMessage('pushsubscriptionchange', data); + let ppmm = Cc['@mozilla.org/parentprocessmessagemanager;1'] + .getService(Ci.nsIMessageListenerManager); + ppmm.broadcastAsyncMessage('pushsubscriptionchange', data); }, // Fires a push-register system message to all applications that have @@ -804,9 +798,9 @@ this.PushService = { scope: aPushRecord.scope }; - let globalMM = Cc['@mozilla.org/globalmessagemanager;1'] + let ppmm = Cc['@mozilla.org/parentprocessmessagemanager;1'] .getService(Ci.nsIMessageListenerManager); - globalMM.broadcastAsyncMessage('push', data); + ppmm.broadcastAsyncMessage('push', data); }, getByKeyID: function(aKeyID) { diff --git a/dom/push/PushServiceChildPreload.js b/dom/push/PushServiceChildPreload.jsm similarity index 71% rename from dom/push/PushServiceChildPreload.js rename to dom/push/PushServiceChildPreload.jsm index 395b1798b6f3..4a81b575851e 100644 --- a/dom/push/PushServiceChildPreload.js +++ b/dom/push/PushServiceChildPreload.jsm @@ -4,17 +4,22 @@ "use strict"; +const Cu = Components.utils; + +Cu.import("resource://gre/modules/Services.jsm"); +Cu.import("resource://gre/modules/XPCOMUtils.jsm"); + XPCOMUtils.defineLazyServiceGetter(this, "swm", "@mozilla.org/serviceworkers/manager;1", "nsIServiceWorkerManager"); -addMessageListener("push", function (aMessage) { +Services.cpmm.addMessageListener("push", function (aMessage) { swm.sendPushEvent(aMessage.data.originAttributes, aMessage.data.scope, aMessage.data.payload); }); -addMessageListener("pushsubscriptionchange", function (aMessage) { +Services.cpmm.addMessageListener("pushsubscriptionchange", function (aMessage) { swm.sendPushSubscriptionChangeEvent(aMessage.data.originAttributes, aMessage.data.scope); }); diff --git a/dom/push/moz.build b/dom/push/moz.build index 17471715aa47..8c9fcabc52c8 100644 --- a/dom/push/moz.build +++ b/dom/push/moz.build @@ -18,6 +18,7 @@ EXTRA_JS_MODULES += [ 'PushDB.jsm', 'PushRecord.jsm', 'PushService.jsm', + 'PushServiceChildPreload.jsm', 'PushServiceHttp2.jsm', ] diff --git a/dom/workers/ServiceWorkerManager.cpp b/dom/workers/ServiceWorkerManager.cpp index 2c0b01c7f63c..849074fc411a 100644 --- a/dom/workers/ServiceWorkerManager.cpp +++ b/dom/workers/ServiceWorkerManager.cpp @@ -2252,7 +2252,7 @@ ServiceWorkerManager::SendPushEvent(const nsACString& aOriginAttributes, nsRefPtr serviceWorker = CreateServiceWorkerForScope(attrs, aScope, nullptr /* failure runnable */); - if (!serviceWorker) { + if (NS_WARN_IF(!serviceWorker)) { return NS_ERROR_FAILURE; } diff --git a/toolkit/content/process-content.js b/toolkit/content/process-content.js index 78aaa1adad5e..148522ecbcc2 100644 --- a/toolkit/content/process-content.js +++ b/toolkit/content/process-content.js @@ -10,3 +10,6 @@ let { classes: Cc, interfaces: Ci, utils: Cu } = Components; // and for those that match URLs provided by the parent process will set up // a dedicated message port and notify the parent process. Cu.import("resource://gre/modules/RemotePageManager.jsm"); + +// Hooks to listen for push messages +Cu.import("resource://gre/modules/PushServiceChildPreload.jsm"); From 83b4188234080fe76b131b7a14c43bb342394a06 Mon Sep 17 00:00:00 2001 From: Wes Kocher Date: Fri, 24 Jul 2015 13:15:57 -0700 Subject: [PATCH 031/136] Backed out 14 changesets (bug 1156472) for test_getUserMedia_audioCapture.html failures on b2g emulator Backed out changeset deec8eb18346 (bug 1156472) Backed out changeset 0f5bec4c05ba (bug 1156472) Backed out changeset 2dd83ac00bf9 (bug 1156472) Backed out changeset abd4e47887f7 (bug 1156472) Backed out changeset 4824d9874663 (bug 1156472) Backed out changeset 12805598e6fa (bug 1156472) Backed out changeset e2f0062a1f67 (bug 1156472) Backed out changeset 99ef8e436a7f (bug 1156472) Backed out changeset 65bbfc1546af (bug 1156472) Backed out changeset 2ab4f16eaf0a (bug 1156472) Backed out changeset 7f565685e20a (bug 1156472) Backed out changeset 28c03c98cb2b (bug 1156472) Backed out changeset d477cfba6e1d (bug 1156472) Backed out changeset 9819fa56caa1 (bug 1156472) --- .../locales/en-US/chrome/browser/browser.dtd | 1 - .../en-US/chrome/browser/browser.properties | 23 +-- browser/modules/ContentWebRTC.jsm | 14 +- browser/modules/webrtcUI.jsm | 50 +++--- dom/audiochannel/AudioChannelAgent.cpp | 20 --- dom/audiochannel/AudioChannelAgent.h | 2 - dom/audiochannel/AudioChannelService.cpp | 32 ---- dom/audiochannel/AudioChannelService.h | 8 - dom/audiochannel/nsIAudioChannelAgent.idl | 7 +- dom/base/nsGlobalWindow.cpp | 22 +-- dom/base/nsPIDOMWindow.h | 5 - dom/fmradio/FMRadio.cpp | 6 - dom/html/HTMLMediaElement.cpp | 62 +------ dom/html/HTMLMediaElement.h | 6 - dom/media/AudioCaptureStream.cpp | 133 --------------- dom/media/AudioCaptureStream.h | 40 ----- dom/media/AudioChannelFormat.cpp | 112 +++++++++++- dom/media/AudioChannelFormat.h | 123 +------------- dom/media/AudioMixer.h | 6 +- dom/media/AudioSegment.cpp | 97 ----------- dom/media/AudioSegment.h | 9 +- dom/media/DOMMediaStream.cpp | 30 ---- dom/media/DOMMediaStream.h | 15 -- dom/media/DecodedStream.cpp | 8 - dom/media/DecodedStream.h | 1 - dom/media/MediaDecoder.cpp | 7 - dom/media/MediaDecoder.h | 2 - dom/media/MediaDecoderStateMachine.cpp | 29 ---- dom/media/MediaDecoderStateMachine.h | 3 - dom/media/MediaManager.cpp | 160 ++++++------------ dom/media/MediaManager.h | 10 +- dom/media/MediaStreamGraph.cpp | 73 -------- dom/media/MediaStreamGraph.h | 10 -- dom/media/MediaStreamGraphImpl.h | 17 -- dom/media/moz.build | 1 - dom/media/tests/mochitest/head.js | 113 +------------ dom/media/tests/mochitest/mochitest.ini | 1 - dom/media/tests/mochitest/pc.js | 39 ++++- .../test_getUserMedia_audioCapture.html | 110 ------------ .../test_peerConnection_replaceTrack.html | 2 +- .../test_peerConnection_webAudio.html | 2 +- dom/media/webaudio/AudioDestinationNode.cpp | 40 +---- dom/media/webaudio/AudioDestinationNode.h | 2 - dom/media/webrtc/MediaEngineWebRTC.cpp | 19 +-- dom/media/webrtc/MediaEngineWebRTC.h | 78 +-------- dom/media/webrtc/MediaEngineWebRTCAudio.cpp | 102 +++-------- dom/webidl/Constraints.webidl | 1 - modules/libpref/init/all.js | 2 - 48 files changed, 293 insertions(+), 1362 deletions(-) delete mode 100644 dom/media/AudioCaptureStream.cpp delete mode 100644 dom/media/AudioCaptureStream.h delete mode 100644 dom/media/tests/mochitest/test_getUserMedia_audioCapture.html diff --git a/browser/locales/en-US/chrome/browser/browser.dtd b/browser/locales/en-US/chrome/browser/browser.dtd index fe7439e0a445..89981e6936c4 100644 --- a/browser/locales/en-US/chrome/browser/browser.dtd +++ b/browser/locales/en-US/chrome/browser/browser.dtd @@ -758,7 +758,6 @@ you can use these alternative items. Otherwise, their values should be empty. - - diff --git a/browser/locales/en-US/chrome/browser/browser.properties b/browser/locales/en-US/chrome/browser/browser.properties index 1a71d59b1b09..766446fac755 100644 --- a/browser/locales/en-US/chrome/browser/browser.properties +++ b/browser/locales/en-US/chrome/browser/browser.properties @@ -553,17 +553,13 @@ identity.loggedIn.signOut.accessKey = O # LOCALIZATION NOTE (getUserMedia.shareCamera.message, getUserMedia.shareMicrophone.message, # getUserMedia.shareScreen.message, getUserMedia.shareCameraAndMicrophone.message, -# getUserMedia.shareScreenAndMicrophone.message, getUserMedia.shareCameraAndAudioCapture.message, -# getUserMedia.shareAudioCapture.message, getUserMedia.shareScreenAndAudioCapture.message): +# getUserMedia.shareScreenAndMicrophone.message): # %S is the website origin (e.g. www.mozilla.org) getUserMedia.shareCamera.message = Would you like to share your camera with %S? getUserMedia.shareMicrophone.message = Would you like to share your microphone with %S? getUserMedia.shareScreen.message = Would you like to share your screen with %S? getUserMedia.shareCameraAndMicrophone.message = Would you like to share your camera and microphone with %S? -getUserMedia.shareCameraAndAudioCapture.message = Would you like to share your camera and this tab's audio with %S? getUserMedia.shareScreenAndMicrophone.message = Would you like to share your microphone and screen with %S? -getUserMedia.shareScreenAndAudioCapture.message = Would you like to share this tab's audio and your screen with %S? -getUserMedia.shareAudioCapture.message = Would you like to share this tab's audio with %S? getUserMedia.selectWindow.label=Window to share: getUserMedia.selectWindow.accesskey=W getUserMedia.selectScreen.label=Screen to share: @@ -605,7 +601,6 @@ getUserMedia.sharingApplication.message = You are currently sharing an applicati getUserMedia.sharingScreen.message = You are currently sharing your screen with this page. getUserMedia.sharingWindow.message = You are currently sharing a window with this page. getUserMedia.sharingBrowser.message = You are currently sharing a tab with this page. -getUserMedia.sharingAudioCapture.message = You are currently sharing a tab's audio with this page. getUserMedia.continueSharing.label = Continue Sharing getUserMedia.continueSharing.accesskey = C getUserMedia.stopSharing.label = Stop Sharing @@ -615,7 +610,6 @@ getUserMedia.sharingMenu.label = Tabs sharing devices getUserMedia.sharingMenu.accesskey = d # LOCALIZATION NOTE (getUserMedia.sharingMenuCamera # getUserMedia.sharingMenuMicrophone, -# getUserMedia.sharingMenuAudioCapture, # getUserMedia.sharingMenuApplication, # getUserMedia.sharingMenuScreen, # getUserMedia.sharingMenuWindow, @@ -625,11 +619,6 @@ getUserMedia.sharingMenu.accesskey = d # getUserMedia.sharingMenuCameraMicrophoneScreen, # getUserMedia.sharingMenuCameraMicrophoneWindow, # getUserMedia.sharingMenuCameraMicrophoneBrowser, -# getUserMedia.sharingMenuCameraAudioCapture, -# getUserMedia.sharingMenuCameraAudioCaptureApplication, -# getUserMedia.sharingMenuCameraAudioCaptureScreen, -# getUserMedia.sharingMenuCameraAudioCaptureWindow, -# getUserMedia.sharingMenuCameraAudioCaptureBrowser, # getUserMedia.sharingMenuCameraApplication, # getUserMedia.sharingMenuCameraScreen, # getUserMedia.sharingMenuCameraWindow, @@ -641,7 +630,6 @@ getUserMedia.sharingMenu.accesskey = d # %S is the website origin (e.g. www.mozilla.org) getUserMedia.sharingMenuCamera = %S (camera) getUserMedia.sharingMenuMicrophone = %S (microphone) -getUserMedia.sharingMenuAudioCapture = %S (tab audio) getUserMedia.sharingMenuApplication = %S (application) getUserMedia.sharingMenuScreen = %S (screen) getUserMedia.sharingMenuWindow = %S (window) @@ -651,11 +639,6 @@ getUserMedia.sharingMenuCameraMicrophoneApplication = %S (camera, microphone and getUserMedia.sharingMenuCameraMicrophoneScreen = %S (camera, microphone and screen) getUserMedia.sharingMenuCameraMicrophoneWindow = %S (camera, microphone and window) getUserMedia.sharingMenuCameraMicrophoneBrowser = %S (camera, microphone and tab) -getUserMedia.sharingMenuCameraAudioCapture = %S (camera and tab audio) -getUserMedia.sharingMenuCameraAudioCaptureApplication = %S (camera, tab audio and application) -getUserMedia.sharingMenuCameraAudioCaptureScreen = %S (camera, tab audio and screen) -getUserMedia.sharingMenuCameraAudioCaptureWindow = %S (camera, tab audio and window) -getUserMedia.sharingMenuCameraAudioCaptureBrowser = %S (camera, tab audio and tab) getUserMedia.sharingMenuCameraApplication = %S (camera and application) getUserMedia.sharingMenuCameraScreen = %S (camera and screen) getUserMedia.sharingMenuCameraWindow = %S (camera and window) @@ -664,10 +647,6 @@ getUserMedia.sharingMenuMicrophoneApplication = %S (microphone and application) getUserMedia.sharingMenuMicrophoneScreen = %S (microphone and screen) getUserMedia.sharingMenuMicrophoneWindow = %S (microphone and window) getUserMedia.sharingMenuMicrophoneBrowser = %S (microphone and tab) -getUserMedia.sharingMenuMicrophoneApplication = %S (tab audio and application) -getUserMedia.sharingMenuMicrophoneScreen = %S (tab audio and screen) -getUserMedia.sharingMenuMicrophoneWindow = %S (tab audio and window) -getUserMedia.sharingMenuMicrophoneBrowser = %S (tab audio and tab) # LOCALIZATION NOTE(getUserMedia.sharingMenuUnknownHost): this is used for the website # origin for the sharing menu if no readable origin could be deduced from the URL. getUserMedia.sharingMenuUnknownHost = Unknown origin diff --git a/browser/modules/ContentWebRTC.jsm b/browser/modules/ContentWebRTC.jsm index e059c60d3d2f..5f0514170d6b 100644 --- a/browser/modules/ContentWebRTC.jsm +++ b/browser/modules/ContentWebRTC.jsm @@ -86,21 +86,14 @@ function prompt(aContentWindow, aWindowID, aCallID, aConstraints, aDevices, aSec // MediaStreamConstraints defines video as 'boolean or MediaTrackConstraints'. let video = aConstraints.video || aConstraints.picture; - let audio = aConstraints.audio; let sharingScreen = video && typeof(video) != "boolean" && video.mediaSource != "camera"; - let sharingAudio = audio && typeof(audio) != "boolean" && - audio.mediaSource != "microphone"; for (let device of aDevices) { device = device.QueryInterface(Ci.nsIMediaDevice); switch (device.type) { case "audio": - // Check that if we got a microphone, we have not requested an audio - // capture, and if we have requested an audio capture, we are not - // getting a microphone instead. - if (audio && (device.mediaSource == "microphone") != sharingAudio) { - audioDevices.push({name: device.name, deviceIndex: devices.length, - mediaSource: device.mediaSource}); + if (aConstraints.audio) { + audioDevices.push({name: device.name, deviceIndex: devices.length}); devices.push(device); } break; @@ -120,7 +113,7 @@ function prompt(aContentWindow, aWindowID, aCallID, aConstraints, aDevices, aSec if (videoDevices.length) requestTypes.push(sharingScreen ? "Screen" : "Camera"); if (audioDevices.length) - requestTypes.push(sharingAudio ? "AudioCapture" : "Microphone"); + requestTypes.push("Microphone"); if (!requestTypes.length) { denyRequest({callID: aCallID}, "NotFoundError"); @@ -140,7 +133,6 @@ function prompt(aContentWindow, aWindowID, aCallID, aConstraints, aDevices, aSec secure: aSecure, requestTypes: requestTypes, sharingScreen: sharingScreen, - sharingAudio: sharingAudio, audioDevices: audioDevices, videoDevices: videoDevices }; diff --git a/browser/modules/webrtcUI.jsm b/browser/modules/webrtcUI.jsm index 792c58bf1dcd..be52cb8350f8 100644 --- a/browser/modules/webrtcUI.jsm +++ b/browser/modules/webrtcUI.jsm @@ -188,8 +188,7 @@ function getHost(uri, href) { function prompt(aBrowser, aRequest) { let {audioDevices: audioDevices, videoDevices: videoDevices, - sharingScreen: sharingScreen, sharingAudio: sharingAudio, - requestTypes: requestTypes} = aRequest; + sharingScreen: sharingScreen, requestTypes: requestTypes} = aRequest; let uri = Services.io.newURI(aRequest.documentURI, null, null); let host = getHost(uri); let chromeDoc = aBrowser.ownerDocument; @@ -199,9 +198,10 @@ function prompt(aBrowser, aRequest) { let message = stringBundle.getFormattedString(stringId, [host]); let mainLabel; - if (sharingScreen || sharingAudio) { + if (sharingScreen) { mainLabel = stringBundle.getString("getUserMedia.shareSelectedItems.label"); - } else { + } + else { let string = stringBundle.getString("getUserMedia.shareSelectedDevices.label"); mainLabel = PluralForm.get(requestTypes.length, string); } @@ -225,8 +225,8 @@ function prompt(aBrowser, aRequest) { } } ]; - // Bug 1037438: implement 'never' for screen sharing. - if (!sharingScreen && !sharingAudio) { + + if (!sharingScreen) { // Bug 1037438: implement 'never' for screen sharing. secondaryActions.push({ label: stringBundle.getString("getUserMedia.never.label"), accessKey: stringBundle.getString("getUserMedia.never.accesskey"), @@ -243,10 +243,10 @@ function prompt(aBrowser, aRequest) { }); } - if (aRequest.secure && !sharingScreen && !sharingAudio) { + if (aRequest.secure && !sharingScreen) { // Don't show the 'Always' action if the connection isn't secure, or for - // screen/audio sharing (because we can't guess which window the user wants - // to share without prompting). + // screen sharing (because we can't guess which window the user wants to + // share without prompting). secondaryActions.unshift({ label: stringBundle.getString("getUserMedia.always.label"), accessKey: stringBundle.getString("getUserMedia.always.accesskey"), @@ -266,8 +266,7 @@ function prompt(aBrowser, aRequest) { if (aTopic == "shown") { let PopupNotifications = chromeDoc.defaultView.PopupNotifications; let popupId = "Devices"; - if (requestTypes.length == 1 && (requestTypes[0] == "Microphone" || - requestTypes[0] == "AudioCapture")) + if (requestTypes.length == 1 && requestTypes[0] == "Microphone") popupId = "Microphone"; if (requestTypes.indexOf("Screen") != -1) popupId = "Screen"; @@ -385,7 +384,7 @@ function prompt(aBrowser, aRequest) { chromeDoc.getElementById("webRTC-selectCamera").hidden = !videoDevices.length || sharingScreen; chromeDoc.getElementById("webRTC-selectWindowOrScreen").hidden = !sharingScreen || !videoDevices.length; - chromeDoc.getElementById("webRTC-selectMicrophone").hidden = !audioDevices.length || sharingAudio; + chromeDoc.getElementById("webRTC-selectMicrophone").hidden = !audioDevices.length; let camMenupopup = chromeDoc.getElementById("webRTC-selectCamera-menupopup"); let windowMenupopup = chromeDoc.getElementById("webRTC-selectWindow-menupopup"); @@ -394,16 +393,12 @@ function prompt(aBrowser, aRequest) { listScreenShareDevices(windowMenupopup, videoDevices); else listDevices(camMenupopup, videoDevices); - - if (!sharingAudio) - listDevices(micMenupopup, audioDevices); - + listDevices(micMenupopup, audioDevices); if (requestTypes.length == 2) { let stringBundle = chromeDoc.defaultView.gNavigatorBundle; if (!sharingScreen) addDeviceToList(camMenupopup, stringBundle.getString("getUserMedia.noVideo.label"), "-1"); - if (!sharingAudio) - addDeviceToList(micMenupopup, stringBundle.getString("getUserMedia.noAudio.label"), "-1"); + addDeviceToList(micMenupopup, stringBundle.getString("getUserMedia.noAudio.label"), "-1"); } this.mainAction.callback = function(aRemember) { @@ -421,18 +416,13 @@ function prompt(aBrowser, aRequest) { } } if (audioDevices.length) { - if (!sharingAudio) { - let audioDeviceIndex = chromeDoc.getElementById("webRTC-selectMicrophone-menulist").value; - let allowMic = audioDeviceIndex != "-1"; - if (allowMic) - allowedDevices.push(audioDeviceIndex); - if (aRemember) { - perms.add(uri, "microphone", - allowMic ? perms.ALLOW_ACTION : perms.DENY_ACTION); - } - } else { - // Only one device possible for audio capture. - allowedDevices.push(0); + let audioDeviceIndex = chromeDoc.getElementById("webRTC-selectMicrophone-menulist").value; + let allowMic = audioDeviceIndex != "-1"; + if (allowMic) + allowedDevices.push(audioDeviceIndex); + if (aRemember) { + perms.add(uri, "microphone", + allowMic ? perms.ALLOW_ACTION : perms.DENY_ACTION); } } diff --git a/dom/audiochannel/AudioChannelAgent.cpp b/dom/audiochannel/AudioChannelAgent.cpp index 3a68bdd371ac..c02602db25de 100644 --- a/dom/audiochannel/AudioChannelAgent.cpp +++ b/dom/audiochannel/AudioChannelAgent.cpp @@ -35,7 +35,6 @@ NS_IMPL_CYCLE_COLLECTING_RELEASE(AudioChannelAgent) AudioChannelAgent::AudioChannelAgent() : mAudioChannelType(AUDIO_AGENT_CHANNEL_ERROR) - , mInnerWindowID(0) , mIsRegToService(false) { } @@ -105,10 +104,6 @@ AudioChannelAgent::InitInternal(nsIDOMWindow* aWindow, int32_t aChannelType, } if (aWindow) { - nsCOMPtr pInnerWindow = do_QueryInterface(aWindow); - MOZ_ASSERT(pInnerWindow->IsInnerWindow()); - mInnerWindowID = pInnerWindow->WindowID(); - nsCOMPtr topWindow; aWindow->GetScriptableTop(getter_AddRefs(topWindow)); mWindow = do_QueryInterface(topWindow); @@ -196,18 +191,3 @@ AudioChannelAgent::WindowID() const { return mWindow ? mWindow->WindowID() : 0; } - -void -AudioChannelAgent::WindowAudioCaptureChanged(uint64_t aInnerWindowID) -{ - if (aInnerWindowID != mInnerWindowID) { - return; - } - - nsCOMPtr callback = GetCallback(); - if (!callback) { - return; - } - - callback->WindowAudioCaptureChanged(); -} diff --git a/dom/audiochannel/AudioChannelAgent.h b/dom/audiochannel/AudioChannelAgent.h index 809d34f2a1e7..75b2fd335edc 100644 --- a/dom/audiochannel/AudioChannelAgent.h +++ b/dom/audiochannel/AudioChannelAgent.h @@ -34,7 +34,6 @@ public: AudioChannelAgent(); void WindowVolumeChanged(); - void WindowAudioCaptureChanged(uint64_t aInnerWindowID); nsPIDOMWindow* Window() const { @@ -62,7 +61,6 @@ private: nsWeakPtr mWeakCallback; int32_t mAudioChannelType; - uint64_t mInnerWindowID; bool mIsRegToService; }; diff --git a/dom/audiochannel/AudioChannelService.cpp b/dom/audiochannel/AudioChannelService.cpp index 93a916b07b43..c3b858ab7761 100644 --- a/dom/audiochannel/AudioChannelService.cpp +++ b/dom/audiochannel/AudioChannelService.cpp @@ -546,38 +546,6 @@ AudioChannelService::RefreshAgentsVolume(nsPIDOMWindow* aWindow) } } -void -AudioChannelService::RefreshAgentsCapture(nsPIDOMWindow* aWindow, - uint64_t aInnerWindowID) -{ - MOZ_ASSERT(aWindow); - MOZ_ASSERT(aWindow->IsOuterWindow()); - - nsCOMPtr topWindow; - aWindow->GetScriptableTop(getter_AddRefs(topWindow)); - nsCOMPtr pTopWindow = do_QueryInterface(topWindow); - if (!pTopWindow) { - return; - } - - AudioChannelWindow* winData = GetWindowData(pTopWindow->WindowID()); - - // This can happen, but only during shutdown, because the the outer window - // changes ScriptableTop, so that its ID is different. - // In this case either we are capturing, and it's too late because the window - // has been closed anyways, or we are un-capturing, and everything has already - // been cleaned up by the HTMLMediaElements or the AudioContexts. - if (!winData) { - return; - } - - nsTObserverArray::ForwardIterator - iter(winData->mAgents); - while (iter.HasMore()) { - iter.GetNext()->WindowAudioCaptureChanged(aInnerWindowID); - } -} - /* static */ const nsAttrValue::EnumTable* AudioChannelService::GetAudioChannelTable() { diff --git a/dom/audiochannel/AudioChannelService.h b/dom/audiochannel/AudioChannelService.h index 4dc0bedb7475..a0a65d8c737a 100644 --- a/dom/audiochannel/AudioChannelService.h +++ b/dom/audiochannel/AudioChannelService.h @@ -102,14 +102,6 @@ public: void RefreshAgentsVolume(nsPIDOMWindow* aWindow); - // This method needs to know the inner window that wants to capture audio. We - // group agents per top outer window, but we can have multiple innerWindow per - // top outerWindow (subiframes, etc.) and we have to identify all the agents - // just for a particular innerWindow. - void RefreshAgentsCapture(nsPIDOMWindow* aWindow, - uint64_t aInnerWindowID); - - #ifdef MOZ_WIDGET_GONK void RegisterSpeakerManager(SpeakerManagerService* aSpeakerManager) { diff --git a/dom/audiochannel/nsIAudioChannelAgent.idl b/dom/audiochannel/nsIAudioChannelAgent.idl index 87934d4bacc0..a35f54c09530 100644 --- a/dom/audiochannel/nsIAudioChannelAgent.idl +++ b/dom/audiochannel/nsIAudioChannelAgent.idl @@ -6,18 +6,13 @@ interface nsIDOMWindow; -[uuid(5fe83b24-38b9-4901-a4a1-d1bd57d3fe18)] +[uuid(4f537c88-3722-4946-9a09-ce559fa0591d)] interface nsIAudioChannelAgentCallback : nsISupports { /** * Notified when the window volume/mute is changed */ void windowVolumeChanged(in float aVolume, in bool aMuted); - - /** - * Notified when the capture state is changed. - */ - void windowAudioCaptureChanged(); }; /** diff --git a/dom/base/nsGlobalWindow.cpp b/dom/base/nsGlobalWindow.cpp index 59483a458bd1..3827f6b57a01 100644 --- a/dom/base/nsGlobalWindow.cpp +++ b/dom/base/nsGlobalWindow.cpp @@ -564,7 +564,7 @@ nsPIDOMWindow::nsPIDOMWindow(nsPIDOMWindow *aOuterWindow) mMayHavePointerEnterLeaveEventListener(false), mIsModalContentWindow(false), mIsActive(false), mIsBackground(false), - mAudioMuted(false), mAudioVolume(1.0), mAudioCaptured(false), + mAudioMuted(false), mAudioVolume(1.0), mDesktopModeViewport(false), mInnerWindow(nullptr), mOuterWindow(aOuterWindow), // Make sure no actual window ends up with mWindowID == 0 @@ -3745,26 +3745,6 @@ nsPIDOMWindow::RefreshMediaElements() service->RefreshAgentsVolume(GetOuterWindow()); } -bool -nsPIDOMWindow::GetAudioCaptured() const -{ - MOZ_ASSERT(IsInnerWindow()); - return mAudioCaptured; -} - -nsresult -nsPIDOMWindow::SetAudioCapture(bool aCapture) -{ - MOZ_ASSERT(IsInnerWindow()); - - mAudioCaptured = aCapture; - - nsRefPtr service = AudioChannelService::GetOrCreate(); - service->RefreshAgentsCapture(GetOuterWindow(), mWindowID); - - return NS_OK; -} - // nsISpeechSynthesisGetter #ifdef MOZ_WEBSPEECH diff --git a/dom/base/nsPIDOMWindow.h b/dom/base/nsPIDOMWindow.h index 3e6404e9950c..b9f17bb801a4 100644 --- a/dom/base/nsPIDOMWindow.h +++ b/dom/base/nsPIDOMWindow.h @@ -185,9 +185,6 @@ public: float GetAudioVolume() const; nsresult SetAudioVolume(float aVolume); - bool GetAudioCaptured() const; - nsresult SetAudioCapture(bool aCapture); - virtual void SetServiceWorkersTestingEnabled(bool aEnabled) { MOZ_ASSERT(IsOuterWindow()); @@ -825,8 +822,6 @@ protected: bool mAudioMuted; float mAudioVolume; - bool mAudioCaptured; - // current desktop mode flag. bool mDesktopModeViewport; diff --git a/dom/fmradio/FMRadio.cpp b/dom/fmradio/FMRadio.cpp index 150ee703a1f7..1f5d8de3f0e1 100644 --- a/dom/fmradio/FMRadio.cpp +++ b/dom/fmradio/FMRadio.cpp @@ -471,12 +471,6 @@ FMRadio::WindowVolumeChanged(float aVolume, bool aMuted) return NS_OK; } -NS_IMETHODIMP -FMRadio::WindowAudioCaptureChanged() -{ - return NS_OK; -} - NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION_INHERITED(FMRadio) NS_INTERFACE_MAP_ENTRY(nsISupportsWeakReference) NS_INTERFACE_MAP_ENTRY(nsIAudioChannelAgentCallback) diff --git a/dom/html/HTMLMediaElement.cpp b/dom/html/HTMLMediaElement.cpp index f511ef93f51c..493bbd26678a 100644 --- a/dom/html/HTMLMediaElement.cpp +++ b/dom/html/HTMLMediaElement.cpp @@ -2030,7 +2030,6 @@ HTMLMediaElement::HTMLMediaElement(already_AddRefed& aNo mAllowCasting(false), mIsCasting(false), mAudioCaptured(false), - mAudioCapturedByWindow(false), mPlayingBeforeSeek(false), mPlayingThroughTheAudioChannelBeforeSeek(false), mPausedForInactiveDocumentOrChannel(false), @@ -2098,11 +2097,6 @@ HTMLMediaElement::~HTMLMediaElement() EndSrcMediaStreamPlayback(); } - if (mCaptureStreamPort) { - mCaptureStreamPort->Destroy(); - mCaptureStreamPort = nullptr; - } - NS_ASSERTION(MediaElementTableCount(this, mLoadingSrc) == 0, "Destroyed media element should no longer be in element table"); @@ -4481,7 +4475,8 @@ void HTMLMediaElement::UpdateAudioChannelPlayingState() (!mPaused && (HasAttr(kNameSpaceID_None, nsGkAtoms::loop) || (mReadyState >= nsIDOMHTMLMediaElement::HAVE_CURRENT_DATA && - !IsPlaybackEnded()) || + !IsPlaybackEnded() && + (!mSrcStream || HasAudio())) || mPlayingThroughTheAudioChannelBeforeSeek)); if (playingThroughTheAudioChannel != mPlayingThroughTheAudioChannel) { mPlayingThroughTheAudioChannel = playingThroughTheAudioChannel; @@ -4497,7 +4492,7 @@ void HTMLMediaElement::UpdateAudioChannelPlayingState() if (!mAudioChannelAgent) { return; } - mAudioChannelAgent->InitWithWeakCallback(OwnerDoc()->GetInnerWindow(), + mAudioChannelAgent->InitWithWeakCallback(OwnerDoc()->GetWindow(), static_cast(mAudioChannel), this); } @@ -4509,10 +4504,6 @@ void HTMLMediaElement::UpdateAudioChannelPlayingState() void HTMLMediaElement::NotifyAudioChannelAgent(bool aPlaying) { - // Immediately check if this should go to the MSG instead of the normal - // media playback route. - WindowAudioCaptureChanged(); - // This is needed to pass nsContentUtils::IsCallerChrome(). // AudioChannel API should not called from content but it can happen that // this method has some content JS in its stack. @@ -4683,53 +4674,6 @@ HTMLMediaElement::GetTopLevelPrincipal() } #endif // MOZ_EME -NS_IMETHODIMP HTMLMediaElement::WindowAudioCaptureChanged() -{ - MOZ_ASSERT(mAudioChannelAgent); - - if (!OwnerDoc()->GetInnerWindow()) { - return NS_OK; - } - bool captured = OwnerDoc()->GetInnerWindow()->GetAudioCaptured(); - - if (captured != mAudioCapturedByWindow) { - if (captured) { - mAudioCapturedByWindow = true; - nsCOMPtr window = - do_QueryInterface(OwnerDoc()->GetParentObject()); - uint64_t id = window->WindowID(); - MediaStreamGraph* msg = MediaStreamGraph::GetInstance(); - - if (!mPlaybackStream) { - nsRefPtr stream = CaptureStreamInternal(false, msg); - mCaptureStreamPort = msg->ConnectToCaptureStream(id, stream->GetStream()); - } else { - mCaptureStreamPort = msg->ConnectToCaptureStream(id, mPlaybackStream->GetStream()); - } - } else { - mAudioCapturedByWindow = false; - if (mDecoder) { - ProcessedMediaStream* ps = - mCaptureStreamPort->GetSource()->AsProcessedStream(); - MOZ_ASSERT(ps); - - for (uint32_t i = 0; i < mOutputStreams.Length(); i++) { - if (mOutputStreams[i].mStream->GetStream() == ps) { - mOutputStreams.RemoveElementAt(i); - break; - } - } - - mDecoder->RemoveOutputStream(ps); - } - mCaptureStreamPort->Destroy(); - mCaptureStreamPort = nullptr; - } - } - - return NS_OK; -} - AudioTrackList* HTMLMediaElement::AudioTracks() { diff --git a/dom/html/HTMLMediaElement.h b/dom/html/HTMLMediaElement.h index 406478fc507c..84f4ed0d9cd8 100644 --- a/dom/html/HTMLMediaElement.h +++ b/dom/html/HTMLMediaElement.h @@ -1074,9 +1074,6 @@ protected: // Holds a reference to a MediaInputPort connecting mSrcStream to mPlaybackStream. nsRefPtr mPlaybackStreamInputPort; - // Holds a reference to the stream connecting this stream to the capture sink. - nsRefPtr mCaptureStreamPort; - // Holds a reference to a stream with mSrcStream as input but intended for // playback. Used so we don't block playback of other video elements // playing the same mSrcStream. @@ -1286,9 +1283,6 @@ protected: // True if the sound is being captured. bool mAudioCaptured; - // True if the sound is being captured by the window. - bool mAudioCapturedByWindow; - // If TRUE then the media element was actively playing before the currently // in progress seeking. If FALSE then the media element is either not seeking // or was not actively playing before the current seek. Used to decide whether diff --git a/dom/media/AudioCaptureStream.cpp b/dom/media/AudioCaptureStream.cpp deleted file mode 100644 index f22050328958..000000000000 --- a/dom/media/AudioCaptureStream.cpp +++ /dev/null @@ -1,133 +0,0 @@ -/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-*/ -/* 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/. */ - -#include "MediaStreamGraphImpl.h" -#include "mozilla/MathAlgorithms.h" -#include "mozilla/unused.h" - -#include "AudioSegment.h" -#include "mozilla/Logging.h" -#include "mozilla/Attributes.h" -#include "AudioCaptureStream.h" -#include "ImageContainer.h" -#include "AudioNodeEngine.h" -#include "AudioNodeStream.h" -#include "AudioNodeExternalInputStream.h" -#include "webaudio/MediaStreamAudioDestinationNode.h" -#include -#include "DOMMediaStream.h" - -using namespace mozilla::layers; -using namespace mozilla::dom; -using namespace mozilla::gfx; - -namespace mozilla -{ - -// We are mixing to mono until PeerConnection can accept stereo -static const uint32_t MONO = 1; - -AudioCaptureStream::AudioCaptureStream(DOMMediaStream* aWrapper) - : ProcessedMediaStream(aWrapper), mTrackCreated(false) -{ - MOZ_ASSERT(NS_IsMainThread()); - MOZ_COUNT_CTOR(AudioCaptureStream); - mMixer.AddCallback(this); -} - -AudioCaptureStream::~AudioCaptureStream() -{ - MOZ_COUNT_DTOR(AudioCaptureStream); - mMixer.RemoveCallback(this); -} - -void -AudioCaptureStream::ProcessInput(GraphTime aFrom, GraphTime aTo, - uint32_t aFlags) -{ - uint32_t inputCount = mInputs.Length(); - StreamBuffer::Track* track = EnsureTrack(AUDIO_TRACK); - // Notify the DOM everything is in order. - if (!mTrackCreated) { - for (uint32_t i = 0; i < mListeners.Length(); i++) { - MediaStreamListener* l = mListeners[i]; - AudioSegment tmp; - l->NotifyQueuedTrackChanges( - Graph(), AUDIO_TRACK, 0, MediaStreamListener::TRACK_EVENT_CREATED, tmp); - l->NotifyFinishedTrackCreation(Graph()); - } - mTrackCreated = true; - } - - // If the captured stream is connected back to a object on the page (be it an - // HTMLMediaElement with a stream as source, or an AudioContext), a cycle - // situation occur. This can work if it's an AudioContext with at least one - // DelayNode, but the MSG will mute the whole cycle otherwise. - bool blocked = mFinished || mBlocked.GetAt(aFrom); - if (blocked || InMutedCycle() || inputCount == 0) { - track->Get()->AppendNullData(aTo - aFrom); - } else { - // We mix down all the tracks of all inputs, to a stereo track. Everything - // is {up,down}-mixed to stereo. - mMixer.StartMixing(); - AudioSegment output; - for (uint32_t i = 0; i < inputCount; i++) { - MediaStream* s = mInputs[i]->GetSource(); - StreamBuffer::TrackIter tracks(s->GetStreamBuffer(), MediaSegment::AUDIO); - while (!tracks.IsEnded()) { - AudioSegment* inputSegment = tracks->Get(); - StreamTime inputStart = s->GraphTimeToStreamTime(aFrom); - StreamTime inputEnd = s->GraphTimeToStreamTime(aTo); - AudioSegment toMix; - toMix.AppendSlice(*inputSegment, inputStart, inputEnd); - // Care for streams blocked in the [aTo, aFrom] range. - if (inputEnd - inputStart < aTo - aFrom) { - toMix.AppendNullData((aTo - aFrom) - (inputEnd - inputStart)); - } - toMix.Mix(mMixer, MONO, Graph()->GraphRate()); - tracks.Next(); - } - } - // This calls MixerCallback below - mMixer.FinishMixing(); - } - - // Regardless of the status of the input tracks, we go foward. - mBuffer.AdvanceKnownTracksTime(GraphTimeToStreamTime((aTo))); -} - -void -AudioCaptureStream::MixerCallback(AudioDataValue* aMixedBuffer, - AudioSampleFormat aFormat, uint32_t aChannels, - uint32_t aFrames, uint32_t aSampleRate) -{ - nsAutoTArray, MONO> output; - nsAutoTArray bufferPtrs; - output.SetLength(MONO); - bufferPtrs.SetLength(MONO); - - uint32_t written = 0; - // We need to copy here, because the mixer will reuse the storage, we should - // not hold onto it. Buffers are in planar format. - for (uint32_t channel = 0; channel < aChannels; channel++) { - AudioDataValue* out = output[channel].AppendElements(aFrames); - PodCopy(out, aMixedBuffer + written, aFrames); - bufferPtrs[channel] = out; - written += aFrames; - } - AudioChunk chunk; - chunk.mBuffer = new mozilla::SharedChannelArrayBuffer(&output); - chunk.mDuration = aFrames; - chunk.mBufferFormat = aFormat; - chunk.mVolume = 1.0f; - chunk.mChannelData.SetLength(MONO); - for (uint32_t channel = 0; channel < aChannels; channel++) { - chunk.mChannelData[channel] = bufferPtrs[channel]; - } - - // Now we have mixed data, simply append it to out track. - EnsureTrack(AUDIO_TRACK)->Get()->AppendAndConsumeChunk(&chunk); -} -} diff --git a/dom/media/AudioCaptureStream.h b/dom/media/AudioCaptureStream.h deleted file mode 100644 index 322dcd880458..000000000000 --- a/dom/media/AudioCaptureStream.h +++ /dev/null @@ -1,40 +0,0 @@ -/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-*/ -/* 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/. */ - -#ifndef MOZILLA_AUDIOCAPTURESTREAM_H_ -#define MOZILLA_AUDIOCAPTURESTREAM_H_ - -#include "MediaStreamGraph.h" -#include "AudioMixer.h" -#include - -namespace mozilla -{ - -class DOMMediaStream; - -/** - * See MediaStreamGraph::CreateAudioCaptureStream. - */ -class AudioCaptureStream : public ProcessedMediaStream, - public MixerCallbackReceiver -{ -public: - explicit AudioCaptureStream(DOMMediaStream* aWrapper); - virtual ~AudioCaptureStream(); - - void ProcessInput(GraphTime aFrom, GraphTime aTo, uint32_t aFlags) override; - -protected: - enum { AUDIO_TRACK = 1 }; - void MixerCallback(AudioDataValue* aMixedBuffer, AudioSampleFormat aFormat, - uint32_t aChannels, uint32_t aFrames, - uint32_t aSampleRate) override; - AudioMixer mMixer; - bool mTrackCreated; -}; -} - -#endif /* MOZILLA_AUDIOCAPTURESTREAM_H_ */ diff --git a/dom/media/AudioChannelFormat.cpp b/dom/media/AudioChannelFormat.cpp index 1a1ce9d61ac7..a447b1dd5d73 100644 --- a/dom/media/AudioChannelFormat.cpp +++ b/dom/media/AudioChannelFormat.cpp @@ -4,11 +4,26 @@ * You can obtain one at http://mozilla.org/MPL/2.0/. */ #include "AudioChannelFormat.h" +#include "nsTArray.h" #include namespace mozilla { +enum { + SURROUND_L, + SURROUND_R, + SURROUND_C, + SURROUND_LFE, + SURROUND_SL, + SURROUND_SR +}; + +static const uint32_t CUSTOM_CHANNEL_LAYOUTS = 6; + +static const int IGNORE = CUSTOM_CHANNEL_LAYOUTS; +static const float IGNORE_F = 0.0f; + uint32_t GetAudioChannelsSuperset(uint32_t aChannels1, uint32_t aChannels2) { @@ -48,6 +63,9 @@ gUpMixMatrices[CUSTOM_CHANNEL_LAYOUTS*(CUSTOM_CHANNEL_LAYOUTS - 1)/2] = { { 0, 1, 2, 3, 4, IGNORE } } }; +static const int gMixingMatrixIndexByChannels[CUSTOM_CHANNEL_LAYOUTS - 1] = + { 0, 5, 9, 12, 14 }; + void AudioChannelsUpMix(nsTArray* aChannelArray, uint32_t aOutputChannelCount, @@ -58,8 +76,8 @@ AudioChannelsUpMix(nsTArray* aChannelArray, GetAudioChannelsSuperset(aOutputChannelCount, inputChannelCount); NS_ASSERTION(outputChannelCount > inputChannelCount, "No up-mix needed"); - MOZ_ASSERT(inputChannelCount > 0, "Bad number of channels"); - MOZ_ASSERT(outputChannelCount > 0, "Bad number of channels"); + NS_ASSERTION(inputChannelCount > 0, "Bad number of channels"); + NS_ASSERTION(outputChannelCount > 0, "Bad number of channels"); aChannelArray->SetLength(outputChannelCount); @@ -90,4 +108,94 @@ AudioChannelsUpMix(nsTArray* aChannelArray, } } +/** + * DownMixMatrix represents a conversion matrix efficiently by exploiting the + * fact that each input channel contributes to at most one output channel, + * except possibly for the C input channel in layouts that have one. Also, + * every input channel is multiplied by the same coefficient for every output + * channel it contributes to. + */ +struct DownMixMatrix { + // Every input channel c is copied to output channel mInputDestination[c] + // after multiplying by mInputCoefficient[c]. + uint8_t mInputDestination[CUSTOM_CHANNEL_LAYOUTS]; + // If not IGNORE, then the C channel is copied to this output channel after + // multiplying by its coefficient. + uint8_t mCExtraDestination; + float mInputCoefficient[CUSTOM_CHANNEL_LAYOUTS]; +}; + +static const DownMixMatrix +gDownMixMatrices[CUSTOM_CHANNEL_LAYOUTS*(CUSTOM_CHANNEL_LAYOUTS - 1)/2] = +{ + // Downmixes to mono + { { 0, 0 }, IGNORE, { 0.5f, 0.5f } }, + { { 0, IGNORE, IGNORE }, IGNORE, { 1.0f, IGNORE_F, IGNORE_F } }, + { { 0, 0, 0, 0 }, IGNORE, { 0.25f, 0.25f, 0.25f, 0.25f } }, + { { 0, IGNORE, IGNORE, IGNORE, IGNORE }, IGNORE, { 1.0f, IGNORE_F, IGNORE_F, IGNORE_F, IGNORE_F } }, + { { 0, 0, 0, IGNORE, 0, 0 }, IGNORE, { 0.7071f, 0.7071f, 1.0f, IGNORE_F, 0.5f, 0.5f } }, + // Downmixes to stereo + { { 0, 1, IGNORE }, IGNORE, { 1.0f, 1.0f, IGNORE_F } }, + { { 0, 1, 0, 1 }, IGNORE, { 0.5f, 0.5f, 0.5f, 0.5f } }, + { { 0, 1, IGNORE, IGNORE, IGNORE }, IGNORE, { 1.0f, 1.0f, IGNORE_F, IGNORE_F, IGNORE_F } }, + { { 0, 1, 0, IGNORE, 0, 1 }, 1, { 1.0f, 1.0f, 0.7071f, IGNORE_F, 0.7071f, 0.7071f } }, + // Downmixes to 3-channel + { { 0, 1, 2, IGNORE }, IGNORE, { 1.0f, 1.0f, 1.0f, IGNORE_F } }, + { { 0, 1, 2, IGNORE, IGNORE }, IGNORE, { 1.0f, 1.0f, 1.0f, IGNORE_F, IGNORE_F } }, + { { 0, 1, 2, IGNORE, IGNORE, IGNORE }, IGNORE, { 1.0f, 1.0f, 1.0f, IGNORE_F, IGNORE_F, IGNORE_F } }, + // Downmixes to quad + { { 0, 1, 2, 3, IGNORE }, IGNORE, { 1.0f, 1.0f, 1.0f, 1.0f, IGNORE_F } }, + { { 0, 1, 0, IGNORE, 2, 3 }, 1, { 1.0f, 1.0f, 0.7071f, IGNORE_F, 1.0f, 1.0f } }, + // Downmixes to 5-channel + { { 0, 1, 2, 3, 4, IGNORE }, IGNORE, { 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, IGNORE_F } } +}; + +void +AudioChannelsDownMix(const nsTArray& aChannelArray, + float** aOutputChannels, + uint32_t aOutputChannelCount, + uint32_t aDuration) +{ + uint32_t inputChannelCount = aChannelArray.Length(); + const void* const* inputChannels = aChannelArray.Elements(); + NS_ASSERTION(inputChannelCount > aOutputChannelCount, "Nothing to do"); + + if (inputChannelCount > 6) { + // Just drop the unknown channels. + for (uint32_t o = 0; o < aOutputChannelCount; ++o) { + memcpy(aOutputChannels[o], inputChannels[o], aDuration*sizeof(float)); + } + return; + } + + // Ignore unknown channels, they're just dropped. + inputChannelCount = std::min(6, inputChannelCount); + + const DownMixMatrix& m = gDownMixMatrices[ + gMixingMatrixIndexByChannels[aOutputChannelCount - 1] + + inputChannelCount - aOutputChannelCount - 1]; + + // This is slow, but general. We can define custom code for special + // cases later. + for (uint32_t s = 0; s < aDuration; ++s) { + // Reserve an extra junk channel at the end for the cases where we + // want an input channel to contribute to nothing + float outputChannels[CUSTOM_CHANNEL_LAYOUTS + 1]; + memset(outputChannels, 0, sizeof(float)*(CUSTOM_CHANNEL_LAYOUTS)); + for (uint32_t c = 0; c < inputChannelCount; ++c) { + outputChannels[m.mInputDestination[c]] += + m.mInputCoefficient[c]*(static_cast(inputChannels[c]))[s]; + } + // Utilize the fact that in every layout, C is the third channel. + if (m.mCExtraDestination != IGNORE) { + outputChannels[m.mCExtraDestination] += + m.mInputCoefficient[SURROUND_C]*(static_cast(inputChannels[SURROUND_C]))[s]; + } + + for (uint32_t c = 0; c < aOutputChannelCount; ++c) { + aOutputChannels[c][s] = outputChannels[c]; + } + } +} + } // namespace mozilla diff --git a/dom/media/AudioChannelFormat.h b/dom/media/AudioChannelFormat.h index d5aef21c5668..99a201456aa5 100644 --- a/dom/media/AudioChannelFormat.h +++ b/dom/media/AudioChannelFormat.h @@ -9,8 +9,6 @@ #include #include "nsTArrayForwardDeclare.h" -#include "AudioSampleFormat.h" -#include "nsTArray.h" namespace mozilla { @@ -31,26 +29,6 @@ namespace mozilla { * Only 1, 2, 4 and 6 are currently defined in Web Audio. */ -enum { - SURROUND_L, - SURROUND_R, - SURROUND_C, - SURROUND_LFE, - SURROUND_SL, - SURROUND_SR -}; - -const uint32_t CUSTOM_CHANNEL_LAYOUTS = 6; - -// This is defined by some Windows SDK header. -#undef IGNORE - -const int IGNORE = CUSTOM_CHANNEL_LAYOUTS; -const float IGNORE_F = 0.0f; - -const int gMixingMatrixIndexByChannels[CUSTOM_CHANNEL_LAYOUTS - 1] = - { 0, 5, 9, 12, 14 }; - /** * Return a channel count whose channel layout includes all the channels from * aChannels1 and aChannels2. @@ -75,102 +53,19 @@ AudioChannelsUpMix(nsTArray* aChannelArray, uint32_t aOutputChannelCount, const void* aZeroChannel); - /** - * DownMixMatrix represents a conversion matrix efficiently by exploiting the - * fact that each input channel contributes to at most one output channel, - * except possibly for the C input channel in layouts that have one. Also, - * every input channel is multiplied by the same coefficient for every output - * channel it contributes to. + * Given an array of input channels (which must be float format!), + * downmix to aOutputChannelCount, and copy the results to the + * channel buffers in aOutputChannels. + * Don't call this with input count <= output count. */ -struct DownMixMatrix { - // Every input channel c is copied to output channel mInputDestination[c] - // after multiplying by mInputCoefficient[c]. - uint8_t mInputDestination[CUSTOM_CHANNEL_LAYOUTS]; - // If not IGNORE, then the C channel is copied to this output channel after - // multiplying by its coefficient. - uint8_t mCExtraDestination; - float mInputCoefficient[CUSTOM_CHANNEL_LAYOUTS]; -}; - -static const DownMixMatrix -gDownMixMatrices[CUSTOM_CHANNEL_LAYOUTS*(CUSTOM_CHANNEL_LAYOUTS - 1)/2] = -{ - // Downmixes to mono - { { 0, 0 }, IGNORE, { 0.5f, 0.5f } }, - { { 0, IGNORE, IGNORE }, IGNORE, { 1.0f, IGNORE_F, IGNORE_F } }, - { { 0, 0, 0, 0 }, IGNORE, { 0.25f, 0.25f, 0.25f, 0.25f } }, - { { 0, IGNORE, IGNORE, IGNORE, IGNORE }, IGNORE, { 1.0f, IGNORE_F, IGNORE_F, IGNORE_F, IGNORE_F } }, - { { 0, 0, 0, IGNORE, 0, 0 }, IGNORE, { 0.7071f, 0.7071f, 1.0f, IGNORE_F, 0.5f, 0.5f } }, - // Downmixes to stereo - { { 0, 1, IGNORE }, IGNORE, { 1.0f, 1.0f, IGNORE_F } }, - { { 0, 1, 0, 1 }, IGNORE, { 0.5f, 0.5f, 0.5f, 0.5f } }, - { { 0, 1, IGNORE, IGNORE, IGNORE }, IGNORE, { 1.0f, 1.0f, IGNORE_F, IGNORE_F, IGNORE_F } }, - { { 0, 1, 0, IGNORE, 0, 1 }, 1, { 1.0f, 1.0f, 0.7071f, IGNORE_F, 0.7071f, 0.7071f } }, - // Downmixes to 3-channel - { { 0, 1, 2, IGNORE }, IGNORE, { 1.0f, 1.0f, 1.0f, IGNORE_F } }, - { { 0, 1, 2, IGNORE, IGNORE }, IGNORE, { 1.0f, 1.0f, 1.0f, IGNORE_F, IGNORE_F } }, - { { 0, 1, 2, IGNORE, IGNORE, IGNORE }, IGNORE, { 1.0f, 1.0f, 1.0f, IGNORE_F, IGNORE_F, IGNORE_F } }, - // Downmixes to quad - { { 0, 1, 2, 3, IGNORE }, IGNORE, { 1.0f, 1.0f, 1.0f, 1.0f, IGNORE_F } }, - { { 0, 1, 0, IGNORE, 2, 3 }, 1, { 1.0f, 1.0f, 0.7071f, IGNORE_F, 1.0f, 1.0f } }, - // Downmixes to 5-channel - { { 0, 1, 2, 3, 4, IGNORE }, IGNORE, { 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, IGNORE_F } } -}; - -/** - * Given an array of input channels, downmix to aOutputChannelCount, and copy - * the results to the channel buffers in aOutputChannels. Don't call this with - * input count <= output count. - */ -template -void AudioChannelsDownMix(const nsTArray& aChannelArray, - T** aOutputChannels, +void +AudioChannelsDownMix(const nsTArray& aChannelArray, + float** aOutputChannels, uint32_t aOutputChannelCount, - uint32_t aDuration) -{ - uint32_t inputChannelCount = aChannelArray.Length(); - const void* const* inputChannels = aChannelArray.Elements(); - NS_ASSERTION(inputChannelCount > aOutputChannelCount, "Nothing to do"); - - if (inputChannelCount > 6) { - // Just drop the unknown channels. - for (uint32_t o = 0; o < aOutputChannelCount; ++o) { - memcpy(aOutputChannels[o], inputChannels[o], aDuration*sizeof(T)); - } - return; - } - - // Ignore unknown channels, they're just dropped. - inputChannelCount = std::min(6, inputChannelCount); - - const DownMixMatrix& m = gDownMixMatrices[ - gMixingMatrixIndexByChannels[aOutputChannelCount - 1] + - inputChannelCount - aOutputChannelCount - 1]; - - // This is slow, but general. We can define custom code for special - // cases later. - for (uint32_t s = 0; s < aDuration; ++s) { - // Reserve an extra junk channel at the end for the cases where we - // want an input channel to contribute to nothing - T outputChannels[CUSTOM_CHANNEL_LAYOUTS + 1]; - memset(outputChannels, 0, sizeof(T)*(CUSTOM_CHANNEL_LAYOUTS)); - for (uint32_t c = 0; c < inputChannelCount; ++c) { - outputChannels[m.mInputDestination[c]] += - m.mInputCoefficient[c]*(static_cast(inputChannels[c]))[s]; - } - // Utilize the fact that in every layout, C is the third channel. - if (m.mCExtraDestination != IGNORE) { - outputChannels[m.mCExtraDestination] += - m.mInputCoefficient[SURROUND_C]*(static_cast(inputChannels[SURROUND_C]))[s]; - } - - for (uint32_t c = 0; c < aOutputChannelCount; ++c) { - aOutputChannels[c][s] = outputChannels[c]; - } - } -} + uint32_t aDuration); +// A version of AudioChannelsDownMix that downmixes int16_ts may be required. } // namespace mozilla diff --git a/dom/media/AudioMixer.h b/dom/media/AudioMixer.h index c86aa33455b3..c992942e25f9 100644 --- a/dom/media/AudioMixer.h +++ b/dom/media/AudioMixer.h @@ -26,9 +26,7 @@ struct MixerCallbackReceiver { * stream. * * AudioMixer::Mix is to be called repeatedly with buffers that have the same - * length, sample rate, sample format and channel count. This class works with - * interleaved and plannar buffers, but the buffer mixed must be of the same - * type during a mixing cycle. + * length, sample rate, sample format and channel count. * * When all the tracks have been mixed, calling FinishMixing will call back with * a buffer containing the mixed audio data. @@ -73,7 +71,7 @@ public: mSampleRate = mChannels = mFrames = 0; } - /* Add a buffer to the mix. */ + /* Add a buffer to the mix. aSamples is interleaved. */ void Mix(AudioDataValue* aSamples, uint32_t aChannels, uint32_t aFrames, diff --git a/dom/media/AudioSegment.cpp b/dom/media/AudioSegment.cpp index c4162842d360..ddd16bbe16a5 100644 --- a/dom/media/AudioSegment.cpp +++ b/dom/media/AudioSegment.cpp @@ -146,103 +146,6 @@ void AudioSegment::ResampleChunks(SpeexResamplerState* aResampler, uint32_t aInR } } -// This helps to to safely get a pointer to the position we want to start -// writing a planar audio buffer, depending on the channel and the offset in the -// buffer. -static AudioDataValue* -PointerForOffsetInChannel(AudioDataValue* aData, size_t aLengthSamples, - uint32_t aChannelCount, uint32_t aChannel, - uint32_t aOffsetSamples) -{ - size_t samplesPerChannel = aLengthSamples / aChannelCount; - size_t beginningOfChannel = samplesPerChannel * aChannel; - MOZ_ASSERT(aChannel * samplesPerChannel + aOffsetSamples < aLengthSamples, - "Offset request out of bounds."); - return aData + beginningOfChannel + aOffsetSamples; -} - -void -AudioSegment::Mix(AudioMixer& aMixer, uint32_t aOutputChannels, - uint32_t aSampleRate) -{ - nsAutoTArray - buf; - nsAutoTArray channelData; - uint32_t offsetSamples = 0; - uint32_t duration = GetDuration(); - - if (duration <= 0) { - MOZ_ASSERT(duration == 0); - return; - } - - uint32_t outBufferLength = duration * aOutputChannels; - buf.SetLength(outBufferLength); - - for (ChunkIterator ci(*this); !ci.IsEnded(); ci.Next()) { - AudioChunk& c = *ci; - uint32_t frames = c.mDuration; - - // If the chunk is silent, simply write the right number of silence in the - // buffers. - if (c.mBufferFormat == AUDIO_FORMAT_SILENCE) { - for (uint32_t channel = 0; channel < aOutputChannels; channel++) { - AudioDataValue* ptr = - PointerForOffsetInChannel(buf.Elements(), outBufferLength, - aOutputChannels, channel, offsetSamples); - PodZero(ptr, frames); - } - } else { - // Othewise, we need to upmix or downmix appropriately, depending on the - // desired input and output channels. - channelData.SetLength(c.mChannelData.Length()); - for (uint32_t i = 0; i < channelData.Length(); ++i) { - channelData[i] = c.mChannelData[i]; - } - if (channelData.Length() < aOutputChannels) { - // Up-mix. - AudioChannelsUpMix(&channelData, aOutputChannels, gZeroChannel); - for (uint32_t channel = 0; channel < aOutputChannels; channel++) { - AudioDataValue* ptr = - PointerForOffsetInChannel(buf.Elements(), outBufferLength, - aOutputChannels, channel, offsetSamples); - PodCopy(ptr, reinterpret_cast(channelData[channel]), - frames); - } - MOZ_ASSERT(channelData.Length() == aOutputChannels); - } else if (channelData.Length() > aOutputChannels) { - // Down mix. - nsAutoTArray outChannelPtrs; - outChannelPtrs.SetLength(aOutputChannels); - uint32_t offsetSamples = 0; - for (uint32_t channel = 0; channel < aOutputChannels; channel++) { - outChannelPtrs[channel] = - PointerForOffsetInChannel(buf.Elements(), outBufferLength, - aOutputChannels, channel, offsetSamples); - } - AudioChannelsDownMix(channelData, outChannelPtrs.Elements(), - aOutputChannels, frames); - } else { - // The channel count is already what we want, just copy it over. - for (uint32_t channel = 0; channel < aOutputChannels; channel++) { - AudioDataValue* ptr = - PointerForOffsetInChannel(buf.Elements(), outBufferLength, - aOutputChannels, channel, offsetSamples); - PodCopy(ptr, reinterpret_cast(channelData[channel]), - frames); - } - } - } - offsetSamples += frames; - } - - if (offsetSamples) { - MOZ_ASSERT(offsetSamples == outBufferLength / aOutputChannels, - "We forgot to write some samples?"); - aMixer.Mix(buf.Elements(), aOutputChannels, offsetSamples, aSampleRate); - } -} - void AudioSegment::WriteTo(uint64_t aID, AudioMixer& aMixer, uint32_t aOutputChannels, uint32_t aSampleRate) { diff --git a/dom/media/AudioSegment.h b/dom/media/AudioSegment.h index 25c0057f1b7f..22bad4e7790a 100644 --- a/dom/media/AudioSegment.h +++ b/dom/media/AudioSegment.h @@ -299,14 +299,7 @@ public: return chunk; } void ApplyVolume(float aVolume); - // Mix the segment into a mixer, interleaved. This is useful to output a - // segment to a system audio callback. It up or down mixes to aChannelCount - // channels. - void WriteTo(uint64_t aID, AudioMixer& aMixer, uint32_t aChannelCount, - uint32_t aSampleRate); - // Mix the segment into a mixer, keeping it planar, up or down mixing to - // aChannelCount channels. - void Mix(AudioMixer& aMixer, uint32_t aChannelCount, uint32_t aSampleRate); + void WriteTo(uint64_t aID, AudioMixer& aMixer, uint32_t aChannelCount, uint32_t aSampleRate); int ChannelCount() { NS_WARN_IF_FALSE(!mChunks.IsEmpty(), diff --git a/dom/media/DOMMediaStream.cpp b/dom/media/DOMMediaStream.cpp index e75d5fbfad02..40bdee8bd364 100644 --- a/dom/media/DOMMediaStream.cpp +++ b/dom/media/DOMMediaStream.cpp @@ -301,18 +301,6 @@ DOMMediaStream::InitTrackUnionStream(nsIDOMWindow* aWindow, InitStreamCommon(aGraph->CreateTrackUnionStream(this)); } -void -DOMMediaStream::InitAudioCaptureStream(nsIDOMWindow* aWindow, - MediaStreamGraph* aGraph) -{ - mWindow = aWindow; - - if (!aGraph) { - aGraph = MediaStreamGraph::GetInstance(); - } - InitStreamCommon(aGraph->CreateAudioCaptureStream(this)); -} - void DOMMediaStream::InitStreamCommon(MediaStream* aStream) { @@ -341,15 +329,6 @@ DOMMediaStream::CreateTrackUnionStream(nsIDOMWindow* aWindow, return stream.forget(); } -already_AddRefed -DOMMediaStream::CreateAudioCaptureStream(nsIDOMWindow* aWindow, - MediaStreamGraph* aGraph) -{ - nsRefPtr stream = new DOMMediaStream(); - stream->InitAudioCaptureStream(aWindow, aGraph); - return stream.forget(); -} - void DOMMediaStream::SetTrackEnabled(TrackID aTrackID, bool aEnabled) { @@ -674,15 +653,6 @@ DOMLocalMediaStream::CreateTrackUnionStream(nsIDOMWindow* aWindow, return stream.forget(); } -already_AddRefed -DOMLocalMediaStream::CreateAudioCaptureStream(nsIDOMWindow* aWindow, - MediaStreamGraph* aGraph) -{ - nsRefPtr stream = new DOMLocalMediaStream(); - stream->InitAudioCaptureStream(aWindow, aGraph); - return stream.forget(); -} - DOMAudioNodeMediaStream::DOMAudioNodeMediaStream(AudioNode* aNode) : mStreamNode(aNode) { diff --git a/dom/media/DOMMediaStream.h b/dom/media/DOMMediaStream.h index fb7bac8733b4..ebad4e70afbc 100644 --- a/dom/media/DOMMediaStream.h +++ b/dom/media/DOMMediaStream.h @@ -198,13 +198,6 @@ public: static already_AddRefed CreateTrackUnionStream(nsIDOMWindow* aWindow, MediaStreamGraph* aGraph = nullptr); - /** - * Create an nsDOMMediaStream whose underlying stream is an - * AudioCaptureStream - */ - static already_AddRefed CreateAudioCaptureStream( - nsIDOMWindow* aWindow, MediaStreamGraph* aGraph = nullptr); - void SetLogicalStreamStartTime(StreamTime aTime) { mLogicalStreamStartTime = aTime; @@ -268,8 +261,6 @@ protected: MediaStreamGraph* aGraph = nullptr); void InitTrackUnionStream(nsIDOMWindow* aWindow, MediaStreamGraph* aGraph = nullptr); - void InitAudioCaptureStream(nsIDOMWindow* aWindow, - MediaStreamGraph* aGraph = nullptr); void InitStreamCommon(MediaStream* aStream); already_AddRefed CreateAudioTrack(AudioStreamTrack* aStreamTrack); already_AddRefed CreateVideoTrack(VideoStreamTrack* aStreamTrack); @@ -360,12 +351,6 @@ public: CreateTrackUnionStream(nsIDOMWindow* aWindow, MediaStreamGraph* aGraph = nullptr); - /** - * Create an nsDOMLocalMediaStream whose underlying stream is an - * AudioCaptureStream. */ - static already_AddRefed CreateAudioCaptureStream( - nsIDOMWindow* aWindow, MediaStreamGraph* aGraph = nullptr); - protected: virtual ~DOMLocalMediaStream(); }; diff --git a/dom/media/DecodedStream.cpp b/dom/media/DecodedStream.cpp index 913f68203e21..dcc950228f72 100644 --- a/dom/media/DecodedStream.cpp +++ b/dom/media/DecodedStream.cpp @@ -289,14 +289,6 @@ DecodedStream::OutputStreams() return mOutputStreams; } -bool -DecodedStream::HasConsumers() const -{ - MOZ_ASSERT(NS_IsMainThread()); - ReentrantMonitorAutoEnter mon(GetReentrantMonitor()); - return mOutputStreams.IsEmpty(); -} - ReentrantMonitor& DecodedStream::GetReentrantMonitor() const { diff --git a/dom/media/DecodedStream.h b/dom/media/DecodedStream.h index ebad8330c865..8b25b95c9f7d 100644 --- a/dom/media/DecodedStream.h +++ b/dom/media/DecodedStream.h @@ -114,7 +114,6 @@ public: int64_t AudioEndTime() const; int64_t GetPosition() const; bool IsFinished() const; - bool HasConsumers() const; // Return true if stream is finished. bool SendData(double aVolume, bool aIsSameOrigin); diff --git a/dom/media/MediaDecoder.cpp b/dom/media/MediaDecoder.cpp index 3f0cdadc6a19..59f7e5fcc59b 100644 --- a/dom/media/MediaDecoder.cpp +++ b/dom/media/MediaDecoder.cpp @@ -326,13 +326,6 @@ void MediaDecoder::AddOutputStream(ProcessedMediaStream* aStream, mDecoderStateMachine->AddOutputStream(aStream, aFinishWhenEnded); } -void MediaDecoder::RemoveOutputStream(MediaStream* aStream) -{ - MOZ_ASSERT(NS_IsMainThread()); - MOZ_ASSERT(mDecoderStateMachine, "Must be called after Load()."); - mDecoderStateMachine->RemoveOutputStream(aStream); -} - double MediaDecoder::GetDuration() { MOZ_ASSERT(NS_IsMainThread()); diff --git a/dom/media/MediaDecoder.h b/dom/media/MediaDecoder.h index d216bf9c7666..c2a01bb07465 100644 --- a/dom/media/MediaDecoder.h +++ b/dom/media/MediaDecoder.h @@ -399,8 +399,6 @@ public: // The stream is initially blocked. The decoder is responsible for unblocking // it while it is playing back. virtual void AddOutputStream(ProcessedMediaStream* aStream, bool aFinishWhenEnded); - // Remove an output stream added with AddOutputStream. - virtual void RemoveOutputStream(MediaStream* aStream); // Return the duration of the video in seconds. virtual double GetDuration(); diff --git a/dom/media/MediaDecoderStateMachine.cpp b/dom/media/MediaDecoderStateMachine.cpp index 9b7ab7e0e092..2ca215ca06f9 100644 --- a/dom/media/MediaDecoderStateMachine.cpp +++ b/dom/media/MediaDecoderStateMachine.cpp @@ -3177,25 +3177,6 @@ void MediaDecoderStateMachine::DispatchAudioCaptured() OwnerThread()->Dispatch(r.forget()); } -void MediaDecoderStateMachine::DispatchAudioUncaptured() -{ - nsRefPtr self = this; - nsCOMPtr r = NS_NewRunnableFunction([self] () -> void - { - MOZ_ASSERT(self->OnTaskQueue()); - ReentrantMonitorAutoEnter mon(self->mDecoder->GetReentrantMonitor()); - if (self->mAudioCaptured) { - // Start again the audio sink - self->mAudioCaptured = false; - if (self->IsPlaying()) { - self->StartAudioThread(); - } - self->ScheduleStateMachine(); - } - }); - OwnerThread()->Dispatch(r.forget()); -} - void MediaDecoderStateMachine::AddOutputStream(ProcessedMediaStream* aStream, bool aFinishWhenEnded) { @@ -3205,16 +3186,6 @@ void MediaDecoderStateMachine::AddOutputStream(ProcessedMediaStream* aStream, DispatchAudioCaptured(); } -void MediaDecoderStateMachine::RemoveOutputStream(MediaStream* aStream) -{ - MOZ_ASSERT(NS_IsMainThread()); - DECODER_LOG("RemoveOutputStream=%p!", aStream); - mDecodedStream->Remove(aStream); - if (!mDecodedStream->HasConsumers()) { - DispatchAudioUncaptured(); - } -} - } // namespace mozilla // avoid redefined macro in unified build diff --git a/dom/media/MediaDecoderStateMachine.h b/dom/media/MediaDecoderStateMachine.h index 8670d0569baa..ea485d4e9d08 100644 --- a/dom/media/MediaDecoderStateMachine.h +++ b/dom/media/MediaDecoderStateMachine.h @@ -149,8 +149,6 @@ public: }; void AddOutputStream(ProcessedMediaStream* aStream, bool aFinishWhenEnded); - // Remove an output stream added with AddOutputStream. - void RemoveOutputStream(MediaStream* aStream); // Set/Unset dormant state. void SetDormant(bool aDormant); @@ -162,7 +160,6 @@ private: void InitializationTask(); void DispatchAudioCaptured(); - void DispatchAudioUncaptured(); void Shutdown(); public: diff --git a/dom/media/MediaManager.cpp b/dom/media/MediaManager.cpp index 5b9d252f6a6a..7af74e55c71a 100644 --- a/dom/media/MediaManager.cpp +++ b/dom/media/MediaManager.cpp @@ -300,8 +300,7 @@ protected: NS_IMPL_ISUPPORTS(MediaDevice, nsIMediaDevice) MediaDevice::MediaDevice(MediaEngineSource* aSource, bool aIsVideo) - : mMediaSource(aSource->GetMediaSource()) - , mSource(aSource) + : mSource(aSource) , mIsVideo(aIsVideo) { mSource->GetName(mName); @@ -312,7 +311,9 @@ MediaDevice::MediaDevice(MediaEngineSource* aSource, bool aIsVideo) VideoDevice::VideoDevice(MediaEngineVideoSource* aSource) : MediaDevice(aSource, true) -{} +{ + mMediaSource = aSource->GetMediaSource(); +} /** * Helper functions that implement the constraints algorithm from @@ -438,8 +439,6 @@ MediaDevice::GetMediaSource(nsAString& aMediaSource) { if (mMediaSource == dom::MediaSourceEnum::Microphone) { aMediaSource.Assign(NS_LITERAL_STRING("microphone")); - } else if (mMediaSource == dom::MediaSourceEnum::AudioCapture) { - aMediaSource.Assign(NS_LITERAL_STRING("audioCapture")); } else if (mMediaSource == dom::MediaSourceEnum::Window) { // this will go away aMediaSource.Assign(NS_LITERAL_STRING("window")); } else { // all the rest are shared @@ -785,55 +784,11 @@ public: } } #endif - - MediaStreamGraph* msg = MediaStreamGraph::GetInstance(); - nsRefPtr stream = msg->CreateSourceStream(nullptr); - - nsRefPtr domStream; - // AudioCapture is a special case, here, in the sense that we're not really - // using the audio source and the SourceMediaStream, which acts as - // placeholders. We re-route a number of stream internaly in the MSG and mix - // them down instead. - if (mAudioSource && - mAudioSource->GetMediaSource() == dom::MediaSourceEnum::AudioCapture) { - domStream = DOMLocalMediaStream::CreateAudioCaptureStream(window); - // It should be possible to pipe the capture stream to anything. CORS is - // not a problem here, we got explicit user content. - domStream->SetPrincipal(window->GetExtantDoc()->NodePrincipal()); - msg->RegisterCaptureStreamForWindow( - mWindowID, domStream->GetStream()->AsProcessedStream()); - window->SetAudioCapture(true); - } else { - // Normal case, connect the source stream to the track union stream to - // avoid us blocking - nsRefPtr trackunion = - nsDOMUserMediaStream::CreateTrackUnionStream(window, mListener, - mAudioSource, mVideoSource); - trackunion->GetStream()->AsProcessedStream()->SetAutofinish(true); - nsRefPtr port = trackunion->GetStream()->AsProcessedStream()-> - AllocateInputPort(stream, MediaInputPort::FLAG_BLOCK_OUTPUT); - trackunion->mSourceStream = stream; - trackunion->mPort = port.forget(); - // Log the relationship between SourceMediaStream and TrackUnion stream - // Make sure logger starts before capture - AsyncLatencyLogger::Get(true); - LogLatency(AsyncLatencyLogger::MediaStreamCreate, - reinterpret_cast(stream.get()), - reinterpret_cast(trackunion->GetStream())); - - nsCOMPtr principal; - if (mPeerIdentity) { - principal = nsNullPrincipal::Create(); - trackunion->SetPeerIdentity(mPeerIdentity.forget()); - } else { - principal = window->GetExtantDoc()->NodePrincipal(); - } - trackunion->CombineWithPrincipal(principal); - - domStream = trackunion.forget(); - } - - if (!domStream || sInShutdown) { + // Create a media stream. + nsRefPtr trackunion = + nsDOMUserMediaStream::CreateTrackUnionStream(window, mListener, + mAudioSource, mVideoSource); + if (!trackunion || sInShutdown) { nsCOMPtr onFailure = mOnFailure.forget(); LOG(("Returning error for getUserMedia() - no stream")); @@ -847,6 +802,36 @@ public: } return NS_OK; } + trackunion->AudioConfig(aec_on, (uint32_t) aec, + agc_on, (uint32_t) agc, + noise_on, (uint32_t) noise, + playout_delay); + + + MediaStreamGraph* gm = MediaStreamGraph::GetInstance(); + nsRefPtr stream = gm->CreateSourceStream(nullptr); + + // connect the source stream to the track union stream to avoid us blocking + trackunion->GetStream()->AsProcessedStream()->SetAutofinish(true); + nsRefPtr port = trackunion->GetStream()->AsProcessedStream()-> + AllocateInputPort(stream, MediaInputPort::FLAG_BLOCK_OUTPUT); + trackunion->mSourceStream = stream; + trackunion->mPort = port.forget(); + // Log the relationship between SourceMediaStream and TrackUnion stream + // Make sure logger starts before capture + AsyncLatencyLogger::Get(true); + LogLatency(AsyncLatencyLogger::MediaStreamCreate, + reinterpret_cast(stream.get()), + reinterpret_cast(trackunion->GetStream())); + + nsCOMPtr principal; + if (mPeerIdentity) { + principal = nsNullPrincipal::Create(); + trackunion->SetPeerIdentity(mPeerIdentity.forget()); + } else { + principal = window->GetExtantDoc()->NodePrincipal(); + } + trackunion->CombineWithPrincipal(principal); // The listener was added at the beginning in an inactive state. // Activate our listener. We'll call Start() on the source when get a callback @@ -856,7 +841,7 @@ public: // Note: includes JS callbacks; must be released on MainThread TracksAvailableCallback* tracksAvailableCallback = - new TracksAvailableCallback(mManager, mOnSuccess, mWindowID, domStream); + new TracksAvailableCallback(mManager, mOnSuccess, mWindowID, trackunion); mListener->AudioConfig(aec_on, (uint32_t) aec, agc_on, (uint32_t) agc, @@ -867,11 +852,11 @@ public: // because that can take a while. // Pass ownership of trackunion to the MediaOperationTask // to ensure it's kept alive until the MediaOperationTask runs (at least). - MediaManager::PostTask( - FROM_HERE, new MediaOperationTask(MEDIA_START, mListener, domStream, - tracksAvailableCallback, mAudioSource, - mVideoSource, false, mWindowID, - mOnFailure.forget())); + MediaManager::PostTask(FROM_HERE, + new MediaOperationTask(MEDIA_START, mListener, trackunion, + tracksAvailableCallback, + mAudioSource, mVideoSource, false, mWindowID, + mOnFailure.forget())); // We won't need mOnFailure now. mOnFailure = nullptr; @@ -1260,9 +1245,7 @@ static auto& MediaManager_AnonymizeDevices = MediaManager::AnonymizeDevices; */ already_AddRefed -MediaManager::EnumerateRawDevices(uint64_t aWindowId, - MediaSourceEnum aVideoType, - MediaSourceEnum aAudioType, +MediaManager::EnumerateRawDevices(uint64_t aWindowId, MediaSourceEnum aVideoType, bool aFake, bool aFakeTracks) { MOZ_ASSERT(NS_IsMainThread()); @@ -1292,8 +1275,7 @@ MediaManager::EnumerateRawDevices(uint64_t aWindowId, MediaManager::PostTask(FROM_HERE, NewTaskFrom([id, aWindowId, audioLoopDev, videoLoopDev, aVideoType, - aAudioType, aFake, - aFakeTracks]() mutable { + aFake, aFakeTracks]() mutable { nsRefPtr backend; if (aFake) { backend = new MediaEngineDefault(aFakeTracks); @@ -1312,7 +1294,7 @@ MediaManager::EnumerateRawDevices(uint64_t aWindowId, } nsTArray> audios; - GetSources(backend, aAudioType, + GetSources(backend, dom::MediaSourceEnum::Microphone, &MediaEngine::EnumerateAudioDevices, audios, audioLoopDev); for (auto& source : audios) { result->AppendElement(source); @@ -1634,7 +1616,6 @@ MediaManager::GetUserMedia(nsPIDOMWindow* aWindow, } MediaSourceEnum videoType = dom::MediaSourceEnum::Camera; - MediaSourceEnum audioType = dom::MediaSourceEnum::Microphone; if (c.mVideo.IsMediaTrackConstraints()) { auto& vc = c.mVideo.GetAsMediaTrackConstraints(); @@ -1723,23 +1704,6 @@ MediaManager::GetUserMedia(nsPIDOMWindow* aWindow, privileged = false; } } - - if (c.mAudio.IsMediaTrackConstraints()) { - auto& ac = c.mAudio.GetAsMediaTrackConstraints(); - audioType = StringToEnum(dom::MediaSourceEnumValues::strings, - ac.mMediaSource, - audioType); - // Only enable AudioCapture if the pref is enabled. If it's not, we can deny - // right away. - if (audioType == dom::MediaSourceEnum::AudioCapture && - !Preferences::GetBool("media.getusermedia.audiocapture.enabled")) { - nsRefPtr error = - new MediaStreamError(aWindow, - NS_LITERAL_STRING("PermissionDeniedError")); - onFailure->OnError(error); - return NS_OK; - } - } StreamListeners* listeners = AddWindowID(windowID); // Create a disabled listener to act as a placeholder @@ -1802,8 +1766,7 @@ MediaManager::GetUserMedia(nsPIDOMWindow* aWindow, (!fake || Preferences::GetBool("media.navigator.permission.fake")); nsRefPtr p = EnumerateDevicesImpl(windowID, videoType, - audioType, fake, - fakeTracks); + fake, fakeTracks); p->Then([this, onSuccess, onFailure, windowID, c, listener, askPermission, prefs, isHTTPS, callID, origin](SourceSet*& aDevices) mutable { ScopedDeletePtr devices(aDevices); // grab result @@ -1959,9 +1922,7 @@ MediaManager::ToJSArray(SourceSet& aDevices) } already_AddRefed -MediaManager::EnumerateDevicesImpl(uint64_t aWindowId, - MediaSourceEnum aVideoType, - MediaSourceEnum aAudioType, +MediaManager::EnumerateDevicesImpl(uint64_t aWindowId, MediaSourceEnum aVideoType, bool aFake, bool aFakeTracks) { MOZ_ASSERT(NS_IsMainThread()); @@ -1990,13 +1951,12 @@ MediaManager::EnumerateDevicesImpl(uint64_t aWindowId, nsRefPtr> p = media::GetOriginKey(origin, privateBrowsing, persist); - p->Then([id, aWindowId, aVideoType, aAudioType, + p->Then([id, aWindowId, aVideoType, aFake, aFakeTracks](const nsCString& aOriginKey) mutable { MOZ_ASSERT(NS_IsMainThread()); nsRefPtr mgr = MediaManager_GetInstance(); - nsRefPtr p = mgr->EnumerateRawDevices(aWindowId, - aVideoType, aAudioType, + nsRefPtr p = mgr->EnumerateRawDevices(aWindowId, aVideoType, aFake, aFakeTracks); p->Then([id, aWindowId, aOriginKey](SourceSet*& aDevices) mutable { ScopedDeletePtr devices(aDevices); // secondary result @@ -2035,7 +1995,6 @@ MediaManager::EnumerateDevices(nsPIDOMWindow* aWindow, nsRefPtr p = EnumerateDevicesImpl(windowId, dom::MediaSourceEnum::Camera, - dom::MediaSourceEnum::Microphone, fake); p->Then([onSuccess](SourceSet*& aDevices) mutable { ScopedDeletePtr devices(aDevices); // grab result @@ -2116,7 +2075,7 @@ StopSharingCallback(MediaManager *aThis, listener->Invalidate(); } listener->Remove(); - listener->StopSharing(); + listener->StopScreenWindowSharing(); } aListeners->Clear(); aThis->RemoveWindowID(aWindowID); @@ -2439,7 +2398,7 @@ MediaManager::Observe(nsISupports* aSubject, const char* aTopic, uint64_t windowID = PromiseFlatString(Substring(data, strlen("screen:"))).ToInteger64(&rv); MOZ_ASSERT(NS_SUCCEEDED(rv)); if (NS_SUCCEEDED(rv)) { - LOG(("Revoking Screen/windowCapture access for window %llu", windowID)); + LOG(("Revoking Screeen/windowCapture access for window %llu", windowID)); StopScreensharing(windowID); } } else { @@ -2620,7 +2579,7 @@ StopScreensharingCallback(MediaManager *aThis, if (aListeners) { auto length = aListeners->Length(); for (size_t i = 0; i < length; ++i) { - aListeners->ElementAt(i)->StopSharing(); + aListeners->ElementAt(i)->StopScreenWindowSharing(); } } } @@ -2782,7 +2741,7 @@ GetUserMediaCallbackMediaStreamListener::Invalidate() // Doesn't kill audio // XXX refactor to combine with Invalidate()? void -GetUserMediaCallbackMediaStreamListener::StopSharing() +GetUserMediaCallbackMediaStreamListener::StopScreenWindowSharing() { NS_ASSERTION(NS_IsMainThread(), "Only call on main thread"); if (mVideoSource && !mStopped && @@ -2795,13 +2754,6 @@ GetUserMediaCallbackMediaStreamListener::StopSharing() this, nullptr, nullptr, nullptr, mVideoSource, mFinished, mWindowID, nullptr)); - } else if (mAudioSource && - mAudioSource->GetMediaSource() == dom::MediaSourceEnum::AudioCapture) { - nsCOMPtr window = nsGlobalWindow::GetInnerWindowWithId(mWindowID); - MOZ_ASSERT(window); - window->SetAudioCapture(false); - MediaStreamGraph::GetInstance()->UnregisterCaptureStreamForWindow(mWindowID); - mStream->Destroy(); } } diff --git a/dom/media/MediaManager.h b/dom/media/MediaManager.h index d35f4bf40ece..d7af9c5a7b99 100644 --- a/dom/media/MediaManager.h +++ b/dom/media/MediaManager.h @@ -103,7 +103,7 @@ public: return mStream->AsSourceStream(); } - void StopSharing(); + void StopScreenWindowSharing(); void StopTrack(TrackID aID, bool aIsAudio); @@ -597,14 +597,10 @@ public: // TODO: make private once we upgrade to GCC 4.8+ on linux. static already_AddRefed ToJSArray(SourceSet& aDevices); private: already_AddRefed - EnumerateRawDevices(uint64_t aWindowId, - dom::MediaSourceEnum aVideoType, - dom::MediaSourceEnum aAudioType, + EnumerateRawDevices(uint64_t aWindowId, dom::MediaSourceEnum aSrcType, bool aFake, bool aFakeTracks); already_AddRefed - EnumerateDevicesImpl(uint64_t aWindowId, - dom::MediaSourceEnum aVideoSrcType, - dom::MediaSourceEnum aAudioSrcType, + EnumerateDevicesImpl(uint64_t aWindowId, dom::MediaSourceEnum aSrcType, bool aFake = false, bool aFakeTracks = false); StreamListeners* AddWindowID(uint64_t aWindowId); diff --git a/dom/media/MediaStreamGraph.cpp b/dom/media/MediaStreamGraph.cpp index a23fba28f998..53144c054893 100644 --- a/dom/media/MediaStreamGraph.cpp +++ b/dom/media/MediaStreamGraph.cpp @@ -18,7 +18,6 @@ #include "mozilla/Attributes.h" #include "TrackUnionStream.h" #include "ImageContainer.h" -#include "AudioCaptureStream.h" #include "AudioChannelService.h" #include "AudioNodeEngine.h" #include "AudioNodeStream.h" @@ -3193,17 +3192,6 @@ MediaStreamGraph::CreateTrackUnionStream(DOMMediaStream* aWrapper) return stream; } -ProcessedMediaStream* -MediaStreamGraph::CreateAudioCaptureStream(DOMMediaStream* aWrapper) -{ - AudioCaptureStream* stream = new AudioCaptureStream(aWrapper); - NS_ADDREF(stream); - MediaStreamGraphImpl* graph = static_cast(this); - stream->SetGraphImpl(graph); - graph->AppendMessage(new CreateMessage(stream)); - return stream; -} - AudioNodeExternalInputStream* MediaStreamGraph::CreateAudioNodeExternalInputStream(AudioNodeEngine* aEngine, TrackRate aSampleRate) { @@ -3568,65 +3556,4 @@ ProcessedMediaStream::AddInput(MediaInputPort* aPort) GraphImpl()->SetStreamOrderDirty(); } -void -MediaStreamGraph::RegisterCaptureStreamForWindow( - uint64_t aWindowId, ProcessedMediaStream* aCaptureStream) -{ - MOZ_ASSERT(NS_IsMainThread()); - MediaStreamGraphImpl* graphImpl = static_cast(this); - graphImpl->RegisterCaptureStreamForWindow(aWindowId, aCaptureStream); -} - -void -MediaStreamGraphImpl::RegisterCaptureStreamForWindow( - uint64_t aWindowId, ProcessedMediaStream* aCaptureStream) -{ - MOZ_ASSERT(NS_IsMainThread()); - WindowAndStream winAndStream; - winAndStream.mWindowId = aWindowId; - winAndStream.mCaptureStreamSink = aCaptureStream; - mWindowCaptureStreams.AppendElement(winAndStream); -} - -void -MediaStreamGraph::UnregisterCaptureStreamForWindow(uint64_t aWindowId) -{ - MOZ_ASSERT(NS_IsMainThread()); - MediaStreamGraphImpl* graphImpl = static_cast(this); - graphImpl->UnregisterCaptureStreamForWindow(aWindowId); -} - -void -MediaStreamGraphImpl::UnregisterCaptureStreamForWindow(uint64_t aWindowId) -{ - MOZ_ASSERT(NS_IsMainThread()); - for (uint32_t i = 0; i < mWindowCaptureStreams.Length(); i++) { - if (mWindowCaptureStreams[i].mWindowId == aWindowId) { - mWindowCaptureStreams.RemoveElementAt(i); - } - } -} - -already_AddRefed -MediaStreamGraph::ConnectToCaptureStream(uint64_t aWindowId, - MediaStream* aMediaStream) -{ - return aMediaStream->GraphImpl()->ConnectToCaptureStream(aWindowId, - aMediaStream); -} - -already_AddRefed -MediaStreamGraphImpl::ConnectToCaptureStream(uint64_t aWindowId, - MediaStream* aMediaStream) -{ - MOZ_ASSERT(NS_IsMainThread()); - for (uint32_t i = 0; i < mWindowCaptureStreams.Length(); i++) { - if (mWindowCaptureStreams[i].mWindowId == aWindowId) { - ProcessedMediaStream* sink = mWindowCaptureStreams[i].mCaptureStreamSink; - return sink->AllocateInputPort(aMediaStream, 0); - } - } - return nullptr; -} - } // namespace mozilla diff --git a/dom/media/MediaStreamGraph.h b/dom/media/MediaStreamGraph.h index ac770fe1396a..312aad706052 100644 --- a/dom/media/MediaStreamGraph.h +++ b/dom/media/MediaStreamGraph.h @@ -1262,10 +1262,6 @@ public: * particular tracks of each input stream. */ ProcessedMediaStream* CreateTrackUnionStream(DOMMediaStream* aWrapper); - /** - * Create a stream that will mix all its audio input. - */ - ProcessedMediaStream* CreateAudioCaptureStream(DOMMediaStream* aWrapper); // Internal AudioNodeStreams can only pass their output to another // AudioNode, whereas external AudioNodeStreams can pass their output // to an nsAudioStream for playback. @@ -1322,12 +1318,6 @@ public: */ TrackRate GraphRate() const { return mSampleRate; } - void RegisterCaptureStreamForWindow(uint64_t aWindowId, - ProcessedMediaStream* aCaptureStream); - void UnregisterCaptureStreamForWindow(uint64_t aWindowId); - already_AddRefed ConnectToCaptureStream( - uint64_t aWindowId, MediaStream* aMediaStream); - protected: explicit MediaStreamGraph(TrackRate aSampleRate) : mNextGraphUpdateIndex(1) diff --git a/dom/media/MediaStreamGraphImpl.h b/dom/media/MediaStreamGraphImpl.h index 15ded10c470c..262cae526c2e 100644 --- a/dom/media/MediaStreamGraphImpl.h +++ b/dom/media/MediaStreamGraphImpl.h @@ -532,13 +532,6 @@ public: } } - // Capture Stream API. This allows to get a mixed-down output for a window. - void RegisterCaptureStreamForWindow(uint64_t aWindowId, - ProcessedMediaStream* aCaptureStream); - void UnregisterCaptureStreamForWindow(uint64_t aWindowId); - already_AddRefed - ConnectToCaptureStream(uint64_t aWindowId, MediaStream* aMediaStream); - // Data members // /** @@ -762,16 +755,6 @@ private: * Used to pass memory report information across threads. */ nsTArray mAudioStreamSizes; - - struct WindowAndStream - { - uint64_t mWindowId; - nsRefPtr mCaptureStreamSink; - }; - /** - * Stream for window audio capture. - */ - nsTArray mWindowCaptureStreams; /** * Indicates that the MSG thread should gather data for a memory report. */ diff --git a/dom/media/moz.build b/dom/media/moz.build index 25d2dbb728d1..63c6fa3366bd 100644 --- a/dom/media/moz.build +++ b/dom/media/moz.build @@ -196,7 +196,6 @@ EXPORTS.mozilla.dom += [ UNIFIED_SOURCES += [ 'AbstractThread.cpp', - 'AudioCaptureStream.cpp', 'AudioChannelFormat.cpp', 'AudioCompactor.cpp', 'AudioSegment.cpp', diff --git a/dom/media/tests/mochitest/head.js b/dom/media/tests/mochitest/head.js index dfe4a2874806..68158f28ee59 100644 --- a/dom/media/tests/mochitest/head.js +++ b/dom/media/tests/mochitest/head.js @@ -20,114 +20,6 @@ try { FAKE_ENABLED = true; } -/** - * This class provides helpers around analysing the audio content in a stream - * using WebAudio AnalyserNodes. - * - * @constructor - * @param {object} stream - * A MediaStream object whose audio track we shall analyse. - */ -function AudioStreamAnalyser(ac, stream) { - if (stream.getAudioTracks().length === 0) { - throw new Error("No audio track in stream"); - } - this.audioContext = ac; - this.stream = stream; - this.sourceNode = this.audioContext.createMediaStreamSource(this.stream); - this.analyser = this.audioContext.createAnalyser(); - this.sourceNode.connect(this.analyser); - this.data = new Uint8Array(this.analyser.frequencyBinCount); -} - -AudioStreamAnalyser.prototype = { - /** - * Get an array of frequency domain data for our stream's audio track. - * - * @returns {array} A Uint8Array containing the frequency domain data. - */ - getByteFrequencyData: function() { - this.analyser.getByteFrequencyData(this.data); - return this.data; - }, - - /** - * Append a canvas to the DOM where the frequency data are drawn. - * Useful to debug tests. - */ - enableDebugCanvas: function() { - var cvs = document.createElement("canvas"); - document.getElementById("content").appendChild(cvs); - - // Easy: 1px per bin - cvs.width = this.analyser.frequencyBinCount; - cvs.height = 256; - cvs.style.border = "1px solid red"; - - var c = cvs.getContext('2d'); - - var self = this; - function render() { - c.clearRect(0, 0, cvs.width, cvs.height); - var array = self.getByteFrequencyData(); - for (var i = 0; i < array.length; i++) { - c.fillRect(i, (256 - (array[i])), 1, 256); - } - requestAnimationFrame(render); - } - requestAnimationFrame(render); - }, - - /** - * Return a Promise, that will be resolved when the function passed as - * argument, when called, returns true (meaning the analysis was a - * success). - * - * @param {function} analysisFunction - * A fonction that performs an analysis, and returns true if the - * analysis was a success (i.e. it found what it was looking for) - */ - waitForAnalysisSuccess: function(analysisFunction) { - var self = this; - return new Promise((resolve, reject) => { - function analysisLoop() { - var success = analysisFunction(self.getByteFrequencyData()); - if (success) { - resolve(); - return; - } - // else, we need more time - requestAnimationFrame(analysisLoop); - } - analysisLoop(); - }); - }, - - /** - * Return the FFT bin index for a given frequency. - * - * @param {double} frequency - * The frequency for whicht to return the bin number. - * @returns {integer} the index of the bin in the FFT array. - */ - binIndexForFrequency: function(frequency) { - return 1 + Math.round(frequency * - this.analyser.fftSize / - this.audioContext.sampleRate); - }, - - /** - * Reverse operation, get the frequency for a bin index. - * - * @param {integer} index an index in an FFT array - * @returns {double} the frequency for this bin - */ - frequencyForBinIndex: function(index) { - return (index - 1) * - this.audioContext.sampleRate / - this.analyser.fftSize; - } -}; /** * Create the necessary HTML elements for head and body as used by Mochitests @@ -244,10 +136,7 @@ function setupEnvironment() { ['media.navigator.permission.disabled', true], ['media.navigator.streams.fake', FAKE_ENABLED], ['media.getusermedia.screensharing.enabled', true], - ['media.getusermedia.screensharing.allowed_domains', "mochi.test"], - ['media.getusermedia.audiocapture.enabled', true], - ['media.useAudioChannelService', true], - ['media.recorder.audio_node.enabled', true] + ['media.getusermedia.screensharing.allowed_domains', "mochi.test"] ] }, setTestOptions); diff --git a/dom/media/tests/mochitest/mochitest.ini b/dom/media/tests/mochitest/mochitest.ini index 115d83b11f0f..9d458b0e59b8 100644 --- a/dom/media/tests/mochitest/mochitest.ini +++ b/dom/media/tests/mochitest/mochitest.ini @@ -30,7 +30,6 @@ skip-if = toolkit == 'gonk' || buildapp == 'mulet' # b2g emulator seems to be to [test_dataChannel_noOffer.html] [test_enumerateDevices.html] skip-if = buildapp == 'mulet' -[test_getUserMedia_audioCapture.html] [test_getUserMedia_basicAudio.html] skip-if = (toolkit == 'gonk' || buildapp == 'mulet' && debug) # debug-only failure [test_getUserMedia_basicVideo.html] diff --git a/dom/media/tests/mochitest/pc.js b/dom/media/tests/mochitest/pc.js index 645f29d153e9..51aa7d17ceae 100644 --- a/dom/media/tests/mochitest/pc.js +++ b/dom/media/tests/mochitest/pc.js @@ -642,6 +642,39 @@ DataChannelWrapper.prototype = { }; +/** + * This class provides helpers around analysing the audio content in a stream + * using WebAudio AnalyserNodes. + * + * @constructor + * @param {object} stream + * A MediaStream object whose audio track we shall analyse. + */ +function AudioStreamAnalyser(stream) { + if (stream.getAudioTracks().length === 0) { + throw new Error("No audio track in stream"); + } + this.stream = stream; + this.audioContext = new AudioContext(); + this.sourceNode = this.audioContext.createMediaStreamSource(this.stream); + this.analyser = this.audioContext.createAnalyser(); + this.sourceNode.connect(this.analyser); + this.data = new Uint8Array(this.analyser.frequencyBinCount); +} + +AudioStreamAnalyser.prototype = { + /** + * Get an array of frequency domain data for our stream's audio track. + * + * @returns {array} A Uint8Array containing the frequency domain data. + */ + getByteFrequencyData: function() { + this.analyser.getByteFrequencyData(this.data); + return this.data; + } +}; + + /** * This class acts as a wrapper around a PeerConnection instance. * @@ -1526,20 +1559,20 @@ PeerConnectionWrapper.prototype = { * @returns {Promise} * A promise that resolves when we're receiving the tone from |from|. */ - checkReceivingToneFrom : function(audiocontext, from) { + checkReceivingToneFrom : function(from) { var inputElem = from.localMediaElements[0]; // As input we use the stream of |from|'s first available audio sender. var inputSenderTracks = from._pc.getSenders().map(sn => sn.track); var inputAudioStream = from._pc.getLocalStreams() .find(s => s.getAudioTracks().some(t => inputSenderTracks.some(t2 => t == t2))); - var inputAnalyser = new AudioStreamAnalyser(audiocontext, inputAudioStream); + var inputAnalyser = new AudioStreamAnalyser(inputAudioStream); // It would have been nice to have a working getReceivers() here, but until // we do, let's use what remote streams we have. var outputAudioStream = this._pc.getRemoteStreams() .find(s => s.getAudioTracks().length > 0); - var outputAnalyser = new AudioStreamAnalyser(audiocontext, outputAudioStream); + var outputAnalyser = new AudioStreamAnalyser(outputAudioStream); var maxWithIndex = (a, b, i) => (b >= a.value) ? { value: b, index: i } : a; var initial = { value: -1, index: -1 }; diff --git a/dom/media/tests/mochitest/test_getUserMedia_audioCapture.html b/dom/media/tests/mochitest/test_getUserMedia_audioCapture.html deleted file mode 100644 index 057d754ee292..000000000000 --- a/dom/media/tests/mochitest/test_getUserMedia_audioCapture.html +++ /dev/null @@ -1,110 +0,0 @@ - - - - Test AudioCapture - - - -
-
-
- - diff --git a/dom/media/tests/mochitest/test_peerConnection_replaceTrack.html b/dom/media/tests/mochitest/test_peerConnection_replaceTrack.html index 7f3a4d4bd8d0..6d6e7be029f2 100644 --- a/dom/media/tests/mochitest/test_peerConnection_replaceTrack.html +++ b/dom/media/tests/mochitest/test_peerConnection_replaceTrack.html @@ -136,7 +136,7 @@ ]); test.chain.append([ function PC_LOCAL_CHECK_WEBAUDIO_FLOW_PRESENT(test) { - return test.pcRemote.checkReceivingToneFrom(test.audioCtx, test.pcLocal); + return test.pcRemote.checkReceivingToneFrom(test.pcLocal); } ]); test.chain.append([ diff --git a/dom/media/tests/mochitest/test_peerConnection_webAudio.html b/dom/media/tests/mochitest/test_peerConnection_webAudio.html index 2a8cd31f546a..f5448cc65ae8 100644 --- a/dom/media/tests/mochitest/test_peerConnection_webAudio.html +++ b/dom/media/tests/mochitest/test_peerConnection_webAudio.html @@ -32,7 +32,7 @@ runNetworkTest(function() { ]); test.chain.append([ function CHECK_AUDIO_FLOW(test) { - return test.pcRemote.checkReceivingToneFrom(test.audioContext, test.pcLocal); + return test.pcRemote.checkReceivingToneFrom(test.pcLocal); } ]); test.run(); diff --git a/dom/media/webaudio/AudioDestinationNode.cpp b/dom/media/webaudio/AudioDestinationNode.cpp index d37145ef547a..95ab1b413459 100644 --- a/dom/media/webaudio/AudioDestinationNode.cpp +++ b/dom/media/webaudio/AudioDestinationNode.cpp @@ -313,9 +313,12 @@ AudioDestinationNode::AudioDestinationNode(AudioContext* aContext, bool aIsOffline, AudioChannel aChannel, uint32_t aNumberOfChannels, - uint32_t aLength, float aSampleRate) - : AudioNode(aContext, aIsOffline ? aNumberOfChannels : 2, - ChannelCountMode::Explicit, ChannelInterpretation::Speakers) + uint32_t aLength, + float aSampleRate) + : AudioNode(aContext, + aIsOffline ? aNumberOfChannels : 2, + ChannelCountMode::Explicit, + ChannelInterpretation::Speakers) , mFramesToProduce(aLength) , mAudioChannel(AudioChannel::Normal) , mIsOffline(aIsOffline) @@ -323,7 +326,6 @@ AudioDestinationNode::AudioDestinationNode(AudioContext* aContext, , mExtraCurrentTime(0) , mExtraCurrentTimeSinceLastStartedBlocking(0) , mExtraCurrentTimeUpdatedSinceLastStableState(false) - , mCaptured(false) { bool startWithAudioDriver = true; MediaStreamGraph* graph = aIsOffline ? @@ -503,33 +505,6 @@ AudioDestinationNode::WindowVolumeChanged(float aVolume, bool aMuted) return NS_OK; } -NS_IMETHODIMP -AudioDestinationNode::WindowAudioCaptureChanged() -{ - MOZ_ASSERT(mAudioChannelAgent); - - if (!mStream || Context()->IsOffline()) { - return NS_OK; - } - - bool captured = GetOwner()->GetAudioCaptured(); - - if (captured != mCaptured) { - if (captured) { - nsCOMPtr window = Context()->GetParentObject(); - uint64_t id = window->WindowID(); - mCaptureStreamPort = - mStream->Graph()->ConnectToCaptureStream(id, mStream); - } else { - mCaptureStreamPort->Disconnect(); - mCaptureStreamPort->Destroy(); - } - mCaptured = captured; - } - - return NS_OK; -} - AudioChannel AudioDestinationNode::MozAudioChannelType() const { @@ -616,8 +591,6 @@ AudioDestinationNode::CreateAudioChannelAgent() // The AudioChannelAgent must start playing immediately in order to avoid // race conditions with mozinterruptbegin/end events. InputMuted(false); - - WindowAudioCaptureChanged(); } void @@ -709,7 +682,6 @@ AudioDestinationNode::InputMuted(bool aMuted) return; } - WindowAudioCaptureChanged(); WindowVolumeChanged(volume, muted); } diff --git a/dom/media/webaudio/AudioDestinationNode.h b/dom/media/webaudio/AudioDestinationNode.h index 724e44d61d3c..db5418a9cb51 100644 --- a/dom/media/webaudio/AudioDestinationNode.h +++ b/dom/media/webaudio/AudioDestinationNode.h @@ -99,7 +99,6 @@ private: uint32_t mFramesToProduce; nsCOMPtr mAudioChannelAgent; - nsRefPtr mCaptureStreamPort; nsRefPtr mOfflineRenderingPromise; @@ -112,7 +111,6 @@ private: double mExtraCurrentTime; double mExtraCurrentTimeSinceLastStartedBlocking; bool mExtraCurrentTimeUpdatedSinceLastStableState; - bool mCaptured; }; } // namespace dom diff --git a/dom/media/webrtc/MediaEngineWebRTC.cpp b/dom/media/webrtc/MediaEngineWebRTC.cpp index 207e97acb33e..8771ef79af7c 100644 --- a/dom/media/webrtc/MediaEngineWebRTC.cpp +++ b/dom/media/webrtc/MediaEngineWebRTC.cpp @@ -291,13 +291,6 @@ MediaEngineWebRTC::EnumerateAudioDevices(dom::MediaSourceEnum aMediaSource, // We spawn threads to handle gUM runnables, so we must protect the member vars MutexAutoLock lock(mMutex); - if (aMediaSource == dom::MediaSourceEnum::AudioCapture) { - nsRefPtr audioCaptureSource = - new MediaEngineWebRTCAudioCaptureSource(nullptr); - aASources->AppendElement(audioCaptureSource); - return; - } - #ifdef MOZ_WIDGET_ANDROID jobject context = mozilla::AndroidBridge::Bridge()->GetGlobalContextRef(); @@ -365,14 +358,15 @@ MediaEngineWebRTC::EnumerateAudioDevices(dom::MediaSourceEnum aMediaSource, strcpy(uniqueId,deviceName); // safe given assert and initialization/error-check } - nsRefPtr aSource; + nsRefPtr aSource; NS_ConvertUTF8toUTF16 uuid(uniqueId); if (mAudioSources.Get(uuid, getter_AddRefs(aSource))) { // We've already seen this device, just append. aASources->AppendElement(aSource.get()); } else { - aSource = new MediaEngineWebRTCMicrophoneSource(mThread, mVoiceEngine, i, - deviceName, uniqueId); + aSource = new MediaEngineWebRTCAudioSource( + mThread, mVoiceEngine, i, deviceName, uniqueId + ); mAudioSources.Put(uuid, aSource); // Hashtable takes ownership. aASources->AppendElement(aSource); } @@ -391,8 +385,9 @@ ClearVideoSource (const nsAString&, // unused } static PLDHashOperator -ClearAudioSource(const nsAString &, // unused - MediaEngineAudioSource *aData, void *userArg) +ClearAudioSource (const nsAString&, // unused + MediaEngineWebRTCAudioSource* aData, + void *userArg) { if (aData) { aData->Shutdown(); diff --git a/dom/media/webrtc/MediaEngineWebRTC.h b/dom/media/webrtc/MediaEngineWebRTC.h index 112c5134d607..105cca560048 100644 --- a/dom/media/webrtc/MediaEngineWebRTC.h +++ b/dom/media/webrtc/MediaEngineWebRTC.h @@ -133,77 +133,13 @@ private: void GetCapability(size_t aIndex, webrtc::CaptureCapability& aOut) override; }; -class MediaEngineWebRTCAudioCaptureSource : public MediaEngineAudioSource +class MediaEngineWebRTCAudioSource : public MediaEngineAudioSource, + public webrtc::VoEMediaProcess, + private MediaConstraintsHelper { public: - NS_DECL_THREADSAFE_ISUPPORTS - - explicit MediaEngineWebRTCAudioCaptureSource(const char* aUuid) - : MediaEngineAudioSource(kReleased) - { - } - void GetName(nsAString& aName) override; - void GetUUID(nsACString& aUUID) override; - nsresult Allocate(const dom::MediaTrackConstraints& aConstraints, - const MediaEnginePrefs& aPrefs, - const nsString& aDeviceId) override - { - // Nothing to do here, everything is managed in MediaManager.cpp - return NS_OK; - } - nsresult Deallocate() override - { - // Nothing to do here, everything is managed in MediaManager.cpp - return NS_OK; - } - void Shutdown() override - { - // Nothing to do here, everything is managed in MediaManager.cpp - } - nsresult Start(SourceMediaStream* aMediaStream, TrackID aId) override; - nsresult Stop(SourceMediaStream* aMediaStream, TrackID aId) override; - void SetDirectListeners(bool aDirect) override - {} - nsresult Config(bool aEchoOn, uint32_t aEcho, bool aAgcOn, - uint32_t aAGC, bool aNoiseOn, uint32_t aNoise, - int32_t aPlayoutDelay) override - { - return NS_OK; - } - void NotifyPull(MediaStreamGraph* aGraph, SourceMediaStream* aSource, - TrackID aID, StreamTime aDesiredTime) override - {} - const dom::MediaSourceEnum GetMediaSource() override - { - return dom::MediaSourceEnum::AudioCapture; - } - bool IsFake() override - { - return false; - } - nsresult TakePhoto(PhotoCallback* aCallback) override - { - return NS_ERROR_NOT_IMPLEMENTED; - } - uint32_t GetBestFitnessDistance( - const nsTArray& aConstraintSets, - const nsString& aDeviceId) override; - -protected: - virtual ~MediaEngineWebRTCAudioCaptureSource() { Shutdown(); } - nsCString mUUID; -}; - -class MediaEngineWebRTCMicrophoneSource : public MediaEngineAudioSource, - public webrtc::VoEMediaProcess, - private MediaConstraintsHelper -{ -public: - MediaEngineWebRTCMicrophoneSource(nsIThread* aThread, - webrtc::VoiceEngine* aVoiceEnginePtr, - int aIndex, - const char* name, - const char* uuid) + MediaEngineWebRTCAudioSource(nsIThread* aThread, webrtc::VoiceEngine* aVoiceEnginePtr, + int aIndex, const char* name, const char* uuid) : MediaEngineAudioSource(kReleased) , mVoiceEngine(aVoiceEnginePtr) , mMonitor("WebRTCMic.Monitor") @@ -271,7 +207,7 @@ public: virtual void Shutdown() override; protected: - ~MediaEngineWebRTCMicrophoneSource() { Shutdown(); } + ~MediaEngineWebRTCAudioSource() { Shutdown(); } private: void Init(); @@ -358,7 +294,7 @@ private: // Store devices we've already seen in a hashtable for quick return. // Maps UUID to MediaEngineSource (one set for audio, one for video). nsRefPtrHashtable mVideoSources; - nsRefPtrHashtable mAudioSources; + nsRefPtrHashtable mAudioSources; }; } diff --git a/dom/media/webrtc/MediaEngineWebRTCAudio.cpp b/dom/media/webrtc/MediaEngineWebRTCAudio.cpp index c45beae4ce24..c85c5710c193 100644 --- a/dom/media/webrtc/MediaEngineWebRTCAudio.cpp +++ b/dom/media/webrtc/MediaEngineWebRTCAudio.cpp @@ -41,10 +41,9 @@ extern PRLogModuleInfo* GetMediaManagerLog(); #define LOG_FRAMES(msg) MOZ_LOG(GetMediaManagerLog(), mozilla::LogLevel::Verbose, msg) /** - * Webrtc microphone source source. + * Webrtc audio source. */ -NS_IMPL_ISUPPORTS0(MediaEngineWebRTCMicrophoneSource) -NS_IMPL_ISUPPORTS0(MediaEngineWebRTCAudioCaptureSource) +NS_IMPL_ISUPPORTS0(MediaEngineWebRTCAudioSource) // XXX temp until MSG supports registration StaticRefPtr gFarendObserver; @@ -178,7 +177,7 @@ AudioOutputObserver::InsertFarEnd(const AudioDataValue *aBuffer, uint32_t aFrame } void -MediaEngineWebRTCMicrophoneSource::GetName(nsAString& aName) +MediaEngineWebRTCAudioSource::GetName(nsAString& aName) { if (mInitDone) { aName.Assign(mDeviceName); @@ -188,7 +187,7 @@ MediaEngineWebRTCMicrophoneSource::GetName(nsAString& aName) } void -MediaEngineWebRTCMicrophoneSource::GetUUID(nsACString& aUUID) +MediaEngineWebRTCAudioSource::GetUUID(nsACString& aUUID) { if (mInitDone) { aUUID.Assign(mDeviceUUID); @@ -198,10 +197,10 @@ MediaEngineWebRTCMicrophoneSource::GetUUID(nsACString& aUUID) } nsresult -MediaEngineWebRTCMicrophoneSource::Config(bool aEchoOn, uint32_t aEcho, - bool aAgcOn, uint32_t aAGC, - bool aNoiseOn, uint32_t aNoise, - int32_t aPlayoutDelay) +MediaEngineWebRTCAudioSource::Config(bool aEchoOn, uint32_t aEcho, + bool aAgcOn, uint32_t aAGC, + bool aNoiseOn, uint32_t aNoise, + int32_t aPlayoutDelay) { LOG(("Audio config: aec: %d, agc: %d, noise: %d", aEchoOn ? aEcho : -1, @@ -268,7 +267,7 @@ MediaEngineWebRTCMicrophoneSource::Config(bool aEchoOn, uint32_t aEcho, // Infinity = UINT32_MAX e.g. device cannot satisfy accumulated ConstraintSets. // A finite result may be used to calculate this device's ranking as a choice. -uint32_t MediaEngineWebRTCMicrophoneSource::GetBestFitnessDistance( +uint32_t MediaEngineWebRTCAudioSource::GetBestFitnessDistance( const nsTArray& aConstraintSets, const nsString& aDeviceId) { @@ -282,9 +281,9 @@ uint32_t MediaEngineWebRTCMicrophoneSource::GetBestFitnessDistance( } nsresult -MediaEngineWebRTCMicrophoneSource::Allocate(const dom::MediaTrackConstraints &aConstraints, - const MediaEnginePrefs &aPrefs, - const nsString& aDeviceId) +MediaEngineWebRTCAudioSource::Allocate(const dom::MediaTrackConstraints &aConstraints, + const MediaEnginePrefs &aPrefs, + const nsString& aDeviceId) { if (mState == kReleased) { if (mInitDone) { @@ -310,7 +309,7 @@ MediaEngineWebRTCMicrophoneSource::Allocate(const dom::MediaTrackConstraints &aC } nsresult -MediaEngineWebRTCMicrophoneSource::Deallocate() +MediaEngineWebRTCAudioSource::Deallocate() { bool empty; { @@ -332,8 +331,7 @@ MediaEngineWebRTCMicrophoneSource::Deallocate() } nsresult -MediaEngineWebRTCMicrophoneSource::Start(SourceMediaStream *aStream, - TrackID aID) +MediaEngineWebRTCAudioSource::Start(SourceMediaStream* aStream, TrackID aID) { if (!mInitDone || !aStream) { return NS_ERROR_FAILURE; @@ -386,7 +384,7 @@ MediaEngineWebRTCMicrophoneSource::Start(SourceMediaStream *aStream, } nsresult -MediaEngineWebRTCMicrophoneSource::Stop(SourceMediaStream *aSource, TrackID aID) +MediaEngineWebRTCAudioSource::Stop(SourceMediaStream *aSource, TrackID aID) { { MonitorAutoLock lock(mMonitor); @@ -423,17 +421,17 @@ MediaEngineWebRTCMicrophoneSource::Stop(SourceMediaStream *aSource, TrackID aID) } void -MediaEngineWebRTCMicrophoneSource::NotifyPull(MediaStreamGraph *aGraph, - SourceMediaStream *aSource, - TrackID aID, - StreamTime aDesiredTime) +MediaEngineWebRTCAudioSource::NotifyPull(MediaStreamGraph* aGraph, + SourceMediaStream *aSource, + TrackID aID, + StreamTime aDesiredTime) { // Ignore - we push audio data LOG_FRAMES(("NotifyPull, desired = %ld", (int64_t) aDesiredTime)); } void -MediaEngineWebRTCMicrophoneSource::Init() +MediaEngineWebRTCAudioSource::Init() { mVoEBase = webrtc::VoEBase::GetInterface(mVoiceEngine); @@ -498,7 +496,7 @@ MediaEngineWebRTCMicrophoneSource::Init() } void -MediaEngineWebRTCMicrophoneSource::Shutdown() +MediaEngineWebRTCAudioSource::Shutdown() { if (!mInitDone) { // duplicate these here in case we failed during Init() @@ -553,10 +551,9 @@ MediaEngineWebRTCMicrophoneSource::Shutdown() typedef int16_t sample; void -MediaEngineWebRTCMicrophoneSource::Process(int channel, - webrtc::ProcessingTypes type, - sample *audio10ms, int length, - int samplingFreq, bool isStereo) +MediaEngineWebRTCAudioSource::Process(int channel, + webrtc::ProcessingTypes type, sample* audio10ms, + int length, int samplingFreq, bool isStereo) { // On initial capture, throw away all far-end data except the most recent sample // since it's already irrelevant and we want to keep avoid confusing the AEC far-end @@ -621,55 +618,4 @@ MediaEngineWebRTCMicrophoneSource::Process(int channel, return; } -void -MediaEngineWebRTCAudioCaptureSource::GetName(nsAString &aName) -{ - aName.AssignLiteral("AudioCapture"); -} -void -MediaEngineWebRTCAudioCaptureSource::GetUUID(nsACString &aUUID) -{ - nsID uuid; - char uuidBuffer[NSID_LENGTH]; - nsCString asciiString; - ErrorResult rv; - - rv = nsContentUtils::GenerateUUIDInPlace(uuid); - if (rv.Failed()) { - aUUID.AssignLiteral(""); - return; - } - - - uuid.ToProvidedString(uuidBuffer); - asciiString.AssignASCII(uuidBuffer); - - // Remove {} and the null terminator - aUUID.Assign(Substring(asciiString, 1, NSID_LENGTH - 3)); -} - -nsresult -MediaEngineWebRTCAudioCaptureSource::Start(SourceMediaStream *aMediaStream, - TrackID aId) -{ - aMediaStream->AddTrack(aId, 0, new AudioSegment()); - return NS_OK; -} - -nsresult -MediaEngineWebRTCAudioCaptureSource::Stop(SourceMediaStream *aMediaStream, - TrackID aId) -{ - aMediaStream->EndAllTrackAndFinish(); - return NS_OK; -} - -uint32_t -MediaEngineWebRTCAudioCaptureSource::GetBestFitnessDistance( - const nsTArray& aConstraintSets, - const nsString& aDeviceId) -{ - // There is only one way of capturing audio for now, and it's always adequate. - return 0; -} } diff --git a/dom/webidl/Constraints.webidl b/dom/webidl/Constraints.webidl index f7f0c706a9d7..fc6275b59b4e 100644 --- a/dom/webidl/Constraints.webidl +++ b/dom/webidl/Constraints.webidl @@ -25,7 +25,6 @@ enum MediaSourceEnum { "window", "browser", "microphone", - "audioCapture", "other" }; diff --git a/modules/libpref/init/all.js b/modules/libpref/init/all.js index 576b7680a6a9..fbbab15fb332 100644 --- a/modules/libpref/init/all.js +++ b/modules/libpref/init/all.js @@ -445,8 +445,6 @@ pref("media.getusermedia.screensharing.allowed_domains", "mozilla.github.io,webe // OS/X 10.6 and XP have screen/window sharing off by default due to various issues - Caveat emptor pref("media.getusermedia.screensharing.allow_on_old_platforms", false); -pref("media.getusermedia.audiocapture.enabled", false); - // TextTrack support pref("media.webvtt.enabled", true); pref("media.webvtt.regions.enabled", false); From dd7731ea5d66c9e860c0ea165c94b4445d3569a3 Mon Sep 17 00:00:00 2001 From: David Keeler Date: Fri, 24 Jul 2015 14:13:25 -0700 Subject: [PATCH 032/136] bug 1186461 - keep telemetry probe SSL_PERMANENT_CERT_ERROR_OVERRIDES for longer r=mgoodwin --- toolkit/components/telemetry/Histograms.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/toolkit/components/telemetry/Histograms.json b/toolkit/components/telemetry/Histograms.json index 237f8d180c34..8287e4b0e253 100644 --- a/toolkit/components/telemetry/Histograms.json +++ b/toolkit/components/telemetry/Histograms.json @@ -7482,7 +7482,7 @@ }, "SSL_PERMANENT_CERT_ERROR_OVERRIDES": { "alert_emails": ["seceng@mozilla.org"], - "expires_in_version": "42", + "expires_in_version": "default", "kind": "exponential", "high": 1024, "n_buckets": 10, From 4796dbdf30fd21508d81b98bbfb4199b80988c7c Mon Sep 17 00:00:00 2001 From: Timothy Nikkel Date: Fri, 24 Jul 2015 16:24:49 -0500 Subject: [PATCH 033/136] Bug 1187463. Enable containerful scrolling on b2g. r=kats --- modules/libpref/init/all.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/modules/libpref/init/all.js b/modules/libpref/init/all.js index fbbab15fb332..94e090f1657c 100644 --- a/modules/libpref/init/all.js +++ b/modules/libpref/init/all.js @@ -597,8 +597,8 @@ pref("apz.test.logging_enabled", false); pref("gfx.hidpi.enabled", 2); #endif -#if !defined(MOZ_WIDGET_ANDROID) -// Containerless scrolling for root frames does not yet pass tests on Android. +#if !defined(MOZ_WIDGET_GONK) && !defined(MOZ_WIDGET_ANDROID) +// Use containerless scrolling for now on desktop. pref("layout.scroll.root-frame-containers", false); #endif From 28e62e3685f6ee19d3d5bf54c56e3cc4d1010e92 Mon Sep 17 00:00:00 2001 From: Armen Zambrano Gasparnian Date: Fri, 24 Jul 2015 17:29:04 -0400 Subject: [PATCH 034/136] Bug 1176358 - Fix typo in symbols_url for Firefox UI tests. DONTBUILD. r=chmanchester --- testing/mozharness/scripts/firefox_ui_updates.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/testing/mozharness/scripts/firefox_ui_updates.py b/testing/mozharness/scripts/firefox_ui_updates.py index f4f605a6a43c..96629bf4a4dd 100644 --- a/testing/mozharness/scripts/firefox_ui_updates.py +++ b/testing/mozharness/scripts/firefox_ui_updates.py @@ -268,8 +268,8 @@ class FirefoxUIUpdates(FirefoxUITests): try: # Let's see if the symbols are available - urllib2.urlopen(symbols_path) - return symbols_path + urllib2.urlopen(symbols_url) + return symbols_url except urllib2.HTTPError, e: self.warning("%s - %s" % (str(e), symbols_url)) From 2021b2998ccbadb2bd644431c48f87777cc04621 Mon Sep 17 00:00:00 2001 From: Michael Layzell Date: Sat, 18 Jul 2015 00:11:31 -0400 Subject: [PATCH 035/136] Bug 1185188 - Support multiple clang-plugin annotations; r=ehsan --- build/clang-plugin/clang-plugin.cpp | 15 ++++++++++----- .../tests/TestMultipleAnnotations.cpp | 17 +++++++++++++++++ build/clang-plugin/tests/moz.build | 1 + 3 files changed, 28 insertions(+), 5 deletions(-) create mode 100644 build/clang-plugin/tests/TestMultipleAnnotations.cpp diff --git a/build/clang-plugin/clang-plugin.cpp b/build/clang-plugin/clang-plugin.cpp index b600fecb27a5..2cafb0e97d9c 100644 --- a/build/clang-plugin/clang-plugin.cpp +++ b/build/clang-plugin/clang-plugin.cpp @@ -232,12 +232,17 @@ public: TraverseDecl(ctx.getTranslationUnitDecl()); } - static bool hasCustomAnnotation(const Decl *d, const char *spelling) { - AnnotateAttr *attr = d->getAttr(); - if (!attr) - return false; + static bool hasCustomAnnotation(const Decl *D, const char *Spelling) { + iterator_range > Attrs = + D->specific_attrs(); - return attr->getAnnotation() == spelling; + for (AnnotateAttr *Attr : Attrs) { + if (Attr->getAnnotation() == Spelling) { + return true; + } + } + + return false; } void HandleUnusedExprResult(const Stmt *stmt) { diff --git a/build/clang-plugin/tests/TestMultipleAnnotations.cpp b/build/clang-plugin/tests/TestMultipleAnnotations.cpp new file mode 100644 index 000000000000..91ae6e7122f4 --- /dev/null +++ b/build/clang-plugin/tests/TestMultipleAnnotations.cpp @@ -0,0 +1,17 @@ +#define MOZ_MUST_USE __attribute__((annotate("moz_must_use"))) +#define MOZ_STACK_CLASS __attribute__((annotate("moz_stack_class"))) + +class MOZ_MUST_USE MOZ_STACK_CLASS TestClass {}; + +TestClass foo; // expected-error {{variable of type 'TestClass' only valid on the stack}} + +TestClass f() +{ + TestClass bar; + return bar; +} + +void g() +{ + f(); // expected-error {{Unused MOZ_MUST_USE value of type 'TestClass'}} +} diff --git a/build/clang-plugin/tests/moz.build b/build/clang-plugin/tests/moz.build index 6dc1ec982786..d2fbe2ad1e94 100644 --- a/build/clang-plugin/tests/moz.build +++ b/build/clang-plugin/tests/moz.build @@ -9,6 +9,7 @@ SOURCES += [ 'TestCustomHeap.cpp', 'TestExplicitOperatorBool.cpp', 'TestGlobalClass.cpp', + 'TestMultipleAnnotations.cpp', 'TestMustOverride.cpp', 'TestMustUse.cpp', 'TestNANTestingExpr.cpp', From 7e6901b7fd3efbb1b57d2b1279473d535ea674e4 Mon Sep 17 00:00:00 2001 From: Michael Layzell Date: Mon, 20 Jul 2015 19:43:12 -0400 Subject: [PATCH 036/136] Bug 1185044 - Unify type annotation logic between MOZ_*_CLASS and MOZ_MUST_USE; r=ehsan --- build/clang-plugin/clang-plugin.cpp | 366 +++++++++--------- build/clang-plugin/tests/TestGlobalClass.cpp | 8 +- .../tests/TestMultipleAnnotations.cpp | 2 +- build/clang-plugin/tests/TestMustUse.cpp | 60 +-- build/clang-plugin/tests/TestNonHeapClass.cpp | 8 +- build/clang-plugin/tests/TestStackClass.cpp | 6 +- 6 files changed, 220 insertions(+), 230 deletions(-) diff --git a/build/clang-plugin/clang-plugin.cpp b/build/clang-plugin/clang-plugin.cpp index 2cafb0e97d9c..e525834f0e6a 100644 --- a/build/clang-plugin/clang-plugin.cpp +++ b/build/clang-plugin/clang-plugin.cpp @@ -56,7 +56,6 @@ private: ScopeChecker(Scope scope_) : scope(scope_) {} virtual void run(const MatchFinder::MatchResult &Result); - void noteInferred(QualType T, DiagnosticsEngine &Diag); private: Scope scope; }; @@ -64,7 +63,6 @@ private: class NonHeapClassChecker : public MatchFinder::MatchCallback { public: virtual void run(const MatchFinder::MatchResult &Result); - void noteInferred(QualType T, DiagnosticsEngine &Diag); }; class ArithmeticArgChecker : public MatchFinder::MatchCallback { @@ -217,6 +215,51 @@ bool isInterestingDeclForImplicitConversion(const Decl *decl) { } +class CustomTypeAnnotation { + enum ReasonKind { + RK_None, + RK_Direct, + RK_ArrayElement, + RK_BaseClass, + RK_Field, + }; + struct AnnotationReason { + QualType Type; + ReasonKind Kind; + const FieldDecl *Field; + + bool valid() const { return Kind != RK_None; } + }; + typedef DenseMap ReasonCache; + + const char *Spelling; + const char *Pretty; + ReasonCache Cache; + +public: + CustomTypeAnnotation(const char *Spelling, const char *Pretty) + : Spelling(Spelling), Pretty(Pretty) {}; + + // Checks if this custom annotation "effectively affects" the given type. + bool hasEffectiveAnnotation(QualType T) { + return directAnnotationReason(T).valid(); + } + void dumpAnnotationReason(DiagnosticsEngine &Diag, QualType T, SourceLocation Loc); + +private: + bool hasLiteralAnnotation(QualType T) const; + AnnotationReason directAnnotationReason(QualType T); +}; + +static CustomTypeAnnotation StackClass = + CustomTypeAnnotation("moz_stack_class", "stack"); +static CustomTypeAnnotation GlobalClass = + CustomTypeAnnotation("moz_global_class", "global"); +static CustomTypeAnnotation NonHeapClass = + CustomTypeAnnotation("moz_nonheap_class", "non-heap"); +static CustomTypeAnnotation MustUse = + CustomTypeAnnotation("moz_must_use", "must-use"); + class MozChecker : public ASTConsumer, public RecursiveASTVisitor { DiagnosticsEngine &Diag; const CompilerInstance &CI; @@ -248,18 +291,13 @@ public: void HandleUnusedExprResult(const Stmt *stmt) { const Expr* E = dyn_cast_or_null(stmt); if (E) { - // XXX It would be nice if we could use getAsTagDecl, - // but our version of clang is too old. - // (getAsTagDecl would also cover enums etc.) QualType T = E->getType(); - CXXRecordDecl *decl = T->getAsCXXRecordDecl(); - if (decl) { - decl = decl->getDefinition(); - if (decl && hasCustomAnnotation(decl, "moz_must_use")) { - unsigned errorID = Diag.getDiagnosticIDs()->getCustomDiagID( - DiagnosticIDs::Error, "Unused MOZ_MUST_USE value of type %0"); - Diag.Report(E->getLocStart(), errorID) << T; - } + if (MustUse.hasEffectiveAnnotation(T)) { + unsigned errorID = Diag.getDiagnosticIDs()->getCustomDiagID( + DiagnosticIDs::Error, "Unused value of must-use type %0"); + + Diag.Report(E->getLocStart(), errorID) << T; + MustUse.dumpAnnotationReason(Diag, T, E->getLocStart()); } } } @@ -383,102 +421,6 @@ public: } }; -/** - * Where classes may be allocated. Regular classes can be allocated anywhere, - * non-heap classes on the stack or as static variables, and stack classes only - * on the stack. Note that stack classes subsumes non-heap classes. - */ -enum ClassAllocationNature { - RegularClass = 0, - NonHeapClass = 1, - StackClass = 2, - GlobalClass = 3 -}; - -/// A cached data of whether classes are stack classes, non-heap classes, or -/// neither. -DenseMap > inferredAllocCauses; - -ClassAllocationNature getClassAttrs(QualType T); - -ClassAllocationNature getClassAttrs(CXXRecordDecl *D) { - // Normalize so that D points to the definition if it exists. If it doesn't, - // then we can't allocate it anyways. - if (!D->hasDefinition()) - return RegularClass; - D = D->getDefinition(); - // Base class: anyone with this annotation is obviously a stack class - if (MozChecker::hasCustomAnnotation(D, "moz_stack_class")) - return StackClass; - // Base class: anyone with this annotation is obviously a global class - if (MozChecker::hasCustomAnnotation(D, "moz_global_class")) - return GlobalClass; - - // See if we cached the result. - DenseMap >::iterator it = - inferredAllocCauses.find(D); - if (it != inferredAllocCauses.end()) { - return it->second.second; - } - - // Continue looking, we might be a stack class yet. Even if we're a nonheap - // class, it might be possible that we've inferred to be a stack class. - ClassAllocationNature type = RegularClass; - if (MozChecker::hasCustomAnnotation(D, "moz_nonheap_class")) { - type = NonHeapClass; - } - inferredAllocCauses.insert(std::make_pair(D, - std::make_pair((const Decl *)0, type))); - - // Look through all base cases to figure out if the parent is a stack class or - // a non-heap class. Since we might later infer to also be a stack class, keep - // going. - for (CXXRecordDecl::base_class_iterator base = D->bases_begin(), - e = D->bases_end(); base != e; ++base) { - ClassAllocationNature super = getClassAttrs(base->getType()); - if (super == StackClass) { - inferredAllocCauses[D] = std::make_pair( - base->getType()->getAsCXXRecordDecl(), StackClass); - return StackClass; - } else if (super == GlobalClass) { - inferredAllocCauses[D] = std::make_pair( - base->getType()->getAsCXXRecordDecl(), GlobalClass); - return GlobalClass; - } else if (super == NonHeapClass) { - inferredAllocCauses[D] = std::make_pair( - base->getType()->getAsCXXRecordDecl(), NonHeapClass); - type = NonHeapClass; - } - } - - // Maybe it has a member which is a stack class. - for (RecordDecl::field_iterator field = D->field_begin(), e = D->field_end(); - field != e; ++field) { - ClassAllocationNature fieldType = getClassAttrs(field->getType()); - if (fieldType == StackClass) { - inferredAllocCauses[D] = std::make_pair(*field, StackClass); - return StackClass; - } else if (fieldType == GlobalClass) { - inferredAllocCauses[D] = std::make_pair(*field, GlobalClass); - return GlobalClass; - } else if (fieldType == NonHeapClass) { - inferredAllocCauses[D] = std::make_pair(*field, NonHeapClass); - type = NonHeapClass; - } - } - - return type; -} - -ClassAllocationNature getClassAttrs(QualType T) { - while (const ArrayType *arrTy = T->getAsArrayTypeUnsafe()) - T = arrTy->getElementType(); - CXXRecordDecl *clazz = T->getAsCXXRecordDecl(); - return clazz ? getClassAttrs(clazz) : RegularClass; -} - /// A cached data of whether classes are refcounted or not. typedef DenseMap > RefCountedMap; @@ -532,7 +474,7 @@ bool isClassRefCounted(QualType T) { while (const ArrayType *arrTy = T->getAsArrayTypeUnsafe()) T = arrTy->getElementType(); CXXRecordDecl *clazz = T->getAsCXXRecordDecl(); - return clazz ? isClassRefCounted(clazz) : RegularClass; + return clazz ? isClassRefCounted(clazz) : false; } template @@ -553,19 +495,19 @@ namespace ast_matchers { /// This matcher will match any class with the stack class assertion or an /// array of such classes. AST_MATCHER(QualType, stackClassAggregate) { - return getClassAttrs(Node) == StackClass; + return StackClass.hasEffectiveAnnotation(Node); } /// This matcher will match any class with the global class assertion or an /// array of such classes. AST_MATCHER(QualType, globalClassAggregate) { - return getClassAttrs(Node) == GlobalClass; + return GlobalClass.hasEffectiveAnnotation(Node); } /// This matcher will match any class with the stack class assertion or an /// array of such classes. AST_MATCHER(QualType, nonheapClassAggregate) { - return getClassAttrs(Node) == NonHeapClass; + return NonHeapClass.hasEffectiveAnnotation(Node); } /// This matcher will match any function declaration that is declared as a heap @@ -704,6 +646,103 @@ AST_POLYMORPHIC_MATCHER_P(equalsBoundNode, namespace { +void CustomTypeAnnotation::dumpAnnotationReason(DiagnosticsEngine &Diag, QualType T, SourceLocation Loc) { + unsigned InheritsID = Diag.getDiagnosticIDs()->getCustomDiagID( + DiagnosticIDs::Note, "%1 is a %0 type because it inherits from a %0 type %2"); + unsigned MemberID = Diag.getDiagnosticIDs()->getCustomDiagID( + DiagnosticIDs::Note, "%1 is a %0 type because member %2 is a %0 type %3"); + unsigned ArrayID = Diag.getDiagnosticIDs()->getCustomDiagID( + DiagnosticIDs::Note, "%1 is a %0 type because it is an array of %0 type %2"); + unsigned TemplID = Diag.getDiagnosticIDs()->getCustomDiagID( + DiagnosticIDs::Note, "%1 is a %0 type because it has a template argument %0 type %2"); + + AnnotationReason Reason = directAnnotationReason(T); + for (;;) { + switch (Reason.Kind) { + case RK_ArrayElement: + Diag.Report(Loc, ArrayID) + << Pretty << T << Reason.Type; + break; + case RK_BaseClass: + { + const CXXRecordDecl *Decl = T->getAsCXXRecordDecl(); + assert(Decl && "This type should be a C++ class"); + + Diag.Report(Decl->getLocation(), InheritsID) + << Pretty << T << Reason.Type; + break; + } + case RK_Field: + Diag.Report(Reason.Field->getLocation(), MemberID) + << Pretty << T << Reason.Field << Reason.Type; + break; + default: + return; + } + + T = Reason.Type; + Reason = directAnnotationReason(T); + } +} + +bool CustomTypeAnnotation::hasLiteralAnnotation(QualType T) const { + if (const TagDecl *D = T->getAsTagDecl()) { + return MozChecker::hasCustomAnnotation(D, Spelling); + } + return false; +} + +CustomTypeAnnotation::AnnotationReason CustomTypeAnnotation::directAnnotationReason(QualType T) { + if (hasLiteralAnnotation(T)) { + AnnotationReason Reason = { T, RK_Direct, nullptr }; + return Reason; + } + + // Check if we have a cached answer + void *Key = T.getAsOpaquePtr(); + ReasonCache::iterator Cached = Cache.find(T.getAsOpaquePtr()); + if (Cached != Cache.end()) { + return Cached->second; + } + + // Check if we have a type which we can recurse into + if (const ArrayType *Array = T->getAsArrayTypeUnsafe()) { + if (hasEffectiveAnnotation(Array->getElementType())) { + AnnotationReason Reason = { Array->getElementType(), RK_ArrayElement, nullptr }; + Cache[Key] = Reason; + return Reason; + } + } + + // Recurse into base classes + if (const CXXRecordDecl *Decl = T->getAsCXXRecordDecl()) { + if (Decl->hasDefinition()) { + Decl = Decl->getDefinition(); + + for (const CXXBaseSpecifier &Base : Decl->bases()) { + if (hasEffectiveAnnotation(Base.getType())) { + AnnotationReason Reason = { Base.getType(), RK_BaseClass, nullptr }; + Cache[Key] = Reason; + return Reason; + } + } + + // Recurse into members + for (const FieldDecl *Field : Decl->fields()) { + if (hasEffectiveAnnotation(Field->getType())) { + AnnotationReason Reason = { Field->getType(), RK_Field, Field }; + Cache[Key] = Reason; + return Reason; + } + } + } + } + + AnnotationReason Reason = { QualType(), RK_None, nullptr }; + Cache[Key] = Reason; + return Reason; +} + bool isPlacementNew(const CXXNewExpr *expr) { // Regular new expressions aren't placement new if (expr->getNumPlacementArgs() == 0) @@ -830,7 +869,9 @@ void DiagnosticsMatcher::ScopeChecker::run( DiagnosticIDs::Error, "variable of type %0 only valid on the stack"); unsigned globalID = Diag.getDiagnosticIDs()->getCustomDiagID( DiagnosticIDs::Error, "variable of type %0 only valid as global"); - unsigned errorID = (scope == eGlobal) ? globalID : stackID; + + SourceLocation Loc; + QualType T; if (const VarDecl *d = Result.Nodes.getNodeAs("node")) { if (scope == eLocal) { // Ignore the match if it's a local variable. @@ -845,56 +886,29 @@ void DiagnosticsMatcher::ScopeChecker::run( return; } - Diag.Report(d->getLocation(), errorID) << d->getType(); - noteInferred(d->getType(), Diag); + Loc = d->getLocation(); + T = d->getType(); } else if (const CXXNewExpr *expr = Result.Nodes.getNodeAs("node")) { // If it's placement new, then this match doesn't count. if (scope == eLocal && isPlacementNew(expr)) return; - Diag.Report(expr->getStartLoc(), errorID) << expr->getAllocatedType(); - noteInferred(expr->getAllocatedType(), Diag); + + Loc = expr->getStartLoc(); + T = expr->getAllocatedType(); } else if (const CallExpr *expr = Result.Nodes.getNodeAs("node")) { - QualType badType = GetCallReturnType(expr)->getPointeeType(); - Diag.Report(expr->getLocStart(), errorID) << badType; - noteInferred(badType, Diag); - } -} - -void DiagnosticsMatcher::ScopeChecker::noteInferred(QualType T, - DiagnosticsEngine &Diag) { - unsigned inheritsID = Diag.getDiagnosticIDs()->getCustomDiagID( - DiagnosticIDs::Note, - "%0 is a %2 class because it inherits from a %2 class %1"); - unsigned memberID = Diag.getDiagnosticIDs()->getCustomDiagID( - DiagnosticIDs::Note, - "%0 is a %3 class because member %1 is a %3 class %2"); - const char* attribute = (scope == eGlobal) ? - "moz_global_class" : "moz_stack_class"; - const char* type = (scope == eGlobal) ? - "global" : "stack"; - - // Find the CXXRecordDecl that is the local/global class of interest - while (const ArrayType *arrTy = T->getAsArrayTypeUnsafe()) - T = arrTy->getElementType(); - CXXRecordDecl *clazz = T->getAsCXXRecordDecl(); - - // Direct result, we're done. - if (MozChecker::hasCustomAnnotation(clazz, attribute)) - return; - - const Decl *cause = inferredAllocCauses[clazz].first; - if (const CXXRecordDecl *CRD = dyn_cast(cause)) { - Diag.Report(clazz->getLocation(), inheritsID) << - T << CRD->getDeclName() << type; - } else if (const FieldDecl *FD = dyn_cast(cause)) { - Diag.Report(FD->getLocation(), memberID) << - T << FD << FD->getType() << type; + Loc = expr->getLocStart(); + T = GetCallReturnType(expr)->getPointeeType(); } - // Recursively follow this back. - noteInferred(cast(cause)->getType(), Diag); + if (scope == eLocal) { + Diag.Report(Loc, stackID) << T; + StackClass.dumpAnnotationReason(Diag, T, Loc); + } else if (scope == eGlobal) { + Diag.Report(Loc, globalID) << T; + GlobalClass.dumpAnnotationReason(Diag, T, Loc); + } } void DiagnosticsMatcher::NonHeapClassChecker::run( @@ -902,46 +916,22 @@ void DiagnosticsMatcher::NonHeapClassChecker::run( DiagnosticsEngine &Diag = Result.Context->getDiagnostics(); unsigned stackID = Diag.getDiagnosticIDs()->getCustomDiagID( DiagnosticIDs::Error, "variable of type %0 is not valid on the heap"); + + SourceLocation Loc; + QualType T; if (const CXXNewExpr *expr = Result.Nodes.getNodeAs("node")) { // If it's placement new, then this match doesn't count. if (isPlacementNew(expr)) return; - Diag.Report(expr->getStartLoc(), stackID) << expr->getAllocatedType(); - noteInferred(expr->getAllocatedType(), Diag); + Loc = expr->getLocStart(); + T = expr->getAllocatedType(); } else if (const CallExpr *expr = Result.Nodes.getNodeAs("node")) { - QualType badType = GetCallReturnType(expr)->getPointeeType(); - Diag.Report(expr->getLocStart(), stackID) << badType; - noteInferred(badType, Diag); + Loc = expr->getLocStart(); + T = GetCallReturnType(expr)->getPointeeType(); } -} -void DiagnosticsMatcher::NonHeapClassChecker::noteInferred(QualType T, - DiagnosticsEngine &Diag) { - unsigned inheritsID = Diag.getDiagnosticIDs()->getCustomDiagID( - DiagnosticIDs::Note, - "%0 is a non-heap class because it inherits from a non-heap class %1"); - unsigned memberID = Diag.getDiagnosticIDs()->getCustomDiagID( - DiagnosticIDs::Note, - "%0 is a non-heap class because member %1 is a non-heap class %2"); - - // Find the CXXRecordDecl that is the stack class of interest - while (const ArrayType *arrTy = T->getAsArrayTypeUnsafe()) - T = arrTy->getElementType(); - CXXRecordDecl *clazz = T->getAsCXXRecordDecl(); - - // Direct result, we're done. - if (MozChecker::hasCustomAnnotation(clazz, "moz_nonheap_class")) - return; - - const Decl *cause = inferredAllocCauses[clazz].first; - if (const CXXRecordDecl *CRD = dyn_cast(cause)) { - Diag.Report(clazz->getLocation(), inheritsID) << T << CRD->getDeclName(); - } else if (const FieldDecl *FD = dyn_cast(cause)) { - Diag.Report(FD->getLocation(), memberID) << T << FD << FD->getType(); - } - - // Recursively follow this back. - noteInferred(cast(cause)->getType(), Diag); + Diag.Report(Loc, stackID) << T; + NonHeapClass.dumpAnnotationReason(Diag, T, Loc); } void DiagnosticsMatcher::ArithmeticArgChecker::run( diff --git a/build/clang-plugin/tests/TestGlobalClass.cpp b/build/clang-plugin/tests/TestGlobalClass.cpp index 88da22e9cd56..62d4d07b87ed 100644 --- a/build/clang-plugin/tests/TestGlobalClass.cpp +++ b/build/clang-plugin/tests/TestGlobalClass.cpp @@ -16,9 +16,9 @@ void gobble(void *) { } void misuseGlobalClass(int len) { Global notValid; // expected-error {{variable of type 'Global' only valid as global}} - Global alsoNotValid[2]; // expected-error {{variable of type 'Global [2]' only valid as global}} + Global alsoNotValid[2]; // expected-error {{variable of type 'Global [2]' only valid as global}} expected-note {{'Global [2]' is a global type because it is an array of global type 'Global'}} static Global valid; // expected-error {{variable of type 'Global' only valid as global}} - static Global alsoValid[2]; // expected-error {{variable of type 'Global [2]' only valid as global}} + static Global alsoValid[2]; // expected-error {{variable of type 'Global [2]' only valid as global}} expected-note {{'Global [2]' is a global type because it is an array of global type 'Global'}} gobble(&valid); gobble(¬Valid); @@ -35,7 +35,7 @@ void misuseGlobalClass(int len) { Global valid; struct RandomClass { - Global nonstaticMember; // expected-note {{'RandomClass' is a global class because member 'nonstaticMember' is a global class 'Global'}} + Global nonstaticMember; // expected-note {{'RandomClass' is a global type because member 'nonstaticMember' is a global type 'Global'}} static Global staticMember; }; struct MOZ_GLOBAL_CLASS RandomGlobalClass { @@ -43,7 +43,7 @@ struct MOZ_GLOBAL_CLASS RandomGlobalClass { static Global staticMember; }; -struct BadInherit : Global {}; // expected-note {{'BadInherit' is a global class because it inherits from a global class 'Global'}} +struct BadInherit : Global {}; // expected-note {{'BadInherit' is a global type because it inherits from a global type 'Global'}} struct MOZ_GLOBAL_CLASS GoodInherit : Global {}; void misuseGlobalClassEvenMore(int len) { diff --git a/build/clang-plugin/tests/TestMultipleAnnotations.cpp b/build/clang-plugin/tests/TestMultipleAnnotations.cpp index 91ae6e7122f4..cade13f9a08c 100644 --- a/build/clang-plugin/tests/TestMultipleAnnotations.cpp +++ b/build/clang-plugin/tests/TestMultipleAnnotations.cpp @@ -13,5 +13,5 @@ TestClass f() void g() { - f(); // expected-error {{Unused MOZ_MUST_USE value of type 'TestClass'}} + f(); // expected-error {{Unused value of must-use type 'TestClass'}} } diff --git a/build/clang-plugin/tests/TestMustUse.cpp b/build/clang-plugin/tests/TestMustUse.cpp index edcdb1a508cb..33d6a8bd7e88 100644 --- a/build/clang-plugin/tests/TestMustUse.cpp +++ b/build/clang-plugin/tests/TestMustUse.cpp @@ -20,42 +20,42 @@ void use(MayUse&&); void use(bool); void foo() { - producesMustUse(); // expected-error {{Unused MOZ_MUST_USE value of type 'MustUse'}} + producesMustUse(); // expected-error {{Unused value of must-use type 'MustUse'}} producesMustUsePointer(); - producesMustUseRef(); // expected-error {{Unused MOZ_MUST_USE value of type 'MustUse'}} + producesMustUseRef(); // expected-error {{Unused value of must-use type 'MustUse'}} producesMayUse(); producesMayUsePointer(); producesMayUseRef(); { - producesMustUse(); // expected-error {{Unused MOZ_MUST_USE value of type 'MustUse'}} + producesMustUse(); // expected-error {{Unused value of must-use type 'MustUse'}} producesMustUsePointer(); - producesMustUseRef(); // expected-error {{Unused MOZ_MUST_USE value of type 'MustUse'}} + producesMustUseRef(); // expected-error {{Unused value of must-use type 'MustUse'}} producesMayUse(); producesMayUsePointer(); producesMayUseRef(); } if (true) { - producesMustUse(); // expected-error {{Unused MOZ_MUST_USE value of type 'MustUse'}} + producesMustUse(); // expected-error {{Unused value of must-use type 'MustUse'}} producesMustUsePointer(); - producesMustUseRef(); // expected-error {{Unused MOZ_MUST_USE value of type 'MustUse'}} + producesMustUseRef(); // expected-error {{Unused value of must-use type 'MustUse'}} producesMayUse(); producesMayUsePointer(); producesMayUseRef(); } else { - producesMustUse(); // expected-error {{Unused MOZ_MUST_USE value of type 'MustUse'}} + producesMustUse(); // expected-error {{Unused value of must-use type 'MustUse'}} producesMustUsePointer(); - producesMustUseRef(); // expected-error {{Unused MOZ_MUST_USE value of type 'MustUse'}} + producesMustUseRef(); // expected-error {{Unused value of must-use type 'MustUse'}} producesMayUse(); producesMayUsePointer(); producesMayUseRef(); } - if(true) producesMustUse(); // expected-error {{Unused MOZ_MUST_USE value of type 'MustUse'}} - else producesMustUse(); // expected-error {{Unused MOZ_MUST_USE value of type 'MustUse'}} + if(true) producesMustUse(); // expected-error {{Unused value of must-use type 'MustUse'}} + else producesMustUse(); // expected-error {{Unused value of must-use type 'MustUse'}} if(true) producesMustUsePointer(); else producesMustUsePointer(); - if(true) producesMustUseRef(); // expected-error {{Unused MOZ_MUST_USE value of type 'MustUse'}} - else producesMustUseRef(); // expected-error {{Unused MOZ_MUST_USE value of type 'MustUse'}} + if(true) producesMustUseRef(); // expected-error {{Unused value of must-use type 'MustUse'}} + else producesMustUseRef(); // expected-error {{Unused value of must-use type 'MustUse'}} if(true) producesMayUse(); else producesMayUse(); if(true) producesMayUsePointer(); @@ -63,18 +63,18 @@ void foo() { if(true) producesMayUseRef(); else producesMayUseRef(); - while (true) producesMustUse(); // expected-error {{Unused MOZ_MUST_USE value of type 'MustUse'}} + while (true) producesMustUse(); // expected-error {{Unused value of must-use type 'MustUse'}} while (true) producesMustUsePointer(); - while (true) producesMustUseRef(); // expected-error {{Unused MOZ_MUST_USE value of type 'MustUse'}} + while (true) producesMustUseRef(); // expected-error {{Unused value of must-use type 'MustUse'}} while (true) producesMayUse(); while (true) producesMayUsePointer(); while (true) producesMayUseRef(); - do producesMustUse(); // expected-error {{Unused MOZ_MUST_USE value of type 'MustUse'}} + do producesMustUse(); // expected-error {{Unused value of must-use type 'MustUse'}} while (true); do producesMustUsePointer(); while (true); - do producesMustUseRef(); // expected-error {{Unused MOZ_MUST_USE value of type 'MustUse'}} + do producesMustUseRef(); // expected-error {{Unused value of must-use type 'MustUse'}} while (true); do producesMayUse(); while (true); @@ -83,48 +83,48 @@ void foo() { do producesMayUseRef(); while (true); - for (;;) producesMustUse(); // expected-error {{Unused MOZ_MUST_USE value of type 'MustUse'}} + for (;;) producesMustUse(); // expected-error {{Unused value of must-use type 'MustUse'}} for (;;) producesMustUsePointer(); - for (;;) producesMustUseRef(); // expected-error {{Unused MOZ_MUST_USE value of type 'MustUse'}} + for (;;) producesMustUseRef(); // expected-error {{Unused value of must-use type 'MustUse'}} for (;;) producesMayUse(); for (;;) producesMayUsePointer(); for (;;) producesMayUseRef(); - for (producesMustUse();;); // expected-error {{Unused MOZ_MUST_USE value of type 'MustUse'}} + for (producesMustUse();;); // expected-error {{Unused value of must-use type 'MustUse'}} for (producesMustUsePointer();;); - for (producesMustUseRef();;); // expected-error {{Unused MOZ_MUST_USE value of type 'MustUse'}} + for (producesMustUseRef();;); // expected-error {{Unused value of must-use type 'MustUse'}} for (producesMayUse();;); for (producesMayUsePointer();;); for (producesMayUseRef();;); - for (;;producesMustUse()); // expected-error {{Unused MOZ_MUST_USE value of type 'MustUse'}} + for (;;producesMustUse()); // expected-error {{Unused value of must-use type 'MustUse'}} for (;;producesMustUsePointer()); - for (;;producesMustUseRef()); // expected-error {{Unused MOZ_MUST_USE value of type 'MustUse'}} + for (;;producesMustUseRef()); // expected-error {{Unused value of must-use type 'MustUse'}} for (;;producesMayUse()); for (;;producesMayUsePointer()); for (;;producesMayUseRef()); - use((producesMustUse(), false)); // expected-error {{Unused MOZ_MUST_USE value of type 'MustUse'}} + use((producesMustUse(), false)); // expected-error {{Unused value of must-use type 'MustUse'}} use((producesMustUsePointer(), false)); - use((producesMustUseRef(), false)); // expected-error {{Unused MOZ_MUST_USE value of type 'MustUse'}} + use((producesMustUseRef(), false)); // expected-error {{Unused value of must-use type 'MustUse'}} use((producesMayUse(), false)); use((producesMayUsePointer(), false)); use((producesMayUseRef(), false)); switch (1) { case 1: - producesMustUse(); // expected-error {{Unused MOZ_MUST_USE value of type 'MustUse'}} + producesMustUse(); // expected-error {{Unused value of must-use type 'MustUse'}} producesMustUsePointer(); - producesMustUseRef(); // expected-error {{Unused MOZ_MUST_USE value of type 'MustUse'}} + producesMustUseRef(); // expected-error {{Unused value of must-use type 'MustUse'}} producesMayUse(); producesMayUsePointer(); producesMayUseRef(); case 2: - producesMustUse(); // expected-error {{Unused MOZ_MUST_USE value of type 'MustUse'}} + producesMustUse(); // expected-error {{Unused value of must-use type 'MustUse'}} case 3: producesMustUsePointer(); case 4: - producesMustUseRef(); // expected-error {{Unused MOZ_MUST_USE value of type 'MustUse'}} + producesMustUseRef(); // expected-error {{Unused value of must-use type 'MustUse'}} case 5: producesMayUse(); case 6: @@ -132,9 +132,9 @@ void foo() { case 7: producesMayUseRef(); default: - producesMustUse(); // expected-error {{Unused MOZ_MUST_USE value of type 'MustUse'}} + producesMustUse(); // expected-error {{Unused value of must-use type 'MustUse'}} producesMustUsePointer(); - producesMustUseRef(); // expected-error {{Unused MOZ_MUST_USE value of type 'MustUse'}} + producesMustUseRef(); // expected-error {{Unused value of must-use type 'MustUse'}} producesMayUse(); producesMayUsePointer(); producesMayUseRef(); diff --git a/build/clang-plugin/tests/TestNonHeapClass.cpp b/build/clang-plugin/tests/TestNonHeapClass.cpp index cf258ad00093..25538e8b20cf 100644 --- a/build/clang-plugin/tests/TestNonHeapClass.cpp +++ b/build/clang-plugin/tests/TestNonHeapClass.cpp @@ -36,7 +36,7 @@ void misuseNonHeapClass(int len) { NonHeap validStatic; struct RandomClass { - NonHeap nonstaticMember; // expected-note {{'RandomClass' is a non-heap class because member 'nonstaticMember' is a non-heap class 'NonHeap'}} + NonHeap nonstaticMember; // expected-note {{'RandomClass' is a non-heap type because member 'nonstaticMember' is a non-heap type 'NonHeap'}} static NonHeap staticMember; }; struct MOZ_NONHEAP_CLASS RandomNonHeapClass { @@ -44,7 +44,7 @@ struct MOZ_NONHEAP_CLASS RandomNonHeapClass { static NonHeap staticMember; }; -struct BadInherit : NonHeap {}; // expected-note {{'BadInherit' is a non-heap class because it inherits from a non-heap class 'NonHeap'}} +struct BadInherit : NonHeap {}; // expected-note {{'BadInherit' is a non-heap type because it inherits from a non-heap type 'NonHeap'}} struct MOZ_NONHEAP_CLASS GoodInherit : NonHeap {}; void useStuffWrongly() { @@ -52,11 +52,11 @@ void useStuffWrongly() { gobble(new RandomClass); // expected-error {{variable of type 'RandomClass' is not valid on the heap}} } -// Stack class overrides non-heap classes. +// Stack class overrides non-heap typees. struct MOZ_STACK_CLASS StackClass {}; struct MOZ_NONHEAP_CLASS InferredStackClass : GoodInherit { NonHeap nonstaticMember; - StackClass stackClass; // expected-note {{'InferredStackClass' is a stack class because member 'stackClass' is a stack class 'StackClass'}} + StackClass stackClass; // expected-note {{'InferredStackClass' is a stack type because member 'stackClass' is a stack type 'StackClass'}} }; InferredStackClass global; // expected-error {{variable of type 'InferredStackClass' only valid on the stack}} diff --git a/build/clang-plugin/tests/TestStackClass.cpp b/build/clang-plugin/tests/TestStackClass.cpp index 6f01e3843334..cb331176842c 100644 --- a/build/clang-plugin/tests/TestStackClass.cpp +++ b/build/clang-plugin/tests/TestStackClass.cpp @@ -18,7 +18,7 @@ void misuseStackClass(int len) { Stack valid; Stack alsoValid[2]; static Stack notValid; // expected-error {{variable of type 'Stack' only valid on the stack}} - static Stack alsoNotValid[2]; // expected-error {{variable of type 'Stack [2]' only valid on the stack}} + static Stack alsoNotValid[2]; // expected-error {{variable of type 'Stack [2]' only valid on the stack}} expected-note {{'Stack [2]' is a stack type because it is an array of stack type 'Stack'}} gobble(&valid); gobble(¬Valid); @@ -35,7 +35,7 @@ void misuseStackClass(int len) { Stack notValid; // expected-error {{variable of type 'Stack' only valid on the stack}} struct RandomClass { - Stack nonstaticMember; // expected-note {{'RandomClass' is a stack class because member 'nonstaticMember' is a stack class 'Stack'}} + Stack nonstaticMember; // expected-note {{'RandomClass' is a stack type because member 'nonstaticMember' is a stack type 'Stack'}} static Stack staticMember; // expected-error {{variable of type 'Stack' only valid on the stack}} }; struct MOZ_STACK_CLASS RandomStackClass { @@ -43,7 +43,7 @@ struct MOZ_STACK_CLASS RandomStackClass { static Stack staticMember; // expected-error {{variable of type 'Stack' only valid on the stack}} }; -struct BadInherit : Stack {}; // expected-note {{'BadInherit' is a stack class because it inherits from a stack class 'Stack'}} +struct BadInherit : Stack {}; // expected-note {{'BadInherit' is a stack type because it inherits from a stack type 'Stack'}} struct MOZ_STACK_CLASS GoodInherit : Stack {}; BadInherit moreInvalid; // expected-error {{variable of type 'BadInherit' only valid on the stack}} From 91c1e847d662381e9b6b64fe7cd3d0fe26f1b171 Mon Sep 17 00:00:00 2001 From: Michael Layzell Date: Fri, 19 Jun 2015 19:30:51 -0400 Subject: [PATCH 037/136] Bug 1123907 - Part 1: Add an analysis to ensure that a class marked MOZ_NEEDS_NO_VTABLE_TYPE cannot be instantiated by a class with a VTable; r=ehsan --- build/clang-plugin/clang-plugin.cpp | 52 ++++++++++ .../tests/TestNeedsNoVTableType.cpp | 94 +++++++++++++++++++ build/clang-plugin/tests/moz.build | 1 + 3 files changed, 147 insertions(+) create mode 100644 build/clang-plugin/tests/TestNeedsNoVTableType.cpp diff --git a/build/clang-plugin/clang-plugin.cpp b/build/clang-plugin/clang-plugin.cpp index e525834f0e6a..38c0e1428c22 100644 --- a/build/clang-plugin/clang-plugin.cpp +++ b/build/clang-plugin/clang-plugin.cpp @@ -95,6 +95,11 @@ private: virtual void run(const MatchFinder::MatchResult &Result); }; + class NeedsNoVTableTypeChecker : public MatchFinder::MatchCallback { + public: + virtual void run(const MatchFinder::MatchResult &Result); + }; + ScopeChecker stackClassChecker; ScopeChecker globalClassChecker; NonHeapClassChecker nonheapClassChecker; @@ -104,6 +109,7 @@ private: NoAddRefReleaseOnReturnChecker noAddRefReleaseOnReturnChecker; RefCountedInsideLambdaChecker refCountedInsideLambdaChecker; ExplicitOperatorBoolChecker explicitOperatorBoolChecker; + NeedsNoVTableTypeChecker needsNoVTableTypeChecker; MatchFinder astMatcher; }; @@ -487,6 +493,13 @@ bool IsInSystemHeader(const ASTContext &AC, const T &D) { return SourceManager.isInSystemHeader(ExpansionLoc); } +bool typeHasVTable(QualType T) { + while (const ArrayType *arrTy = T->getAsArrayTypeUnsafe()) + T = arrTy->getElementType(); + CXXRecordDecl* offender = T->getAsCXXRecordDecl(); + return offender && offender->hasDefinition() && offender->isDynamicClass(); +} + } namespace clang { @@ -641,6 +654,14 @@ AST_POLYMORPHIC_MATCHER_P(equalsBoundNode, #endif +AST_MATCHER(QualType, hasVTable) { + return typeHasVTable(Node); +} + +AST_MATCHER(CXXRecordDecl, hasNeedsNoVTableTypeAttr) { + return MozChecker::hasCustomAnnotation(&Node, "moz_needs_no_vtable_type"); +} + } } @@ -860,6 +881,11 @@ DiagnosticsMatcher::DiagnosticsMatcher() astMatcher.addMatcher(methodDecl(anyOf(hasName("operator bool"), hasName("operator _Bool"))).bind("node"), &explicitOperatorBoolChecker); + + astMatcher.addMatcher(classTemplateSpecializationDecl( + allOf(hasAnyTemplateArgument(refersToType(hasVTable())), + hasNeedsNoVTableTypeAttr())).bind("node"), + &needsNoVTableTypeChecker); } void DiagnosticsMatcher::ScopeChecker::run( @@ -1042,6 +1068,32 @@ void DiagnosticsMatcher::ExplicitOperatorBoolChecker::run( } } +void DiagnosticsMatcher::NeedsNoVTableTypeChecker::run( + const MatchFinder::MatchResult &Result) { + DiagnosticsEngine &Diag = Result.Context->getDiagnostics(); + unsigned errorID = Diag.getDiagnosticIDs()->getCustomDiagID( + DiagnosticIDs::Error, "%0 cannot be instantiated because %1 has a VTable"); + unsigned noteID = Diag.getDiagnosticIDs()->getCustomDiagID( + DiagnosticIDs::Note, "bad instantiation of %0 requested here"); + + const ClassTemplateSpecializationDecl *specialization = + Result.Nodes.getNodeAs("node"); + + // Get the offending template argument + QualType offender; + const TemplateArgumentList &args = + specialization->getTemplateInstantiationArgs(); + for (unsigned i = 0; i < args.size(); ++i) { + offender = args[i].getAsType(); + if (typeHasVTable(offender)) { + break; + } + } + + Diag.Report(specialization->getLocStart(), errorID) << specialization << offender; + Diag.Report(specialization->getPointOfInstantiation(), noteID) << specialization; +} + class MozCheckAction : public PluginASTAction { public: ASTConsumerPtr CreateASTConsumer(CompilerInstance &CI, StringRef fileName) override { diff --git a/build/clang-plugin/tests/TestNeedsNoVTableType.cpp b/build/clang-plugin/tests/TestNeedsNoVTableType.cpp new file mode 100644 index 000000000000..531a1c82a16f --- /dev/null +++ b/build/clang-plugin/tests/TestNeedsNoVTableType.cpp @@ -0,0 +1,94 @@ +#define MOZ_NEEDS_NO_VTABLE_TYPE __attribute__((annotate("moz_needs_no_vtable_type"))) + +template +struct MOZ_NEEDS_NO_VTABLE_TYPE PickyConsumer { // expected-error {{'PickyConsumer' cannot be instantiated because 'B' has a VTable}} expected-error {{'PickyConsumer' cannot be instantiated because 'E' has a VTable}} expected-error {{'PickyConsumer' cannot be instantiated because 'F' has a VTable}} expected-error {{'PickyConsumer' cannot be instantiated because 'G' has a VTable}} + T *m; +}; + +template +struct MOZ_NEEDS_NO_VTABLE_TYPE PickyConsumer_A { // expected-error {{'PickyConsumer_A' cannot be instantiated because 'B' has a VTable}} expected-error {{'PickyConsumer_A' cannot be instantiated because 'E' has a VTable}} expected-error {{'PickyConsumer_A' cannot be instantiated because 'F' has a VTable}} expected-error {{'PickyConsumer_A' cannot be instantiated because 'G' has a VTable}} + T *m; +}; +template +struct PickyConsumerWrapper { + PickyConsumer_A m; // expected-note {{bad instantiation of 'PickyConsumer_A' requested here}} expected-note {{bad instantiation of 'PickyConsumer_A' requested here}} expected-note {{bad instantiation of 'PickyConsumer_A' requested here}} expected-note {{bad instantiation of 'PickyConsumer_A' requested here}} +}; + +template +struct MOZ_NEEDS_NO_VTABLE_TYPE PickyConsumer_B { // expected-error {{'PickyConsumer_B' cannot be instantiated because 'B' has a VTable}} expected-error {{'PickyConsumer_B' cannot be instantiated because 'E' has a VTable}} expected-error {{'PickyConsumer_B' cannot be instantiated because 'F' has a VTable}} expected-error {{'PickyConsumer_B' cannot be instantiated because 'G' has a VTable}} + T *m; +}; +template +struct PickyConsumerSubclass : PickyConsumer_B {}; // expected-note {{bad instantiation of 'PickyConsumer_B' requested here}} expected-note {{bad instantiation of 'PickyConsumer_B' requested here}} expected-note {{bad instantiation of 'PickyConsumer_B' requested here}} expected-note {{bad instantiation of 'PickyConsumer_B' requested here}} + +template +struct NonPickyConsumer { + T *m; +}; + +struct A {}; +struct B : virtual A {}; +struct C : A {}; +struct D { + void d(); +}; +struct E { + virtual void e(); +}; +struct F : E { + virtual void e() final; +}; +struct G { + virtual void e() = 0; +}; + +void f() { + { + PickyConsumer a1; + PickyConsumerWrapper a2; + PickyConsumerSubclass a3; + NonPickyConsumer a4; + } + + { + PickyConsumer a1; // expected-note {{bad instantiation of 'PickyConsumer' requested here}} + PickyConsumerWrapper a2; + PickyConsumerSubclass a3; + NonPickyConsumer a4; + } + + { + PickyConsumer a1; + PickyConsumerWrapper a2; + PickyConsumerSubclass a3; + NonPickyConsumer a4; + } + + { + PickyConsumer a1; + PickyConsumerWrapper a2; + PickyConsumerSubclass a3; + NonPickyConsumer a4; + } + + { + PickyConsumer a1; // expected-note {{bad instantiation of 'PickyConsumer' requested here}} + PickyConsumerWrapper a2; + PickyConsumerSubclass a3; + NonPickyConsumer a4; + } + + { + PickyConsumer a1; // expected-note {{bad instantiation of 'PickyConsumer' requested here}} + PickyConsumerWrapper a2; + PickyConsumerSubclass a3; + NonPickyConsumer a4; + } + + { + PickyConsumer a1; // expected-note {{bad instantiation of 'PickyConsumer' requested here}} + PickyConsumerWrapper a2; + PickyConsumerSubclass a3; + NonPickyConsumer a4; + } +} diff --git a/build/clang-plugin/tests/moz.build b/build/clang-plugin/tests/moz.build index d2fbe2ad1e94..927138f2171c 100644 --- a/build/clang-plugin/tests/moz.build +++ b/build/clang-plugin/tests/moz.build @@ -14,6 +14,7 @@ SOURCES += [ 'TestMustUse.cpp', 'TestNANTestingExpr.cpp', 'TestNANTestingExprC.c', + 'TestNeedsNoVTableType.cpp', 'TestNoAddRefReleaseOnReturn.cpp', 'TestNoArithmeticExprInArgument.cpp', 'TestNonHeapClass.cpp', From 69cc6fcb31be6cfe6892d796d521cb1a708ffe2e Mon Sep 17 00:00:00 2001 From: Michael Layzell Date: Fri, 19 Jun 2015 19:37:43 -0400 Subject: [PATCH 038/136] Bug 1123907 - Part 2: Add MOZ_NEEDS_NO_VTABLE_TYPE to Attributes.h, and use it to verify the EntryType argument of nsTHashtable; r=ehsan --- mfbt/Attributes.h | 5 +++++ xpcom/glue/nsTHashtable.h | 3 ++- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/mfbt/Attributes.h b/mfbt/Attributes.h index 463b9ba21859..82fe1323d4c3 100644 --- a/mfbt/Attributes.h +++ b/mfbt/Attributes.h @@ -454,6 +454,9 @@ * MOZ_MUST_USE: Applies to type declarations. Makes it a compile time error to not * use the return value of a function which has this type. This is intended to be * used with types which it is an error to not use. + * MOZ_NEEDS_NO_VTABLE_TYPE: Applies to template class declarations. Makes it + * a compile time error to instantiate this template with a type parameter which + * has a VTable. */ #ifdef MOZ_CLANG_PLUGIN # define MOZ_MUST_OVERRIDE __attribute__((annotate("moz_must_override"))) @@ -474,6 +477,7 @@ # define MOZ_UNSAFE_REF(reason) __attribute__((annotate("moz_weak_ref"))) # define MOZ_NO_ADDREF_RELEASE_ON_RETURN __attribute__((annotate("moz_no_addref_release_on_return"))) # define MOZ_MUST_USE __attribute__((annotate("moz_must_use"))) +# define MOZ_NEEDS_NO_VTABLE_TYPE __attribute__((annotate("moz_needs_no_vtable_type"))) /* * It turns out that clang doesn't like void func() __attribute__ {} without a * warning, so use pragmas to disable the warning. This code won't work on GCC @@ -498,6 +502,7 @@ # define MOZ_UNSAFE_REF(reason) /* nothing */ # define MOZ_NO_ADDREF_RELEASE_ON_RETURN /* nothing */ # define MOZ_MUST_USE /* nothing */ +# define MOZ_NEEDS_NO_VTABLE_TYPE /* nothing */ #endif /* MOZ_CLANG_PLUGIN */ #endif /* __cplusplus */ diff --git a/xpcom/glue/nsTHashtable.h b/xpcom/glue/nsTHashtable.h index 943121810102..a89dad83f5a3 100644 --- a/xpcom/glue/nsTHashtable.h +++ b/xpcom/glue/nsTHashtable.h @@ -16,6 +16,7 @@ #include "mozilla/Move.h" #include "mozilla/fallible.h" #include "mozilla/PodOperations.h" +#include "mozilla/Attributes.h" #include @@ -82,7 +83,7 @@ enum PLDHashOperator }; template -class nsTHashtable +class MOZ_NEEDS_NO_VTABLE_TYPE nsTHashtable { typedef mozilla::fallible_t fallible_t; From bf91a08bcc196c8a472e5b5b6c0b5af9f754c8d6 Mon Sep 17 00:00:00 2001 From: Michael Layzell Date: Thu, 18 Jun 2015 17:34:27 -0400 Subject: [PATCH 039/136] Bug 1159433 - Part 1: Add an analysis to ensure that some template arguments cannot be non-memmovable types; r=ehsan --- build/clang-plugin/clang-plugin.cpp | 145 ++++ .../clang-plugin/tests/TestNonMemMovable.cpp | 812 ++++++++++++++++++ build/clang-plugin/tests/moz.build | 1 + 3 files changed, 958 insertions(+) create mode 100644 build/clang-plugin/tests/TestNonMemMovable.cpp diff --git a/build/clang-plugin/clang-plugin.cpp b/build/clang-plugin/clang-plugin.cpp index 38c0e1428c22..d3887496ab62 100644 --- a/build/clang-plugin/clang-plugin.cpp +++ b/build/clang-plugin/clang-plugin.cpp @@ -1,6 +1,7 @@ /* 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/. */ + #include "clang/AST/ASTConsumer.h" #include "clang/AST/ASTContext.h" #include "clang/AST/RecursiveASTVisitor.h" @@ -100,6 +101,11 @@ private: virtual void run(const MatchFinder::MatchResult &Result); }; + class NonMemMovableChecker : public MatchFinder::MatchCallback { + public: + virtual void run(const MatchFinder::MatchResult &Result); + }; + ScopeChecker stackClassChecker; ScopeChecker globalClassChecker; NonHeapClassChecker nonheapClassChecker; @@ -110,6 +116,7 @@ private: RefCountedInsideLambdaChecker refCountedInsideLambdaChecker; ExplicitOperatorBoolChecker explicitOperatorBoolChecker; NeedsNoVTableTypeChecker needsNoVTableTypeChecker; + NonMemMovableChecker nonMemMovableChecker; MatchFinder astMatcher; }; @@ -483,6 +490,87 @@ bool isClassRefCounted(QualType T) { return clazz ? isClassRefCounted(clazz) : false; } +/// A cached data of whether classes are memmovable, and if not, what declaration +/// makes them non-movable +typedef DenseMap InferredMovability; +InferredMovability inferredMovability; + +bool isClassNonMemMovable(QualType T); +const CXXRecordDecl* isClassNonMemMovableWorker(QualType T); + +const CXXRecordDecl* isClassNonMemMovableWorker(const CXXRecordDecl *D) { + // If we have a definition, then we want to standardize our reference to point + // to the definition node. If we don't have a definition, that means that either + // we only have a forward declaration of the type in our file, or we are being + // passed a template argument which is not used, and thus never instantiated by + // clang. + // As the argument isn't used, we can't memmove it (as we don't know it's size), + // which means not reporting an error is OK. + if (!D->hasDefinition()) { + return 0; + } + D = D->getDefinition(); + + // Are we explicitly marked as non-memmovable class? + if (MozChecker::hasCustomAnnotation(D, "moz_non_memmovable")) { + return D; + } + + // Look through all base cases to figure out if the parent is a non-memmovable class. + for (CXXRecordDecl::base_class_const_iterator base = D->bases_begin(); + base != D->bases_end(); ++base) { + const CXXRecordDecl *result = isClassNonMemMovableWorker(base->getType()); + if (result) { + return result; + } + } + + // Look through all members to figure out if a member is a non-memmovable class. + for (RecordDecl::field_iterator field = D->field_begin(), e = D->field_end(); + field != e; ++field) { + const CXXRecordDecl *result = isClassNonMemMovableWorker(field->getType()); + if (result) { + return result; + } + } + + return 0; +} + +const CXXRecordDecl* isClassNonMemMovableWorker(QualType T) { + while (const ArrayType *arrTy = T->getAsArrayTypeUnsafe()) + T = arrTy->getElementType(); + const CXXRecordDecl *clazz = T->getAsCXXRecordDecl(); + return clazz ? isClassNonMemMovableWorker(clazz) : 0; +} + +bool isClassNonMemMovable(const CXXRecordDecl *D) { + InferredMovability::iterator it = + inferredMovability.find(D); + if (it != inferredMovability.end()) + return !!it->second; + const CXXRecordDecl *result = isClassNonMemMovableWorker(D); + inferredMovability.insert(std::make_pair(D, result)); + return !!result; +} + +bool isClassNonMemMovable(QualType T) { + while (const ArrayType *arrTy = T->getAsArrayTypeUnsafe()) + T = arrTy->getElementType(); + const CXXRecordDecl *clazz = T->getAsCXXRecordDecl(); + return clazz ? isClassNonMemMovable(clazz) : false; +} + +const CXXRecordDecl* findWhyClassIsNonMemMovable(QualType T) { + while (const ArrayType *arrTy = T->getAsArrayTypeUnsafe()) + T = arrTy->getElementType(); + CXXRecordDecl *clazz = T->getAsCXXRecordDecl(); + InferredMovability::iterator it = + inferredMovability.find(clazz); + assert(it != inferredMovability.end()); + return it->second; +} + template bool IsInSystemHeader(const ASTContext &AC, const T &D) { auto &SourceManager = AC.getSourceManager(); @@ -662,6 +750,16 @@ AST_MATCHER(CXXRecordDecl, hasNeedsNoVTableTypeAttr) { return MozChecker::hasCustomAnnotation(&Node, "moz_needs_no_vtable_type"); } +/// This matcher will select classes which are non-memmovable +AST_MATCHER(QualType, isNonMemMovable) { + return isClassNonMemMovable(Node); +} + +/// This matcher will select classes which require a memmovable template arg +AST_MATCHER(CXXRecordDecl, needsMemMovable) { + return MozChecker::hasCustomAnnotation(&Node, "moz_needs_memmovable_type"); +} + } } @@ -886,6 +984,13 @@ DiagnosticsMatcher::DiagnosticsMatcher() allOf(hasAnyTemplateArgument(refersToType(hasVTable())), hasNeedsNoVTableTypeAttr())).bind("node"), &needsNoVTableTypeChecker); + + // Handle non-mem-movable template specializations + astMatcher.addMatcher(classTemplateSpecializationDecl( + allOf(needsMemMovable(), + hasAnyTemplateArgument(refersToType(isNonMemMovable()))) + ).bind("specialization"), + &nonMemMovableChecker); } void DiagnosticsMatcher::ScopeChecker::run( @@ -1094,6 +1199,46 @@ void DiagnosticsMatcher::NeedsNoVTableTypeChecker::run( Diag.Report(specialization->getPointOfInstantiation(), noteID) << specialization; } +void DiagnosticsMatcher::NonMemMovableChecker::run( + const MatchFinder::MatchResult &Result) { + DiagnosticsEngine &Diag = Result.Context->getDiagnostics(); + unsigned errorID = Diag.getDiagnosticIDs()->getCustomDiagID( + DiagnosticIDs::Error, "Cannot instantiate %0 with non-memmovable template argument %1"); + unsigned note1ID = Diag.getDiagnosticIDs()->getCustomDiagID( + DiagnosticIDs::Note, "instantiation of %0 requested here"); + unsigned note2ID = Diag.getDiagnosticIDs()->getCustomDiagID( + DiagnosticIDs::Note, "%0 is non-memmovable because of the MOZ_NON_MEMMOVABLE annotation on %1"); + unsigned note3ID = Diag.getDiagnosticIDs()->getCustomDiagID(DiagnosticIDs::Note, "%0"); + + // Get the specialization + const ClassTemplateSpecializationDecl *specialization = + Result.Nodes.getNodeAs("specialization"); + SourceLocation requestLoc = specialization->getPointOfInstantiation(); + const CXXRecordDecl *templ = + specialization->getSpecializedTemplate()->getTemplatedDecl(); + + // Report an error for every template argument which is non-memmovable + const TemplateArgumentList &args = + specialization->getTemplateInstantiationArgs(); + for (unsigned i = 0; i < args.size(); ++i) { + QualType argType = args[i].getAsType(); + if (isClassNonMemMovable(args[i].getAsType())) { + const CXXRecordDecl *reason = findWhyClassIsNonMemMovable(argType); + Diag.Report(specialization->getLocation(), errorID) + << specialization << argType; + // XXX It would be really nice if we could get the instantiation stack information + // from Sema such that we could print a full template instantiation stack, however, + // it seems as though that information is thrown out by the time we get here so we + // can only report one level of template specialization (which in many cases won't + // be useful) + Diag.Report(requestLoc, note1ID) + << specialization; + Diag.Report(reason->getLocation(), note2ID) + << argType << reason; + } + } +} + class MozCheckAction : public PluginASTAction { public: ASTConsumerPtr CreateASTConsumer(CompilerInstance &CI, StringRef fileName) override { diff --git a/build/clang-plugin/tests/TestNonMemMovable.cpp b/build/clang-plugin/tests/TestNonMemMovable.cpp new file mode 100644 index 000000000000..7f36b2e634f6 --- /dev/null +++ b/build/clang-plugin/tests/TestNonMemMovable.cpp @@ -0,0 +1,812 @@ +#define MOZ_NON_MEMMOVABLE __attribute__((annotate("moz_non_memmovable"))) +#define MOZ_NEEDS_MEMMOVABLE_TYPE __attribute__((annotate("moz_needs_memmovable_type"))) + +/* + These are a bunch of structs with variable levels of memmovability. + They will be used as template parameters to the various NeedyTemplates +*/ +struct MOZ_NON_MEMMOVABLE NonMovable {}; // expected-note-re + {{'{{.*}}' is non-memmovable because of the MOZ_NON_MEMMOVABLE annotation on 'NonMovable'}} +struct Movable {}; + +// Subclasses +struct S_NonMovable : NonMovable {}; +struct S_Movable : Movable {}; + +// Members +struct W_NonMovable { + NonMovable m; +}; +struct W_Movable { + Movable m; +}; + +// Wrapped Subclasses +struct WS_NonMovable { + S_NonMovable m; +}; +struct WS_Movable { + S_Movable m; +}; + +// Combinations of the above +struct SW_NonMovable : W_NonMovable {}; +struct SW_Movable : W_Movable {}; + +struct SWS_NonMovable : WS_NonMovable {}; +struct SWS_Movable : WS_Movable {}; + +// Basic templated wrapper +template +struct Template_Inline { + T m; +}; + +template +struct Template_Ref { + T* m; +}; + +template +struct Template_Unused {}; + +template +struct MOZ_NON_MEMMOVABLE Template_NonMovable {}; // expected-note-re + {{'{{.*}}' is non-memmovable because of the MOZ_NON_MEMMOVABLE annotation on 'Template_NonMovable<{{.*}}>'}} + +/* + These tests take the following form: + DECLARATIONS => Declarations of the templates which are either marked with MOZ_NEEDS_MEMMOVABLE_TYPE + or which instantiate a MOZ_NEEDS_MEMMOVABLE_TYPE through some mechanism. + BAD N => Instantiations of the wrapper template with each of the non-memmovable types. + The prefix S_ means subclass, W_ means wrapped. Each of these rows should produce an error + on the NeedyTemplate in question, and a note at the instantiation location of that template. + Unfortunately, on every case more complicated than bad1, the instantiation location is + within another template. Thus, the notes are expected on the template in question which + actually instantiates the MOZ_NEEDS_MEMMOVABLE_TYPE template. + GOOD N => Instantiations of the wrapper template with each of the memmovable types. + This is meant as a sanity check to ensure that we don't reject valid instantiations of + templates. + + + Note 1: Each set uses it's own types to ensure that they don't re-use each-other's template specializations. + If they did, then some of the error messages would not be emitted (as error messages are emitted for template + specializations, rather than for variable declarations) + + Note 2: Every instance of NeedyTemplate contains a member of type T. This is to ensure that T is actually + instantiated (if T is a template) by clang. If T isn't instantiated, then we can't actually tell if it is + NON_MEMMOVABLE. (This is OK in practice, as you cannot memmove a type which you don't know the size of). + + Note 3: There are a set of tests for specializations of NeedyTemplate at the bottom. For each set of tests, + these tests contribute two expected errors to the templates. +*/ + +// +// 1 - Unwrapped MOZ_NEEDS_MEMMOVABLE_TYPE +// + +template +struct MOZ_NEEDS_MEMMOVABLE_TYPE NeedyTemplate1 {T m;}; // expected-error-re 26 {{Cannot instantiate 'NeedyTemplate1<{{.*}}>' with non-memmovable template argument '{{.*}}'}} + +void bad1() { + NeedyTemplate1 a1; // expected-note-re {{instantiation of 'NeedyTemplate1<{{.*}}>' requested here}} + NeedyTemplate1 a2; // expected-note-re {{instantiation of 'NeedyTemplate1<{{.*}}>' requested here}} + NeedyTemplate1 a3; // expected-note-re {{instantiation of 'NeedyTemplate1<{{.*}}>' requested here}} + NeedyTemplate1 a4; // expected-note-re {{instantiation of 'NeedyTemplate1<{{.*}}>' requested here}} + NeedyTemplate1 a5; // expected-note-re {{instantiation of 'NeedyTemplate1<{{.*}}>' requested here}} + NeedyTemplate1 a6; // expected-note-re {{instantiation of 'NeedyTemplate1<{{.*}}>' requested here}} + + NeedyTemplate1 > b1; // expected-note-re {{instantiation of 'NeedyTemplate1<{{.*}}>' requested here}} + NeedyTemplate1 > b2; // expected-note-re {{instantiation of 'NeedyTemplate1<{{.*}}>' requested here}} + NeedyTemplate1 > b3; // expected-note-re {{instantiation of 'NeedyTemplate1<{{.*}}>' requested here}} + NeedyTemplate1 > b4; // expected-note-re {{instantiation of 'NeedyTemplate1<{{.*}}>' requested here}} + NeedyTemplate1 > b5; // expected-note-re {{instantiation of 'NeedyTemplate1<{{.*}}>' requested here}} + NeedyTemplate1 > b6; // expected-note-re {{instantiation of 'NeedyTemplate1<{{.*}}>' requested here}} + + NeedyTemplate1 > c1; // expected-note-re {{instantiation of 'NeedyTemplate1<{{.*}}>' requested here}} + NeedyTemplate1 > c2; // expected-note-re {{instantiation of 'NeedyTemplate1<{{.*}}>' requested here}} + NeedyTemplate1 > c3; // expected-note-re {{instantiation of 'NeedyTemplate1<{{.*}}>' requested here}} + NeedyTemplate1 > c4; // expected-note-re {{instantiation of 'NeedyTemplate1<{{.*}}>' requested here}} + NeedyTemplate1 > c5; // expected-note-re {{instantiation of 'NeedyTemplate1<{{.*}}>' requested here}} + NeedyTemplate1 > c6; // expected-note-re {{instantiation of 'NeedyTemplate1<{{.*}}>' requested here}} + NeedyTemplate1 > c7; // expected-note-re {{instantiation of 'NeedyTemplate1<{{.*}}>' requested here}} + NeedyTemplate1 > c8; // expected-note-re {{instantiation of 'NeedyTemplate1<{{.*}}>' requested here}} + NeedyTemplate1 > c9; // expected-note-re {{instantiation of 'NeedyTemplate1<{{.*}}>' requested here}} + NeedyTemplate1 > c10; // expected-note-re {{instantiation of 'NeedyTemplate1<{{.*}}>' requested here}} + NeedyTemplate1 > c11; // expected-note-re {{instantiation of 'NeedyTemplate1<{{.*}}>' requested here}} + NeedyTemplate1 > c12; // expected-note-re {{instantiation of 'NeedyTemplate1<{{.*}}>' requested here}} +} + +void good1() { + NeedyTemplate1 a1; + NeedyTemplate1 a2; + NeedyTemplate1 a3; + NeedyTemplate1 a4; + NeedyTemplate1 a5; + NeedyTemplate1 a6; + + NeedyTemplate1 > b1; + NeedyTemplate1 > b2; + NeedyTemplate1 > b3; + NeedyTemplate1 > b4; + NeedyTemplate1 > b5; + NeedyTemplate1 > b6; + + NeedyTemplate1 > c1; + NeedyTemplate1 > c2; + NeedyTemplate1 > c3; + NeedyTemplate1 > c4; + NeedyTemplate1 > c5; + NeedyTemplate1 > c6; + NeedyTemplate1 > c7; + NeedyTemplate1 > c8; + NeedyTemplate1 > c9; + NeedyTemplate1 > c10; + NeedyTemplate1 > c11; + NeedyTemplate1 > c12; + + NeedyTemplate1 > d1; + NeedyTemplate1 > d2; + NeedyTemplate1 > d3; + NeedyTemplate1 > d4; + NeedyTemplate1 > d5; + NeedyTemplate1 > d6; + NeedyTemplate1 > d7; + NeedyTemplate1 > d8; + NeedyTemplate1 > d9; + NeedyTemplate1 > d10; + NeedyTemplate1 > d11; + NeedyTemplate1 > d12; +} + +// +// 2 - Subclassed MOZ_NEEDS_MEMMOVABLE_TYPE +// + +template +struct MOZ_NEEDS_MEMMOVABLE_TYPE NeedyTemplate2 {T m;}; // expected-error-re 26 {{Cannot instantiate 'NeedyTemplate2<{{.*}}>' with non-memmovable template argument '{{.*}}'}} +template +struct S_NeedyTemplate2 : NeedyTemplate2 {}; // expected-note-re 26 {{instantiation of 'NeedyTemplate2<{{.*}}>' requested here}} + +void bad2() { + S_NeedyTemplate2 a1; + S_NeedyTemplate2 a2; + S_NeedyTemplate2 a3; + S_NeedyTemplate2 a4; + S_NeedyTemplate2 a5; + S_NeedyTemplate2 a6; + + S_NeedyTemplate2 > b1; + S_NeedyTemplate2 > b2; + S_NeedyTemplate2 > b3; + S_NeedyTemplate2 > b4; + S_NeedyTemplate2 > b5; + S_NeedyTemplate2 > b6; + + S_NeedyTemplate2 > c1; + S_NeedyTemplate2 > c2; + S_NeedyTemplate2 > c3; + S_NeedyTemplate2 > c4; + S_NeedyTemplate2 > c5; + S_NeedyTemplate2 > c6; + S_NeedyTemplate2 > c7; + S_NeedyTemplate2 > c8; + S_NeedyTemplate2 > c9; + S_NeedyTemplate2 > c10; + S_NeedyTemplate2 > c11; + S_NeedyTemplate2 > c12; +} + +void good2() { + S_NeedyTemplate2 a1; + S_NeedyTemplate2 a2; + S_NeedyTemplate2 a3; + S_NeedyTemplate2 a4; + S_NeedyTemplate2 a5; + S_NeedyTemplate2 a6; + + S_NeedyTemplate2 > b1; + S_NeedyTemplate2 > b2; + S_NeedyTemplate2 > b3; + S_NeedyTemplate2 > b4; + S_NeedyTemplate2 > b5; + S_NeedyTemplate2 > b6; + + S_NeedyTemplate2 > c1; + S_NeedyTemplate2 > c2; + S_NeedyTemplate2 > c3; + S_NeedyTemplate2 > c4; + S_NeedyTemplate2 > c5; + S_NeedyTemplate2 > c6; + S_NeedyTemplate2 > c7; + S_NeedyTemplate2 > c8; + S_NeedyTemplate2 > c9; + S_NeedyTemplate2 > c10; + S_NeedyTemplate2 > c11; + S_NeedyTemplate2 > c12; + + S_NeedyTemplate2 > d1; + S_NeedyTemplate2 > d2; + S_NeedyTemplate2 > d3; + S_NeedyTemplate2 > d4; + S_NeedyTemplate2 > d5; + S_NeedyTemplate2 > d6; + S_NeedyTemplate2 > d7; + S_NeedyTemplate2 > d8; + S_NeedyTemplate2 > d9; + S_NeedyTemplate2 > d10; + S_NeedyTemplate2 > d11; + S_NeedyTemplate2 > d12; +} + +// +// 3 - Wrapped MOZ_NEEDS_MEMMOVABLE_TYPE +// + +template +struct MOZ_NEEDS_MEMMOVABLE_TYPE NeedyTemplate3 {T m;}; // expected-error-re 26 {{Cannot instantiate 'NeedyTemplate3<{{.*}}>' with non-memmovable template argument '{{.*}}'}} +template +struct W_NeedyTemplate3 { + NeedyTemplate3 m; // expected-note-re 26 {{instantiation of 'NeedyTemplate3<{{.*}}>' requested here}} +}; +void bad3() { + W_NeedyTemplate3 a1; + W_NeedyTemplate3 a2; + W_NeedyTemplate3 a3; + W_NeedyTemplate3 a4; + W_NeedyTemplate3 a5; + W_NeedyTemplate3 a6; + + W_NeedyTemplate3 > b1; + W_NeedyTemplate3 > b2; + W_NeedyTemplate3 > b3; + W_NeedyTemplate3 > b4; + W_NeedyTemplate3 > b5; + W_NeedyTemplate3 > b6; + + W_NeedyTemplate3 > c1; + W_NeedyTemplate3 > c2; + W_NeedyTemplate3 > c3; + W_NeedyTemplate3 > c4; + W_NeedyTemplate3 > c5; + W_NeedyTemplate3 > c6; + W_NeedyTemplate3 > c7; + W_NeedyTemplate3 > c8; + W_NeedyTemplate3 > c9; + W_NeedyTemplate3 > c10; + W_NeedyTemplate3 > c11; + W_NeedyTemplate3 > c12; +} + +void good3() { + W_NeedyTemplate3 a1; + W_NeedyTemplate3 a2; + W_NeedyTemplate3 a3; + W_NeedyTemplate3 a4; + W_NeedyTemplate3 a5; + W_NeedyTemplate3 a6; + + W_NeedyTemplate3 > b1; + W_NeedyTemplate3 > b2; + W_NeedyTemplate3 > b3; + W_NeedyTemplate3 > b4; + W_NeedyTemplate3 > b5; + W_NeedyTemplate3 > b6; + + W_NeedyTemplate3 > c1; + W_NeedyTemplate3 > c2; + W_NeedyTemplate3 > c3; + W_NeedyTemplate3 > c4; + W_NeedyTemplate3 > c5; + W_NeedyTemplate3 > c6; + W_NeedyTemplate3 > c7; + W_NeedyTemplate3 > c8; + W_NeedyTemplate3 > c9; + W_NeedyTemplate3 > c10; + W_NeedyTemplate3 > c11; + W_NeedyTemplate3 > c12; + + W_NeedyTemplate3 > d1; + W_NeedyTemplate3 > d2; + W_NeedyTemplate3 > d3; + W_NeedyTemplate3 > d4; + W_NeedyTemplate3 > d5; + W_NeedyTemplate3 > d6; + W_NeedyTemplate3 > d7; + W_NeedyTemplate3 > d8; + W_NeedyTemplate3 > d9; + W_NeedyTemplate3 > d10; + W_NeedyTemplate3 > d11; + W_NeedyTemplate3 > d12; +} + +// +// 4 - Wrapped Subclassed MOZ_NEEDS_MEMMOVABLE_TYPE +// + +template +struct MOZ_NEEDS_MEMMOVABLE_TYPE NeedyTemplate4 {T m;}; // expected-error-re 26 {{Cannot instantiate 'NeedyTemplate4<{{.*}}>' with non-memmovable template argument '{{.*}}'}} +template +struct S_NeedyTemplate4 : NeedyTemplate4 {}; // expected-note-re 26 {{instantiation of 'NeedyTemplate4<{{.*}}>' requested here}} +template +struct WS_NeedyTemplate4 { + S_NeedyTemplate4 m; +}; +void bad4() { + WS_NeedyTemplate4 a1; + WS_NeedyTemplate4 a2; + WS_NeedyTemplate4 a3; + WS_NeedyTemplate4 a4; + WS_NeedyTemplate4 a5; + WS_NeedyTemplate4 a6; + + WS_NeedyTemplate4 > b1; + WS_NeedyTemplate4 > b2; + WS_NeedyTemplate4 > b3; + WS_NeedyTemplate4 > b4; + WS_NeedyTemplate4 > b5; + WS_NeedyTemplate4 > b6; + + WS_NeedyTemplate4 > c1; + WS_NeedyTemplate4 > c2; + WS_NeedyTemplate4 > c3; + WS_NeedyTemplate4 > c4; + WS_NeedyTemplate4 > c5; + WS_NeedyTemplate4 > c6; + WS_NeedyTemplate4 > c7; + WS_NeedyTemplate4 > c8; + WS_NeedyTemplate4 > c9; + WS_NeedyTemplate4 > c10; + WS_NeedyTemplate4 > c11; + WS_NeedyTemplate4 > c12; +} + +void good4() { + WS_NeedyTemplate4 a1; + WS_NeedyTemplate4 a2; + WS_NeedyTemplate4 a3; + WS_NeedyTemplate4 a4; + WS_NeedyTemplate4 a5; + WS_NeedyTemplate4 a6; + + WS_NeedyTemplate4 > b1; + WS_NeedyTemplate4 > b2; + WS_NeedyTemplate4 > b3; + WS_NeedyTemplate4 > b4; + WS_NeedyTemplate4 > b5; + WS_NeedyTemplate4 > b6; + + WS_NeedyTemplate4 > c1; + WS_NeedyTemplate4 > c2; + WS_NeedyTemplate4 > c3; + WS_NeedyTemplate4 > c4; + WS_NeedyTemplate4 > c5; + WS_NeedyTemplate4 > c6; + WS_NeedyTemplate4 > c7; + WS_NeedyTemplate4 > c8; + WS_NeedyTemplate4 > c9; + WS_NeedyTemplate4 > c10; + WS_NeedyTemplate4 > c11; + WS_NeedyTemplate4 > c12; + + WS_NeedyTemplate4 > d1; + WS_NeedyTemplate4 > d2; + WS_NeedyTemplate4 > d3; + WS_NeedyTemplate4 > d4; + WS_NeedyTemplate4 > d5; + WS_NeedyTemplate4 > d6; + WS_NeedyTemplate4 > d7; + WS_NeedyTemplate4 > d8; + WS_NeedyTemplate4 > d9; + WS_NeedyTemplate4 > d10; + WS_NeedyTemplate4 > d11; + WS_NeedyTemplate4 > d12; +} + +// +// 5 - Subclassed Wrapped MOZ_NEEDS_MEMMOVABLE_TYPE +// + +template +struct MOZ_NEEDS_MEMMOVABLE_TYPE NeedyTemplate5 {T m;}; // expected-error-re 26 {{Cannot instantiate 'NeedyTemplate5<{{.*}}>' with non-memmovable template argument '{{.*}}'}} +template +struct W_NeedyTemplate5 { + NeedyTemplate5 m; // expected-note-re 26 {{instantiation of 'NeedyTemplate5<{{.*}}>' requested here}} +}; +template +struct SW_NeedyTemplate5 : W_NeedyTemplate5 {}; +void bad5() { + SW_NeedyTemplate5 a1; + SW_NeedyTemplate5 a2; + SW_NeedyTemplate5 a3; + SW_NeedyTemplate5 a4; + SW_NeedyTemplate5 a5; + SW_NeedyTemplate5 a6; + + SW_NeedyTemplate5 > b1; + SW_NeedyTemplate5 > b2; + SW_NeedyTemplate5 > b3; + SW_NeedyTemplate5 > b4; + SW_NeedyTemplate5 > b5; + SW_NeedyTemplate5 > b6; + + SW_NeedyTemplate5 > c1; + SW_NeedyTemplate5 > c2; + SW_NeedyTemplate5 > c3; + SW_NeedyTemplate5 > c4; + SW_NeedyTemplate5 > c5; + SW_NeedyTemplate5 > c6; + SW_NeedyTemplate5 > c7; + SW_NeedyTemplate5 > c8; + SW_NeedyTemplate5 > c9; + SW_NeedyTemplate5 > c10; + SW_NeedyTemplate5 > c11; + SW_NeedyTemplate5 > c12; +} + +void good5() { + SW_NeedyTemplate5 a1; + SW_NeedyTemplate5 a2; + SW_NeedyTemplate5 a3; + SW_NeedyTemplate5 a4; + SW_NeedyTemplate5 a5; + SW_NeedyTemplate5 a6; + + SW_NeedyTemplate5 > b1; + SW_NeedyTemplate5 > b2; + SW_NeedyTemplate5 > b3; + SW_NeedyTemplate5 > b4; + SW_NeedyTemplate5 > b5; + SW_NeedyTemplate5 > b6; + + SW_NeedyTemplate5 > c1; + SW_NeedyTemplate5 > c2; + SW_NeedyTemplate5 > c3; + SW_NeedyTemplate5 > c4; + SW_NeedyTemplate5 > c5; + SW_NeedyTemplate5 > c6; + SW_NeedyTemplate5 > c7; + SW_NeedyTemplate5 > c8; + SW_NeedyTemplate5 > c9; + SW_NeedyTemplate5 > c10; + SW_NeedyTemplate5 > c11; + SW_NeedyTemplate5 > c12; + + SW_NeedyTemplate5 > d1; + SW_NeedyTemplate5 > d2; + SW_NeedyTemplate5 > d3; + SW_NeedyTemplate5 > d4; + SW_NeedyTemplate5 > d5; + SW_NeedyTemplate5 > d6; + SW_NeedyTemplate5 > d7; + SW_NeedyTemplate5 > d8; + SW_NeedyTemplate5 > d9; + SW_NeedyTemplate5 > d10; + SW_NeedyTemplate5 > d11; + SW_NeedyTemplate5 > d12; +} + +// +// 6 - MOZ_NEEDS_MEMMOVABLE_TYPE instantiated with default template argument +// +// Note: This has an extra error, because it also includes a test with the default template argument. +// + +template +struct MOZ_NEEDS_MEMMOVABLE_TYPE NeedyTemplate6 {T m;}; // expected-error-re 27 {{Cannot instantiate 'NeedyTemplate6<{{.*}}>' with non-memmovable template argument '{{.*}}'}} +template +struct W_NeedyTemplate6 { + NeedyTemplate6 m; // expected-note-re 27 {{instantiation of 'NeedyTemplate6<{{.*}}>' requested here}} +}; +template +struct SW_NeedyTemplate6 : W_NeedyTemplate6 {}; +// We create a different NonMovable type here, as NeedyTemplate6 will already be instantiated with NonMovable +struct MOZ_NON_MEMMOVABLE NonMovable2 {}; // expected-note {{'NonMovable2' is non-memmovable because of the MOZ_NON_MEMMOVABLE annotation on 'NonMovable2'}} +template +struct Defaulted_SW_NeedyTemplate6 { + SW_NeedyTemplate6 m; +}; +void bad6() { + Defaulted_SW_NeedyTemplate6 a1; + Defaulted_SW_NeedyTemplate6 a2; + Defaulted_SW_NeedyTemplate6 a3; + Defaulted_SW_NeedyTemplate6 a4; + Defaulted_SW_NeedyTemplate6 a5; + Defaulted_SW_NeedyTemplate6 a6; + + Defaulted_SW_NeedyTemplate6 > b1; + Defaulted_SW_NeedyTemplate6 > b2; + Defaulted_SW_NeedyTemplate6 > b3; + Defaulted_SW_NeedyTemplate6 > b4; + Defaulted_SW_NeedyTemplate6 > b5; + Defaulted_SW_NeedyTemplate6 > b6; + + Defaulted_SW_NeedyTemplate6 > c1; + Defaulted_SW_NeedyTemplate6 > c2; + Defaulted_SW_NeedyTemplate6 > c3; + Defaulted_SW_NeedyTemplate6 > c4; + Defaulted_SW_NeedyTemplate6 > c5; + Defaulted_SW_NeedyTemplate6 > c6; + Defaulted_SW_NeedyTemplate6 > c7; + Defaulted_SW_NeedyTemplate6 > c8; + Defaulted_SW_NeedyTemplate6 > c9; + Defaulted_SW_NeedyTemplate6 > c10; + Defaulted_SW_NeedyTemplate6 > c11; + Defaulted_SW_NeedyTemplate6 > c12; + + Defaulted_SW_NeedyTemplate6<> c13; +} + +void good6() { + Defaulted_SW_NeedyTemplate6 a1; + Defaulted_SW_NeedyTemplate6 a2; + Defaulted_SW_NeedyTemplate6 a3; + Defaulted_SW_NeedyTemplate6 a4; + Defaulted_SW_NeedyTemplate6 a5; + Defaulted_SW_NeedyTemplate6 a6; + + Defaulted_SW_NeedyTemplate6 > b1; + Defaulted_SW_NeedyTemplate6 > b2; + Defaulted_SW_NeedyTemplate6 > b3; + Defaulted_SW_NeedyTemplate6 > b4; + Defaulted_SW_NeedyTemplate6 > b5; + Defaulted_SW_NeedyTemplate6 > b6; + + Defaulted_SW_NeedyTemplate6 > c1; + Defaulted_SW_NeedyTemplate6 > c2; + Defaulted_SW_NeedyTemplate6 > c3; + Defaulted_SW_NeedyTemplate6 > c4; + Defaulted_SW_NeedyTemplate6 > c5; + Defaulted_SW_NeedyTemplate6 > c6; + Defaulted_SW_NeedyTemplate6 > c7; + Defaulted_SW_NeedyTemplate6 > c8; + Defaulted_SW_NeedyTemplate6 > c9; + Defaulted_SW_NeedyTemplate6 > c10; + Defaulted_SW_NeedyTemplate6 > c11; + Defaulted_SW_NeedyTemplate6 > c12; + + Defaulted_SW_NeedyTemplate6 > d1; + Defaulted_SW_NeedyTemplate6 > d2; + Defaulted_SW_NeedyTemplate6 > d3; + Defaulted_SW_NeedyTemplate6 > d4; + Defaulted_SW_NeedyTemplate6 > d5; + Defaulted_SW_NeedyTemplate6 > d6; + Defaulted_SW_NeedyTemplate6 > d7; + Defaulted_SW_NeedyTemplate6 > d8; + Defaulted_SW_NeedyTemplate6 > d9; + Defaulted_SW_NeedyTemplate6 > d10; + Defaulted_SW_NeedyTemplate6 > d11; + Defaulted_SW_NeedyTemplate6 > d12; +} + +// +// 7 - MOZ_NEEDS_MEMMOVABLE_TYPE instantiated as default template argument +// + +template +struct MOZ_NEEDS_MEMMOVABLE_TYPE NeedyTemplate7 {T m;}; // expected-error-re 26 {{Cannot instantiate 'NeedyTemplate7<{{.*}}>' with non-memmovable template argument '{{.*}}'}} +template > +struct Defaulted_Templated_NeedyTemplate7 {Q m;}; // expected-note-re 26 {{instantiation of 'NeedyTemplate7<{{.*}}>' requested here}} +void bad7() { + Defaulted_Templated_NeedyTemplate7 a1; + Defaulted_Templated_NeedyTemplate7 a2; + Defaulted_Templated_NeedyTemplate7 a3; + Defaulted_Templated_NeedyTemplate7 a4; + Defaulted_Templated_NeedyTemplate7 a5; + Defaulted_Templated_NeedyTemplate7 a6; + + Defaulted_Templated_NeedyTemplate7 > b1; + Defaulted_Templated_NeedyTemplate7 > b2; + Defaulted_Templated_NeedyTemplate7 > b3; + Defaulted_Templated_NeedyTemplate7 > b4; + Defaulted_Templated_NeedyTemplate7 > b5; + Defaulted_Templated_NeedyTemplate7 > b6; + + Defaulted_Templated_NeedyTemplate7 > c1; + Defaulted_Templated_NeedyTemplate7 > c2; + Defaulted_Templated_NeedyTemplate7 > c3; + Defaulted_Templated_NeedyTemplate7 > c4; + Defaulted_Templated_NeedyTemplate7 > c5; + Defaulted_Templated_NeedyTemplate7 > c6; + Defaulted_Templated_NeedyTemplate7 > c7; + Defaulted_Templated_NeedyTemplate7 > c8; + Defaulted_Templated_NeedyTemplate7 > c9; + Defaulted_Templated_NeedyTemplate7 > c10; + Defaulted_Templated_NeedyTemplate7 > c11; + Defaulted_Templated_NeedyTemplate7 > c12; +} + +void good7() { + Defaulted_Templated_NeedyTemplate7 a1; + Defaulted_Templated_NeedyTemplate7 a2; + Defaulted_Templated_NeedyTemplate7 a3; + Defaulted_Templated_NeedyTemplate7 a4; + Defaulted_Templated_NeedyTemplate7 a5; + Defaulted_Templated_NeedyTemplate7 a6; + + Defaulted_Templated_NeedyTemplate7 > b1; + Defaulted_Templated_NeedyTemplate7 > b2; + Defaulted_Templated_NeedyTemplate7 > b3; + Defaulted_Templated_NeedyTemplate7 > b4; + Defaulted_Templated_NeedyTemplate7 > b5; + Defaulted_Templated_NeedyTemplate7 > b6; + + Defaulted_Templated_NeedyTemplate7 > c1; + Defaulted_Templated_NeedyTemplate7 > c2; + Defaulted_Templated_NeedyTemplate7 > c3; + Defaulted_Templated_NeedyTemplate7 > c4; + Defaulted_Templated_NeedyTemplate7 > c5; + Defaulted_Templated_NeedyTemplate7 > c6; + Defaulted_Templated_NeedyTemplate7 > c7; + Defaulted_Templated_NeedyTemplate7 > c8; + Defaulted_Templated_NeedyTemplate7 > c9; + Defaulted_Templated_NeedyTemplate7 > c10; + Defaulted_Templated_NeedyTemplate7 > c11; + Defaulted_Templated_NeedyTemplate7 > c12; + + Defaulted_Templated_NeedyTemplate7 > d1; + Defaulted_Templated_NeedyTemplate7 > d2; + Defaulted_Templated_NeedyTemplate7 > d3; + Defaulted_Templated_NeedyTemplate7 > d4; + Defaulted_Templated_NeedyTemplate7 > d5; + Defaulted_Templated_NeedyTemplate7 > d6; + Defaulted_Templated_NeedyTemplate7 > d7; + Defaulted_Templated_NeedyTemplate7 > d8; + Defaulted_Templated_NeedyTemplate7 > d9; + Defaulted_Templated_NeedyTemplate7 > d10; + Defaulted_Templated_NeedyTemplate7 > d11; + Defaulted_Templated_NeedyTemplate7 > d12; +} + +// +// 8 - Wrapped MOZ_NEEDS_MEMMOVABLE_TYPE instantiated as default template argument +// + +template +struct MOZ_NEEDS_MEMMOVABLE_TYPE NeedyTemplate8 {T m;}; // expected-error-re 26 {{Cannot instantiate 'NeedyTemplate8<{{.*}}>' with non-memmovable template argument '{{.*}}'}} +template > +struct Defaulted_Templated_NeedyTemplate8 {Q m;}; // expected-note-re 26 {{instantiation of 'NeedyTemplate8<{{.*}}>' requested here}} +template +struct W_Defaulted_Templated_NeedyTemplate8 { + Defaulted_Templated_NeedyTemplate8 m; +}; +void bad8() { + W_Defaulted_Templated_NeedyTemplate8 a1; + W_Defaulted_Templated_NeedyTemplate8 a2; + W_Defaulted_Templated_NeedyTemplate8 a3; + W_Defaulted_Templated_NeedyTemplate8 a4; + W_Defaulted_Templated_NeedyTemplate8 a5; + W_Defaulted_Templated_NeedyTemplate8 a6; + + W_Defaulted_Templated_NeedyTemplate8 > b1; + W_Defaulted_Templated_NeedyTemplate8 > b2; + W_Defaulted_Templated_NeedyTemplate8 > b3; + W_Defaulted_Templated_NeedyTemplate8 > b4; + W_Defaulted_Templated_NeedyTemplate8 > b5; + W_Defaulted_Templated_NeedyTemplate8 > b6; + + W_Defaulted_Templated_NeedyTemplate8 > c1; + W_Defaulted_Templated_NeedyTemplate8 > c2; + W_Defaulted_Templated_NeedyTemplate8 > c3; + W_Defaulted_Templated_NeedyTemplate8 > c4; + W_Defaulted_Templated_NeedyTemplate8 > c5; + W_Defaulted_Templated_NeedyTemplate8 > c6; + W_Defaulted_Templated_NeedyTemplate8 > c7; + W_Defaulted_Templated_NeedyTemplate8 > c8; + W_Defaulted_Templated_NeedyTemplate8 > c9; + W_Defaulted_Templated_NeedyTemplate8 > c10; + W_Defaulted_Templated_NeedyTemplate8 > c11; + W_Defaulted_Templated_NeedyTemplate8 > c12; +} + +void good8() { + W_Defaulted_Templated_NeedyTemplate8 a1; + W_Defaulted_Templated_NeedyTemplate8 a2; + W_Defaulted_Templated_NeedyTemplate8 a3; + W_Defaulted_Templated_NeedyTemplate8 a4; + W_Defaulted_Templated_NeedyTemplate8 a5; + W_Defaulted_Templated_NeedyTemplate8 a6; + + W_Defaulted_Templated_NeedyTemplate8 > b1; + W_Defaulted_Templated_NeedyTemplate8 > b2; + W_Defaulted_Templated_NeedyTemplate8 > b3; + W_Defaulted_Templated_NeedyTemplate8 > b4; + W_Defaulted_Templated_NeedyTemplate8 > b5; + W_Defaulted_Templated_NeedyTemplate8 > b6; + + W_Defaulted_Templated_NeedyTemplate8 > c1; + W_Defaulted_Templated_NeedyTemplate8 > c2; + W_Defaulted_Templated_NeedyTemplate8 > c3; + W_Defaulted_Templated_NeedyTemplate8 > c4; + W_Defaulted_Templated_NeedyTemplate8 > c5; + W_Defaulted_Templated_NeedyTemplate8 > c6; + W_Defaulted_Templated_NeedyTemplate8 > c7; + W_Defaulted_Templated_NeedyTemplate8 > c8; + W_Defaulted_Templated_NeedyTemplate8 > c9; + W_Defaulted_Templated_NeedyTemplate8 > c10; + W_Defaulted_Templated_NeedyTemplate8 > c11; + W_Defaulted_Templated_NeedyTemplate8 > c12; + + W_Defaulted_Templated_NeedyTemplate8 > d1; + W_Defaulted_Templated_NeedyTemplate8 > d2; + W_Defaulted_Templated_NeedyTemplate8 > d3; + W_Defaulted_Templated_NeedyTemplate8 > d4; + W_Defaulted_Templated_NeedyTemplate8 > d5; + W_Defaulted_Templated_NeedyTemplate8 > d6; + W_Defaulted_Templated_NeedyTemplate8 > d7; + W_Defaulted_Templated_NeedyTemplate8 > d8; + W_Defaulted_Templated_NeedyTemplate8 > d9; + W_Defaulted_Templated_NeedyTemplate8 > d10; + W_Defaulted_Templated_NeedyTemplate8 > d11; + W_Defaulted_Templated_NeedyTemplate8 > d12; +} + +/* + SpecializedNonMovable is a non-movable class which has an explicit specialization of NeedyTemplate + for it. Instantiations of NeedyTemplateN should be legal as the explicit + specialization isn't annotated with MOZ_NEEDS_MEMMOVABLE_TYPE. + + However, as it is MOZ_NON_MEMMOVABLE, derived classes and members shouldn't be able to be used to + instantiate NeedyTemplate. +*/ + +struct MOZ_NON_MEMMOVABLE SpecializedNonMovable {}; // expected-note 8 {{'S_SpecializedNonMovable' is non-memmovable because of the MOZ_NON_MEMMOVABLE annotation on 'SpecializedNonMovable'}} expected-note 8 {{'Template_Inline' is non-memmovable because of the MOZ_NON_MEMMOVABLE annotation on 'SpecializedNonMovable'}} +struct S_SpecializedNonMovable : SpecializedNonMovable {}; + +// Specialize all of the NeedyTemplates with SpecializedNonMovable. +template <> +struct NeedyTemplate1 {}; +template <> +struct NeedyTemplate2 {}; +template <> +struct NeedyTemplate3 {}; +template <> +struct NeedyTemplate4 {}; +template <> +struct NeedyTemplate5 {}; +template <> +struct NeedyTemplate6 {}; +template <> +struct NeedyTemplate7 {}; +template <> +struct NeedyTemplate8 {}; + +void specialization() { + /* + SpecializedNonMovable has a specialization for every variant of NeedyTemplate, + so these templates are valid, even though SpecializedNonMovable isn't + memmovable + */ + NeedyTemplate1 a1; + S_NeedyTemplate2 a2; + W_NeedyTemplate3 a3; + WS_NeedyTemplate4 a4; + SW_NeedyTemplate5 a5; + Defaulted_SW_NeedyTemplate6 a6; + Defaulted_Templated_NeedyTemplate7 a7; + W_Defaulted_Templated_NeedyTemplate8 a8; + + /* + These entries contain an element which is SpecializedNonMovable, and are non-movable + as there is no valid specialization, and their member is non-memmovable + */ + NeedyTemplate1 > b1; // expected-note {{instantiation of 'NeedyTemplate1 >' requested here}} + S_NeedyTemplate2 > b2; + W_NeedyTemplate3 > b3; + WS_NeedyTemplate4 > b4; + SW_NeedyTemplate5 > b5; + Defaulted_SW_NeedyTemplate6 > b6; + Defaulted_Templated_NeedyTemplate7 > b7; + W_Defaulted_Templated_NeedyTemplate8 > b8; + + /* + The subclass of SpecializedNonMovable, is also non-memmovable, + as there is no valid specialization. + */ + NeedyTemplate1 c1; // expected-note {{instantiation of 'NeedyTemplate1' requested here}} + S_NeedyTemplate2 c2; + W_NeedyTemplate3 c3; + WS_NeedyTemplate4 c4; + SW_NeedyTemplate5 c5; + Defaulted_SW_NeedyTemplate6 c6; + Defaulted_Templated_NeedyTemplate7 c7; + W_Defaulted_Templated_NeedyTemplate8 c8; +} diff --git a/build/clang-plugin/tests/moz.build b/build/clang-plugin/tests/moz.build index 927138f2171c..044ed31fc82d 100644 --- a/build/clang-plugin/tests/moz.build +++ b/build/clang-plugin/tests/moz.build @@ -18,6 +18,7 @@ SOURCES += [ 'TestNoAddRefReleaseOnReturn.cpp', 'TestNoArithmeticExprInArgument.cpp', 'TestNonHeapClass.cpp', + 'TestNonMemMovable.cpp', 'TestNoRefcountedInsideLambdas.cpp', 'TestStackClass.cpp', 'TestTrivialCtorDtor.cpp', From 20eee585a6171f30c46e3404caf337614526de43 Mon Sep 17 00:00:00 2001 From: Ehsan Akhgari Date: Thu, 18 Jun 2015 17:37:22 -0400 Subject: [PATCH 040/136] Bug 1159433 - Part 2: Add the MOZ_NON_MEMMOVABLE and MOZ_NEEDS_MEMMOVABLE_TYPE macros to MFBT; r=froydnj --- mfbt/Attributes.h | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/mfbt/Attributes.h b/mfbt/Attributes.h index 82fe1323d4c3..6052d64d3236 100644 --- a/mfbt/Attributes.h +++ b/mfbt/Attributes.h @@ -457,6 +457,12 @@ * MOZ_NEEDS_NO_VTABLE_TYPE: Applies to template class declarations. Makes it * a compile time error to instantiate this template with a type parameter which * has a VTable. + * MOZ_NON_MEMMOVABLE: Applies to class declarations for types that are not safe + * to be moved in memory using memmove(). + * MOZ_NEEDS_MEMMOVABLE_TYPE: Applies to template class declarations where the + * template arguments are required to be safe to move in memory using + * memmove(). Passing MOZ_NON_MEMMOVABLE types to these templates is a + * compile time error. */ #ifdef MOZ_CLANG_PLUGIN # define MOZ_MUST_OVERRIDE __attribute__((annotate("moz_must_override"))) @@ -478,6 +484,8 @@ # define MOZ_NO_ADDREF_RELEASE_ON_RETURN __attribute__((annotate("moz_no_addref_release_on_return"))) # define MOZ_MUST_USE __attribute__((annotate("moz_must_use"))) # define MOZ_NEEDS_NO_VTABLE_TYPE __attribute__((annotate("moz_needs_no_vtable_type"))) +# define MOZ_NON_MEMMOVABLE __attribute__((annotate("moz_non_memmovable"))) +# define MOZ_NEEDS_MEMMOVABLE_TYPE __attribute__((annotate("moz_needs_memmovable_type"))) /* * It turns out that clang doesn't like void func() __attribute__ {} without a * warning, so use pragmas to disable the warning. This code won't work on GCC @@ -503,6 +511,8 @@ # define MOZ_NO_ADDREF_RELEASE_ON_RETURN /* nothing */ # define MOZ_MUST_USE /* nothing */ # define MOZ_NEEDS_NO_VTABLE_TYPE /* nothing */ +# define MOZ_NON_MEMMOVABLE /* nothing */ +# define MOZ_NEEDS_MEMMOVABLE_TYPE /* nothing */ #endif /* MOZ_CLANG_PLUGIN */ #endif /* __cplusplus */ From 66a04cf80f5f514dab565504f845d0af5275887e Mon Sep 17 00:00:00 2001 From: Michael Layzell Date: Thu, 18 Jun 2015 17:46:46 -0400 Subject: [PATCH 041/136] Bug 1159433 - Part 3: Make nsTArray_CopyChooser only accept memmovable argument types by default; r=froydnj --- xpcom/glue/nsTArray.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/xpcom/glue/nsTArray.h b/xpcom/glue/nsTArray.h index 14a27a7ea96e..093d25b53718 100644 --- a/xpcom/glue/nsTArray.h +++ b/xpcom/glue/nsTArray.h @@ -10,6 +10,7 @@ #include "nsTArrayForwardDeclare.h" #include "mozilla/Alignment.h" #include "mozilla/Assertions.h" +#include "mozilla/Attributes.h" #include "mozilla/BinarySearch.h" #include "mozilla/fallible.h" #include "mozilla/MathAlgorithms.h" @@ -660,7 +661,7 @@ struct nsTArray_CopyWithConstructors // The default behaviour is to use memcpy/memmove for everything. // template -struct nsTArray_CopyChooser +struct MOZ_NEEDS_MEMMOVABLE_TYPE nsTArray_CopyChooser { typedef nsTArray_CopyWithMemutils Type; }; From 660f381a2f4fff7a89cd9dddbc5f813f252aae9b Mon Sep 17 00:00:00 2001 From: Michael Layzell Date: Thu, 18 Jun 2015 17:47:55 -0400 Subject: [PATCH 042/136] Bug 1159433 - Part 4: Mark nsTAutoString_CharT and nsAutoArrayBase as non-memmovable; r=froydnj --- xpcom/glue/nsTArray.h | 2 +- xpcom/string/nsTString.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/xpcom/glue/nsTArray.h b/xpcom/glue/nsTArray.h index 093d25b53718..2809ad0c1329 100644 --- a/xpcom/glue/nsTArray.h +++ b/xpcom/glue/nsTArray.h @@ -2188,7 +2188,7 @@ public: // You shouldn't use this class directly. // template -class nsAutoArrayBase : public TArrayBase +class MOZ_NON_MEMMOVABLE nsAutoArrayBase : public TArrayBase { static_assert(N != 0, "nsAutoArrayBase should be specialized"); public: diff --git a/xpcom/string/nsTString.h b/xpcom/string/nsTString.h index 757fda7689da..93f39d20ccbe 100644 --- a/xpcom/string/nsTString.h +++ b/xpcom/string/nsTString.h @@ -560,7 +560,7 @@ protected: * nsAutoString for wide characters * nsAutoCString for narrow characters */ -class nsTAutoString_CharT : public nsTFixedString_CharT +class MOZ_NON_MEMMOVABLE nsTAutoString_CharT : public nsTFixedString_CharT { public: From d274fe0384739ebd2260e65cb8327cda7f9d534b Mon Sep 17 00:00:00 2001 From: James Graham Date: Mon, 20 Jul 2015 10:39:03 +0100 Subject: [PATCH 043/136] Bug 1185453 - Generate error summary files for failures, r=chmanchester --HG-- extra : commitid : FDbFkQpnFZB extra : rebase_source : 190e2269243938823f8ea05f94306b09a6ff668a extra : source : df2c4d64382042e7a5f16c28835552239d29e65d --- .../mozharness/android_arm_4_3_config.py | 94 +++++++++---- .../config/mozharness/android_arm_config.py | 127 +++++++++++++----- .../config/mozharness/android_panda_config.py | 4 +- .../config/mozharness/android_x86_config.py | 62 ++++++--- .../config/mozharness/b2g_desktop_config.py | 1 + .../config/mozharness/b2g_emulator_config.py | 5 +- testing/config/mozharness/linux_config.py | 4 + testing/config/mozharness/mac_config.py | 2 + testing/config/mozharness/marionette.py | 7 +- .../mozharness/taskcluster_linux_config.py | 29 ++-- testing/config/mozharness/windows_config.py | 2 + testing/mozharness/mozharness.json | 2 +- .../scripts/android_emulator_unittest.py | 4 + testing/mozharness/scripts/android_panda.py | 3 + .../scripts/androidx86_emulator_unittest.py | 3 + .../scripts/b2g_desktop_unittest.py | 3 + .../scripts/b2g_emulator_unittest.py | 3 + .../mozharness/scripts/desktop_unittest.py | 4 + .../mozharness/scripts/luciddream_unittest.py | 1 + testing/mozharness/scripts/marionette.py | 3 + 20 files changed, 266 insertions(+), 97 deletions(-) diff --git a/testing/config/mozharness/android_arm_4_3_config.py b/testing/config/mozharness/android_arm_4_3_config.py index a2d20c657ab4..ba34d3b28d13 100644 --- a/testing/config/mozharness/android_arm_4_3_config.py +++ b/testing/config/mozharness/android_arm_4_3_config.py @@ -7,21 +7,39 @@ config = { "mochitest": { "run_filename": "runtestsremote.py", "testsdir": "mochitest", - "options": ["--dm_trans=adb", "--app=%(app)s", "--remote-webserver=%(remote_webserver)s", - "--xre-path=%(xre_path)s", "--utility-path=%(utility_path)s", - "--http-port=%(http_port)s", "--ssl-port=%(ssl_port)s", - "--certificate-path=%(certs_path)s", "--symbols-path=%(symbols_path)s", - "--quiet", "--log-raw=%(raw_log_file)s", "--screenshot-on-fail", + "options": [ + "--dm_trans=adb", + "--app=%(app)s", + "--remote-webserver=%(remote_webserver)s", + "--xre-path=%(xre_path)s", + "--utility-path=%(utility_path)s", + "--http-port=%(http_port)s", + "--ssl-port=%(ssl_port)s", + "--certificate-path=%(certs_path)s", + "--symbols-path=%(symbols_path)s", + "--quiet", + "--log-raw=%(raw_log_file)s", + "--log-errorsummary=%(error_summary_file)s", + "--screenshot-on-fail", ], }, "mochitest-gl": { "run_filename": "runtestsremote.py", "testsdir": "mochitest", - "options": ["--dm_trans=adb", "--app=%(app)s", "--remote-webserver=%(remote_webserver)s", - "--xre-path=%(xre_path)s", "--utility-path=%(utility_path)s", - "--http-port=%(http_port)s", "--ssl-port=%(ssl_port)s", - "--certificate-path=%(certs_path)s", "--symbols-path=%(symbols_path)s", - "--quiet", "--log-raw=%(raw_log_file)s", "--screenshot-on-fail", + "options": [ + "--dm_trans=adb", + "--app=%(app)s", + "--remote-webserver=%(remote_webserver)s", + "--xre-path=%(xre_path)s", + "--utility-path=%(utility_path)s", + "--http-port=%(http_port)s", + "--ssl-port=%(ssl_port)s", + "--certificate-path=%(certs_path)s", + "--symbols-path=%(symbols_path)s", + "--quiet", + "--log-raw=%(raw_log_file)s", + "--log-errorsummary=%(error_summary_file)s", + "--screenshot-on-fail", "--total-chunks=4", "--subsuite=webgl", ], @@ -29,11 +47,19 @@ config = { "robocop": { "run_filename": "runrobocop.py", "testsdir": "mochitest", - "options": ["--dm_trans=adb", "--app=%(app)s", "--remote-webserver=%(remote_webserver)s", - "--xre-path=%(xre_path)s", "--utility-path=%(utility_path)s", - "--http-port=%(http_port)s", "--ssl-port=%(ssl_port)s", - "--certificate-path=%(certs_path)s", "--symbols-path=%(symbols_path)s", - "--quiet", "--log-raw=%(raw_log_file)s", + "options": [ + "--dm_trans=adb", + "--app=%(app)s", + "--remote-webserver=%(remote_webserver)s", + "--xre-path=%(xre_path)s", + "--utility-path=%(utility_path)s", + "--http-port=%(http_port)s", + "--ssl-port=%(ssl_port)s", + "--certificate-path=%(certs_path)s", + "--symbols-path=%(symbols_path)s", + "--quiet", + "--log-raw=%(raw_log_file)s", + "--log-errorsummary=%(error_summary_file)s", "--total-chunks=4", "--robocop-apk=../../robocop.apk", "--robocop-ini=robocop.ini", @@ -42,12 +68,17 @@ config = { "reftest": { "run_filename": "remotereftest.py", "testsdir": "reftest", - "options": [ "--app=%(app)s", "--ignore-window-size", + "options": [ + "--app=%(app)s", + "--ignore-window-size", "--dm_trans=adb", "--bootstrap", - "--remote-webserver=%(remote_webserver)s", "--xre-path=%(xre_path)s", - "--utility-path=%(utility_path)s", "--http-port=%(http_port)s", - "--ssl-port=%(ssl_port)s", "--httpd-path", "%(modules_dir)s", + "--remote-webserver=%(remote_webserver)s", + "--xre-path=%(xre_path)s", + "--utility-path=%(utility_path)s", + "--http-port=%(http_port)s", + "--ssl-port=%(ssl_port)s", + "--httpd-path", "%(modules_dir)s", "--symbols-path=%(symbols_path)s", "--total-chunks=16", "tests/layout/reftests/reftest.list", @@ -56,12 +87,18 @@ config = { "crashtest": { "run_filename": "remotereftest.py", "testsdir": "reftest", - "options": [ "--app=%(app)s", "--ignore-window-size", + "options": [ + "--app=%(app)s", + "--ignore-window-size", "--dm_trans=adb", "--bootstrap", - "--remote-webserver=%(remote_webserver)s", "--xre-path=%(xre_path)s", - "--utility-path=%(utility_path)s", "--http-port=%(http_port)s", - "--ssl-port=%(ssl_port)s", "--httpd-path", "%(modules_dir)s", + "--remote-webserver=%(remote_webserver)s", + "--xre-path=%(xre_path)s", + "--utility-path=%(utility_path)s", + "--http-port=%(http_port)s", + "--ssl-port=%(ssl_port)s", + "--httpd-path", + "%(modules_dir)s", "--symbols-path=%(symbols_path)s", "--total-chunks=2", "tests/testing/crashtest/crashtests.list", @@ -70,7 +107,9 @@ config = { "jsreftest": { "run_filename": "remotereftest.py", "testsdir": "reftest", - "options": [ "--app=%(app)s", "--ignore-window-size", + "options": [ + "--app=%(app)s", + "--ignore-window-size", "--dm_trans=adb", "--bootstrap", "--remote-webserver=%(remote_webserver)s", "--xre-path=%(xre_path)s", @@ -87,11 +126,14 @@ config = { "testsdir": "xpcshell", "options": [ "--dm_trans=adb", - "--xre-path=%(xre_path)s", "--testing-modules-dir=%(modules_dir)s", - "--apk=%(installer_path)s", "--no-logfiles", + "--xre-path=%(xre_path)s", + "--testing-modules-dir=%(modules_dir)s", + "--apk=%(installer_path)s", + "--no-logfiles", "--symbols-path=%(symbols_path)s", "--manifest=tests/xpcshell.ini", "--log-raw=%(raw_log_file)s", + "--log-errorsummary=%(error_summary_file)s", "--total-chunks=3", ], }, diff --git a/testing/config/mozharness/android_arm_config.py b/testing/config/mozharness/android_arm_config.py index a86b4ab2f21f..46dadef7ca9c 100644 --- a/testing/config/mozharness/android_arm_config.py +++ b/testing/config/mozharness/android_arm_config.py @@ -7,23 +7,43 @@ config = { "mochitest": { "run_filename": "runtestsremote.py", "testsdir": "mochitest", - "options": ["--dm_trans=sut", "--app=%(app)s", "--remote-webserver=%(remote_webserver)s", - "--xre-path=%(xre_path)s", "--utility-path=%(utility_path)s", - "--deviceIP=%(device_ip)s", "--devicePort=%(device_port)s", - "--http-port=%(http_port)s", "--ssl-port=%(ssl_port)s", - "--certificate-path=%(certs_path)s", "--symbols-path=%(symbols_path)s", - "--quiet", "--log-raw=%(raw_log_file)s", "--screenshot-on-fail", + "options": [ + "--dm_trans=sut", + "--app=%(app)s", + "--remote-webserver=%(remote_webserver)s", + "--xre-path=%(xre_path)s", + "--utility-path=%(utility_path)s", + "--deviceIP=%(device_ip)s", + "--devicePort=%(device_port)s", + "--http-port=%(http_port)s", + "--ssl-port=%(ssl_port)s", + "--certificate-path=%(certs_path)s", + "--symbols-path=%(symbols_path)s", + "--quiet", + "--log-raw=%(raw_log_file)s", + "--log-errorsummary=%(error_summary_file)s", + "--screenshot-on-fail", ], }, "mochitest-gl": { "run_filename": "runtestsremote.py", "testsdir": "mochitest", - "options": ["--dm_trans=sut", "--app=%(app)s", "--remote-webserver=%(remote_webserver)s", - "--xre-path=%(xre_path)s", "--utility-path=%(utility_path)s", - "--deviceIP=%(device_ip)s", "--devicePort=%(device_port)s", - "--http-port=%(http_port)s", "--ssl-port=%(ssl_port)s", - "--certificate-path=%(certs_path)s", "--symbols-path=%(symbols_path)s", - "--quiet", "--log-raw=%(raw_log_file)s", "--screenshot-on-fail", + "options": [ + "--dm_trans=sut", + "--app=%(app)s", + "--remote-webserver=%(remote_webserver)s", + "--xre-path=%(xre_path)s", + "--utility-path=%(utility_path)s", + "--deviceIP=%(device_ip)s", + "--devicePort=%(device_port)s", + "--http-port=%(http_port)s", + "--ssl-port=%(ssl_port)s", + "--certificate-path=%(certs_path)s", + "--symbols-path=%(symbols_path)s", + "--quiet", + "--log-raw=%(raw_log_file)s", + "--log-errorsummary=%(error_summary_file)s", + "--screenshot-on-fail", "--total-chunks=4", "--subsuite=webgl", ], @@ -31,12 +51,21 @@ config = { "robocop": { "run_filename": "runrobocop.py", "testsdir": "mochitest", - "options": ["--dm_trans=sut", "--app=%(app)s", "--remote-webserver=%(remote_webserver)s", - "--xre-path=%(xre_path)s", "--utility-path=%(utility_path)s", - "--deviceIP=%(device_ip)s", "--devicePort=%(device_port)s", - "--http-port=%(http_port)s", "--ssl-port=%(ssl_port)s", - "--certificate-path=%(certs_path)s", "--symbols-path=%(symbols_path)s", - "--quiet", "--log-raw=%(raw_log_file)s", + "options": [ + "--dm_trans=sut", + "--app=%(app)s", + "--remote-webserver=%(remote_webserver)s", + "--xre-path=%(xre_path)s", + "--utility-path=%(utility_path)s", + "--deviceIP=%(device_ip)s", + "--devicePort=%(device_port)s", + "--http-port=%(http_port)s", + "--ssl-port=%(ssl_port)s", + "--certificate-path=%(certs_path)s", + "--symbols-path=%(symbols_path)s", + "--quiet", + "--log-raw=%(raw_log_file)s", + "--log-errorsummary=%(error_summary_file)s", "--total-chunks=4", "--robocop-apk=../../robocop.apk", "--robocop-ini=robocop.ini", @@ -45,12 +74,19 @@ config = { "reftest": { "run_filename": "remotereftest.py", "testsdir": "reftest", - "options": [ "--app=%(app)s", "--ignore-window-size", + "options": [ + "--app=%(app)s", + "--ignore-window-size", "--bootstrap", - "--remote-webserver=%(remote_webserver)s", "--xre-path=%(xre_path)s", - "--utility-path=%(utility_path)s", "--deviceIP=%(device_ip)s", - "--devicePort=%(device_port)s", "--http-port=%(http_port)s", - "--ssl-port=%(ssl_port)s", "--httpd-path", "%(modules_dir)s", + "--remote-webserver=%(remote_webserver)s", + "--xre-path=%(xre_path)s", + "--utility-path=%(utility_path)s", + "--deviceIP=%(device_ip)s", + "--devicePort=%(device_port)s", + "--http-port=%(http_port)s", + "--ssl-port=%(ssl_port)s", + "--httpd-path", + "%(modules_dir)s", "--symbols-path=%(symbols_path)s", "--total-chunks=16", "tests/layout/reftests/reftest.list", @@ -59,12 +95,19 @@ config = { "crashtest": { "run_filename": "remotereftest.py", "testsdir": "reftest", - "options": [ "--app=%(app)s", "--ignore-window-size", + "options": [ + "--app=%(app)s", + "--ignore-window-size", "--bootstrap", - "--remote-webserver=%(remote_webserver)s", "--xre-path=%(xre_path)s", - "--utility-path=%(utility_path)s", "--deviceIP=%(device_ip)s", - "--devicePort=%(device_port)s", "--http-port=%(http_port)s", - "--ssl-port=%(ssl_port)s", "--httpd-path", "%(modules_dir)s", + "--remote-webserver=%(remote_webserver)s", + "--xre-path=%(xre_path)s", + "--utility-path=%(utility_path)s", + "--deviceIP=%(device_ip)s", + "--devicePort=%(device_port)s", + "--http-port=%(http_port)s", + "--ssl-port=%(ssl_port)s", + "--httpd-path", + "%(modules_dir)s", "--symbols-path=%(symbols_path)s", "--total-chunks=2", "tests/testing/crashtest/crashtests.list", @@ -73,12 +116,19 @@ config = { "jsreftest": { "run_filename": "remotereftest.py", "testsdir": "reftest", - "options": [ "--app=%(app)s", "--ignore-window-size", + "options": [ + "--app=%(app)s", + "--ignore-window-size", "--bootstrap", - "--remote-webserver=%(remote_webserver)s", "--xre-path=%(xre_path)s", - "--utility-path=%(utility_path)s", "--deviceIP=%(device_ip)s", - "--devicePort=%(device_port)s", "--http-port=%(http_port)s", - "--ssl-port=%(ssl_port)s", "--httpd-path", "%(modules_dir)s", + "--remote-webserver=%(remote_webserver)s", + "--xre-path=%(xre_path)s", + "--utility-path=%(utility_path)s", + "--deviceIP=%(device_ip)s", + "--devicePort=%(device_port)s", + "--http-port=%(http_port)s", + "--ssl-port=%(ssl_port)s", + "--httpd-path", + "%(modules_dir)s", "--symbols-path=%(symbols_path)s", "../jsreftest/tests/jstests.list", "--total-chunks=6", @@ -88,12 +138,17 @@ config = { "xpcshell": { "run_filename": "remotexpcshelltests.py", "testsdir": "xpcshell", - "options": ["--deviceIP=%(device_ip)s", "--devicePort=%(device_port)s", - "--xre-path=%(xre_path)s", "--testing-modules-dir=%(modules_dir)s", - "--apk=%(installer_path)s", "--no-logfiles", + "options": [ + "--deviceIP=%(device_ip)s", + "--devicePort=%(device_port)s", + "--xre-path=%(xre_path)s", + "--testing-modules-dir=%(modules_dir)s", + "--apk=%(installer_path)s", + "--no-logfiles", "--symbols-path=%(symbols_path)s", "--manifest=tests/xpcshell.ini", "--log-raw=%(raw_log_file)s", + "--log-errorsummary=%(error_summary_file)s", "--total-chunks=3", ], }, diff --git a/testing/config/mozharness/android_panda_config.py b/testing/config/mozharness/android_panda_config.py index f86fdc36f3ba..32afd6bf9051 100644 --- a/testing/config/mozharness/android_panda_config.py +++ b/testing/config/mozharness/android_panda_config.py @@ -80,6 +80,7 @@ config = { "--symbols-path=%(symbols_path)s", "--quiet", "--log-raw=%(raw_log_file)s", + "--log-errorsummary=%(error_summary_file)s", "--screenshot-on-fail", ], "run_filename": "runtestsremote.py", @@ -129,7 +130,8 @@ config = { "--apk=../%(apk_name)s", "--no-logfiles", "--symbols-path=%(symbols_path)s", - "--log-raw=%(raw_log_file)s" + "--log-raw=%(raw_log_file)s", + "--log-errorsummary=%(error_summary_file)s", ], "run_filename": "remotexpcshelltests.py", "testsdir": "xpcshell" diff --git a/testing/config/mozharness/android_x86_config.py b/testing/config/mozharness/android_x86_config.py index 1a4c64012948..7ef1caccbc72 100644 --- a/testing/config/mozharness/android_x86_config.py +++ b/testing/config/mozharness/android_x86_config.py @@ -6,34 +6,52 @@ config = { "suite_definitions": { "mochitest": { "run_filename": "runtestsremote.py", - "options": ["--dm_trans=sut", "--app=%(app)s", "--remote-webserver=%(remote_webserver)s", - "--xre-path=%(xre_path)s", "--utility-path=%(utility_path)s", - "--deviceIP=%(device_ip)s", "--devicePort=%(device_port)s", - "--http-port=%(http_port)s", "--ssl-port=%(ssl_port)s", - "--certificate-path=%(certs_path)s", "--symbols-path=%(symbols_path)s", - "--quiet", "--log-raw=%(raw_log_file)s", "--screenshot-on-fail", - ], + "options": ["--dm_trans=sut", + "--app=%(app)s", + "--remote-webserver=%(remote_webserver)s", + "--xre-path=%(xre_path)s", + "--utility-path=%(utility_path)s", + "--deviceIP=%(device_ip)s", + "--devicePort=%(device_port)s", + "--http-port=%(http_port)s", + "--ssl-port=%(ssl_port)s", + "--certificate-path=%(certs_path)s", + "--symbols-path=%(symbols_path)s", + "--quiet", + "--log-raw=%(raw_log_file)s", + "--log-errorsummary=%(error_summary_file)s", + "--screenshot-on-fail", + ], }, "reftest": { "run_filename": "remotereftest.py", - "options": [ "--app=%(app)s", "--ignore-window-size", - "--bootstrap", - "--remote-webserver=%(remote_webserver)s", "--xre-path=%(xre_path)s", - "--utility-path=%(utility_path)s", "--deviceIP=%(device_ip)s", - "--devicePort=%(device_port)s", "--http-port=%(http_port)s", - "--ssl-port=%(ssl_port)s", "--httpd-path", "%(modules_dir)s", - "--symbols-path=%(symbols_path)s", - ], + "options": ["--app=%(app)s", + "--ignore-window-size", + "--bootstrap", + "--remote-webserver=%(remote_webserver)s", + "--xre-path=%(xre_path)s", + "--utility-path=%(utility_path)s", + "--deviceIP=%(device_ip)s", + "--devicePort=%(device_port)s", + "--http-port=%(http_port)s", + "--ssl-port=%(ssl_port)s", + "--httpd-path", "%(modules_dir)s", + "--symbols-path=%(symbols_path)s", + ], }, "xpcshell": { "run_filename": "remotexpcshelltests.py", - "options": ["--deviceIP=%(device_ip)s", "--devicePort=%(device_port)s", - "--xre-path=%(xre_path)s", "--testing-modules-dir=%(modules_dir)s", - "--apk=%(installer_path)s", "--no-logfiles", - "--symbols-path=%(symbols_path)s", - "--manifest=tests/xpcshell.ini", - "--log-raw=%(raw_log_file)s", - ], + "options": ["--deviceIP=%(device_ip)s", + "--devicePort=%(device_port)s", + "--xre-path=%(xre_path)s", + "--testing-modules-dir=%(modules_dir)s", + "--apk=%(installer_path)s", + "--no-logfiles", + "--symbols-path=%(symbols_path)s", + "--manifest=tests/xpcshell.ini", + "--log-raw=%(raw_log_file)s", + "--log-errorsummary=%(error_summary_file)s", + ], }, }, # end suite_definitions } diff --git a/testing/config/mozharness/b2g_desktop_config.py b/testing/config/mozharness/b2g_desktop_config.py index 755095f0854e..3b5545593d3f 100644 --- a/testing/config/mozharness/b2g_desktop_config.py +++ b/testing/config/mozharness/b2g_desktop_config.py @@ -17,6 +17,7 @@ config = { "--browser-arg=%(browser_arg)s", "--quiet", "--log-raw=%(raw_log_file)s", + "--log-errorsummary=%(error_summary_file)s", "--screenshot-on-fail", ], "run_filename": "runtestsb2g.py", diff --git a/testing/config/mozharness/b2g_emulator_config.py b/testing/config/mozharness/b2g_emulator_config.py index 41af93c17f09..a3ec67493d4b 100644 --- a/testing/config/mozharness/b2g_emulator_config.py +++ b/testing/config/mozharness/b2g_emulator_config.py @@ -71,6 +71,7 @@ config = { "--this-chunk=%(this_chunk)s", "--quiet", "--log-raw=%(raw_log_file)s", + "--log-errorsummary=%(error_summary_file)s", "--certificate-path=%(certificate_path)s", "--screenshot-on-fail", "%(test_path)s" @@ -93,6 +94,7 @@ config = { "--quiet", "--chrome", "--log-raw=%(raw_log_file)s", + "--log-errorsummary=%(error_summary_file)s", "--certificate-path=%(certificate_path)s", "--screenshot-on-fail", "%(test_path)s" @@ -133,7 +135,8 @@ config = { "--busybox=%(busybox)s", "--total-chunks=%(total_chunks)s", "--this-chunk=%(this_chunk)s", - "--log-raw=%(raw_log_file)s" + "--log-raw=%(raw_log_file)s", + "--log-errorsummary=%(error_summary_file)s", ], "run_filename": "runtestsb2g.py", "testsdir": "xpcshell" diff --git a/testing/config/mozharness/linux_config.py b/testing/config/mozharness/linux_config.py index 702eb9b5e221..6ae9180be913 100644 --- a/testing/config/mozharness/linux_config.py +++ b/testing/config/mozharness/linux_config.py @@ -27,6 +27,7 @@ config = { "options": [ "--startup-timeout=300", "--log-raw=%(raw_log_file)s", + "--log-errorsummary=%(error_summary_file)s", "--browser-path=%(browser_path)s", "--b2gpath=%(emulator_path)s", "%(test_manifest)s" @@ -36,6 +37,7 @@ config = { "options": [ "--startup-timeout=300", "--log-raw=%(raw_log_file)s", + "--log-errorsummary=%(error_summary_file)s", "--browser-path=%(browser_path)s", "--b2g-desktop-path=%(fxos_desktop_path)s", "--gaia-profile=%(gaia_profile)s", @@ -52,6 +54,7 @@ config = { "--setpref=webgl.force-enabled=true", "--quiet", "--log-raw=%(raw_log_file)s", + "--log-errorsummary=%(error_summary_file)s", "--use-test-media-devices", "--screenshot-on-fail", ], @@ -103,6 +106,7 @@ config = { "--symbols-path=%(symbols_path)s", "--test-plugin-path=%(test_plugin_path)s", "--log-raw=%(raw_log_file)s", + "--log-errorsummary=%(error_summary_file)s", "--utility-path=tests/bin", ], "run_filename": "runxpcshelltests.py", diff --git a/testing/config/mozharness/mac_config.py b/testing/config/mozharness/mac_config.py index 8e938fbb5d5f..9783bcb0084e 100644 --- a/testing/config/mozharness/mac_config.py +++ b/testing/config/mozharness/mac_config.py @@ -32,6 +32,7 @@ config = { "--certificate-path=tests/certs", "--quiet", "--log-raw=%(raw_log_file)s", + "--log-errorsummary=%(error_summary_file)s", "--screenshot-on-fail", ], "run_filename": "runtests.py", @@ -83,6 +84,7 @@ config = { "--symbols-path=%(symbols_path)s", "--test-plugin-path=%(test_plugin_path)s", "--log-raw=%(raw_log_file)s", + "--log-errorsummary=%(error_summary_file)s", "--utility-path=tests/bin", ], "run_filename": "runxpcshelltests.py", diff --git a/testing/config/mozharness/marionette.py b/testing/config/mozharness/marionette.py index f662171cf250..90d6eb56be73 100644 --- a/testing/config/mozharness/marionette.py +++ b/testing/config/mozharness/marionette.py @@ -16,6 +16,7 @@ config = { "--xml-output=%(xml_output)s", "--html-output=%(html_output)s", "--log-raw=%(raw_log_file)s", + "--log-errorsummary=%(error_summary_file)s", "--binary=%(binary)s", "--address=%(address)s", "--total-chunks=%(total_chunks)s", @@ -35,6 +36,7 @@ config = { "--xml-output=%(xml_output)s", "--html-output=%(html_output)s", "--log-raw=%(raw_log_file)s", + "--log-errorsummary=%(error_summary_file)s", "--logcat-dir=%(logcat_dir)s", "--emulator=%(emulator)s", "--homedir=%(homedir)s" @@ -46,6 +48,7 @@ config = { "options": [ "--type=%(type)s", "--log-raw=%(raw_log_file)s", + "--log-errorsummary=%(error_summary_file)s", "--binary=%(binary)s", "--address=%(address)s", "--symbols-path=%(symbols_path)s" @@ -57,6 +60,7 @@ config = { "options": [ "--type=%(type)s", "--log-raw=%(raw_log_file)s", + "--log-errorsummary=%(error_summary_file)s", "--logcat-dir=%(logcat_dir)s", "--emulator=%(emulator)s", "--homedir=%(homedir)s", @@ -74,6 +78,7 @@ config = { "options": [ "--type=%(type)s", "--log-raw=%(raw_log_file)s", + "--log-errorsummary=%(error_summary_file)s", "--symbols-path=%(symbols_path)s", "--logcat-dir=%(logcat_dir)s", "--emulator=%(emulator)s", @@ -83,4 +88,4 @@ config = { "testsdir": "" } } -} \ No newline at end of file +} diff --git a/testing/config/mozharness/taskcluster_linux_config.py b/testing/config/mozharness/taskcluster_linux_config.py index e55f525361a2..bb15eb02d681 100644 --- a/testing/config/mozharness/taskcluster_linux_config.py +++ b/testing/config/mozharness/taskcluster_linux_config.py @@ -4,20 +4,31 @@ config = { "reftest_options": [ - "--appname=%(binary_path)s", "--utility-path=tests/bin", - "--extra-profile-file=tests/bin/plugins", "--symbols-path=%(symbols_path)s" + "--appname=%(binary_path)s", + "--utility-path=tests/bin", + "--extra-profile-file=tests/bin/plugins", + "--symbols-path=%(symbols_path)s" ], "mochitest_options": [ - "--appname=%(binary_path)s", "--utility-path=tests/bin", - "--extra-profile-file=tests/bin/plugins", "--symbols-path=%(symbols_path)s", - "--certificate-path=tests/certs", "--setpref=webgl.force-enabled=true", - "--quiet", "--log-raw=%(raw_log_file)s", "--screenshot-on-fail", + "--appname=%(binary_path)s", + "--utility-path=tests/bin", + "--extra-profile-file=tests/bin/plugins", + "--symbols-path=%(symbols_path)s", + "--certificate-path=tests/certs", + "--setpref=webgl.force-enabled=true", + "--quiet", + "--log-raw=%(raw_log_file)s", + "--log-errorsummary=%(error_summary_file)s", + "--screenshot-on-fail", ], "webapprt_options": [ - "--app=%(app_path)s", "--utility-path=tests/bin", - "--extra-profile-file=tests/bin/plugins", "--symbols-path=%(symbols_path)s", + "--app=%(app_path)s", + "--utility-path=tests/bin", + "--extra-profile-file=tests/bin/plugins", + "--symbols-path=%(symbols_path)s", "--certificate-path=tests/certs", - "--console-level=INFO", "--testing-modules-dir=tests/modules", + "--console-level=INFO", + "--testing-modules-dir=tests/modules", "--quiet" ], "xpcshell_options": [ diff --git a/testing/config/mozharness/windows_config.py b/testing/config/mozharness/windows_config.py index 5b7219b19f37..18ee58258ba0 100644 --- a/testing/config/mozharness/windows_config.py +++ b/testing/config/mozharness/windows_config.py @@ -32,6 +32,7 @@ config = { "--certificate-path=tests/certs", "--quiet", "--log-raw=%(raw_log_file)s", + "--log-errorsummary=%(error_summary_file)s", "--screenshot-on-fail", ], "run_filename": "runtests.py", @@ -82,6 +83,7 @@ config = { "--symbols-path=%(symbols_path)s", "--test-plugin-path=%(test_plugin_path)s", "--log-raw=%(raw_log_file)s", + "--log-errorsummary=%(error_summary_file)s", "--utility-path=tests/bin", ], "run_filename": "runxpcshelltests.py", diff --git a/testing/mozharness/mozharness.json b/testing/mozharness/mozharness.json index a3f867f3e1bd..ab8b5fde28a1 100644 --- a/testing/mozharness/mozharness.json +++ b/testing/mozharness/mozharness.json @@ -1,4 +1,4 @@ { "repo": "https://hg.mozilla.org/build/mozharness", - "revision": "565f7f26ec17" + "revision": "8978f498da2b" } diff --git a/testing/mozharness/scripts/android_emulator_unittest.py b/testing/mozharness/scripts/android_emulator_unittest.py index e908163da8ab..bae5d101bc9f 100644 --- a/testing/mozharness/scripts/android_emulator_unittest.py +++ b/testing/mozharness/scripts/android_emulator_unittest.py @@ -453,6 +453,9 @@ class AndroidEmulatorTest(BlobUploadMixin, TestingMixin, EmulatorMixin, VCSMixin raw_log_file = os.path.join(dirs['abs_blob_upload_dir'], '%s_raw.log' % self.test_suite) + + error_summary_file = os.path.join(dirs['abs_blob_upload_dir'], + '%s_errorsummary.log' % self.test_suite) str_format_values = { 'app': self._query_package_name(), 'remote_webserver': c['remote_webserver'], @@ -467,6 +470,7 @@ class AndroidEmulatorTest(BlobUploadMixin, TestingMixin, EmulatorMixin, VCSMixin 'modules_dir': dirs['abs_modules_dir'], 'installer_path': self.installer_path, 'raw_log_file': raw_log_file, + 'error_summary_file': error_summary_file, 'dm_trans': c['device_manager'], } if self.config["device_manager"] == "sut": diff --git a/testing/mozharness/scripts/android_panda.py b/testing/mozharness/scripts/android_panda.py index 6cee2ee3cb8c..8a3f0d58cfda 100644 --- a/testing/mozharness/scripts/android_panda.py +++ b/testing/mozharness/scripts/android_panda.py @@ -458,6 +458,8 @@ class PandaTest(TestingMixin, MercurialScript, BlobUploadMixin, MozpoolMixin, Bu raw_log_file = os.path.join(dirs['abs_blob_upload_dir'], '%s_raw.log' % suite) + error_summary_file = os.path.join(dirs['abs_blob_upload_dir'], + '%s_errorsummary.log' % suite) str_format_values = { 'device_ip': self.device_ip, 'hostname': self.mozpool_device, @@ -468,6 +470,7 @@ class PandaTest(TestingMixin, MercurialScript, BlobUploadMixin, MozpoolMixin, Bu 'apk_name': self.filename_apk, 'apk_path': self.apk_path, 'raw_log_file': raw_log_file, + 'error_summary_file': error_summary_file, } if '%s_options' % suite_category in self.tree_config: for option in self.tree_config['%s_options' % suite_category]: diff --git a/testing/mozharness/scripts/androidx86_emulator_unittest.py b/testing/mozharness/scripts/androidx86_emulator_unittest.py index 541b7325c308..2c61e34eff22 100644 --- a/testing/mozharness/scripts/androidx86_emulator_unittest.py +++ b/testing/mozharness/scripts/androidx86_emulator_unittest.py @@ -419,6 +419,8 @@ class AndroidEmulatorTest(BlobUploadMixin, TestingMixin, EmulatorMixin, VCSMixin raw_log_file = os.path.join(dirs['abs_blob_upload_dir'], '%s_raw.log' % suite_name) + error_summary_file = os.path.join(dirs['abs_blob_upload_dir'], + '%s_errorsummary.log' % suite_name) str_format_values = { 'app': self._query_package_name(), 'remote_webserver': c['remote_webserver'], @@ -433,6 +435,7 @@ class AndroidEmulatorTest(BlobUploadMixin, TestingMixin, EmulatorMixin, VCSMixin 'modules_dir': dirs['abs_modules_dir'], 'installer_path': self.installer_path, 'raw_log_file': raw_log_file, + 'error_summary_file': error_summary_file, 'dm_trans': c['device_manager'], } if self.config["device_manager"] == "sut": diff --git a/testing/mozharness/scripts/b2g_desktop_unittest.py b/testing/mozharness/scripts/b2g_desktop_unittest.py index a0c9c7098a00..cd2a55ec384f 100755 --- a/testing/mozharness/scripts/b2g_desktop_unittest.py +++ b/testing/mozharness/scripts/b2g_desktop_unittest.py @@ -147,6 +147,8 @@ class B2GDesktopTest(BlobUploadMixin, TestingMixin, MercurialScript): raw_log_file = os.path.join(dirs['abs_blob_upload_dir'], '%s_raw.log' % suite) + error_summary_file = os.path.join(dirs['abs_blob_upload_dir'], + '%s_errorsummary.log' % suite) str_format_values = { 'application': self.binary_path, 'test_manifest': self.test_manifest, @@ -158,6 +160,7 @@ class B2GDesktopTest(BlobUploadMixin, TestingMixin, MercurialScript): 'cert_path': dirs['abs_certs_dir'], 'browser_arg': self.config.get('browser_arg'), 'raw_log_file': raw_log_file, + 'error_summary_file': error_summary_file, } missing_key = True diff --git a/testing/mozharness/scripts/b2g_emulator_unittest.py b/testing/mozharness/scripts/b2g_emulator_unittest.py index 781e8f2be07d..1cd23a3d76ca 100755 --- a/testing/mozharness/scripts/b2g_emulator_unittest.py +++ b/testing/mozharness/scripts/b2g_emulator_unittest.py @@ -262,6 +262,8 @@ class B2GEmulatorTest(TestingMixin, VCSMixin, BaseScript, BlobUploadMixin): raw_log_file = os.path.join(dirs['abs_blob_upload_dir'], '%s_raw.log' % suite) + error_summary_file = os.path.join(dirs['abs_blob_upload_dir'], + '%s_errorsummary.log' % suite) emulator_type = 'x86' if os.path.isdir(os.path.join(dirs['abs_b2g-distro_dir'], 'out', 'target', 'product', 'generic_x86')) else 'arm' self.info("The emulator type: %s" % emulator_type) @@ -281,6 +283,7 @@ class B2GEmulatorTest(TestingMixin, VCSMixin, BaseScript, BlobUploadMixin): 'test_path': self.config.get('test_path'), 'certificate_path': dirs['abs_certs_dir'], 'raw_log_file': raw_log_file, + 'error_summary_file': error_summary_file, } missing_key = True diff --git a/testing/mozharness/scripts/desktop_unittest.py b/testing/mozharness/scripts/desktop_unittest.py index 45df7a1f9d94..9d78ca391339 100755 --- a/testing/mozharness/scripts/desktop_unittest.py +++ b/testing/mozharness/scripts/desktop_unittest.py @@ -326,12 +326,16 @@ class DesktopUnittest(TestingMixin, MercurialScript, BlobUploadMixin, MozbaseMix raw_log_file = os.path.join(dirs['abs_blob_upload_dir'], '%s_raw.log' % suite) + + error_summary_file = os.path.join(dirs['abs_blob_upload_dir'], + '%s_errorsummary.log' % suite) str_format_values = { 'binary_path': self.binary_path, 'symbols_path': self._query_symbols_url(), 'abs_app_dir': abs_app_dir, 'abs_res_dir': abs_res_dir, 'raw_log_file': raw_log_file, + 'error_summary_file': error_summary_file, } # TestingMixin._download_and_extract_symbols() will set # self.symbols_path when downloading/extracting. diff --git a/testing/mozharness/scripts/luciddream_unittest.py b/testing/mozharness/scripts/luciddream_unittest.py index 2d802d3e198c..35af4e216cc3 100644 --- a/testing/mozharness/scripts/luciddream_unittest.py +++ b/testing/mozharness/scripts/luciddream_unittest.py @@ -236,6 +236,7 @@ class LuciddreamTest(TestingMixin, MercurialScript, MozbaseMixin, BaseScript, str_format_values = { 'browser_path': self.binary_path, 'raw_log_file': os.path.join(dirs['abs_work_dir'], 'luciddream_raw.log'), + 'error_summary_file': os.path.join(dirs['abs_work_dir'], 'luciddream_errorsummary.log'), 'test_manifest': os.path.join(ld_dir, 'example-tests', 'luciddream.ini') } diff --git a/testing/mozharness/scripts/marionette.py b/testing/mozharness/scripts/marionette.py index 1f1eb02c8b12..41249df4f379 100755 --- a/testing/mozharness/scripts/marionette.py +++ b/testing/mozharness/scripts/marionette.py @@ -342,6 +342,8 @@ class MarionetteTest(TestingMixin, MercurialScript, BlobUploadMixin, TransferMix raw_log_file = os.path.join(dirs['abs_blob_upload_dir'], 'marionette_raw.log') + error_summary_file = os.path.join(dirs['abs_blob_upload_dir'], + 'marionette_errorsummary.log') config_fmt_args = { 'type': self.config.get('test_type'), # emulator builds require a longer timeout @@ -357,6 +359,7 @@ class MarionetteTest(TestingMixin, MercurialScript, BlobUploadMixin, TransferMix 'binary': self.binary_path, 'address': self.config.get('marionette_address'), 'raw_log_file': raw_log_file, + 'error_summary_file': error_summary_file, 'gecko_log': dirs["abs_blob_upload_dir"], 'this_chunk': self.config.get('this_chunk', 1), 'total_chunks': self.config.get('total_chunks', 1) From 6601080d53b995b61f6f47ba251665ab878c8ec0 Mon Sep 17 00:00:00 2001 From: John Schoenick Date: Wed, 20 May 2015 15:30:05 +0200 Subject: [PATCH 044/136] Bug 1178963 part 1. Use nsIPluginTagInternal instead of nsPluginTag in cases where it may be nsFakePluginTag. r=peterv --- dom/base/nsMimeTypeArray.cpp | 33 ++++----- dom/base/nsMimeTypeArray.h | 10 ++- dom/base/nsPluginArray.cpp | 35 ++++++---- dom/base/nsPluginArray.h | 8 +-- dom/ipc/ProcessHangMonitor.cpp | 2 +- dom/plugins/base/nsNPAPIPluginInstance.cpp | 4 +- dom/plugins/base/nsPluginHost.cpp | 80 ++++++++++++---------- dom/plugins/base/nsPluginHost.h | 5 +- dom/plugins/base/nsPluginTags.cpp | 61 ++++++++++++----- dom/plugins/base/nsPluginTags.h | 59 +++++++++++++--- dom/plugins/ipc/PluginModuleParent.cpp | 4 +- 11 files changed, 189 insertions(+), 112 deletions(-) diff --git a/dom/base/nsMimeTypeArray.cpp b/dom/base/nsMimeTypeArray.cpp index ca3531b61fe0..0ae20aeba05f 100644 --- a/dom/base/nsMimeTypeArray.cpp +++ b/dom/base/nsMimeTypeArray.cpp @@ -9,11 +9,13 @@ #include "mozilla/dom/MimeTypeArrayBinding.h" #include "mozilla/dom/MimeTypeBinding.h" #include "nsIDOMNavigator.h" +#include "nsPIDOMWindow.h" #include "nsPluginArray.h" #include "nsIMIMEService.h" #include "nsIMIMEInfo.h" #include "Navigator.h" #include "nsServiceManagerUtils.h" +#include "nsPluginTags.h" using namespace mozilla; using namespace mozilla::dom; @@ -216,19 +218,22 @@ NS_IMPL_CYCLE_COLLECTION_UNROOT_NATIVE(nsMimeType, Release) NS_IMPL_CYCLE_COLLECTION_WRAPPERCACHE(nsMimeType, mWindow, mPluginElement) -nsMimeType::nsMimeType(nsPIDOMWindow* aWindow, nsPluginElement* aPluginElement, - uint32_t aPluginTagMimeIndex, const nsAString& aType) +nsMimeType::nsMimeType(nsPIDOMWindow* aWindow, + nsPluginElement* aPluginElement, + const nsAString& aType, + const nsAString& aDescription, + const nsAString& aExtension) : mWindow(aWindow), mPluginElement(aPluginElement), - mPluginTagMimeIndex(aPluginTagMimeIndex), - mType(aType) + mType(aType), + mDescription(aDescription), + mExtension(aExtension) { } nsMimeType::nsMimeType(nsPIDOMWindow* aWindow, const nsAString& aType) : mWindow(aWindow), mPluginElement(nullptr), - mPluginTagMimeIndex(0), mType(aType) { } @@ -251,14 +256,9 @@ nsMimeType::WrapObject(JSContext* aCx, JS::Handle aGivenProto) } void -nsMimeType::GetDescription(nsString& retval) const +nsMimeType::GetDescription(nsString& aRetval) const { - retval.Truncate(); - - if (mPluginElement) { - CopyUTF8toUTF16(mPluginElement->PluginTag()-> - mMimeDescriptions[mPluginTagMimeIndex], retval); - } + aRetval = mDescription; } nsPluginElement* @@ -269,14 +269,9 @@ nsMimeType::GetEnabledPlugin() const } void -nsMimeType::GetSuffixes(nsString& retval) const +nsMimeType::GetSuffixes(nsString& aRetval) const { - retval.Truncate(); - - if (mPluginElement) { - CopyUTF8toUTF16(mPluginElement->PluginTag()-> - mExtensions[mPluginTagMimeIndex], retval); - } + aRetval = mExtension; } void diff --git a/dom/base/nsMimeTypeArray.h b/dom/base/nsMimeTypeArray.h index 6ca5505c76c8..1e22fcd7e81a 100644 --- a/dom/base/nsMimeTypeArray.h +++ b/dom/base/nsMimeTypeArray.h @@ -58,8 +58,11 @@ public: NS_INLINE_DECL_CYCLE_COLLECTING_NATIVE_REFCOUNTING(nsMimeType) NS_DECL_CYCLE_COLLECTION_SCRIPT_HOLDER_NATIVE_CLASS(nsMimeType) - nsMimeType(nsPIDOMWindow* aWindow, nsPluginElement* aPluginElement, - uint32_t aPluginTagMimeIndex, const nsAString& aMimeType); + nsMimeType(nsPIDOMWindow* aWindow, + nsPluginElement* aPluginElement, + const nsAString& aType, + const nsAString& aDescription, + const nsAString& aExtension); nsMimeType(nsPIDOMWindow* aWindow, const nsAString& aMimeType); nsPIDOMWindow* GetParentObject() const; virtual JSObject* WrapObject(JSContext* aCx, JS::Handle aGivenProto) override; @@ -85,8 +88,9 @@ protected: // mimetype array. We rely on the cycle collector to break this // cycle. nsRefPtr mPluginElement; - uint32_t mPluginTagMimeIndex; nsString mType; + nsString mDescription; + nsString mExtension; }; #endif /* nsMimeTypeArray_h___ */ diff --git a/dom/base/nsPluginArray.cpp b/dom/base/nsPluginArray.cpp index d8391e5451fc..c0bd8d46e2dd 100644 --- a/dom/base/nsPluginArray.cpp +++ b/dom/base/nsPluginArray.cpp @@ -130,7 +130,7 @@ nsPluginArray::Refresh(bool aReloadDocuments) // that plugins did not change and was not reloaded if (pluginHost->ReloadPlugins() == NS_ERROR_PLUGINS_PLUGINSNOTCHANGED) { - nsTArray > newPluginTags; + nsTArray > newPluginTags; pluginHost->GetPlugins(newPluginTags); // Check if the number of plugins we know about are different from @@ -279,7 +279,7 @@ operator<(const nsRefPtr& lhs, const nsRefPtr& rhs) { // Sort plugins alphabetically by name. - return lhs->PluginTag()->mName < rhs->PluginTag()->mName; + return lhs->PluginTag()->Name() < rhs->PluginTag()->Name(); } void @@ -296,14 +296,13 @@ nsPluginArray::EnsurePlugins() return; } - nsTArray > pluginTags; + nsTArray > pluginTags; pluginHost->GetPlugins(pluginTags); // need to wrap each of these with a nsPluginElement, which is // scriptable. for (uint32_t i = 0; i < pluginTags.Length(); ++i) { - nsPluginTag* pluginTag = pluginTags[i]; - mPlugins.AppendElement(new nsPluginElement(mWindow, pluginTag)); + mPlugins.AppendElement(new nsPluginElement(mWindow, pluginTags[i])); } // Alphabetize the enumeration order of non-hidden plugins to reduce @@ -323,7 +322,7 @@ NS_INTERFACE_MAP_END NS_IMPL_CYCLE_COLLECTION_WRAPPERCACHE(nsPluginElement, mWindow, mMimeTypes) nsPluginElement::nsPluginElement(nsPIDOMWindow* aWindow, - nsPluginTag* aPluginTag) + nsIInternalPluginTag* aPluginTag) : mWindow(aWindow), mPluginTag(aPluginTag) { @@ -349,25 +348,25 @@ nsPluginElement::WrapObject(JSContext* aCx, JS::Handle aGivenProto) void nsPluginElement::GetDescription(nsString& retval) const { - CopyUTF8toUTF16(mPluginTag->mDescription, retval); + CopyUTF8toUTF16(mPluginTag->Description(), retval); } void nsPluginElement::GetFilename(nsString& retval) const { - CopyUTF8toUTF16(mPluginTag->mFileName, retval); + CopyUTF8toUTF16(mPluginTag->FileName(), retval); } void nsPluginElement::GetVersion(nsString& retval) const { - CopyUTF8toUTF16(mPluginTag->mVersion, retval); + CopyUTF8toUTF16(mPluginTag->Version(), retval); } void nsPluginElement::GetName(nsString& retval) const { - CopyUTF8toUTF16(mPluginTag->mName, retval); + CopyUTF8toUTF16(mPluginTag->Name(), retval); } nsMimeType* @@ -452,8 +451,18 @@ nsPluginElement::EnsurePluginMimeTypes() return; } - for (uint32_t i = 0; i < mPluginTag->mMimeTypes.Length(); ++i) { - NS_ConvertUTF8toUTF16 type(mPluginTag->mMimeTypes[i]); - mMimeTypes.AppendElement(new nsMimeType(mWindow, this, i, type)); + if (mPluginTag->MimeTypes().Length() != mPluginTag->MimeDescriptions().Length() || + mPluginTag->MimeTypes().Length() != mPluginTag->Extensions().Length()) { + MOZ_ASSERT(false, "mime type arrays expected to be the same length"); + return; + } + + for (uint32_t i = 0; i < mPluginTag->MimeTypes().Length(); ++i) { + NS_ConvertUTF8toUTF16 type(mPluginTag->MimeTypes()[i]); + NS_ConvertUTF8toUTF16 description(mPluginTag->MimeDescriptions()[i]); + NS_ConvertUTF8toUTF16 extension(mPluginTag->Extensions()[i]); + + mMimeTypes.AppendElement(new nsMimeType(mWindow, this, type, description, + extension)); } } diff --git a/dom/base/nsPluginArray.h b/dom/base/nsPluginArray.h index 2ae476270673..f73f50511b9c 100644 --- a/dom/base/nsPluginArray.h +++ b/dom/base/nsPluginArray.h @@ -11,11 +11,11 @@ #include "nsWeakReference.h" #include "nsIObserver.h" #include "nsWrapperCache.h" -#include "nsPluginTags.h" #include "nsPIDOMWindow.h" class nsPluginElement; class nsMimeType; +class nsIInternalPluginTag; class nsPluginArray final : public nsIObserver, public nsSupportsWeakReference, @@ -70,12 +70,12 @@ public: NS_DECL_CYCLE_COLLECTING_ISUPPORTS NS_DECL_CYCLE_COLLECTION_SCRIPT_HOLDER_CLASS(nsPluginElement) - nsPluginElement(nsPIDOMWindow* aWindow, nsPluginTag* aPluginTag); + nsPluginElement(nsPIDOMWindow* aWindow, nsIInternalPluginTag* aPluginTag); nsPIDOMWindow* GetParentObject() const; virtual JSObject* WrapObject(JSContext* aCx, JS::Handle aGivenProto) override; - nsPluginTag* PluginTag() const + nsIInternalPluginTag* PluginTag() const { return mPluginTag; } @@ -102,7 +102,7 @@ protected: void EnsurePluginMimeTypes(); nsCOMPtr mWindow; - nsRefPtr mPluginTag; + nsCOMPtr mPluginTag; nsTArray > mMimeTypes; }; diff --git a/dom/ipc/ProcessHangMonitor.cpp b/dom/ipc/ProcessHangMonitor.cpp index c9a445c125e7..a49337c7030a 100644 --- a/dom/ipc/ProcessHangMonitor.cpp +++ b/dom/ipc/ProcessHangMonitor.cpp @@ -750,7 +750,7 @@ HangMonitoredProcess::GetPluginName(nsACString& aPluginName) return NS_ERROR_UNEXPECTED; } - aPluginName = tag->mName; + aPluginName = tag->Name(); return NS_OK; } diff --git a/dom/plugins/base/nsNPAPIPluginInstance.cpp b/dom/plugins/base/nsNPAPIPluginInstance.cpp index b0b4269a00a3..4f35b147ab79 100644 --- a/dom/plugins/base/nsNPAPIPluginInstance.cpp +++ b/dom/plugins/base/nsNPAPIPluginInstance.cpp @@ -1673,8 +1673,8 @@ nsNPAPIPluginInstance::CarbonNPAPIFailure() static bool GetJavaVersionFromMimetype(nsPluginTag* pluginTag, nsCString& version) { - for (uint32_t i = 0; i < pluginTag->mMimeTypes.Length(); ++i) { - nsCString type = pluginTag->mMimeTypes[i]; + for (uint32_t i = 0; i < pluginTag->MimeTypes().Length(); ++i) { + nsCString type = pluginTag->MimeTypes()[i]; nsAutoCString jpi("application/x-java-applet;jpi-version="); int32_t idx = type.Find(jpi, false, 0, -1); diff --git a/dom/plugins/base/nsPluginHost.cpp b/dom/plugins/base/nsPluginHost.cpp index df5105ea7afe..e99f87deb9b9 100644 --- a/dom/plugins/base/nsPluginHost.cpp +++ b/dom/plugins/base/nsPluginHost.cpp @@ -230,7 +230,7 @@ nsInvalidPluginTag::~nsInvalidPluginTag() // Helper to check for a MIME in a comma-delimited preference static bool -IsTypeInList(nsCString &aMimeType, nsCString aTypeList) +IsTypeInList(const nsCString& aMimeType, nsCString aTypeList) { nsAutoCString searchStr; searchStr.Assign(','); @@ -998,7 +998,7 @@ nsPluginHost::TrySetUpPluginInstance(const nsACString &aMimeType, #if defined(MOZ_WIDGET_ANDROID) && defined(MOZ_CRASHREPORTER) if (pluginTag->mIsFlashPlugin) { - CrashReporter::AnnotateCrashReport(NS_LITERAL_CSTRING("FlashVersion"), pluginTag->mVersion); + CrashReporter::AnnotateCrashReport(NS_LITERAL_CSTRING("FlashVersion"), pluginTag->Version()); } #endif @@ -1156,7 +1156,7 @@ nsPluginHost::HavePluginForExtension(const nsACString & aExtension, } void -nsPluginHost::GetPlugins(nsTArray >& aPluginArray, +nsPluginHost::GetPlugins(nsTArray>& aPluginArray, bool aIncludeDisabled) { aPluginArray.Clear(); @@ -1217,7 +1217,7 @@ nsPluginHost::FindPreferredPlugin(const InfallibleTArray& matches) nsPluginTag *preferredPlugin = matches[0]; for (unsigned int i = 1; i < matches.Length(); i++) { - if (mozilla::Version(matches[i]->mVersion.get()) > preferredPlugin->mVersion.get()) { + if (mozilla::Version(matches[i]->Version().get()) > preferredPlugin->Version().get()) { preferredPlugin = matches[i]; } } @@ -1411,12 +1411,12 @@ nsresult nsPluginHost::GetPlugin(const nsACString &aMimeType, rv = NS_OK; PLUGIN_LOG(PLUGIN_LOG_BASIC, ("nsPluginHost::GetPlugin Begin mime=%s, plugin=%s\n", - PromiseFlatCString(aMimeType).get(), pluginTag->mFileName.get())); + PromiseFlatCString(aMimeType).get(), pluginTag->FileName().get())); #ifdef DEBUG - if (!pluginTag->mFileName.IsEmpty()) + if (!pluginTag->FileName().IsEmpty()) printf("For %s found plugin %s\n", - PromiseFlatCString(aMimeType).get(), pluginTag->mFileName.get()); + PromiseFlatCString(aMimeType).get(), pluginTag->FileName().get()); #endif rv = EnsurePluginLoaded(pluginTag); @@ -1431,7 +1431,7 @@ nsresult nsPluginHost::GetPlugin(const nsACString &aMimeType, PLUGIN_LOG(PLUGIN_LOG_NORMAL, ("nsPluginHost::GetPlugin End mime=%s, rv=%d, plugin=%p name=%s\n", PromiseFlatCString(aMimeType).get(), rv, *aPlugin, - (pluginTag ? pluginTag->mFileName.get() : "(not found)"))); + (pluginTag ? pluginTag->FileName().get() : "(not found)"))); return rv; } @@ -1970,7 +1970,7 @@ nsPluginHost::ShouldAddPlugin(nsPluginTag* aPluginTag) #if defined(XP_WIN) && (defined(__x86_64__) || defined(_M_X64)) // On 64-bit windows, the only plugin we should load is flash. Use library // filename and MIME type to check. - if (StringBeginsWith(aPluginTag->mFileName, NS_LITERAL_CSTRING("NPSWF"), nsCaseInsensitiveCStringComparator()) && + if (StringBeginsWith(aPluginTag->FileName(), NS_LITERAL_CSTRING("NPSWF"), nsCaseInsensitiveCStringComparator()) && (aPluginTag->HasMimeType(NS_LITERAL_CSTRING("application/x-shockwave-flash")) || aPluginTag->HasMimeType(NS_LITERAL_CSTRING("application/x-shockwave-flash-test")))) { return true; @@ -1983,7 +1983,7 @@ nsPluginHost::ShouldAddPlugin(nsPluginTag* aPluginTag) } #ifdef PLUGIN_LOGGING PLUGIN_LOG(PLUGIN_LOG_NORMAL, - ("ShouldAddPlugin : Ignoring non-flash plugin library %s\n", aPluginTag->mFileName.get())); + ("ShouldAddPlugin : Ignoring non-flash plugin library %s\n", aPluginTag->FileName().get())); #endif // PLUGIN_LOGGING return false; #else @@ -2003,9 +2003,9 @@ nsPluginHost::AddPluginTag(nsPluginTag* aPluginTag) if (aPluginTag->IsActive()) { nsAdoptingCString disableFullPage = Preferences::GetCString(kPrefDisableFullPage); - for (uint32_t i = 0; i < aPluginTag->mMimeTypes.Length(); i++) { - if (!IsTypeInList(aPluginTag->mMimeTypes[i], disableFullPage)) { - RegisterWithCategoryManager(aPluginTag->mMimeTypes[i], + for (uint32_t i = 0; i < aPluginTag->MimeTypes().Length(); i++) { + if (!IsTypeInList(aPluginTag->MimeTypes()[i], disableFullPage)) { + RegisterWithCategoryManager(aPluginTag->MimeTypes()[i], ePluginRegister); } } @@ -2590,11 +2590,15 @@ nsPluginHost::FindPluginsForContent(uint32_t aPluginEpoch, return; } - nsTArray> plugins; + nsTArray> plugins; GetPlugins(plugins, true); for (size_t i = 0; i < plugins.Length(); i++) { - nsRefPtr tag = plugins[i]; + nsCOMPtr basetag = plugins[i]; + + /// XXX(johns) Bug FIXME-jsplugins - We need to cleanup the various plugintag classes + /// to be more sane and avoid this dance + nsPluginTag *tag = static_cast(basetag.get()); if (!nsNPAPIPlugin::RunPluginOOP(tag)) { // Don't expose non-OOP plugins to content processes since we have no way @@ -2603,15 +2607,15 @@ nsPluginHost::FindPluginsForContent(uint32_t aPluginEpoch, } aPlugins->AppendElement(PluginTag(tag->mId, - tag->mName, - tag->mDescription, - tag->mMimeTypes, - tag->mMimeDescriptions, - tag->mExtensions, + tag->Name(), + tag->Description(), + tag->MimeTypes(), + tag->MimeDescriptions(), + tag->Extensions(), tag->mIsJavaPlugin, tag->mIsFlashPlugin, - tag->mFileName, - tag->mVersion, + tag->FileName(), + tag->Version(), tag->mLastModifiedTime, tag->IsFromExtension())); } @@ -2634,18 +2638,18 @@ nsPluginHost::UpdatePluginInfo(nsPluginTag* aPluginTag) // Update types with category manager nsAdoptingCString disableFullPage = Preferences::GetCString(kPrefDisableFullPage); - for (uint32_t i = 0; i < aPluginTag->mMimeTypes.Length(); i++) { + for (uint32_t i = 0; i < aPluginTag->MimeTypes().Length(); i++) { nsRegisterType shouldRegister; - if (IsTypeInList(aPluginTag->mMimeTypes[i], disableFullPage)) { + if (IsTypeInList(aPluginTag->MimeTypes()[i], disableFullPage)) { shouldRegister = ePluginUnregister; } else { - nsPluginTag *plugin = FindNativePluginForType(aPluginTag->mMimeTypes[i], + nsPluginTag *plugin = FindNativePluginForType(aPluginTag->MimeTypes()[i], true); shouldRegister = plugin ? ePluginRegister : ePluginUnregister; } - RegisterWithCategoryManager(aPluginTag->mMimeTypes[i], shouldRegister); + RegisterWithCategoryManager(aPluginTag->MimeTypes()[i], shouldRegister); } nsCOMPtr obsService = @@ -2666,7 +2670,7 @@ nsPluginHost::IsTypeWhitelisted(const char *aMimeType) } void -nsPluginHost::RegisterWithCategoryManager(nsCString &aMimeType, +nsPluginHost::RegisterWithCategoryManager(const nsCString& aMimeType, nsRegisterType aType) { PLUGIN_LOG(PLUGIN_LOG_NORMAL, @@ -2768,13 +2772,13 @@ nsPluginHost::WritePluginInfo() // filename & fullpath are on separate line // because they can contain field delimiter char PR_fprintf(fd, "%s%c%c\n%s%c%c\n%s%c%c\n", - (tag->mFileName.get()), + (tag->FileName().get()), PLUGIN_REGISTRY_FIELD_DELIMITER, PLUGIN_REGISTRY_END_OF_LINE_MARKER, (tag->mFullPath.get()), PLUGIN_REGISTRY_FIELD_DELIMITER, PLUGIN_REGISTRY_END_OF_LINE_MARKER, - (tag->mVersion.get()), + (tag->Version().get()), PLUGIN_REGISTRY_FIELD_DELIMITER, PLUGIN_REGISTRY_END_OF_LINE_MARKER); @@ -2792,23 +2796,23 @@ nsPluginHost::WritePluginInfo() //description, name & mtypecount are on separate line PR_fprintf(fd, "%s%c%c\n%s%c%c\n%d\n", - (tag->mDescription.get()), + (tag->Description().get()), PLUGIN_REGISTRY_FIELD_DELIMITER, PLUGIN_REGISTRY_END_OF_LINE_MARKER, - (tag->mName.get()), + (tag->Name().get()), PLUGIN_REGISTRY_FIELD_DELIMITER, PLUGIN_REGISTRY_END_OF_LINE_MARKER, - tag->mMimeTypes.Length()); + tag->MimeTypes().Length()); // Add in each mimetype this plugin supports - for (uint32_t i = 0; i < tag->mMimeTypes.Length(); i++) { + for (uint32_t i = 0; i < tag->MimeTypes().Length(); i++) { PR_fprintf(fd, "%d%c%s%c%s%c%s%c%c\n", i,PLUGIN_REGISTRY_FIELD_DELIMITER, - (tag->mMimeTypes[i].get()), + (tag->MimeTypes()[i].get()), PLUGIN_REGISTRY_FIELD_DELIMITER, - (tag->mMimeDescriptions[i].get()), + (tag->MimeDescriptions()[i].get()), PLUGIN_REGISTRY_FIELD_DELIMITER, - (tag->mExtensions[i].get()), + (tag->Extensions()[i].get()), PLUGIN_REGISTRY_FIELD_DELIMITER, PLUGIN_REGISTRY_END_OF_LINE_MARKER); } @@ -3153,7 +3157,7 @@ nsPluginHost::ReadPluginInfo() } MOZ_LOG(nsPluginLogging::gPluginLog, PLUGIN_LOG_BASIC, - ("LoadCachedPluginsInfo : Loading Cached plugininfo for %s\n", tag->mFileName.get())); + ("LoadCachedPluginsInfo : Loading Cached plugininfo for %s\n", tag->FileName().get())); if (!ShouldAddPlugin(tag)) { continue; @@ -3881,7 +3885,7 @@ nsPluginHost::GetPluginName(nsNPAPIPluginInstance *aPluginInstance, if (!plugin) return NS_ERROR_FAILURE; - *aPluginName = TagForPlugin(plugin)->mName.get(); + *aPluginName = TagForPlugin(plugin)->Name().get(); return NS_OK; } diff --git a/dom/plugins/base/nsPluginHost.h b/dom/plugins/base/nsPluginHost.h index cf4170b5ce63..b195854d36bb 100644 --- a/dom/plugins/base/nsPluginHost.h +++ b/dom/plugins/base/nsPluginHost.h @@ -114,7 +114,7 @@ public: /* out */ nsACString & aMimeType, PluginFilter aFilter = eExcludeDisabled); - void GetPlugins(nsTArray >& aPluginArray, + void GetPlugins(nsTArray>& aPluginArray, bool aIncludeDisabled = false); void FindPluginsForContent(uint32_t aPluginEpoch, @@ -287,7 +287,8 @@ private: // Registers or unregisters the given mime type with the category manager // (performs no checks - see UpdateCategoryManager) enum nsRegisterType { ePluginRegister, ePluginUnregister }; - void RegisterWithCategoryManager(nsCString &aMimeType, nsRegisterType aType); + void RegisterWithCategoryManager(const nsCString& aMimeType, + nsRegisterType aType); void AddPluginTag(nsPluginTag* aPluginTag); diff --git a/dom/plugins/base/nsPluginTags.cpp b/dom/plugins/base/nsPluginTags.cpp index 061042d40ba6..bce421b5b0ea 100644 --- a/dom/plugins/base/nsPluginTags.cpp +++ b/dom/plugins/base/nsPluginTags.cpp @@ -139,6 +139,39 @@ GetStatePrefNameForPlugin(nsPluginTag* aTag) return MakePrefNameForPlugin("state", aTag); } +/* nsIInternalPluginTag */ +nsIInternalPluginTag::nsIInternalPluginTag(const char* aName, + const char* aDescription, + const char* aFileName, + const char* aVersion) + : mName(aName) + , mDescription(aDescription) + , mFileName(aFileName) + , mVersion(aVersion) +{ +} + +nsIInternalPluginTag::nsIInternalPluginTag(const char* aName, + const char* aDescription, + const char* aFileName, + const char* aVersion, + const nsTArray& aMimeTypes, + const nsTArray& aMimeDescriptions, + const nsTArray& aExtensions) + : mName(aName) + , mDescription(aDescription) + , mFileName(aFileName) + , mVersion(aVersion) + , mMimeTypes(aMimeTypes) + , mMimeDescriptions(aMimeDescriptions) + , mExtensions(aExtensions) +{ +} + +nsIInternalPluginTag::~nsIInternalPluginTag() +{ +} + /* nsPluginTag */ uint32_t nsPluginTag::sNextId; @@ -146,17 +179,15 @@ uint32_t nsPluginTag::sNextId; nsPluginTag::nsPluginTag(nsPluginInfo* aPluginInfo, int64_t aLastModifiedTime, bool fromExtension) - : mId(sNextId++), + : nsIInternalPluginTag(aPluginInfo->fName, aPluginInfo->fDescription, + aPluginInfo->fFileName, aPluginInfo->fVersion), + mId(sNextId++), mContentProcessRunningCount(0), mHadLocalInstance(false), - mName(aPluginInfo->fName), - mDescription(aPluginInfo->fDescription), mLibrary(nullptr), mIsJavaPlugin(false), mIsFlashPlugin(false), - mFileName(aPluginInfo->fFileName), mFullPath(aPluginInfo->fFullPath), - mVersion(aPluginInfo->fVersion), mLastModifiedTime(aLastModifiedTime), mCachedBlocklistState(nsIBlocklistService::STATE_NOT_BLOCKED), mCachedBlocklistStateValid(false), @@ -182,16 +213,13 @@ nsPluginTag::nsPluginTag(const char* aName, int64_t aLastModifiedTime, bool fromExtension, bool aArgsAreUTF8) - : mId(sNextId++), + : nsIInternalPluginTag(aName, aDescription, aFileName, aVersion), + mId(sNextId++), mContentProcessRunningCount(0), - mName(aName), - mDescription(aDescription), mLibrary(nullptr), mIsJavaPlugin(false), mIsFlashPlugin(false), - mFileName(aFileName), mFullPath(aFullPath), - mVersion(aVersion), mLastModifiedTime(aLastModifiedTime), mCachedBlocklistState(nsIBlocklistService::STATE_NOT_BLOCKED), mCachedBlocklistStateValid(false), @@ -217,18 +245,13 @@ nsPluginTag::nsPluginTag(uint32_t aId, bool aIsFlashPlugin, int64_t aLastModifiedTime, bool aFromExtension) - : mId(aId), + : nsIInternalPluginTag(aName, aDescription, aFileName, aVersion, aMimeTypes, + aMimeDescriptions, aExtensions), + mId(aId), mContentProcessRunningCount(0), - mName(aName), - mDescription(aDescription), - mMimeTypes(aMimeTypes), - mMimeDescriptions(aMimeDescriptions), - mExtensions(aExtensions), mLibrary(nullptr), mIsJavaPlugin(aIsJavaPlugin), mIsFlashPlugin(aIsFlashPlugin), - mFileName(aFileName), - mVersion(aVersion), mLastModifiedTime(aLastModifiedTime), mNiceFileName(), mCachedBlocklistState(nsIBlocklistService::STATE_NOT_BLOCKED), @@ -242,7 +265,7 @@ nsPluginTag::~nsPluginTag() NS_ASSERTION(!mNext, "Risk of exhausting the stack space, bug 486349"); } -NS_IMPL_ISUPPORTS(nsPluginTag, nsIPluginTag) +NS_IMPL_ISUPPORTS(nsPluginTag, nsIPluginTag, nsIInternalPluginTag) void nsPluginTag::InitMime(const char* const* aMimeTypes, const char* const* aMimeDescriptions, diff --git a/dom/plugins/base/nsPluginTags.h b/dom/plugins/base/nsPluginTags.h index 35e8bc7ae98c..91bbf79f9a5d 100644 --- a/dom/plugins/base/nsPluginTags.h +++ b/dom/plugins/base/nsPluginTags.h @@ -19,9 +19,57 @@ struct PRLibrary; struct nsPluginInfo; class nsNPAPIPlugin; +// An interface representing plugin tags internally. +#define NS_IINTERNALPLUGINTAG_IID \ +{ 0xe8fdd227, 0x27da, 0x46ee, \ + { 0xbe, 0xf3, 0x1a, 0xef, 0x5a, 0x8f, 0xc5, 0xb4 } } + +class nsIInternalPluginTag : public nsIPluginTag +{ +public: + NS_DECLARE_STATIC_IID_ACCESSOR(NS_IINTERNALPLUGINTAG_IID) + + nsIInternalPluginTag(const char* aName, const char* aDescription, + const char* aFileName, const char* aVersion); + nsIInternalPluginTag(const char* aName, const char* aDescription, + const char* aFileName, const char* aVersion, + const nsTArray& aMimeTypes, + const nsTArray& aMimeDescriptions, + const nsTArray& aExtensions); + + virtual bool IsEnabled() = 0; + + const nsCString& Name() const { return mName; } + const nsCString& Description() const { return mDescription; } + + const nsTArray& MimeTypes() const { return mMimeTypes; } + + const nsTArray& MimeDescriptions() const { + return mMimeDescriptions; + } + + const nsTArray& Extensions() const { return mExtensions; } + + const nsCString& FileName() const { return mFileName; } + + const nsCString& Version() const { return mVersion; } + +protected: + ~nsIInternalPluginTag(); + + nsCString mName; // UTF-8 + nsCString mDescription; // UTF-8 + nsCString mFileName; // UTF-8 + nsCString mVersion; // UTF-8 + nsTArray mMimeTypes; // UTF-8 + nsTArray mMimeDescriptions; // UTF-8 + nsTArray mExtensions; // UTF-8 +}; +NS_DEFINE_STATIC_IID_ACCESSOR(nsIInternalPluginTag, NS_IINTERNALPLUGINTAG_IID) + // A linked-list of plugin information that is used for instantiating plugins // and reflecting plugin information into JavaScript. -class nsPluginTag final : public nsIPluginTag +class nsPluginTag final : public nsIInternalPluginTag { public: NS_DECL_ISUPPORTS @@ -69,7 +117,7 @@ public: // plugin is enabled and not blocklisted bool IsActive(); - bool IsEnabled(); + bool IsEnabled() override; void SetEnabled(bool enabled); bool IsClicktoplay(); bool IsBlocklisted(); @@ -94,18 +142,11 @@ public: // True if we've ever created an instance of this plugin in the current process. bool mHadLocalInstance; - nsCString mName; // UTF-8 - nsCString mDescription; // UTF-8 - nsTArray mMimeTypes; // UTF-8 - nsTArray mMimeDescriptions; // UTF-8 - nsTArray mExtensions; // UTF-8 PRLibrary *mLibrary; nsRefPtr mPlugin; bool mIsJavaPlugin; bool mIsFlashPlugin; - nsCString mFileName; // UTF-8 nsCString mFullPath; // UTF-8 - nsCString mVersion; // UTF-8 int64_t mLastModifiedTime; nsCOMPtr mUnloadTimer; diff --git a/dom/plugins/ipc/PluginModuleParent.cpp b/dom/plugins/ipc/PluginModuleParent.cpp index 4fba995ec05c..996a1d2c6837 100755 --- a/dom/plugins/ipc/PluginModuleParent.cpp +++ b/dom/plugins/ipc/PluginModuleParent.cpp @@ -1341,8 +1341,8 @@ PluginModuleParent::GetPluginDetails() if (!pluginTag) { return false; } - mPluginName = pluginTag->mName; - mPluginVersion = pluginTag->mVersion; + mPluginName = pluginTag->Name(); + mPluginVersion = pluginTag->Version(); mIsFlashPlugin = pluginTag->mIsFlashPlugin; return true; } From 88602373281ed94e6cb3062dc939d6d244b4946e Mon Sep 17 00:00:00 2001 From: John Schoenick Date: Wed, 20 May 2015 15:30:05 +0200 Subject: [PATCH 045/136] Bug 1178963 part 2. Implement nsFakePluginTag to represent a non-NPAPI "plugin" that is actually implemented in JavaScript. r=peterv --- dom/plugins/base/nsIPluginTag.idl | 20 ++- dom/plugins/base/nsPluginTags.cpp | 262 ++++++++++++++++++++++++++---- dom/plugins/base/nsPluginTags.h | 53 ++++-- 3 files changed, 295 insertions(+), 40 deletions(-) diff --git a/dom/plugins/base/nsIPluginTag.idl b/dom/plugins/base/nsIPluginTag.idl index 41dbb0524610..2ab71e324b0d 100644 --- a/dom/plugins/base/nsIPluginTag.idl +++ b/dom/plugins/base/nsIPluginTag.idl @@ -5,7 +5,9 @@ #include "nsISupports.idl" -[scriptable, uuid(32563b21-3c5e-4864-baaa-4e49b90b64f2)] +interface nsIURI; + +[scriptable, uuid(5daa99d5-265a-4397-b429-c943803e2619)] interface nsIPluginTag : nsISupports { // enabledState is stored as one of the following as an integer in prefs, @@ -26,6 +28,8 @@ interface nsIPluginTag : nsISupports /** * true only if this plugin is "hardblocked" and cannot be enabled. */ + // FIXME-jsplugins QI to fakePluginTag possible + // FIXME-jsplugins implement missing + tests (whatever that means) readonly attribute boolean blocklisted; /** @@ -55,3 +59,17 @@ interface nsIPluginTag : nsISupports [retval, array, size_is(aCount)] out wstring aResults); }; + +/** + * An interface representing a "fake" plugin: one implemented in JavaScript, not + * as a NPAPI plug-in. See nsIPluginHost.registerFakePlugin and the + * documentation for the FakePluginTagInit dictionary. + */ +[scriptable, uuid(6d22c968-226d-4156-b230-da6ad6bbf6e8)] +interface nsIFakePluginTag : nsIPluginTag +{ + // The URI that should be loaded into the tag (as a frame) to handle the + // plugin. Note that the original data/src value for the plugin is not loaded + // and will need to be requested by the handler via XHR or similar if desired. + readonly attribute nsIURI handlerURI; +}; diff --git a/dom/plugins/base/nsPluginTags.cpp b/dom/plugins/base/nsPluginTags.cpp index bce421b5b0ea..7017771f6cf9 100644 --- a/dom/plugins/base/nsPluginTags.cpp +++ b/dom/plugins/base/nsPluginTags.cpp @@ -18,6 +18,7 @@ #include "nsCharSeparatedTokenizer.h" #include "mozilla/Preferences.h" #include "mozilla/unused.h" +#include "nsNetUtil.h" #include #include "mozilla/dom/EncodingUtils.h" #include "mozilla/dom/ContentChild.h" @@ -98,14 +99,24 @@ MakeNiceFileName(const nsCString & aFileName) } static nsCString -MakePrefNameForPlugin(const char* const subname, nsPluginTag* aTag) +MakePrefNameForPlugin(const char* const subname, nsIInternalPluginTag* aTag) { nsCString pref; + nsAutoCString pluginName(aTag->GetNiceFileName()); + + if (pluginName.IsEmpty()) { + // Use filename if nice name fails + pluginName = aTag->FileName(); + if (pluginName.IsEmpty()) { + MOZ_ASSERT_UNREACHABLE("Plugin with no filename or nice name in list"); + pluginName.AssignLiteral("unknown-plugin-name"); + } + } pref.AssignLiteral("plugin."); pref.Append(subname); pref.Append('.'); - pref.Append(aTag->GetNiceFileName()); + pref.Append(pluginName); return pref; } @@ -134,12 +145,33 @@ CStringArrayToXPCArray(nsTArray & aArray, } static nsCString -GetStatePrefNameForPlugin(nsPluginTag* aTag) +GetStatePrefNameForPlugin(nsIInternalPluginTag* aTag) { return MakePrefNameForPlugin("state", aTag); } +static nsresult +IsEnabledStateLockedForPlugin(nsIInternalPluginTag* aTag, + bool* aIsEnabledStateLocked) +{ + *aIsEnabledStateLocked = false; + nsCOMPtr prefs(do_GetService(NS_PREFSERVICE_CONTRACTID)); + + if (NS_WARN_IF(!prefs)) { + return NS_ERROR_FAILURE; + } + + unused << prefs->PrefIsLocked(GetStatePrefNameForPlugin(aTag).get(), + aIsEnabledStateLocked); + + return NS_OK; +} + /* nsIInternalPluginTag */ +nsIInternalPluginTag::nsIInternalPluginTag() +{ +} + nsIInternalPluginTag::nsIInternalPluginTag(const char* aName, const char* aDescription, const char* aFileName, @@ -172,6 +204,20 @@ nsIInternalPluginTag::~nsIInternalPluginTag() { } +bool +nsIInternalPluginTag::HasExtension(const nsACString& aExtension, + nsACString& aMatchingType) const +{ + return SearchExtensions(mExtensions, mMimeTypes, aExtension, aMatchingType); +} + +bool +nsIInternalPluginTag::HasMimeType(const nsACString& aMimeType) const +{ + return mMimeTypes.Contains(aMimeType, + nsCaseInsensitiveCStringArrayComparator()); +} + /* nsPluginTag */ uint32_t nsPluginTag::sNextId; @@ -495,17 +541,7 @@ nsPluginTag::GetBlocklisted(bool* aBlocklisted) NS_IMETHODIMP nsPluginTag::GetIsEnabledStateLocked(bool* aIsEnabledStateLocked) { - *aIsEnabledStateLocked = false; - nsCOMPtr prefs(do_GetService(NS_PREFSERVICE_CONTRACTID)); - - if (NS_WARN_IF(!prefs)) { - return NS_ERROR_FAILURE; - } - - unused << prefs->PrefIsLocked(GetStatePrefNameForPlugin(this).get(), - aIsEnabledStateLocked); - - return NS_OK; + return IsEnabledStateLockedForPlugin(this, aIsEnabledStateLocked); } bool @@ -629,7 +665,9 @@ void nsPluginTag::TryUnloadPlugin(bool inShutdown) } } -nsCString nsPluginTag::GetNiceFileName() { +const nsCString& +nsPluginTag::GetNiceFileName() +{ if (!mNiceFileName.IsEmpty()) { return mNiceFileName; } @@ -705,20 +743,6 @@ nsPluginTag::GetBlocklistState(uint32_t *aResult) #endif // defined(MOZ_WIDGET_ANDROID) } -bool -nsPluginTag::HasMimeType(const nsACString & aMimeType) const -{ - return mMimeTypes.Contains(aMimeType, - nsCaseInsensitiveCStringArrayComparator()); -} - -bool -nsPluginTag::HasExtension(const nsACString & aExtension, - nsACString & aMatchingType) const -{ - return SearchExtensions(mExtensions, mMimeTypes, aExtension, aMatchingType); -} - void nsPluginTag::InvalidateBlocklistState() { @@ -737,3 +761,183 @@ bool nsPluginTag::IsFromExtension() const { return mIsFromExtension; } + +/* nsFakePluginTag */ + +nsFakePluginTag::nsFakePluginTag() + : mState(nsPluginTag::ePluginState_Disabled) +{ +} + +nsFakePluginTag::~nsFakePluginTag() +{ +} + +NS_IMPL_ADDREF(nsFakePluginTag) +NS_IMPL_RELEASE(nsFakePluginTag) +NS_INTERFACE_TABLE_HEAD(nsFakePluginTag) + NS_INTERFACE_TABLE_BEGIN + NS_INTERFACE_TABLE_ENTRY_AMBIGUOUS(nsFakePluginTag, nsIPluginTag, + nsIInternalPluginTag) + NS_INTERFACE_TABLE_ENTRY(nsFakePluginTag, nsIInternalPluginTag) + NS_INTERFACE_TABLE_ENTRY_AMBIGUOUS(nsFakePluginTag, nsISupports, + nsIInternalPluginTag) + NS_INTERFACE_TABLE_ENTRY(nsFakePluginTag, nsIFakePluginTag) + NS_INTERFACE_TABLE_END +NS_INTERFACE_TABLE_TAIL + +NS_IMETHODIMP +nsFakePluginTag::GetHandlerURI(nsIURI **aResult) +{ + NS_IF_ADDREF(*aResult = mHandlerURI); + return NS_OK; +} + +NS_IMETHODIMP +nsFakePluginTag::GetDescription(/* utf-8 */ nsACString& aResult) +{ + aResult = mDescription; + return NS_OK; +} + +NS_IMETHODIMP +nsFakePluginTag::GetFilename(/* utf-8 */ nsACString& aResult) +{ + aResult = mFileName; + return NS_OK; +} + +NS_IMETHODIMP +nsFakePluginTag::GetFullpath(/* utf-8 */ nsACString& aResult) +{ + aResult = mFullPath; + return NS_OK; +} + +NS_IMETHODIMP +nsFakePluginTag::GetVersion(/* utf-8 */ nsACString& aResult) +{ + aResult = mVersion; + return NS_OK; +} + +NS_IMETHODIMP +nsFakePluginTag::GetName(/* utf-8 */ nsACString& aResult) +{ + aResult = mName; + return NS_OK; +} + +const nsCString& +nsFakePluginTag::GetNiceFileName() +{ + // We don't try to mimic the special-cased flash/java names if the fake plugin + // claims one of their MIME types, but do allow directly setting niceName if + // emulating those is desired. + if (mNiceName.IsEmpty() && !mFileName.IsEmpty()) { + mNiceName = MakeNiceFileName(mFileName); + } + + return mNiceName; +} + +NS_IMETHODIMP +nsFakePluginTag::GetNiceName(/* utf-8 */ nsACString& aResult) +{ + aResult = GetNiceFileName(); + return NS_OK; +} + +NS_IMETHODIMP +nsFakePluginTag::GetBlocklistState(uint32_t* aResult) +{ + // Fake tags don't currently support blocklisting + *aResult = nsIBlocklistService::STATE_NOT_BLOCKED; + return NS_OK; +} + +NS_IMETHODIMP +nsFakePluginTag::GetBlocklisted(bool* aBlocklisted) +{ + // Fake tags can't be blocklisted + *aBlocklisted = false; + return NS_OK; +} + +NS_IMETHODIMP +nsFakePluginTag::GetIsEnabledStateLocked(bool* aIsEnabledStateLocked) +{ + return IsEnabledStateLockedForPlugin(this, aIsEnabledStateLocked); +} + +bool +nsFakePluginTag::IsEnabled() +{ + return mState == nsPluginTag::ePluginState_Enabled || + mState == nsPluginTag::ePluginState_Clicktoplay; +} + +NS_IMETHODIMP +nsFakePluginTag::GetDisabled(bool* aDisabled) +{ + *aDisabled = !IsEnabled(); + return NS_OK; +} + +NS_IMETHODIMP +nsFakePluginTag::GetClicktoplay(bool* aClicktoplay) +{ + *aClicktoplay = (mState == nsPluginTag::ePluginState_Clicktoplay); + return NS_OK; +} + +NS_IMETHODIMP +nsFakePluginTag::GetEnabledState(uint32_t* aEnabledState) +{ + *aEnabledState = (uint32_t)mState; + return NS_OK; +} + +NS_IMETHODIMP +nsFakePluginTag::SetEnabledState(uint32_t aEnabledState) +{ + // There are static asserts above enforcing that this enum matches + mState = (nsPluginTag::PluginState)aEnabledState; + // FIXME-jsplugins update + return NS_OK; +} + +NS_IMETHODIMP +nsFakePluginTag::GetMimeTypes(uint32_t* aCount, char16_t*** aResults) +{ + return CStringArrayToXPCArray(mMimeTypes, aCount, aResults); +} + +NS_IMETHODIMP +nsFakePluginTag::GetMimeDescriptions(uint32_t* aCount, char16_t*** aResults) +{ + return CStringArrayToXPCArray(mMimeDescriptions, aCount, aResults); +} + +NS_IMETHODIMP +nsFakePluginTag::GetExtensions(uint32_t* aCount, char16_t*** aResults) +{ + return CStringArrayToXPCArray(mExtensions, aCount, aResults); +} + +NS_IMETHODIMP +nsFakePluginTag::GetActive(bool *aResult) +{ + // Fake plugins can't be blocklisted, so this is just !Disabled + *aResult = IsEnabled(); + return NS_OK; +} + +NS_IMETHODIMP +nsFakePluginTag::GetLastModifiedTime(PRTime* aLastModifiedTime) +{ + // FIXME-jsplugins What should this return, if anything? + MOZ_ASSERT(aLastModifiedTime); + *aLastModifiedTime = 0; + return NS_OK; +} diff --git a/dom/plugins/base/nsPluginTags.h b/dom/plugins/base/nsPluginTags.h index 91bbf79f9a5d..5452a44b1c4f 100644 --- a/dom/plugins/base/nsPluginTags.h +++ b/dom/plugins/base/nsPluginTags.h @@ -15,6 +15,7 @@ #include "nsITimer.h" #include "nsString.h" +class nsIURI; struct PRLibrary; struct nsPluginInfo; class nsNPAPIPlugin; @@ -29,6 +30,7 @@ class nsIInternalPluginTag : public nsIPluginTag public: NS_DECLARE_STATIC_IID_ACCESSOR(NS_IINTERNALPLUGINTAG_IID) + nsIInternalPluginTag(); nsIInternalPluginTag(const char* aName, const char* aDescription, const char* aFileName, const char* aVersion); nsIInternalPluginTag(const char* aName, const char* aDescription, @@ -38,6 +40,7 @@ public: const nsTArray& aExtensions); virtual bool IsEnabled() = 0; + virtual const nsCString& GetNiceFileName() = 0; const nsCString& Name() const { return mName; } const nsCString& Description() const { return mDescription; } @@ -54,6 +57,16 @@ public: const nsCString& Version() const { return mVersion; } + // Returns true if this plugin claims it supports this MIME type. The + // comparison is done ASCII-case-insensitively. + bool HasMimeType(const nsACString & aMimeType) const; + + // Returns true if this plugin claims it supports the given extension. In + // that case, aMatchingType is set to the MIME type the plugin claims + // corresponds to this extension. The match on aExtension is done + // ASCII-case-insensitively. + bool HasExtension(const nsACString & aExtension, + /* out */ nsACString & aMatchingType) const; protected: ~nsIInternalPluginTag(); @@ -129,7 +142,7 @@ public: void ImportFlagsToPrefs(uint32_t flag); bool HasSameNameAndMimes(const nsPluginTag *aPluginTag) const; - nsCString GetNiceFileName(); + const nsCString& GetNiceFileName() override; bool IsFromExtension() const; @@ -152,15 +165,6 @@ public: void InvalidateBlocklistState(); - // Returns true if this plugin claims it supports this MIME type. The - // comparison is done ASCII-case-insensitively. - bool HasMimeType(const nsACString & aMimeType) const; - // Returns true if this plugin claims it supports the given extension. In hat - // case, aMatchingType is set to the MIME type the plugin claims corresponds - // to this extension. Again, the extension is done ASCII-case-insensitively. - bool HasExtension(const nsACString & aExtension, - /* out */ nsACString & aMatchingType) const; - private: virtual ~nsPluginTag(); @@ -179,4 +183,33 @@ private: static uint32_t sNextId; }; +// A class representing "fake" plugin tags; that is plugin tags not +// corresponding to actual NPAPI plugins. In practice these are all +// JS-implemented plugins; maybe we want a better name for this class? +class nsFakePluginTag : public nsIInternalPluginTag, + public nsIFakePluginTag +{ +public: + NS_DECL_ISUPPORTS + NS_DECL_NSIPLUGINTAG + NS_DECL_NSIFAKEPLUGINTAG + + nsFakePluginTag(); + + bool IsEnabled() override; + const nsCString& GetNiceFileName() override; + +private: + virtual ~nsFakePluginTag(); + + // The URI of the handler for our fake plugin. + // FIXME-jsplugins do we need to sanity check these? + nsCOMPtr mHandlerURI; + + nsCString mFullPath; + nsCString mNiceName; + + nsPluginTag::PluginState mState; +}; + #endif // nsPluginTags_h_ From d91deee76b479c5b67d5e6bc97d8ceefc02c2beb Mon Sep 17 00:00:00 2001 From: John Schoenick Date: Wed, 20 May 2015 15:30:05 +0200 Subject: [PATCH 046/136] Bug 1178963 part 3. Make nsPluginHost aware of fake plugins. r=peterv --- dom/plugins/base/nsIPluginHost.idl | 43 +++++- dom/plugins/base/nsPluginHost.cpp | 198 +++++++++++++++++++++++++--- dom/plugins/base/nsPluginHost.h | 40 +++++- dom/plugins/base/nsPluginTags.cpp | 39 ++++++ dom/plugins/base/nsPluginTags.h | 14 +- dom/webidl/FakePluginTagInit.webidl | 39 ++++++ dom/webidl/moz.build | 1 + 7 files changed, 349 insertions(+), 25 deletions(-) create mode 100644 dom/webidl/FakePluginTagInit.webidl diff --git a/dom/plugins/base/nsIPluginHost.idl b/dom/plugins/base/nsIPluginHost.idl index d7545812f4a4..bfb5bb133e29 100644 --- a/dom/plugins/base/nsIPluginHost.idl +++ b/dom/plugins/base/nsIPluginHost.idl @@ -36,11 +36,11 @@ interface nsIClearSiteDataCallback : nsISupports void callback(in nsresult rv); }; -[scriptable, uuid(2bed7533-50e3-45dd-9e47-102e2c6f5ea8)] +[scriptable, uuid(50677599-323f-4c7d-a450-307bdb7acbf0)] interface nsIPluginHost : nsISupports { /** - * Causes the plugins directory to be searched again for new plugin + * Causes the plugins directory to be searched again for new plugin * libraries. */ void reloadPlugins(); @@ -64,6 +64,7 @@ interface nsIPluginHost : nsISupports */ const uint32_t EXCLUDE_NONE = 0; const uint32_t EXCLUDE_DISABLED = 1 << 0; + const uint32_t EXCLUDE_FAKE = 1 << 1; /* * Clear site data for a given plugin. @@ -127,6 +128,9 @@ interface nsIPluginHost : nsISupports * passed to the permission manager to see whether the plugin is allowed to * run, for example. This will typically be based on the plugin's "nice name" * and its blocklist state. + * + * @mimeType The MIME type we're interested in. + * @excludeFlags Set of the EXCLUDE_* flags above, defaulting to EXCLUDE_NONE. */ ACString getPermissionStringForType(in AUTF8String mimeType, [optional] in uint32_t excludeFlags); @@ -136,6 +140,12 @@ interface nsIPluginHost : nsISupports * enabled and disabled/blocklisted plugins, but an enabled plugin will * always be returned if available. * + * A fake plugin tag, if one exists and is available, will be returned in + * preference to NPAPI plugin tags unless excluded by the excludeFlags. + * + * @mimeType The MIME type we're interested in. + * @excludeFlags Set of the EXCLUDE_* flags above, defaulting to EXCLUDE_NONE. + * * @throws NS_ERROR_NOT_AVAILABLE if no plugin is available for this MIME * type. */ @@ -145,16 +155,45 @@ interface nsIPluginHost : nsISupports /** * Get the nsIPluginTag enabled state for this MIME type. See * nsIPluginTag.enabledState. + * + * @mimeType The MIME type we're interested in. + * @excludeFlags Set of the EXCLUDE_* flags above, defaulting to EXCLUDE_NONE. */ unsigned long getStateForType(in AUTF8String mimeType, [optional] in uint32_t excludeFlags); /** * Get the blocklist state for a MIME type. See nsIPluginTag.blocklistState. + * + * @mimeType The MIME type we're interested in. + * @excludeFlags Set of the EXCLUDE_* flags above, defaulting to EXCLUDE_NONE. */ uint32_t getBlocklistStateForType(in AUTF8String aMimeType, [optional] in uint32_t excludeFlags); + /** + * Create a fake plugin tag, register it, and return it. The argument is a + * FakePluginTagInit dictionary. See documentation in + * FakePluginTagInit.webidl for what it should look like. Will throw + * NS_ERROR_UNEXPECTED if there is already a fake plugin registered with the + * given handler URI. + */ + [implicit_jscontext] + nsIFakePluginTag registerFakePlugin(in jsval initDictionary); + + /** + * Get a reference to an existing fake plugin tag for the given MIME type, if + * any. Can return null. + */ + nsIFakePluginTag getFakePlugin(in AUTF8String mimeType); + + /** + * Unregister a fake plugin. The argument can be the .handlerURI.spec of an + * existing nsIFakePluginTag, or just a known handler URI string that was + * passed in the FakePluginTagInit when registering. + */ + void unregisterFakePlugin(in AUTF8String handlerURI); + /** * Returns true if plugins with the given mimetype will run out of process. */ diff --git a/dom/plugins/base/nsPluginHost.cpp b/dom/plugins/base/nsPluginHost.cpp index e99f87deb9b9..4a1570406671 100644 --- a/dom/plugins/base/nsPluginHost.cpp +++ b/dom/plugins/base/nsPluginHost.cpp @@ -52,6 +52,7 @@ #include "nsICategoryManager.h" #include "nsPluginStreamListenerPeer.h" #include "mozilla/dom/ContentChild.h" +#include "mozilla/dom/FakePluginTagInitBinding.h" #include "mozilla/LoadInfo.h" #include "mozilla/plugins/PluginAsyncSurrogate.h" #include "mozilla/plugins/PluginBridge.h" @@ -119,6 +120,7 @@ using namespace mozilla; using mozilla::TimeStamp; using mozilla::plugins::PluginTag; using mozilla::plugins::PluginAsyncSurrogate; +using mozilla::dom::FakePluginTagInit; // Null out a strong ref to a linked list iteratively to avoid // exhausting the stack (bug 486349). @@ -1049,7 +1051,22 @@ nsPluginHost::HavePluginForType(const nsACString & aMimeType, PluginFilter aFilter) { bool checkEnabled = aFilter & eExcludeDisabled; - return FindNativePluginForType(aMimeType, checkEnabled); + bool allowFake = !(aFilter & eExcludeFake); + return FindPluginForType(aMimeType, allowFake, checkEnabled); +} + +nsIInternalPluginTag* +nsPluginHost::FindPluginForType(const nsACString& aMimeType, + bool aIncludeFake, bool aCheckEnabled) +{ + if (aIncludeFake) { + nsFakePluginTag* fakeTag = FindFakePluginForType(aMimeType, aCheckEnabled); + if (fakeTag) { + return fakeTag; + } + } + + return FindNativePluginForType(aMimeType, aCheckEnabled); } NS_IMETHODIMP @@ -1057,21 +1074,22 @@ nsPluginHost::GetPluginTagForType(const nsACString& aMimeType, uint32_t aExcludeFlags, nsIPluginTag** aResult) { + bool includeFake = !(aExcludeFlags & eExcludeFake); bool includeDisabled = !(aExcludeFlags & eExcludeDisabled); - nsPluginTag *tag = FindNativePluginForType(aMimeType, true); - - // Prefer enabled, but select disabled if none is found - if (includeDisabled && !tag) { - tag = FindNativePluginForType(aMimeType, false); + // First look for an enabled plugin. + nsRefPtr tag = FindPluginForType(aMimeType, includeFake, + true); + if (!tag && includeDisabled) { + tag = FindPluginForType(aMimeType, includeFake, false); } - if (!tag) { - return NS_ERROR_NOT_AVAILABLE; + if (tag) { + tag.forget(aResult); + return NS_OK; } - NS_ADDREF(*aResult = tag); - return NS_OK; + return NS_ERROR_NOT_AVAILABLE; } NS_IMETHODIMP @@ -1152,7 +1170,10 @@ nsPluginHost::HavePluginForExtension(const nsACString & aExtension, PluginFilter aFilter) { bool checkEnabled = aFilter & eExcludeDisabled; - return FindNativePluginForExtension(aExtension, aMimeType, checkEnabled); + bool allowFake = !(aFilter & eExcludeFake); + return FindNativePluginForExtension(aExtension, aMimeType, checkEnabled) || + (allowFake && + FindFakePluginForExtension(aExtension, aMimeType, checkEnabled)); } void @@ -1163,6 +1184,14 @@ nsPluginHost::GetPlugins(nsTArray>& aPluginArray, LoadPlugins(); + // Append fake plugins, then normal plugins. + + uint32_t numFake = mFakePlugins.Length(); + for (uint32_t i = 0; i < numFake; i++) { + aPluginArray.AppendElement(mFakePlugins[i]); + } + + // Regular plugins nsPluginTag* plugin = mPlugins; while (plugin != nullptr) { if (plugin->IsEnabled() || aIncludeDisabled) { @@ -1172,12 +1201,14 @@ nsPluginHost::GetPlugins(nsTArray>& aPluginArray, } } +// FIXME-jsplugins Check users for order of fake v non-fake NS_IMETHODIMP nsPluginHost::GetPluginTags(uint32_t* aPluginCount, nsIPluginTag*** aResults) { LoadPlugins(); uint32_t count = 0; + uint32_t fakeCount = mFakePlugins.Length(); nsRefPtr plugin = mPlugins; while (plugin != nullptr) { count++; @@ -1185,11 +1216,11 @@ nsPluginHost::GetPluginTags(uint32_t* aPluginCount, nsIPluginTag*** aResults) } *aResults = static_cast - (moz_xmalloc(count * sizeof(**aResults))); + (moz_xmalloc((fakeCount + count) * sizeof(**aResults))); if (!*aResults) return NS_ERROR_OUT_OF_MEMORY; - *aPluginCount = count; + *aPluginCount = count + fakeCount; plugin = mPlugins; for (uint32_t i = 0; i < count; i++) { @@ -1198,6 +1229,11 @@ nsPluginHost::GetPluginTags(uint32_t* aPluginCount, nsIPluginTag*** aResults) plugin = plugin->mNext; } + for (uint32_t i = 0; i < fakeCount; i++) { + (*aResults)[i + count] = static_cast(mFakePlugins[i]); + NS_ADDREF((*aResults)[i + count]); + } + return NS_OK; } @@ -1225,6 +1261,47 @@ nsPluginHost::FindPreferredPlugin(const InfallibleTArray& matches) return preferredPlugin; } +nsFakePluginTag* +nsPluginHost::FindFakePluginForExtension(const nsACString & aExtension, + /* out */ nsACString & aMimeType, + bool aCheckEnabled) +{ + if (aExtension.IsEmpty()) { + return nullptr; + } + + int32_t numFakePlugins = mFakePlugins.Length(); + for (int32_t i = 0; i < numFakePlugins; i++) { + nsFakePluginTag *plugin = mFakePlugins[i]; + bool active; + if ((!aCheckEnabled || + (NS_SUCCEEDED(plugin->GetActive(&active)) && active)) && + plugin->HasExtension(aExtension, aMimeType)) { + return plugin; + } + } + + return nullptr; +} + +nsFakePluginTag* +nsPluginHost::FindFakePluginForType(const nsACString & aMimeType, + bool aCheckEnabled) +{ + int32_t numFakePlugins = mFakePlugins.Length(); + for (int32_t i = 0; i < numFakePlugins; i++) { + nsFakePluginTag *plugin = mFakePlugins[i]; + bool active; + if ((!aCheckEnabled || + (NS_SUCCEEDED(plugin->GetActive(&active)) && active)) && + plugin->HasMimeType(aMimeType)) { + return plugin; + } + } + + return nullptr; +} + nsPluginTag* nsPluginHost::FindNativePluginForType(const nsACString & aMimeType, bool aCheckEnabled) @@ -1531,6 +1608,50 @@ nsPluginHost::EnumerateSiteData(const nsACString& domain, return NS_OK; } +NS_IMETHODIMP +nsPluginHost::RegisterFakePlugin(JS::Handle aInitDictionary, + JSContext* aCx, + nsIFakePluginTag **aResult) +{ + FakePluginTagInit initDictionary; + if (!initDictionary.Init(aCx, aInitDictionary)) { + return NS_ERROR_FAILURE; + } + + nsRefPtr newTag; + nsresult rv = nsFakePluginTag::Create(initDictionary, getter_AddRefs(newTag)); + NS_ENSURE_SUCCESS(rv, rv); + + for (auto existingTag : mFakePlugins) { + if (newTag->HandlerURIMatches(existingTag->HandlerURI())) { + return NS_ERROR_UNEXPECTED; + } + } + + mFakePlugins.AppendElement(newTag); + // FIXME-jsplugins do we need to register with the category manager here? For + // shumway, for now, probably not. + newTag.forget(aResult); + return NS_OK; +} + +NS_IMETHODIMP +nsPluginHost::UnregisterFakePlugin(const nsACString& aHandlerURI) +{ + nsCOMPtr handlerURI; + nsresult rv = NS_NewURI(getter_AddRefs(handlerURI), aHandlerURI); + NS_ENSURE_SUCCESS(rv, rv); + + for (uint32_t i = 0; i < mFakePlugins.Length(); ++i) { + if (mFakePlugins[i]->HandlerURIMatches(handlerURI)) { + mFakePlugins.RemoveElementAt(i); + return NS_OK; + } + } + + return NS_OK; +} + NS_IMETHODIMP nsPluginHost::RegisterPlayPreviewMimeType(const nsACString& mimeType, bool ignoreCTP, @@ -1583,6 +1704,21 @@ nsPluginHost::GetPlayPreviewInfo(const nsACString& mimeType, return NS_ERROR_NOT_AVAILABLE; } +// FIXME-jsplugins Is this method actually needed? +NS_IMETHODIMP +nsPluginHost::GetFakePlugin(const nsACString & aMimeType, + nsIFakePluginTag** aResult) +{ + nsRefPtr result = FindFakePluginForType(aMimeType, false); + if (result) { + result.forget(aResult); + return NS_OK; + } + + *aResult = nullptr; + return NS_ERROR_NOT_AVAILABLE; +} + #define ClearDataFromSitesClosure_CID {0x9fb21761, 0x2403, 0x41ad, {0x9e, 0xfd, 0x36, 0x7e, 0xc4, 0x4f, 0xa4, 0x5e}} @@ -1649,6 +1785,7 @@ NS_INTERFACE_MAP_BEGIN(ClearDataFromSitesClosure) NS_INTERFACE_MAP_ENTRY_AMBIGUOUS(nsISupports, nsIClearSiteDataCallback) NS_INTERFACE_MAP_END +// FIXME-jsplugins what should this do for fake plugins? NS_IMETHODIMP nsPluginHost::ClearSiteData(nsIPluginTag* plugin, const nsACString& domain, uint64_t flags, int64_t maxAge, nsIClearSiteDataCallback* callbackFunc) @@ -1836,15 +1973,24 @@ nsPluginHost::GetSpecialType(const nsACString & aMIMEType) bool nsPluginHost::IsLiveTag(nsIPluginTag* aPluginTag) { + nsCOMPtr internalTag(do_QueryInterface(aPluginTag)); + uint32_t fakeCount = mFakePlugins.Length(); + for (uint32_t i = 0; i < fakeCount; i++) { + if (mFakePlugins[i] == internalTag) { + return true; + } + } + nsPluginTag* tag; for (tag = mPlugins; tag; tag = tag->mNext) { - if (tag == aPluginTag) { + if (tag == internalTag) { return true; } } return false; } +// FIXME-jsplugins what should happen with jsplugins here, if anything? nsPluginTag* nsPluginHost::HaveSamePlugin(const nsPluginTag* aPluginTag) { @@ -1856,6 +2002,8 @@ nsPluginHost::HaveSamePlugin(const nsPluginTag* aPluginTag) return nullptr; } +// Don't have to worry about fake plugins here, since this is only used during +// the plugin directory scan, which doesn't pick up fake plugins. nsPluginTag* nsPluginHost::FirstPluginWithPath(const nsCString& path) { @@ -2596,8 +2744,16 @@ nsPluginHost::FindPluginsForContent(uint32_t aPluginEpoch, for (size_t i = 0; i < plugins.Length(); i++) { nsCOMPtr basetag = plugins[i]; - /// XXX(johns) Bug FIXME-jsplugins - We need to cleanup the various plugintag classes - /// to be more sane and avoid this dance + nsCOMPtr faketag = do_QueryInterface(basetag); + if (faketag) { + /// FIXME-jsplugins - We need to make content processes properly + /// aware of jsplugins (and add a nsIInternalPluginTag->AsNative() to + /// avoid this hacky static cast) + continue; + } + + /// FIXME-jsplugins - We need to cleanup the various plugintag classes + /// to be more sane and avoid this dance nsPluginTag *tag = static_cast(basetag.get()); if (!nsNPAPIPlugin::RunPluginOOP(tag)) { @@ -2621,6 +2777,7 @@ nsPluginHost::FindPluginsForContent(uint32_t aPluginEpoch, } } +// This function is not relevant for fake plugins. void nsPluginHost::UpdatePluginInfo(nsPluginTag* aPluginTag) { @@ -2694,6 +2851,15 @@ nsPluginHost::RegisterWithCategoryManager(const nsCString& aMimeType, mOverrideInternalTypes, nullptr); } else { + if (aType == ePluginMaybeUnregister) { + // Bail out if this type is still used by an enabled plugin + if (HavePluginForType(aMimeType)) { + return; + } + } else { + MOZ_ASSERT(aType == ePluginUnregister, "Unknown nsRegisterType"); + } + // Only delete the entry if a plugin registered for it nsXPIDLCString value; nsresult rv = catMan->GetCategoryEntry("Gecko-Content-Viewers", diff --git a/dom/plugins/base/nsPluginHost.h b/dom/plugins/base/nsPluginHost.h index b195854d36bb..d47d9ef09b73 100644 --- a/dom/plugins/base/nsPluginHost.h +++ b/dom/plugins/base/nsPluginHost.h @@ -12,6 +12,7 @@ #include "prlink.h" #include "prclist.h" #include "nsIPluginTag.h" +#include "nsPluginPlayPreviewInfo.h" #include "nsPluginsDir.h" #include "nsPluginDirServiceProvider.h" #include "nsAutoPtr.h" @@ -23,7 +24,6 @@ #include "nsTObserverArray.h" #include "nsITimer.h" #include "nsPluginTags.h" -#include "nsPluginPlayPreviewInfo.h" #include "nsIEffectiveTLDService.h" #include "nsIIDNService.h" #include "nsCRT.h" @@ -79,6 +79,7 @@ class nsPluginHost final : public nsIPluginHost, public nsSupportsWeakReference { friend class nsPluginTag; + friend class nsFakePluginTag; virtual ~nsPluginHost(); public: @@ -103,7 +104,8 @@ public: // Acts like a bitfield enum PluginFilter { eExcludeNone = nsIPluginHost::EXCLUDE_NONE, - eExcludeDisabled = nsIPluginHost::EXCLUDE_DISABLED + eExcludeDisabled = nsIPluginHost::EXCLUDE_DISABLED, + eExcludeFake = nsIPluginHost::EXCLUDE_FAKE }; // FIXME-jsplugins comment about fake bool HavePluginForType(const nsACString & aMimeType, @@ -266,11 +268,32 @@ private: nsPluginTag* FindPreferredPlugin(const InfallibleTArray& matches); - // Return an nsPluginTag for this type, if any. If aCheckEnabled is - // true, only enabled plugins will be returned. + // Find a plugin for the given type. If aIncludeFake is true a fake plugin + // will be preferred if one exists; otherwise a fake plugin will never be + // returned. If aCheckEnabled is false, disabled plugins can be returned. + nsIInternalPluginTag* FindPluginForType(const nsACString& aMimeType, + bool aIncludeFake, bool aCheckEnabled); + + // Find specifically a fake plugin for the given type. If aCheckEnabled is + // false, disabled plugins can be returned. + nsFakePluginTag* FindFakePluginForType(const nsACString & aMimeType, + bool aCheckEnabled); + + // Find specifically a fake plugin for the given extension. If aCheckEnabled + // is false, disabled plugins can be returned. aMimeType will be filled in + // with the MIME type the plugin is registered for. + nsFakePluginTag* FindFakePluginForExtension(const nsACString & aExtension, + /* out */ nsACString & aMimeType, + bool aCheckEnabled); + + // Find specifically a native (NPAPI) plugin for the given type. If + // aCheckEnabled is false, disabled plugins can be returned. nsPluginTag* FindNativePluginForType(const nsACString & aMimeType, bool aCheckEnabled); + // Find specifically a native (NPAPI) plugin for the given extension. If + // aCheckEnabled is false, disabled plugins can be returned. aMimeType will + // be filled in with the MIME type the plugin is registered for. nsPluginTag* FindNativePluginForExtension(const nsACString & aExtension, /* out */ nsACString & aMimeType, bool aCheckEnabled); @@ -285,8 +308,10 @@ private: // FIXME revisit, no ns prefix // Registers or unregisters the given mime type with the category manager - // (performs no checks - see UpdateCategoryManager) - enum nsRegisterType { ePluginRegister, ePluginUnregister }; + enum nsRegisterType { ePluginRegister, + ePluginUnregister, + // Checks if this type should still be registered first + ePluginMaybeUnregister }; void RegisterWithCategoryManager(const nsCString& aMimeType, nsRegisterType aType); @@ -349,6 +374,9 @@ private: nsRefPtr mCachedPlugins; nsRefPtr mInvalidPlugins; nsTArray< nsRefPtr > mPlayPreviewMimeTypes; + + nsTArray< nsRefPtr > mFakePlugins; + bool mPluginsLoaded; // set by pref plugin.override_internal_types diff --git a/dom/plugins/base/nsPluginTags.cpp b/dom/plugins/base/nsPluginTags.cpp index 7017771f6cf9..5d48c2a11f3a 100644 --- a/dom/plugins/base/nsPluginTags.cpp +++ b/dom/plugins/base/nsPluginTags.cpp @@ -22,8 +22,10 @@ #include #include "mozilla/dom/EncodingUtils.h" #include "mozilla/dom/ContentChild.h" +#include "mozilla/dom/FakePluginTagInitBinding.h" using mozilla::dom::EncodingUtils; +using mozilla::dom::FakePluginTagInit; using namespace mozilla; // These legacy flags are used in the plugin registry. The states are now @@ -786,6 +788,43 @@ NS_INTERFACE_TABLE_HEAD(nsFakePluginTag) NS_INTERFACE_TABLE_END NS_INTERFACE_TABLE_TAIL +/* static */ +nsresult +nsFakePluginTag::Create(const FakePluginTagInit& aInitDictionary, + nsFakePluginTag** aPluginTag) +{ + NS_ENSURE_TRUE(!aInitDictionary.mMimeEntries.IsEmpty(), NS_ERROR_INVALID_ARG); + + nsRefPtr tag = new nsFakePluginTag(); + nsresult rv = NS_NewURI(getter_AddRefs(tag->mHandlerURI), + aInitDictionary.mHandlerURI); + NS_ENSURE_SUCCESS(rv, rv); + + CopyUTF16toUTF8(aInitDictionary.mNiceName, tag->mNiceName); + CopyUTF16toUTF8(aInitDictionary.mFullPath, tag->mFullPath); + CopyUTF16toUTF8(aInitDictionary.mName, tag->mName); + CopyUTF16toUTF8(aInitDictionary.mDescription, tag->mDescription); + CopyUTF16toUTF8(aInitDictionary.mFileName, tag->mFileName); + CopyUTF16toUTF8(aInitDictionary.mVersion, tag->mVersion); + + for (const FakePluginMimeEntry& mimeEntry : aInitDictionary.mMimeEntries) { + CopyUTF16toUTF8(mimeEntry.mType, *tag->mMimeTypes.AppendElement()); + CopyUTF16toUTF8(mimeEntry.mDescription, + *tag->mMimeDescriptions.AppendElement()); + CopyUTF16toUTF8(mimeEntry.mExtension, *tag->mExtensions.AppendElement()); + } + + tag.forget(aPluginTag); + return NS_OK; +} + +bool +nsFakePluginTag::HandlerURIMatches(nsIURI* aURI) +{ + bool equals = false; + return NS_SUCCEEDED(mHandlerURI->Equals(aURI, &equals)) && equals; +} + NS_IMETHODIMP nsFakePluginTag::GetHandlerURI(nsIURI **aResult) { diff --git a/dom/plugins/base/nsPluginTags.h b/dom/plugins/base/nsPluginTags.h index 5452a44b1c4f..088b3a7838b1 100644 --- a/dom/plugins/base/nsPluginTags.h +++ b/dom/plugins/base/nsPluginTags.h @@ -20,6 +20,12 @@ struct PRLibrary; struct nsPluginInfo; class nsNPAPIPlugin; +namespace mozilla { +namespace dom { +struct FakePluginTagInit; +} // namespace dom +} // namespace mozilla + // An interface representing plugin tags internally. #define NS_IINTERNALPLUGINTAG_IID \ { 0xe8fdd227, 0x27da, 0x46ee, \ @@ -194,12 +200,18 @@ public: NS_DECL_NSIPLUGINTAG NS_DECL_NSIFAKEPLUGINTAG - nsFakePluginTag(); + static nsresult Create(const mozilla::dom::FakePluginTagInit& aInitDictionary, + nsFakePluginTag** aPluginTag); bool IsEnabled() override; const nsCString& GetNiceFileName() override; + bool HandlerURIMatches(nsIURI* aURI); + + nsIURI* HandlerURI() const { return mHandlerURI; } + private: + nsFakePluginTag(); virtual ~nsFakePluginTag(); // The URI of the handler for our fake plugin. diff --git a/dom/webidl/FakePluginTagInit.webidl b/dom/webidl/FakePluginTagInit.webidl new file mode 100644 index 000000000000..93cbad7f842b --- /dev/null +++ b/dom/webidl/FakePluginTagInit.webidl @@ -0,0 +1,39 @@ +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* 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/. + */ + +/** + * A fake plugin is fundamentally identified by its handlerURI. + * + * In addition to that, a fake plugin registration needs to provide at least one + * FakePluginMimeEntry so we'll know what types(s) the plugin is registered for. + * Other information is optional, though having usable niceName is highly + * recommended. + */ +dictionary FakePluginTagInit { + required DOMString handlerURI; + required sequence mimeEntries; + + // The niceName should really be provided, and be unique, if possible; it can + // be used as a key to persist state for this plug-in. + DOMString niceName = ""; + + // Other things can be provided but don't really matter that much. + DOMString fullPath = ""; + DOMString name = ""; + DOMString description = ""; + DOMString fileName = ""; + DOMString version = ""; +}; + +/** + * A single MIME entry for the fake plugin. + */ +dictionary FakePluginMimeEntry { + required DOMString type; + DOMString description = ""; + DOMString extension = ""; +}; + diff --git a/dom/webidl/moz.build b/dom/webidl/moz.build index fc340e7946b2..d17be17f422d 100644 --- a/dom/webidl/moz.build +++ b/dom/webidl/moz.build @@ -146,6 +146,7 @@ WEBIDL_FILES = [ 'EventSource.webidl', 'EventTarget.webidl', 'ExtendableEvent.webidl', + 'FakePluginTagInit.webidl', 'Fetch.webidl', 'FetchEvent.webidl', 'File.webidl', From 93e83551caea09583a47c32f89e9803719c403c4 Mon Sep 17 00:00:00 2001 From: Jan Varga Date: Sat, 25 Jul 2015 09:20:19 +0200 Subject: [PATCH 047/136] Bug 1183689 - Having moz-safe-about+home in storage/permanent and storage/persistent breaks temporary storage initialization; r=khuey --- dom/quota/QuotaManager.cpp | 32 +++++++++++++++++++++++++++++++- 1 file changed, 31 insertions(+), 1 deletion(-) diff --git a/dom/quota/QuotaManager.cpp b/dom/quota/QuotaManager.cpp index b8c4ef273f27..3098708132e1 100644 --- a/dom/quota/QuotaManager.cpp +++ b/dom/quota/QuotaManager.cpp @@ -5240,7 +5240,37 @@ StorageDirectoryHelper::ProcessOriginDirectories(bool aMove) } } - rv = originProps.mDirectory->MoveTo(permanentStorageDir, EmptyString()); + nsString leafName; + rv = originProps.mDirectory->GetLeafName(leafName); + if (NS_WARN_IF(NS_FAILED(rv))) { + return rv; + } + + nsCOMPtr newDirectory; + rv = permanentStorageDir->Clone(getter_AddRefs(newDirectory)); + if (NS_WARN_IF(NS_FAILED(rv))) { + return rv; + } + + rv = newDirectory->Append(leafName); + if (NS_WARN_IF(NS_FAILED(rv))) { + return rv; + } + + bool exists; + rv = newDirectory->Exists(&exists); + if (NS_WARN_IF(NS_FAILED(rv))) { + return rv; + } + + if (exists) { + QM_WARNING("Found %s in storage/persistent and storage/permanent !", + NS_ConvertUTF16toUTF8(leafName).get()); + + rv = originProps.mDirectory->Remove(/* recursive */ true); + } else { + rv = originProps.mDirectory->MoveTo(permanentStorageDir, EmptyString()); + } if (NS_WARN_IF(NS_FAILED(rv))) { return rv; } From 90daf6b5a617a283fc75c9a9e981068a048dbde2 Mon Sep 17 00:00:00 2001 From: Chris Manchester Date: Tue, 21 Jul 2015 15:27:30 -0700 Subject: [PATCH 048/136] Bug 1186233 - Set test_packages_url correctly when running wpt from mozharness but outside of buildbot. r=jgraham --HG-- extra : commitid : 81RUFAAXTwX --- testing/mozharness/scripts/web_platform_tests.py | 1 + 1 file changed, 1 insertion(+) diff --git a/testing/mozharness/scripts/web_platform_tests.py b/testing/mozharness/scripts/web_platform_tests.py index 07a582b147ba..cd267ef56669 100755 --- a/testing/mozharness/scripts/web_platform_tests.py +++ b/testing/mozharness/scripts/web_platform_tests.py @@ -57,6 +57,7 @@ class WebPlatformTest(TestingMixin, MercurialScript, BlobUploadMixin): c = self.config self.installer_url = c.get('installer_url') self.test_url = c.get('test_url') + self.test_packages_url = c.get('test_packages_url') self.installer_path = c.get('installer_path') self.binary_path = c.get('binary_path') self.abs_app_dir = None From 013413b9e2001a36a15c8756d73c605bcc916ed4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Julien=20Pag=C3=A8s?= Date: Sat, 25 Jul 2015 11:33:09 +0200 Subject: [PATCH 049/136] Bug 1186844 - remove deprecated 'results_urls' options when running talos from harness --HG-- extra : commitid : JLtHjKVKD2I extra : rebase_source : 3b8d33852d89cdb38201eb88d60e09ab45fc72ba --- testing/mozharness/configs/talos/linux_config.py | 1 - testing/mozharness/configs/talos/mac_config.py | 1 - testing/mozharness/configs/talos/windows_config.py | 1 - .../mozharness/mozharness/mozilla/testing/talos.py | 14 +------------- 4 files changed, 1 insertion(+), 16 deletions(-) diff --git a/testing/mozharness/configs/talos/linux_config.py b/testing/mozharness/configs/talos/linux_config.py index 3225306eb41d..2f9c7dec0586 100644 --- a/testing/mozharness/configs/talos/linux_config.py +++ b/testing/mozharness/configs/talos/linux_config.py @@ -19,7 +19,6 @@ config = { 'virtualenv': [PYTHON, '/tools/misc-python/virtualenv.py'], }, "title": os.uname()[1].lower().split('.')[0], - "results_url": "http://graphs.mozilla.org/server/collect.cgi", "default_actions": [ "clobber", "read-buildbot-config", diff --git a/testing/mozharness/configs/talos/mac_config.py b/testing/mozharness/configs/talos/mac_config.py index 2e1bce874738..0cb59e365081 100644 --- a/testing/mozharness/configs/talos/mac_config.py +++ b/testing/mozharness/configs/talos/mac_config.py @@ -29,7 +29,6 @@ config = { 'virtualenv': [PYTHON, '/tools/misc-python/virtualenv.py'], }, "title": os.uname()[1].lower().split('.')[0], - "results_url": "http://graphs.mozilla.org/server/collect.cgi", "default_actions": [ "clobber", "read-buildbot-config", diff --git a/testing/mozharness/configs/talos/windows_config.py b/testing/mozharness/configs/talos/windows_config.py index d3f3d4b750af..9ebdee2d4cb1 100644 --- a/testing/mozharness/configs/talos/windows_config.py +++ b/testing/mozharness/configs/talos/windows_config.py @@ -28,7 +28,6 @@ config = { 'hg': 'c:/mozilla-build/hg/hg', }, "title": socket.gethostname().split('.')[0], - "results_url": "http://graphs.mozilla.org/server/collect.cgi", "default_actions": [ "clobber", "read-buildbot-config", diff --git a/testing/mozharness/mozharness/mozilla/testing/talos.py b/testing/mozharness/mozharness/mozilla/testing/talos.py index cdfa412c6b47..1103101a33a1 100755 --- a/testing/mozharness/mozharness/mozilla/testing/talos.py +++ b/testing/mozharness/mozharness/mozilla/testing/talos.py @@ -74,12 +74,6 @@ talos_config_options = [ "default": [], "help": "Specify the tests to run" }], - [["--results-url"], - {'action': 'store', - 'dest': 'results_url', - 'default': None, - 'help': "URL to send results to" - }], ] @@ -163,11 +157,6 @@ class Talos(TestingMixin, MercurialScript, BlobUploadMixin): self.workdir = self.query_abs_dirs()['abs_work_dir'] # convenience - # results output - self.results_url = self.config.get('results_url') - if self.results_url is None: - # use a results_url by default based on the class name in the working directory - self.results_url = 'file://%s' % os.path.join(self.workdir, self.__class__.__name__.lower() + '.txt') self.installer_url = self.config.get("installer_url") self.talos_json_url = self.config.get("talos_json_url") self.talos_json = self.config.get("talos_json") @@ -422,8 +411,7 @@ class Talos(TestingMixin, MercurialScript, BlobUploadMixin): if binary_path.endswith('.exe'): binary_path = binary_path[:-4] kw_options = {'output': 'talos.yml', # options overwritten from **kw - 'executablePath': binary_path, - 'results_url': self.results_url} + 'executablePath': binary_path} kw_options['activeTests'] = self.query_tests() if self.config.get('title'): kw_options['title'] = self.config['title'] From 6eb7e623731eedcd384af53f29aca1648fae1582 Mon Sep 17 00:00:00 2001 From: "\"Anup Allamsetty\"" Date: Tue, 21 Jul 2015 06:43:00 -0400 Subject: [PATCH 050/136] Bug 1035097 - Changed the type from 'radio' to 'radioType'. r=jdm --- dom/system/NetworkGeolocationProvider.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dom/system/NetworkGeolocationProvider.js b/dom/system/NetworkGeolocationProvider.js index 190b9fb41c03..a594cea84389 100644 --- a/dom/system/NetworkGeolocationProvider.js +++ b/dom/system/NetworkGeolocationProvider.js @@ -444,7 +444,7 @@ WifiGeoPositionProvider.prototype = { break; // CDMA cases to be handled in bug 1010282 }; - result.push({ radio: radioTechFamily, + result.push({ radioType: radioTechFamily, mobileCountryCode: voice.network.mcc, mobileNetworkCode: voice.network.mnc, locationAreaCode: cell.gsmLocationAreaCode, From 8221faa2962344475b4f6f0267788b3a01970151 Mon Sep 17 00:00:00 2001 From: Eric Rahm Date: Sat, 25 Jul 2015 10:43:27 -0700 Subject: [PATCH 051/136] Bug 1183828 - Remove 'nsWindow::GetNativeData not implemented for this type' warning. r=roc --- widget/PuppetWidget.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/widget/PuppetWidget.cpp b/widget/PuppetWidget.cpp index 5ffd90816121..e6368fb36da6 100644 --- a/widget/PuppetWidget.cpp +++ b/widget/PuppetWidget.cpp @@ -1065,14 +1065,14 @@ PuppetWidget::GetNativeData(uint32_t aDataType) } return (void*)nativeData; } - case NS_NATIVE_WINDOW: + case NS_NATIVE_WIDGET: case NS_NATIVE_DISPLAY: + // These types are ignored (see bug 1183828). + break; + case NS_NATIVE_WINDOW: case NS_NATIVE_PLUGIN_PORT: case NS_NATIVE_GRAPHIC: case NS_NATIVE_SHELLWIDGET: - case NS_NATIVE_WIDGET: - NS_WARNING("nsWindow::GetNativeData not implemented for this type"); - break; default: NS_WARNING("nsWindow::GetNativeData called with bad value"); break; From 7e15eabc98653d42422f251df01ab4cf8b3411d6 Mon Sep 17 00:00:00 2001 From: Jan de Mooij Date: Sat, 25 Jul 2015 21:41:10 +0200 Subject: [PATCH 052/136] Bug 1187323 - Add some asserts to the assembler's linkJump/nextJump/setNextJump methods. r=nbp --- .../jit/x86-shared/BaseAssembler-x86-shared.h | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/js/src/jit/x86-shared/BaseAssembler-x86-shared.h b/js/src/jit/x86-shared/BaseAssembler-x86-shared.h index 7030780bc5a0..0b07ab393692 100644 --- a/js/src/jit/x86-shared/BaseAssembler-x86-shared.h +++ b/js/src/jit/x86-shared/BaseAssembler-x86-shared.h @@ -3824,6 +3824,13 @@ threeByteOpImmSimd("vblendps", VEX_PD, OP3_BLENDPS_VpsWpsIb, ESCAPE_3A, imm, off // Linking & patching: + void assertValidJmpSrc(JmpSrc src) + { + // The target offset is stored at offset - 4. + MOZ_ASSERT(src.offset() > int32_t(sizeof(int32_t))); + MOZ_ASSERT(size_t(src.offset()) <= size()); + } + bool nextJump(const JmpSrc& from, JmpSrc* next) { // Sanity check - if the assembler has OOM'd, it will start overwriting @@ -3831,10 +3838,14 @@ threeByteOpImmSimd("vblendps", VEX_PD, OP3_BLENDPS_VpsWpsIb, ESCAPE_3A, imm, off if (oom()) return false; + assertValidJmpSrc(from); + const unsigned char* code = m_formatter.data(); int32_t offset = GetInt32(code + from.offset()); if (offset == -1) return false; + + MOZ_ASSERT(size_t(offset) < size()); *next = JmpSrc(offset); return true; } @@ -3845,6 +3856,9 @@ threeByteOpImmSimd("vblendps", VEX_PD, OP3_BLENDPS_VpsWpsIb, ESCAPE_3A, imm, off if (oom()) return; + assertValidJmpSrc(from); + MOZ_ASSERT(to.offset() == -1 || size_t(to.offset()) <= size()); + unsigned char* code = m_formatter.data(); SetInt32(code + from.offset(), to.offset()); } @@ -3859,6 +3873,9 @@ threeByteOpImmSimd("vblendps", VEX_PD, OP3_BLENDPS_VpsWpsIb, ESCAPE_3A, imm, off if (oom()) return; + assertValidJmpSrc(from); + MOZ_ASSERT(size_t(to.offset()) <= size()); + spew(".set .Lfrom%d, .Llabel%d", from.offset(), to.offset()); unsigned char* code = m_formatter.data(); SetRel32(code + from.offset(), code + to.offset()); From 9d66aa4b3b88b09a4395562e684cd3d9b157392f Mon Sep 17 00:00:00 2001 From: Christoph Kerschbaumer Date: Sat, 25 Jul 2015 10:29:22 -0700 Subject: [PATCH 053/136] Bug 1182540 - Use channel->ascynOpen2 in dom/html/HTMLTrackElement.cpp (r=sicking) --- dom/html/HTMLTrackElement.cpp | 24 ++---------------- dom/security/nsContentSecurityManager.cpp | 31 ++++++++++++++--------- 2 files changed, 21 insertions(+), 34 deletions(-) diff --git a/dom/html/HTMLTrackElement.cpp b/dom/html/HTMLTrackElement.cpp index 1c0276aa2d02..bd375fb5eef4 100644 --- a/dom/html/HTMLTrackElement.cpp +++ b/dom/html/HTMLTrackElement.cpp @@ -203,26 +203,6 @@ HTMLTrackElement::LoadResource() mChannel = nullptr; } - rv = nsContentUtils::GetSecurityManager()-> - CheckLoadURIWithPrincipal(NodePrincipal(), uri, - nsIScriptSecurityManager::STANDARD); - NS_ENSURE_TRUE_VOID(NS_SUCCEEDED(rv)); - - int16_t shouldLoad = nsIContentPolicy::ACCEPT; - rv = NS_CheckContentLoadPolicy(nsIContentPolicy::TYPE_INTERNAL_TRACK, - uri, - NodePrincipal(), - static_cast(this), - NS_LITERAL_CSTRING("text/vtt"), // mime type - nullptr, // extra - &shouldLoad, - nsContentUtils::GetContentPolicy(), - nsContentUtils::GetSecurityManager()); - NS_ENSURE_TRUE_VOID(NS_SUCCEEDED(rv)); - if (NS_CP_REJECTED(shouldLoad)) { - return; - } - // We may already have a TextTrack at this point if GetTrack() has already // been called. This happens, for instance, if script tries to get the // TextTrack before its mTrackElement has been bound to the DOM tree. @@ -235,7 +215,7 @@ HTMLTrackElement::LoadResource() rv = NS_NewChannel(getter_AddRefs(channel), uri, static_cast(this), - nsILoadInfo::SEC_NORMAL, + nsILoadInfo::SEC_ALLOW_CROSS_ORIGIN_DATA_INHERITS, nsIContentPolicy::TYPE_INTERNAL_TRACK, loadGroup); @@ -247,7 +227,7 @@ HTMLTrackElement::LoadResource() channel->SetNotificationCallbacks(mListener); LOG(LogLevel::Debug, ("opening webvtt channel")); - rv = channel->AsyncOpen(mListener, nullptr); + rv = channel->AsyncOpen2(mListener); NS_ENSURE_TRUE_VOID(NS_SUCCEEDED(rv)); mChannel = channel; diff --git a/dom/security/nsContentSecurityManager.cpp b/dom/security/nsContentSecurityManager.cpp index 85dd05ce7140..c6ea0563fd71 100644 --- a/dom/security/nsContentSecurityManager.cpp +++ b/dom/security/nsContentSecurityManager.cpp @@ -115,7 +115,7 @@ DoContentSecurityChecks(nsIURI* aURI, nsILoadInfo* aLoadInfo) { nsContentPolicyType contentPolicyType = aLoadInfo->GetContentPolicyType(); nsCString mimeTypeGuess; - nsCOMPtr requestingContext = nullptr; + nsCOMPtr requestingContext = nullptr; switch(contentPolicyType) { case nsIContentPolicy::TYPE_OTHER: @@ -132,30 +132,37 @@ DoContentSecurityChecks(nsIURI* aURI, nsILoadInfo* aLoadInfo) // alias nsIContentPolicy::TYPE_DATAREQUEST: case nsIContentPolicy::TYPE_OBJECT_SUBREQUEST: case nsIContentPolicy::TYPE_DTD: - case nsIContentPolicy::TYPE_FONT: + case nsIContentPolicy::TYPE_FONT: { MOZ_ASSERT(false, "contentPolicyType not supported yet"); break; + } - case nsIContentPolicy::TYPE_MEDIA: - mimeTypeGuess = EmptyCString(); - requestingContext = aLoadInfo->LoadingNode(); -#ifdef DEBUG - { - nsCOMPtr element = do_QueryInterface(requestingContext); - NS_ASSERTION(element != nullptr, - "type_media requires requestingContext of type Element"); + case nsIContentPolicy::TYPE_MEDIA: { + nsContentPolicyType internalContentPolicyType = + aLoadInfo->InternalContentPolicyType(); + + if (internalContentPolicyType == nsIContentPolicy::TYPE_INTERNAL_TRACK) { + mimeTypeGuess = NS_LITERAL_CSTRING("text/vtt"); } -#endif + else { + mimeTypeGuess = EmptyCString(); + } + requestingContext = aLoadInfo->LoadingNode(); + MOZ_ASSERT(!requestingContext || + requestingContext->NodeType() == nsIDOMNode::ELEMENT_NODE, + "type_media requires requestingContext of type Element"); break; + } case nsIContentPolicy::TYPE_WEBSOCKET: case nsIContentPolicy::TYPE_CSP_REPORT: case nsIContentPolicy::TYPE_XSLT: case nsIContentPolicy::TYPE_BEACON: case nsIContentPolicy::TYPE_FETCH: - case nsIContentPolicy::TYPE_IMAGESET: + case nsIContentPolicy::TYPE_IMAGESET: { MOZ_ASSERT(false, "contentPolicyType not supported yet"); break; + } default: // nsIContentPolicy::TYPE_INVALID From da4787f45ed54bb05ebd2f7600c954ec4cf48dbc Mon Sep 17 00:00:00 2001 From: Mike Hommey Date: Sat, 25 Jul 2015 08:48:21 +0900 Subject: [PATCH 054/136] Bug 1177951 - Use a different base directory for the moztt package. r=mshal --- b2g/config/mozconfigs/linux32_gecko/debug | 2 +- b2g/config/mozconfigs/linux32_gecko/nightly | 2 +- b2g/config/mozconfigs/linux64_gecko/debug | 2 +- b2g/config/mozconfigs/linux64_gecko/nightly | 2 +- b2g/config/mozconfigs/macosx64_gecko/debug | 2 +- b2g/config/mozconfigs/macosx64_gecko/nightly | 2 +- b2g/config/mozconfigs/win32_gecko/debug | 2 +- b2g/config/mozconfigs/win32_gecko/nightly | 2 +- b2g/config/tooltool-manifests/linux32/releng.manifest | 6 +++--- b2g/config/tooltool-manifests/linux64/releng.manifest | 6 +++--- b2g/config/tooltool-manifests/macosx64/releng.manifest | 6 +++--- b2g/config/tooltool-manifests/win32/releng.manifest | 6 +++--- b2g/dev/config/mozconfigs/linux64/mulet | 2 +- b2g/dev/config/mozconfigs/macosx64/mulet | 2 +- b2g/dev/config/mozconfigs/win32/mulet | 2 +- b2g/dev/config/tooltool-manifests/linux64/releng.manifest | 6 +++--- b2g/dev/config/tooltool-manifests/macosx64/releng.manifest | 6 +++--- b2g/dev/config/tooltool-manifests/win32/releng.manifest | 6 +++--- 18 files changed, 32 insertions(+), 32 deletions(-) diff --git a/b2g/config/mozconfigs/linux32_gecko/debug b/b2g/config/mozconfigs/linux32_gecko/debug index c3bbe38a452c..9ba6ac90f90d 100644 --- a/b2g/config/mozconfigs/linux32_gecko/debug +++ b/b2g/config/mozconfigs/linux32_gecko/debug @@ -35,6 +35,6 @@ export CXXFLAGS=-DMOZ_ENABLE_JS_DUMP GAIADIR=$topsrcdir/gaia # Include Firefox OS fonts. -MOZTTDIR=$topsrcdir/moztt +MOZTTDIR=$topsrcdir/moz-tt . "$topsrcdir/b2g/config/mozconfigs/common.override" diff --git a/b2g/config/mozconfigs/linux32_gecko/nightly b/b2g/config/mozconfigs/linux32_gecko/nightly index 2dcad1b375d1..251ab2ccd064 100644 --- a/b2g/config/mozconfigs/linux32_gecko/nightly +++ b/b2g/config/mozconfigs/linux32_gecko/nightly @@ -34,7 +34,7 @@ export CXXFLAGS=-DMOZ_ENABLE_JS_DUMP GAIADIR=$topsrcdir/gaia # Include Firefox OS fonts. -MOZTTDIR=$topsrcdir/moztt +MOZTTDIR=$topsrcdir/moz-tt # Build simulator xpi and phone tweaks for b2g-desktop FXOS_SIMULATOR=1 diff --git a/b2g/config/mozconfigs/linux64_gecko/debug b/b2g/config/mozconfigs/linux64_gecko/debug index 1d1c3c60784f..71f4ec3ab0ba 100644 --- a/b2g/config/mozconfigs/linux64_gecko/debug +++ b/b2g/config/mozconfigs/linux64_gecko/debug @@ -35,6 +35,6 @@ export CXXFLAGS=-DMOZ_ENABLE_JS_DUMP GAIADIR=$topsrcdir/gaia # Include Firefox OS fonts. -MOZTTDIR=$topsrcdir/moztt +MOZTTDIR=$topsrcdir/moz-tt . "$topsrcdir/b2g/config/mozconfigs/common.override" diff --git a/b2g/config/mozconfigs/linux64_gecko/nightly b/b2g/config/mozconfigs/linux64_gecko/nightly index 5dfe2819956e..8ac486ed7210 100644 --- a/b2g/config/mozconfigs/linux64_gecko/nightly +++ b/b2g/config/mozconfigs/linux64_gecko/nightly @@ -34,7 +34,7 @@ export CXXFLAGS=-DMOZ_ENABLE_JS_DUMP GAIADIR=$topsrcdir/gaia # Include Firefox OS fonts. -MOZTTDIR=$topsrcdir/moztt +MOZTTDIR=$topsrcdir/moz-tt # Build simulator xpi and phone tweaks for b2g-desktop FXOS_SIMULATOR=1 diff --git a/b2g/config/mozconfigs/macosx64_gecko/debug b/b2g/config/mozconfigs/macosx64_gecko/debug index a3d19eb395cc..43e4bc182f4d 100644 --- a/b2g/config/mozconfigs/macosx64_gecko/debug +++ b/b2g/config/mozconfigs/macosx64_gecko/debug @@ -32,6 +32,6 @@ export CXXFLAGS=-DMOZ_ENABLE_JS_DUMP GAIADIR=$topsrcdir/gaia # Include Firefox OS fonts. -MOZTTDIR=$topsrcdir/moztt +MOZTTDIR=$topsrcdir/moz-tt . "$topsrcdir/b2g/config/mozconfigs/common.override" diff --git a/b2g/config/mozconfigs/macosx64_gecko/nightly b/b2g/config/mozconfigs/macosx64_gecko/nightly index a1b5b061a07f..d13ffe723637 100644 --- a/b2g/config/mozconfigs/macosx64_gecko/nightly +++ b/b2g/config/mozconfigs/macosx64_gecko/nightly @@ -30,7 +30,7 @@ export CXXFLAGS=-DMOZ_ENABLE_JS_DUMP GAIADIR=$topsrcdir/gaia # Include Firefox OS fonts. -MOZTTDIR=$topsrcdir/moztt +MOZTTDIR=$topsrcdir/moz-tt # Build simulator xpi and phone tweaks for b2g-desktop FXOS_SIMULATOR=1 diff --git a/b2g/config/mozconfigs/win32_gecko/debug b/b2g/config/mozconfigs/win32_gecko/debug index e67d627e2fe1..24ba78e034d5 100644 --- a/b2g/config/mozconfigs/win32_gecko/debug +++ b/b2g/config/mozconfigs/win32_gecko/debug @@ -29,6 +29,6 @@ export CXXFLAGS=-DMOZ_ENABLE_JS_DUMP GAIADIR=$topsrcdir/gaia # Include Firefox OS fonts. -MOZTTDIR=$topsrcdir/moztt +MOZTTDIR=$topsrcdir/moz-tt . "$topsrcdir/b2g/config/mozconfigs/common.override" diff --git a/b2g/config/mozconfigs/win32_gecko/nightly b/b2g/config/mozconfigs/win32_gecko/nightly index 9bb1203ae91f..19402d86b782 100644 --- a/b2g/config/mozconfigs/win32_gecko/nightly +++ b/b2g/config/mozconfigs/win32_gecko/nightly @@ -27,7 +27,7 @@ export CXXFLAGS=-DMOZ_ENABLE_JS_DUMP GAIADIR=$topsrcdir/gaia # Include Firefox OS fonts. -MOZTTDIR=$topsrcdir/moztt +MOZTTDIR=$topsrcdir/moz-tt # Build simulator xpi and phone tweaks for b2g-desktop FXOS_SIMULATOR=1 diff --git a/b2g/config/tooltool-manifests/linux32/releng.manifest b/b2g/config/tooltool-manifests/linux32/releng.manifest index 4b9f7ad4ed1b..604e98b09cd7 100644 --- a/b2g/config/tooltool-manifests/linux32/releng.manifest +++ b/b2g/config/tooltool-manifests/linux32/releng.manifest @@ -14,10 +14,10 @@ "unpack": true }, { -"size": 31057326, -"digest": "b844c3e52be493d2cacafa58c4a924b89c9be8d2dcc2a7c71aed58c253d8035fba4d51df309f73e3c4342a1f3c3898a9a25c4815e2112888d1280f43c41c8e51", +"size": 31078810, +"digest": "2dffe4e5419a0c0c9908dc52b01cc07379a42e2aa8481be7a26bb8750b586b95bbac3fe57e64f5d37b43e206516ea70ad938a2e45858fdcf1e28258e70ae8d8c", "algorithm": "sha512", -"filename": "moztt.tar.bz2", +"filename": "moz-tt.tar.bz2", "unpack": true } ] diff --git a/b2g/config/tooltool-manifests/linux64/releng.manifest b/b2g/config/tooltool-manifests/linux64/releng.manifest index 4b9f7ad4ed1b..604e98b09cd7 100644 --- a/b2g/config/tooltool-manifests/linux64/releng.manifest +++ b/b2g/config/tooltool-manifests/linux64/releng.manifest @@ -14,10 +14,10 @@ "unpack": true }, { -"size": 31057326, -"digest": "b844c3e52be493d2cacafa58c4a924b89c9be8d2dcc2a7c71aed58c253d8035fba4d51df309f73e3c4342a1f3c3898a9a25c4815e2112888d1280f43c41c8e51", +"size": 31078810, +"digest": "2dffe4e5419a0c0c9908dc52b01cc07379a42e2aa8481be7a26bb8750b586b95bbac3fe57e64f5d37b43e206516ea70ad938a2e45858fdcf1e28258e70ae8d8c", "algorithm": "sha512", -"filename": "moztt.tar.bz2", +"filename": "moz-tt.tar.bz2", "unpack": true } ] diff --git a/b2g/config/tooltool-manifests/macosx64/releng.manifest b/b2g/config/tooltool-manifests/macosx64/releng.manifest index 0867e800a5cb..a4ea213fb135 100644 --- a/b2g/config/tooltool-manifests/macosx64/releng.manifest +++ b/b2g/config/tooltool-manifests/macosx64/releng.manifest @@ -17,10 +17,10 @@ "unpack": true }, { -"size": 31057326, -"digest": "b844c3e52be493d2cacafa58c4a924b89c9be8d2dcc2a7c71aed58c253d8035fba4d51df309f73e3c4342a1f3c3898a9a25c4815e2112888d1280f43c41c8e51", +"size": 31078810, +"digest": "2dffe4e5419a0c0c9908dc52b01cc07379a42e2aa8481be7a26bb8750b586b95bbac3fe57e64f5d37b43e206516ea70ad938a2e45858fdcf1e28258e70ae8d8c", "algorithm": "sha512", -"filename": "moztt.tar.bz2", +"filename": "moz-tt.tar.bz2", "unpack": true } ] diff --git a/b2g/config/tooltool-manifests/win32/releng.manifest b/b2g/config/tooltool-manifests/win32/releng.manifest index 8cbd9fcee384..f0592ee141fa 100644 --- a/b2g/config/tooltool-manifests/win32/releng.manifest +++ b/b2g/config/tooltool-manifests/win32/releng.manifest @@ -6,10 +6,10 @@ "filename": "mozmake.exe" }, { -"size": 31057326, -"digest": "b844c3e52be493d2cacafa58c4a924b89c9be8d2dcc2a7c71aed58c253d8035fba4d51df309f73e3c4342a1f3c3898a9a25c4815e2112888d1280f43c41c8e51", +"size": 31078810, +"digest": "2dffe4e5419a0c0c9908dc52b01cc07379a42e2aa8481be7a26bb8750b586b95bbac3fe57e64f5d37b43e206516ea70ad938a2e45858fdcf1e28258e70ae8d8c", "algorithm": "sha512", -"filename": "moztt.tar.bz2", +"filename": "moz-tt.tar.bz2", "unpack": true }, { diff --git a/b2g/dev/config/mozconfigs/linux64/mulet b/b2g/dev/config/mozconfigs/linux64/mulet index b2f7dd3b6bba..f2b8977b0de6 100644 --- a/b2g/dev/config/mozconfigs/linux64/mulet +++ b/b2g/dev/config/mozconfigs/linux64/mulet @@ -8,4 +8,4 @@ ac_add_options --enable-default-toolkit=cairo-gtk2 ac_add_options --enable-application=b2g/dev # Include Firefox OS fonts. -MOZTTDIR=$topsrcdir/moztt +MOZTTDIR=$topsrcdir/moz-tt diff --git a/b2g/dev/config/mozconfigs/macosx64/mulet b/b2g/dev/config/mozconfigs/macosx64/mulet index 93bbf41eebd2..901e9892cc68 100644 --- a/b2g/dev/config/mozconfigs/macosx64/mulet +++ b/b2g/dev/config/mozconfigs/macosx64/mulet @@ -24,7 +24,7 @@ ac_add_options --enable-warnings-as-errors export MOZ_PACKAGE_JSSHELL=1 # Include Firefox OS fonts. -MOZTTDIR=$topsrcdir/moztt +MOZTTDIR=$topsrcdir/moz-tt . "$topsrcdir/build/mozconfig.common.override" . "$topsrcdir/build/mozconfig.cache" diff --git a/b2g/dev/config/mozconfigs/win32/mulet b/b2g/dev/config/mozconfigs/win32/mulet index 4cfdf8011831..f5a43bd6a33e 100644 --- a/b2g/dev/config/mozconfigs/win32/mulet +++ b/b2g/dev/config/mozconfigs/win32/mulet @@ -10,4 +10,4 @@ MOZ_AUTOMATION_SDK=0 ac_add_options --enable-application=b2g/dev # Include Firefox OS fonts. -MOZTTDIR=$topsrcdir/moztt +MOZTTDIR=$topsrcdir/moz-tt diff --git a/b2g/dev/config/tooltool-manifests/linux64/releng.manifest b/b2g/dev/config/tooltool-manifests/linux64/releng.manifest index 4b9f7ad4ed1b..604e98b09cd7 100644 --- a/b2g/dev/config/tooltool-manifests/linux64/releng.manifest +++ b/b2g/dev/config/tooltool-manifests/linux64/releng.manifest @@ -14,10 +14,10 @@ "unpack": true }, { -"size": 31057326, -"digest": "b844c3e52be493d2cacafa58c4a924b89c9be8d2dcc2a7c71aed58c253d8035fba4d51df309f73e3c4342a1f3c3898a9a25c4815e2112888d1280f43c41c8e51", +"size": 31078810, +"digest": "2dffe4e5419a0c0c9908dc52b01cc07379a42e2aa8481be7a26bb8750b586b95bbac3fe57e64f5d37b43e206516ea70ad938a2e45858fdcf1e28258e70ae8d8c", "algorithm": "sha512", -"filename": "moztt.tar.bz2", +"filename": "moz-tt.tar.bz2", "unpack": true } ] diff --git a/b2g/dev/config/tooltool-manifests/macosx64/releng.manifest b/b2g/dev/config/tooltool-manifests/macosx64/releng.manifest index 0867e800a5cb..a4ea213fb135 100644 --- a/b2g/dev/config/tooltool-manifests/macosx64/releng.manifest +++ b/b2g/dev/config/tooltool-manifests/macosx64/releng.manifest @@ -17,10 +17,10 @@ "unpack": true }, { -"size": 31057326, -"digest": "b844c3e52be493d2cacafa58c4a924b89c9be8d2dcc2a7c71aed58c253d8035fba4d51df309f73e3c4342a1f3c3898a9a25c4815e2112888d1280f43c41c8e51", +"size": 31078810, +"digest": "2dffe4e5419a0c0c9908dc52b01cc07379a42e2aa8481be7a26bb8750b586b95bbac3fe57e64f5d37b43e206516ea70ad938a2e45858fdcf1e28258e70ae8d8c", "algorithm": "sha512", -"filename": "moztt.tar.bz2", +"filename": "moz-tt.tar.bz2", "unpack": true } ] diff --git a/b2g/dev/config/tooltool-manifests/win32/releng.manifest b/b2g/dev/config/tooltool-manifests/win32/releng.manifest index a01b77812445..a5f5e436a937 100644 --- a/b2g/dev/config/tooltool-manifests/win32/releng.manifest +++ b/b2g/dev/config/tooltool-manifests/win32/releng.manifest @@ -13,10 +13,10 @@ "unpack": true }, { -"size": 31057326, -"digest": "b844c3e52be493d2cacafa58c4a924b89c9be8d2dcc2a7c71aed58c253d8035fba4d51df309f73e3c4342a1f3c3898a9a25c4815e2112888d1280f43c41c8e51", +"size": 31078810, +"digest": "2dffe4e5419a0c0c9908dc52b01cc07379a42e2aa8481be7a26bb8750b586b95bbac3fe57e64f5d37b43e206516ea70ad938a2e45858fdcf1e28258e70ae8d8c", "algorithm": "sha512", -"filename": "moztt.tar.bz2", +"filename": "moz-tt.tar.bz2", "unpack": true } ] From fe229c63662d7761facaad26145c39b76694a71f Mon Sep 17 00:00:00 2001 From: Mike Hommey Date: Thu, 23 Jul 2015 17:34:21 +0900 Subject: [PATCH 055/136] Bug 1177951 - Use tooltool on b2g desktop and mulet taskcluster builds. r=wcosta,r=garndt --- .../scripts/builder/install-packages.sh | 27 +++++-------------- testing/taskcluster/tasks/build.yml | 2 ++ .../tasks/builds/b2g_desktop_base.yml | 3 +-- .../taskcluster/tasks/builds/mulet_linux.yml | 1 + 4 files changed, 10 insertions(+), 23 deletions(-) diff --git a/testing/taskcluster/scripts/builder/install-packages.sh b/testing/taskcluster/scripts/builder/install-packages.sh index 2a290ea1c578..710881eb3c06 100755 --- a/testing/taskcluster/scripts/builder/install-packages.sh +++ b/testing/taskcluster/scripts/builder/install-packages.sh @@ -2,26 +2,11 @@ gecko_dir=$1 test -d $gecko_dir +test -n "$TOOLTOOL_CACHE" +test -n "$TOOLTOOL_MANIFEST" +test -n "$TOOLTOOL_REPO" +test -n "$TOOLTOOL_REV" -if [ ! -d "$gecko_dir/gcc" ]; then - cd $gecko_dir - curl https://s3-us-west-2.amazonaws.com/test-caching/packages/gcc.tar.xz | tar Jx - cd - -fi +tc-vcs checkout $gecko_dir/tooltool $TOOLTOOL_REPO $TOOLTOOL_REPO $TOOLTOOL_REV -if [ ! -d "$gecko_dir/sccache" ]; then - cd $gecko_dir - curl https://s3-us-west-2.amazonaws.com/test-caching/packages/sccache.tar.bz2 | tar jx - cd - -fi - -# Remove cached moztt directory if it exists when a user supplied a git url/revision -if [ ! -z $MOZTT_GIT_URL ] || [ ! -z $MOZTT_REVISION ]; then - echo "Removing cached moztt package" - rm -rf moztt -fi - -moztt_url=${MOZTT_GIT_URL:=https://github.com/mozilla-b2g/moztt} -moztt_revision=${MOZTT_REVISION:=master} - -tc-vcs checkout $gecko_dir/moztt $moztt_url $moztt_url $moztt_revision +(cd $gecko_dir; python $gecko_dir/tooltool/tooltool.py --url https://api.pub.build.mozilla.org/tooltool/ --overwrite -m $gecko_dir/$TOOLTOOL_MANIFEST fetch -c $TOOLTOOL_CACHE) diff --git a/testing/taskcluster/tasks/build.yml b/testing/taskcluster/tasks/build.yml index 02c2245227b4..79a9764249d9 100644 --- a/testing/taskcluster/tasks/build.yml +++ b/testing/taskcluster/tasks/build.yml @@ -55,6 +55,8 @@ task: MOZHARNESS_REPOSITORY: '{{mozharness_repository}}' MOZHARNESS_REV: '{{mozharness_rev}}' MOZHARNESS_REF: '{{mozharness_ref}}' + TOOLTOOL_REPO: 'https://github.com/mozilla/build-tooltool' + TOOLTOOL_REV: 'master' extra: index: diff --git a/testing/taskcluster/tasks/builds/b2g_desktop_base.yml b/testing/taskcluster/tasks/builds/b2g_desktop_base.yml index b86b35f428fa..2651e141c340 100644 --- a/testing/taskcluster/tasks/builds/b2g_desktop_base.yml +++ b/testing/taskcluster/tasks/builds/b2g_desktop_base.yml @@ -9,8 +9,7 @@ task: payload: env: MOZCONFIG: 'b2g/config/mozconfigs/linux64_gecko/nightly' - MOZTT_GIT_URL: '{{moztt_git_url}}' - MOZTT_REVISION: '{{moztt_revision}}' + TOOLTOOL_MANIFEST: 'b2g/config/tooltool-manifests/linux64/releng.manifest' command: - /bin/bash diff --git a/testing/taskcluster/tasks/builds/mulet_linux.yml b/testing/taskcluster/tasks/builds/mulet_linux.yml index 158b718fcf6a..572c47051dcd 100644 --- a/testing/taskcluster/tasks/builds/mulet_linux.yml +++ b/testing/taskcluster/tasks/builds/mulet_linux.yml @@ -29,6 +29,7 @@ task: env: MOZCONFIG: 'b2g/dev/config/mozconfigs/linux64/mulet' + TOOLTOOL_MANIFEST: 'b2g/dev/config/tooltool-manifests/linux64/releng.manifest' maxRunTime: 3600 From 7248054e9c1bf2523d90a75f3618b9c62dc49eba Mon Sep 17 00:00:00 2001 From: Terrence Cole Date: Sat, 25 Jul 2015 15:43:22 -0700 Subject: [PATCH 056/136] Bug 1187512 - Fix accumulated unified bustage in SpiderMonkey; r=jonco --HG-- extra : rebase_source : e0b625a8289cf6986d9f1ff161adac6b1b5fe23c --- js/src/asmjs/AsmJSModule.cpp | 7 +++++++ js/src/asmjs/AsmJSModule.h | 5 +---- js/src/builtin/Reflect.cpp | 4 ++++ js/src/builtin/TestingFunctions.cpp | 2 +- js/src/gc/StoreBuffer.h | 2 +- js/src/gc/Tracer.cpp | 1 + js/src/jit/BytecodeAnalysis.cpp | 1 + js/src/jit/IonAnalysis.cpp | 1 + js/src/jit/IonCaches.h | 1 + js/src/jit/JitSpewer.cpp | 10 ++++++++++ js/src/jit/JitSpewer.h | 8 +------- js/src/jit/JitcodeMap.cpp | 11 +++++++---- js/src/jit/MIR.cpp | 1 + js/src/jit/ScalarReplacement.cpp | 2 ++ js/src/jit/x64/Trampoline-x64.cpp | 2 ++ js/src/vm/Printer.h | 1 + js/src/vm/ReceiverGuard.cpp | 1 + js/src/vm/Shape.cpp | 1 + js/src/vm/UnboxedObject.cpp | 2 +- 19 files changed, 45 insertions(+), 18 deletions(-) diff --git a/js/src/asmjs/AsmJSModule.cpp b/js/src/asmjs/AsmJSModule.cpp index 446fbdd46bdb..b8fcc8a30cbf 100644 --- a/js/src/asmjs/AsmJSModule.cpp +++ b/js/src/asmjs/AsmJSModule.cpp @@ -1742,6 +1742,13 @@ AsmJSModule::changeHeap(Handle newHeap, JSContext* cx) return true; } +size_t +AsmJSModule::heapLength() const +{ + MOZ_ASSERT(isDynamicallyLinked()); + return maybeHeap_ ? maybeHeap_->byteLength() : 0; +} + void AsmJSModule::setProfilingEnabled(bool enabled, JSContext* cx) { diff --git a/js/src/asmjs/AsmJSModule.h b/js/src/asmjs/AsmJSModule.h index 0712e0450eb4..3b930d600dcd 100644 --- a/js/src/asmjs/AsmJSModule.h +++ b/js/src/asmjs/AsmJSModule.h @@ -1571,10 +1571,7 @@ class AsmJSModule MOZ_ASSERT(isDynamicallyLinked()); return maybeHeap_; } - size_t heapLength() const { - MOZ_ASSERT(isDynamicallyLinked()); - return maybeHeap_ ? maybeHeap_->byteLength() : 0; - } + size_t heapLength() const; bool profilingEnabled() const { MOZ_ASSERT(isDynamicallyLinked()); return profilingEnabled_; diff --git a/js/src/builtin/Reflect.cpp b/js/src/builtin/Reflect.cpp index f82a093decf2..2a6eb471bf48 100644 --- a/js/src/builtin/Reflect.cpp +++ b/js/src/builtin/Reflect.cpp @@ -6,10 +6,14 @@ #include "builtin/Reflect.h" +#include "jsarray.h" #include "jscntxt.h" +#include "vm/ArgumentsObject.h" #include "vm/Stack.h" +#include "vm/Interpreter-inl.h" + using namespace js; diff --git a/js/src/builtin/TestingFunctions.cpp b/js/src/builtin/TestingFunctions.cpp index 9c334be1bece..a0e4bb33f542 100644 --- a/js/src/builtin/TestingFunctions.cpp +++ b/js/src/builtin/TestingFunctions.cpp @@ -1455,7 +1455,7 @@ js::testingFunc_inIon(JSContext* cx, unsigned argc, Value* vp) ScriptFrameIter iter(cx); if (iter.isIon()) { // Reset the counter of the IonScript's script. - JitFrameIterator jitIter(cx); + jit::JitFrameIterator jitIter(cx); ++jitIter; jitIter.script()->resetWarmUpResetCounter(); } else { diff --git a/js/src/gc/StoreBuffer.h b/js/src/gc/StoreBuffer.h index 46d3a678a6ba..2b1243e065cd 100644 --- a/js/src/gc/StoreBuffer.h +++ b/js/src/gc/StoreBuffer.h @@ -450,7 +450,7 @@ class StoreBuffer } - void assertHasValueEdge(Value* vp) { + void assertHasValueEdge(JS::Value* vp) { MOZ_ASSERT(bufferVal.has(this, ValueEdge(vp)) || !ValueEdge(vp).maybeInRememberedSet(nursery_)); } diff --git a/js/src/gc/Tracer.cpp b/js/src/gc/Tracer.cpp index 4a4aeb8e72ea..ee24e65123bb 100644 --- a/js/src/gc/Tracer.cpp +++ b/js/src/gc/Tracer.cpp @@ -24,6 +24,7 @@ #include "vm/Shape.h" #include "vm/Symbol.h" +#include "jscompartmentinlines.h" #include "jsgcinlines.h" #include "vm/ObjectGroup-inl.h" diff --git a/js/src/jit/BytecodeAnalysis.cpp b/js/src/jit/BytecodeAnalysis.cpp index 3fd0b0bd0cae..66e09417c028 100644 --- a/js/src/jit/BytecodeAnalysis.cpp +++ b/js/src/jit/BytecodeAnalysis.cpp @@ -9,6 +9,7 @@ #include "jsopcode.h" #include "jit/JitSpewer.h" #include "jsopcodeinlines.h" +#include "jsscriptinlines.h" using namespace js; using namespace js::jit; diff --git a/js/src/jit/IonAnalysis.cpp b/js/src/jit/IonAnalysis.cpp index e7d44509a49f..98d1ca8d257c 100644 --- a/js/src/jit/IonAnalysis.cpp +++ b/js/src/jit/IonAnalysis.cpp @@ -18,6 +18,7 @@ #include "jsobjinlines.h" #include "jsopcodeinlines.h" +#include "jsscriptinlines.h" using namespace js; using namespace js::jit; diff --git a/js/src/jit/IonCaches.h b/js/src/jit/IonCaches.h index f9b84ee5bcc4..884604d33f34 100644 --- a/js/src/jit/IonCaches.h +++ b/js/src/jit/IonCaches.h @@ -14,6 +14,7 @@ #elif defined(JS_CODEGEN_MIPS) # include "jit/mips/Assembler-mips.h" #endif +#include "jit/JitCompartment.h" #include "jit/Registers.h" #include "jit/shared/Assembler-shared.h" #include "js/TrackedOptimizationInfo.h" diff --git a/js/src/jit/JitSpewer.cpp b/js/src/jit/JitSpewer.cpp index 4b064bf2be3c..afce391b0a88 100644 --- a/js/src/jit/JitSpewer.cpp +++ b/js/src/jit/JitSpewer.cpp @@ -12,6 +12,7 @@ #include "jit/Ion.h" #include "jit/MIR.h" +#include "jit/MIRGenerator.h" #include "vm/HelperThreads.h" @@ -238,6 +239,15 @@ IonSpewer::~IonSpewer() release(); } +GraphSpewer::GraphSpewer(TempAllocator *alloc) + : graph_(nullptr), + c1Printer_(alloc->lifoAlloc()), + jsonPrinter_(alloc->lifoAlloc()), + c1Spewer_(c1Printer_), + jsonSpewer_(jsonPrinter_) +{ +} + void GraphSpewer::init(MIRGraph* graph, JSScript* function) { diff --git a/js/src/jit/JitSpewer.h b/js/src/jit/JitSpewer.h index 5516e4ef411d..83fb8b6718ec 100644 --- a/js/src/jit/JitSpewer.h +++ b/js/src/jit/JitSpewer.h @@ -116,13 +116,7 @@ class GraphSpewer JSONSpewer jsonSpewer_; public: - explicit GraphSpewer(TempAllocator *alloc) - : graph_(nullptr), - c1Printer_(alloc->lifoAlloc()), - jsonPrinter_(alloc->lifoAlloc()), - c1Spewer_(c1Printer_), - jsonSpewer_(jsonPrinter_) - { } + explicit GraphSpewer(TempAllocator *alloc); bool isSpewing() const { return graph_; diff --git a/js/src/jit/JitcodeMap.cpp b/js/src/jit/JitcodeMap.cpp index 3a4f1cf2a2a0..a386423df509 100644 --- a/js/src/jit/JitcodeMap.cpp +++ b/js/src/jit/JitcodeMap.cpp @@ -8,23 +8,26 @@ #include "mozilla/DebugOnly.h" #include "mozilla/MathAlgorithms.h" +#include "mozilla/Maybe.h" #include "mozilla/SizePrintfMacros.h" #include "mozilla/UniquePtr.h" + #include "jsprf.h" + #include "gc/Marking.h" #include "gc/Statistics.h" - #include "jit/BaselineJIT.h" #include "jit/JitSpewer.h" - #include "js/Vector.h" #include "vm/SPSProfiler.h" + #include "jsscriptinlines.h" +using mozilla::Maybe; + namespace js { namespace jit { - static inline JitcodeRegionEntry RegionAtAddr(const JitcodeGlobalEntry::IonEntry& entry, void* ptr, uint32_t* ptrOffset) @@ -1052,7 +1055,7 @@ JitcodeGlobalEntry::IonCacheEntry::forEachOptimizationAttempt( entry.forEachOptimizationAttempt(rt, index, op); // Record the outcome associated with the stub. - op(TrackedStrategy::InlineCache_OptimizedStub, trackedOutcome_); + op(JS::TrackedStrategy::InlineCache_OptimizedStub, trackedOutcome_); } void diff --git a/js/src/jit/MIR.cpp b/js/src/jit/MIR.cpp index 01c15a08f81a..56673fa8fc2d 100644 --- a/js/src/jit/MIR.cpp +++ b/js/src/jit/MIR.cpp @@ -25,6 +25,7 @@ #include "jsatominlines.h" #include "jsobjinlines.h" +#include "jsscriptinlines.h" #include "jit/AtomicOperations-inl.h" diff --git a/js/src/jit/ScalarReplacement.cpp b/js/src/jit/ScalarReplacement.cpp index 7667be405aa0..9aa9021eeca7 100644 --- a/js/src/jit/ScalarReplacement.cpp +++ b/js/src/jit/ScalarReplacement.cpp @@ -15,6 +15,8 @@ #include "jit/MIRGraph.h" #include "vm/UnboxedObject.h" +#include "jsobjinlines.h" + namespace js { namespace jit { diff --git a/js/src/jit/x64/Trampoline-x64.cpp b/js/src/jit/x64/Trampoline-x64.cpp index 3a45a5a8c97f..a15a871c5f49 100644 --- a/js/src/jit/x64/Trampoline-x64.cpp +++ b/js/src/jit/x64/Trampoline-x64.cpp @@ -14,6 +14,8 @@ #include "jit/VMFunctions.h" #include "jit/x64/SharedICHelpers-x64.h" +#include "jit/MacroAssembler-inl.h" + using namespace js; using namespace js::jit; diff --git a/js/src/vm/Printer.h b/js/src/vm/Printer.h index ef759d283cff..29763a39620b 100644 --- a/js/src/vm/Printer.h +++ b/js/src/vm/Printer.h @@ -8,6 +8,7 @@ #define vm_Printer_h #include +#include #include class JSString; diff --git a/js/src/vm/ReceiverGuard.cpp b/js/src/vm/ReceiverGuard.cpp index 81b36ce387ec..d491c5e44eb4 100644 --- a/js/src/vm/ReceiverGuard.cpp +++ b/js/src/vm/ReceiverGuard.cpp @@ -8,6 +8,7 @@ #include "builtin/TypedObject.h" #include "vm/UnboxedObject.h" +#include "jsobjinlines.h" using namespace js; diff --git a/js/src/vm/Shape.cpp b/js/src/vm/Shape.cpp index f16f684925c2..045988665e3f 100644 --- a/js/src/vm/Shape.cpp +++ b/js/src/vm/Shape.cpp @@ -20,6 +20,7 @@ #include "js/HashTable.h" #include "jscntxtinlines.h" +#include "jscompartmentinlines.h" #include "jsobjinlines.h" #include "vm/NativeObject-inl.h" diff --git a/js/src/vm/UnboxedObject.cpp b/js/src/vm/UnboxedObject.cpp index 38d11bdff389..abfce4844aff 100644 --- a/js/src/vm/UnboxedObject.cpp +++ b/js/src/vm/UnboxedObject.cpp @@ -338,7 +338,7 @@ UnboxedPlainObject::ensureExpando(JSContext* cx, Handle obj return obj->expando_; UnboxedExpandoObject* expando = - NewObjectWithGivenProto(cx, nullptr, AllocKind::OBJECT4); + NewObjectWithGivenProto(cx, nullptr, gc::AllocKind::OBJECT4); if (!expando) return nullptr; From acd50e6653713cfcd44d5834725a1317a63d5283 Mon Sep 17 00:00:00 2001 From: Mike Hommey Date: Sun, 26 Jul 2015 11:39:44 +0900 Subject: [PATCH 057/136] No bug - Remove outdated comment and additional comment questioning its relevance. r=me DONTBUILD The first half of the comment was added in bug 534467. At that point the code looked like: // NOTE! dst is the same as src, and this relies on reading // from src and advancing that ptr before writing to dst. PRUint8 *src = aData; PRUint8 *dst = aData; It was in content/canvas/src/nsCanvasRenderingContext2D.cpp. Then bug 651858 added nsCanvasRenderingContext2DAzure.cpp, starting from nsCanvasRenderingContext2D.cpp. The comment was kept, but the code was modified such that src and dst were different things. Then bug 734668 removed nsCanvasRenderingContext2D.cpp, and finally renamed nsCanvasRenderingContext2DAzure.cpp to CanvasRenderingContext2D.cpp. The comment questioning the relevance of the first comment was added in bug 764125, when the file was still nsCanvasRenderingContext2DAzure.cpp. --- dom/canvas/CanvasRenderingContext2D.cpp | 4 ---- 1 file changed, 4 deletions(-) diff --git a/dom/canvas/CanvasRenderingContext2D.cpp b/dom/canvas/CanvasRenderingContext2D.cpp index eaf781e76df9..d3eb5cbee19a 100644 --- a/dom/canvas/CanvasRenderingContext2D.cpp +++ b/dom/canvas/CanvasRenderingContext2D.cpp @@ -5074,10 +5074,6 @@ CanvasRenderingContext2D::GetImageDataArray(JSContext* aCx, srcStride = aWidth * 4; } - // NOTE! dst is the same as src, and this relies on reading - // from src and advancing that ptr before writing to dst. - // NOTE! I'm not sure that it is, I think this comment might have been - // inherited from Thebes canvas and is no longer true uint8_t* dst = data + dstWriteRect.y * (aWidth * 4) + dstWriteRect.x * 4; if (mOpaque) { From 0e667e1911729239b201e0e5db2cd821a2467b8b Mon Sep 17 00:00:00 2001 From: Masayuki Nakano Date: Sun, 26 Jul 2015 12:29:47 +0900 Subject: [PATCH 058/136] Bug 1184533 Rewrite range check in aOffset of nsIMM32Handler::GetCharacterRectOfSelectedTextAt() r=emk --- widget/windows/IMMHandler.cpp | 69 ++++++++++++++++++++++++++++------- widget/windows/IMMHandler.h | 29 +++++++++++++++ 2 files changed, 84 insertions(+), 14 deletions(-) diff --git a/widget/windows/IMMHandler.cpp b/widget/windows/IMMHandler.cpp index 0bd9331594e2..2be682693e99 100644 --- a/widget/windows/IMMHandler.cpp +++ b/widget/windows/IMMHandler.cpp @@ -1248,6 +1248,7 @@ IMMHandler::HandleStartComposition(nsWindow* aWindow, AdjustCompositionFont(aContext, selection.mWritingMode); mCompositionStart = selection.mOffset; + mCursorPosition = NO_IME_CARET; WidgetCompositionEvent event(true, NS_COMPOSITION_START, aWindow); nsIntPoint point(0, 0); @@ -2096,23 +2097,63 @@ IMMHandler::GetCharacterRectOfSelectedTextAt(nsWindow* aWindow, return false; } - uint32_t offset = selection.mOffset + aOffset; - bool useCaretRect = selection.mString.IsEmpty(); - if (useCaretRect && ShouldDrawCompositionStringOurselves() && - mIsComposing && !mCompositionString.IsEmpty()) { - // There is not a normal selection, but we have composition string. - // XXX mnakano - Should we implement NS_QUERY_IME_SELECTED_TEXT? - useCaretRect = false; - if (mCursorPosition != NO_IME_CARET) { - uint32_t cursorPosition = - std::min(mCursorPosition, mCompositionString.Length()); - NS_ASSERTION(offset >= cursorPosition, "offset is less than cursorPosition!"); - offset -= cursorPosition; + // The base offset of aOffset is the start of composition string during + // composing or the start of selected string not during composing. + uint32_t baseOffset = + mIsComposing ? mCompositionStart : selection.mOffset; + + CheckedInt checkingOffset = + CheckedInt(baseOffset) + aOffset; + if (NS_WARN_IF(!checkingOffset.isValid()) || + checkingOffset.value() == UINT32_MAX) { + MOZ_LOG(gIMMLog, LogLevel::Error, + ("IMM: GetCharacterRectOfSelectedTextAt, FAILED, due to " + "aOffset is too large (aOffset=%u, baseOffset=%u, mIsComposing=%s)", + aOffset, baseOffset, GetBoolName(mIsComposing))); + return false; + } + + // If the offset is larger than the end of composition string or selected + // string, we should return false since such case must be a bug of the caller + // or the active IME. If it's an IME's bug, we need to set targetLength to + // aOffset. + uint32_t targetLength = + mIsComposing ? mCompositionString.Length() : selection.Length(); + if (NS_WARN_IF(aOffset > targetLength)) { + MOZ_LOG(gIMMLog, LogLevel::Error, + ("IMM: GetCharacterRectOfSelectedTextAt, FAILED, due to " + "aOffset is too large (aOffset=%u, targetLength=%u, mIsComposing=%s)", + aOffset, targetLength, GetBoolName(mIsComposing))); + return false; + } + + uint32_t offset = checkingOffset.value(); + + // If there is caret, we might be able to use caret rect. + uint32_t caretOffset = UINT32_MAX; + // There is a caret only when the normal selection is collapsed. + if (selection.Collapsed()) { + if (mIsComposing) { + // If it's composing, mCursorPosition is the offset to caret in + // the composition string. + if (mCursorPosition != NO_IME_CARET) { + MOZ_ASSERT(mCursorPosition >= 0); + caretOffset = mCompositionStart + mCursorPosition; + } else if (!ShouldDrawCompositionStringOurselves() || + mCompositionString.IsEmpty()) { + // Otherwise, if there is no composition string, we should assume that + // there is a caret at the start of composition string. + caretOffset = mCompositionStart; + } + } else { + // If there is no composition, the selection offset is the caret offset. + caretOffset = selection.mOffset; } } - nsIntRect r; - if (!useCaretRect) { + // If there is a caret and retrieving offset is same as the caret offset, + // we should use the caret rect. + if (offset != caretOffset) { WidgetQueryContentEvent charRect(true, NS_QUERY_TEXT_RECT, aWindow); charRect.InitForQueryTextRect(offset, 1); aWindow->InitEvent(charRect, &point); diff --git a/widget/windows/IMMHandler.h b/widget/windows/IMMHandler.h index bdde8f80c9af..c01a8a441cfd 100644 --- a/widget/windows/IMMHandler.h +++ b/widget/windows/IMMHandler.h @@ -279,11 +279,39 @@ protected: const IMEContext& aContext); void SetIMERelatedWindowsPosOnPlugin(nsWindow* aWindow, const IMEContext& aContext); + /** + * GetCharacterRectOfSelectedTextAt() returns character rect of the offset + * from the selection start or the start of composition string if there is + * a composition. + * + * @param aWindow The window which has focus. + * @param aOffset Offset from the selection start or the start of + * composition string when there is a composition. + * This must be in the selection range or + * the composition string. + * @param aCharRect The result. + * @param aWritingMode The writing mode of current selection. When this + * is nullptr, this assumes that the selection is in + * horizontal writing mode. + * @return true if this succeeded to retrieve the rect. + * Otherwise, false. + */ bool GetCharacterRectOfSelectedTextAt( nsWindow* aWindow, uint32_t aOffset, nsIntRect& aCharRect, mozilla::WritingMode* aWritingMode = nullptr); + /** + * GetCaretRect() returns caret rect at current selection start. + * + * @param aWindow The window which has focus. + * @param aCaretRect The result. + * @param aWritingMode The writing mode of current selection. When this + * is nullptr, this assumes that the selection is in + * horizontal writing mode. + * @return true if this succeeded to retrieve the rect. + * Otherwise, false. + */ bool GetCaretRect(nsWindow* aWindow, nsIntRect& aCaretRect, mozilla::WritingMode* aWritingMode = nullptr); @@ -402,6 +430,7 @@ protected: mIsValid = false; } uint32_t Length() const { return mString.Length(); } + bool Collapsed() const { return !Length(); } bool IsValid() const; bool Update(const IMENotification& aIMENotification); From 0f87c9db553ab85a405beef071adcafe5ac70c95 Mon Sep 17 00:00:00 2001 From: Masayuki Nakano Date: Sun, 26 Jul 2015 12:29:47 +0900 Subject: [PATCH 059/136] Bug 1187351 TSFTextStore should forget modified range at notifying TSF of layout change since GetTextExt() shouldn't return TS_E_NOLAYOUT after that r=emk --- widget/windows/TSFTextStore.cpp | 6 ++++++ widget/windows/TSFTextStore.h | 5 +++++ 2 files changed, 11 insertions(+) diff --git a/widget/windows/TSFTextStore.cpp b/widget/windows/TSFTextStore.cpp index f76f1fd262d7..aeb58d431e20 100644 --- a/widget/windows/TSFTextStore.cpp +++ b/widget/windows/TSFTextStore.cpp @@ -4555,6 +4555,12 @@ TSFTextStore::NotifyTSFOfLayoutChange(bool aFlush) { mPendingOnLayoutChange = false; + // Now, layout has been computed. We should notify mLockedContent for + // making GetTextExt() and GetACPFromPoint() not return TS_E_NOLAYOUT. + if (mLockedContent.IsInitialized()) { + mLockedContent.OnLayoutChanged(); + } + // This method should return true if either way succeeds. bool ret = false; diff --git a/widget/windows/TSFTextStore.h b/widget/windows/TSFTextStore.h index 38b316ab1305..0e3828d84982 100644 --- a/widget/windows/TSFTextStore.h +++ b/widget/windows/TSFTextStore.h @@ -624,6 +624,11 @@ protected: mInitialized = true; } + void OnLayoutChanged() + { + mMinTextModifiedOffset = NOT_MODIFIED; + } + const nsDependentSubstring GetSelectedText() const; const nsDependentSubstring GetSubstring(uint32_t aStart, uint32_t aLength) const; From 904118cf2256f0dfea51cb1e719fdfde1f423ba3 Mon Sep 17 00:00:00 2001 From: Masayuki Nakano Date: Sun, 26 Jul 2015 12:29:47 +0900 Subject: [PATCH 060/136] Bug 1187367 TSFTextStore shouldn't destroy native caret for ATOK until notifying TSF of layout change r=emk --- widget/windows/TSFTextStore.cpp | 31 +++++++++++++++++++++++-------- widget/windows/TSFTextStore.h | 2 ++ 2 files changed, 25 insertions(+), 8 deletions(-) diff --git a/widget/windows/TSFTextStore.cpp b/widget/windows/TSFTextStore.cpp index aeb58d431e20..21e3009fc65f 100644 --- a/widget/windows/TSFTextStore.cpp +++ b/widget/windows/TSFTextStore.cpp @@ -1350,6 +1350,8 @@ TSFTextStore::Destroy() CommitCompositionInternal(false); } + MaybeDestroyNativeCaret(); + if (mSink) { MOZ_LOG(sTextStoreLog, LogLevel::Debug, ("TSF: 0x%p TSFTextStore::Destroy(), calling " @@ -1579,10 +1581,6 @@ TSFTextStore::RequestLock(DWORD dwLockFlags, void TSFTextStore::DidLockGranted() { - if (mNativeCaretIsCreated) { - ::DestroyCaret(); - mNativeCaretIsCreated = false; - } if (IsReadWriteLocked()) { // FreeCJ (TIP for Traditional Chinese) calls SetSelection() to set caret // to the start of composition string and insert a full width space for @@ -3517,10 +3515,6 @@ TSFTextStore::GetTextExt(TsViewCookie vcView, mComposition.IsComposing() && mComposition.mStart <= acpStart && mComposition.EndOffset() >= acpStart && mComposition.mStart <= acpEnd && mComposition.EndOffset() >= acpEnd) { - if (mNativeCaretIsCreated) { - ::DestroyCaret(); - mNativeCaretIsCreated = false; - } CreateNativeCaret(); } @@ -4561,6 +4555,10 @@ TSFTextStore::NotifyTSFOfLayoutChange(bool aFlush) mLockedContent.OnLayoutChanged(); } + // Now, the caret position is different from ours. Destroy the native caret + // if there is. + MaybeDestroyNativeCaret(); + // This method should return true if either way succeeds. bool ret = false; @@ -4684,6 +4682,8 @@ TSFTextStore::OnMouseButtonEventInternal( void TSFTextStore::CreateNativeCaret() { + MaybeDestroyNativeCaret(); + MOZ_LOG(sTextStoreLog, LogLevel::Debug, ("TSF: 0x%p TSFTextStore::CreateNativeCaret(), " "mComposition.IsComposing()=%s", @@ -4739,6 +4739,21 @@ TSFTextStore::CreateNativeCaret() ::SetCaretPos(caretRect.x, caretRect.y); } +void +TSFTextStore::MaybeDestroyNativeCaret() +{ + if (!mNativeCaretIsCreated) { + return; + } + + MOZ_LOG(sTextStoreLog, LogLevel::Debug, + ("TSF: 0x%p TSFTextStore::MaybeDestroyNativeCaret(), " + "destroying native caret", this)); + + ::DestroyCaret(); + mNativeCaretIsCreated = false; +} + void TSFTextStore::CommitCompositionInternal(bool aDiscard) { diff --git a/widget/windows/TSFTextStore.h b/widget/windows/TSFTextStore.h index 0e3828d84982..7b7892e53180 100644 --- a/widget/windows/TSFTextStore.h +++ b/widget/windows/TSFTextStore.h @@ -306,6 +306,8 @@ protected: // Creates native caret over our caret. This method only works on desktop // application. Otherwise, this does nothing. void CreateNativeCaret(); + // Destroys native caret if there is. + void MaybeDestroyNativeCaret(); // Holds the pointer to our current win32 widget nsRefPtr mWidget; From 1181ff2812ad75999b1e36e22617c5df0c749177 Mon Sep 17 00:00:00 2001 From: Andrea Marchesini Date: Sun, 26 Jul 2015 08:38:16 +0100 Subject: [PATCH 061/136] Bug 1187371 - Get rid of dom.broadcastChannel.enabled pref, r=bz --- b2g/app/b2g.js | 3 - dom/broadcastchannel/BroadcastChannel.cpp | 43 ----------- dom/broadcastchannel/BroadcastChannel.h | 2 - .../tests/broadcastchannel_pref_worker.js | 11 --- dom/broadcastchannel/tests/mochitest.ini | 2 - .../tests/test_broadcastchannel_any.html | 2 +- .../tests/test_broadcastchannel_basic.html | 2 +- .../tests/test_broadcastchannel_close.html | 2 +- .../test_broadcastchannel_mozbrowser.html | 3 +- .../test_broadcastchannel_mozbrowser2.html | 3 +- .../tests/test_broadcastchannel_pref.html | 72 ------------------- ...est_broadcastchannel_private_browsing.html | 2 +- .../tests/test_broadcastchannel_self.html | 2 +- .../test_broadcastchannel_sharedWorker.html | 3 +- .../tests/test_broadcastchannel_worker.html | 2 +- .../test_broadcastchannel_worker_alive.html | 2 +- dom/webidl/BroadcastChannel.webidl | 3 +- modules/libpref/init/all.js | 3 - 18 files changed, 11 insertions(+), 151 deletions(-) delete mode 100644 dom/broadcastchannel/tests/broadcastchannel_pref_worker.js delete mode 100644 dom/broadcastchannel/tests/test_broadcastchannel_pref.html diff --git a/b2g/app/b2g.js b/b2g/app/b2g.js index 38f682c5c4ef..136aace65078 100644 --- a/b2g/app/b2g.js +++ b/b2g/app/b2g.js @@ -1118,9 +1118,6 @@ pref("services.mobileid.server.uri", "https://msisdn.services.mozilla.com"); pref("dom.mapped_arraybuffer.enabled", true); #endif -// BroadcastChannel API -pref("dom.broadcastChannel.enabled", true); - // SystemUpdate API pref("dom.system_update.enabled", true); diff --git a/dom/broadcastchannel/BroadcastChannel.cpp b/dom/broadcastchannel/BroadcastChannel.cpp index b6331473c675..b3547da485c1 100644 --- a/dom/broadcastchannel/BroadcastChannel.cpp +++ b/dom/broadcastchannel/BroadcastChannel.cpp @@ -12,7 +12,6 @@ #include "mozilla/ipc/BackgroundChild.h" #include "mozilla/ipc/BackgroundUtils.h" #include "mozilla/ipc/PBackgroundChild.h" -#include "mozilla/Preferences.h" #include "WorkerPrivate.h" #include "WorkerRunnable.h" @@ -299,50 +298,8 @@ private: } }; -class PrefEnabledRunnable final : public WorkerMainThreadRunnable -{ -public: - explicit PrefEnabledRunnable(WorkerPrivate* aWorkerPrivate) - : WorkerMainThreadRunnable(aWorkerPrivate) - , mEnabled(false) - { } - - bool MainThreadRun() override - { - AssertIsOnMainThread(); - mEnabled = Preferences::GetBool("dom.broadcastChannel.enabled", false); - return true; - } - - bool IsEnabled() const - { - return mEnabled; - } - -private: - bool mEnabled; -}; - } // namespace -/* static */ bool -BroadcastChannel::IsEnabled(JSContext* aCx, JSObject* aGlobal) -{ - if (NS_IsMainThread()) { - return Preferences::GetBool("dom.broadcastChannel.enabled", false); - } - - WorkerPrivate* workerPrivate = GetCurrentThreadWorkerPrivate(); - MOZ_ASSERT(workerPrivate); - workerPrivate->AssertIsOnWorkerThread(); - - nsRefPtr runnable = - new PrefEnabledRunnable(workerPrivate); - runnable->Dispatch(workerPrivate->GetJSContext()); - - return runnable->IsEnabled(); -} - BroadcastChannel::BroadcastChannel(nsPIDOMWindow* aWindow, const PrincipalInfo& aPrincipalInfo, const nsACString& aOrigin, diff --git a/dom/broadcastchannel/BroadcastChannel.h b/dom/broadcastchannel/BroadcastChannel.h index 65af55e76956..a22fa0b2a608 100644 --- a/dom/broadcastchannel/BroadcastChannel.h +++ b/dom/broadcastchannel/BroadcastChannel.h @@ -47,8 +47,6 @@ public: NS_DECL_CYCLE_COLLECTION_CLASS_INHERITED(BroadcastChannel, DOMEventTargetHelper) - static bool IsEnabled(JSContext* aCx, JSObject* aGlobal); - virtual JSObject* WrapObject(JSContext* aCx, JS::Handle aGivenProto) override; diff --git a/dom/broadcastchannel/tests/broadcastchannel_pref_worker.js b/dom/broadcastchannel/tests/broadcastchannel_pref_worker.js deleted file mode 100644 index 639d8e258fc7..000000000000 --- a/dom/broadcastchannel/tests/broadcastchannel_pref_worker.js +++ /dev/null @@ -1,11 +0,0 @@ -onmessage = function() { - var exists = true; - try { - var bc = new BroadcastChannel('foobar'); - } catch(e) { - exists = false; - } - - postMessage({ exists: exists }); -} - diff --git a/dom/broadcastchannel/tests/mochitest.ini b/dom/broadcastchannel/tests/mochitest.ini index 8ba17d77cfdf..0be255e4bcc3 100644 --- a/dom/broadcastchannel/tests/mochitest.ini +++ b/dom/broadcastchannel/tests/mochitest.ini @@ -1,7 +1,6 @@ [DEFAULT] support-files = iframe_broadcastchannel.html - broadcastchannel_pref_worker.js broadcastchannel_sharedWorker.js broadcastchannel_worker.js broadcastchannel_worker_alive.js @@ -17,7 +16,6 @@ support-files = [test_broadcastchannel_basic.html] [test_broadcastchannel_close.html] [test_broadcastchannel_self.html] -[test_broadcastchannel_pref.html] [test_broadcastchannel_sharedWorker.html] [test_broadcastchannel_worker.html] [test_broadcastchannel_worker_alive.html] diff --git a/dom/broadcastchannel/tests/test_broadcastchannel_any.html b/dom/broadcastchannel/tests/test_broadcastchannel_any.html index 38535ce1474a..2225e7cad9a6 100644 --- a/dom/broadcastchannel/tests/test_broadcastchannel_any.html +++ b/dom/broadcastchannel/tests/test_broadcastchannel_any.html @@ -130,7 +130,7 @@ function runTest() { } SimpleTest.waitForExplicitFinish(); -SpecialPowers.pushPrefEnv({"set": [["dom.broadcastChannel.enabled", true]]}, runTest); +runTest(); diff --git a/dom/broadcastchannel/tests/test_broadcastchannel_basic.html b/dom/broadcastchannel/tests/test_broadcastchannel_basic.html index eeb748138123..6aecf6c048b4 100644 --- a/dom/broadcastchannel/tests/test_broadcastchannel_basic.html +++ b/dom/broadcastchannel/tests/test_broadcastchannel_basic.html @@ -55,7 +55,7 @@ function runTest() { } SimpleTest.waitForExplicitFinish(); -SpecialPowers.pushPrefEnv({"set": [["dom.broadcastChannel.enabled", true]]}, runTest); +runTest(); diff --git a/dom/broadcastchannel/tests/test_broadcastchannel_close.html b/dom/broadcastchannel/tests/test_broadcastchannel_close.html index 430e13de75d8..84d41db4f948 100644 --- a/dom/broadcastchannel/tests/test_broadcastchannel_close.html +++ b/dom/broadcastchannel/tests/test_broadcastchannel_close.html @@ -54,7 +54,7 @@ function runTest() { } SimpleTest.waitForExplicitFinish(); -SpecialPowers.pushPrefEnv({"set": [["dom.broadcastChannel.enabled", true]]}, runTest); +runTest(); diff --git a/dom/broadcastchannel/tests/test_broadcastchannel_mozbrowser.html b/dom/broadcastchannel/tests/test_broadcastchannel_mozbrowser.html index f5748bc8f49b..180bd72e5be3 100644 --- a/dom/broadcastchannel/tests/test_broadcastchannel_mozbrowser.html +++ b/dom/broadcastchannel/tests/test_broadcastchannel_mozbrowser.html @@ -84,8 +84,7 @@ var steps = [ }, function() { - SpecialPowers.pushPrefEnv({"set": [["dom.broadcastChannel.enabled", true], - ["network.disable.ipc.security", true], + SpecialPowers.pushPrefEnv({"set": [["network.disable.ipc.security", true], ["browser.pagethumbnails.capturing_disabled", true], ["dom.mozBrowserFramesEnabled", true], ["dom.ipc.browser_frames.oop_by_default", false], diff --git a/dom/broadcastchannel/tests/test_broadcastchannel_mozbrowser2.html b/dom/broadcastchannel/tests/test_broadcastchannel_mozbrowser2.html index 52a0a15ff461..4bdaaf3b3e19 100644 --- a/dom/broadcastchannel/tests/test_broadcastchannel_mozbrowser2.html +++ b/dom/broadcastchannel/tests/test_broadcastchannel_mozbrowser2.html @@ -84,8 +84,7 @@ var steps = [ }, function() { - SpecialPowers.pushPrefEnv({"set": [["dom.broadcastChannel.enabled", true], - ["network.disable.ipc.security", true], + SpecialPowers.pushPrefEnv({"set": [["network.disable.ipc.security", true], ["browser.pagethumbnails.capturing_disabled", true], ["dom.mozBrowserFramesEnabled", true], ["dom.ipc.browser_frames.oop_by_default", false], diff --git a/dom/broadcastchannel/tests/test_broadcastchannel_pref.html b/dom/broadcastchannel/tests/test_broadcastchannel_pref.html deleted file mode 100644 index 9b3dd51f7186..000000000000 --- a/dom/broadcastchannel/tests/test_broadcastchannel_pref.html +++ /dev/null @@ -1,72 +0,0 @@ - - - - Test for BroadcastChannel - - - - - -
- - - - diff --git a/dom/broadcastchannel/tests/test_broadcastchannel_private_browsing.html b/dom/broadcastchannel/tests/test_broadcastchannel_private_browsing.html index 9c89f45ca76b..eb4d2e3709fc 100644 --- a/dom/broadcastchannel/tests/test_broadcastchannel_private_browsing.html +++ b/dom/broadcastchannel/tests/test_broadcastchannel_private_browsing.html @@ -109,7 +109,7 @@ function runTest() { } SimpleTest.waitForExplicitFinish(); -SpecialPowers.pushPrefEnv({"set": [["dom.broadcastChannel.enabled", true]]}, runTest); +runTest(); diff --git a/dom/broadcastchannel/tests/test_broadcastchannel_self.html b/dom/broadcastchannel/tests/test_broadcastchannel_self.html index 09597b4d9563..32df390be1b7 100644 --- a/dom/broadcastchannel/tests/test_broadcastchannel_self.html +++ b/dom/broadcastchannel/tests/test_broadcastchannel_self.html @@ -30,7 +30,7 @@ function runTest() { } SimpleTest.waitForExplicitFinish(); -SpecialPowers.pushPrefEnv({"set": [["dom.broadcastChannel.enabled", true]]}, runTest); +runTest(); diff --git a/dom/broadcastchannel/tests/test_broadcastchannel_sharedWorker.html b/dom/broadcastchannel/tests/test_broadcastchannel_sharedWorker.html index 4cd88c1f41a5..c56be7e698f7 100644 --- a/dom/broadcastchannel/tests/test_broadcastchannel_sharedWorker.html +++ b/dom/broadcastchannel/tests/test_broadcastchannel_sharedWorker.html @@ -44,8 +44,7 @@ function runTests() { } SimpleTest.waitForExplicitFinish(); -SpecialPowers.pushPrefEnv({"set": [["dom.broadcastChannel.enabled", true], - ["dom.workers.sharedWorkers.enabled", true]]}, runTests); +SpecialPowers.pushPrefEnv({"set": [["dom.workers.sharedWorkers.enabled", true]]}, runTests); diff --git a/dom/broadcastchannel/tests/test_broadcastchannel_worker.html b/dom/broadcastchannel/tests/test_broadcastchannel_worker.html index 6f731eb7a0fb..42e93cc1e10b 100644 --- a/dom/broadcastchannel/tests/test_broadcastchannel_worker.html +++ b/dom/broadcastchannel/tests/test_broadcastchannel_worker.html @@ -54,7 +54,7 @@ function runTests() { } SimpleTest.waitForExplicitFinish(); -SpecialPowers.pushPrefEnv({"set": [["dom.broadcastChannel.enabled", true]]}, runTests); +runTests(); diff --git a/dom/broadcastchannel/tests/test_broadcastchannel_worker_alive.html b/dom/broadcastchannel/tests/test_broadcastchannel_worker_alive.html index 340431b3cef0..8b1b03c4e7ee 100644 --- a/dom/broadcastchannel/tests/test_broadcastchannel_worker_alive.html +++ b/dom/broadcastchannel/tests/test_broadcastchannel_worker_alive.html @@ -48,7 +48,7 @@ function runTests() { } SimpleTest.waitForExplicitFinish(); -SpecialPowers.pushPrefEnv({"set": [["dom.broadcastChannel.enabled", true]]}, runTests); +runTests(); diff --git a/dom/webidl/BroadcastChannel.webidl b/dom/webidl/BroadcastChannel.webidl index 37c531d4a700..70be23522f2c 100644 --- a/dom/webidl/BroadcastChannel.webidl +++ b/dom/webidl/BroadcastChannel.webidl @@ -8,8 +8,7 @@ */ [Constructor(DOMString channel), - Exposed=(Window,Worker), - Func="BroadcastChannel::IsEnabled"] + Exposed=(Window,Worker)] interface BroadcastChannel : EventTarget { readonly attribute DOMString name; diff --git a/modules/libpref/init/all.js b/modules/libpref/init/all.js index 31dfa9666d03..08b07b692f5b 100644 --- a/modules/libpref/init/all.js +++ b/modules/libpref/init/all.js @@ -4717,9 +4717,6 @@ pref("dom.voicemail.enabled", false); // parameter omitted. pref("dom.voicemail.defaultServiceId", 0); -// DOM BroadcastChannel API. -pref("dom.broadcastChannel.enabled", true); - // DOM Inter-App Communication API. pref("dom.inter-app-communication-api.enabled", false); From daff98e289bf1664e88890834103df41e5c974b1 Mon Sep 17 00:00:00 2001 From: Lorien Hu Date: Sun, 26 Jul 2015 10:30:56 -0400 Subject: [PATCH 062/136] Bug 1187413 - Check for ProxyAccessible in mozAccessible childAt r=tbsaunde --- accessible/mac/mozAccessible.mm | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/accessible/mac/mozAccessible.mm b/accessible/mac/mozAccessible.mm index 6e7fb5405200..51e988cc02b2 100644 --- a/accessible/mac/mozAccessible.mm +++ b/accessible/mac/mozAccessible.mm @@ -355,10 +355,12 @@ ConvertToNSArray(nsTArray& aArray) { NS_OBJC_BEGIN_TRY_ABORT_BLOCK_NIL; - AccessibleWrap* accWrap = [self getGeckoAccessible]; - if (accWrap) { - Accessible* acc = accWrap->GetChildAt(i); - return acc ? GetNativeFromGeckoAccessible(acc) : nil; + if (AccessibleWrap* accWrap = [self getGeckoAccessible]) { + Accessible* child = accWrap->GetChildAt(i); + return child ? GetNativeFromGeckoAccessible(child) : nil; + } else if (ProxyAccessible* proxy = [self getProxyAccessible]) { + ProxyAccessible* child = proxy->ChildAt(i); + return child ? GetNativeFromProxy(child) : nil; } return nil; From d9e8ebc6dd90a5da74a43f8feb08e17af412c614 Mon Sep 17 00:00:00 2001 From: Lorien Hu Date: Sun, 26 Jul 2015 10:33:23 -0400 Subject: [PATCH 063/136] Bug 1187417 - (Part 1) Check for ProxyAccessible in mozAccessible position r=tbsaunde --- accessible/mac/mozAccessible.mm | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/accessible/mac/mozAccessible.mm b/accessible/mac/mozAccessible.mm index 51e988cc02b2..cbd26f16126e 100644 --- a/accessible/mac/mozAccessible.mm +++ b/accessible/mac/mozAccessible.mm @@ -851,12 +851,14 @@ ConvertToNSArray(nsTArray& aArray) { NS_OBJC_BEGIN_TRY_ABORT_BLOCK_NIL; - AccessibleWrap* accWrap = [self getGeckoAccessible]; - if (!accWrap) + nsIntRect rect; + if (AccessibleWrap* accWrap = [self getGeckoAccessible]) + rect = accWrap->Bounds(); + else if (ProxyAccessible* proxy = [self getProxyAccessible]) + rect = proxy->Bounds(); + else return nil; - nsIntRect rect = accWrap->Bounds(); - NSScreen* mainView = [[NSScreen screens] objectAtIndex:0]; CGFloat scaleFactor = nsCocoaUtils::GetBackingScaleFactor(mainView); NSPoint p = NSMakePoint(static_cast(rect.x) / scaleFactor, From 6eaca4d79786a8f40d9e2efd2ea81d35f88d73ed Mon Sep 17 00:00:00 2001 From: Lorien Hu Date: Sun, 26 Jul 2015 10:33:51 -0400 Subject: [PATCH 064/136] Bug 1187417 - (Part 2) Check for ProxyAccessible in mozAccessible size r=tbsaunde --- accessible/mac/mozAccessible.mm | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/accessible/mac/mozAccessible.mm b/accessible/mac/mozAccessible.mm index cbd26f16126e..c1ae2b43cc6f 100644 --- a/accessible/mac/mozAccessible.mm +++ b/accessible/mac/mozAccessible.mm @@ -873,11 +873,14 @@ ConvertToNSArray(nsTArray& aArray) { NS_OBJC_BEGIN_TRY_ABORT_BLOCK_NIL; - AccessibleWrap* accWrap = [self getGeckoAccessible]; - if (!accWrap) + nsIntRect rect; + if (AccessibleWrap* accWrap = [self getGeckoAccessible]) + rect = accWrap->Bounds(); + else if (ProxyAccessible* proxy = [self getProxyAccessible]) + rect = proxy->Bounds(); + else return nil; - nsIntRect rect = accWrap->Bounds(); CGFloat scaleFactor = nsCocoaUtils::GetBackingScaleFactor([[NSScreen screens] objectAtIndex:0]); return [NSValue valueWithSize:NSMakeSize(static_cast(rect.width) / scaleFactor, From 45ed80ae53c6389aeb73a298fe16ae96b179f83d Mon Sep 17 00:00:00 2001 From: James Graham Date: Tue, 21 Jul 2015 17:26:08 +0100 Subject: [PATCH 065/136] Bug 1187720 - Update web-platform-tests to revision 4bc69f287365a67585d470300a2ef109689cf465, a=testonly --HG-- rename : testing/web-platform/tests/conformance-checkers/html-aria/author-requirements/571.html => testing/web-platform/tests/conformance-checkers/html-aria/author-requirements/571-haswarn.html rename : testing/web-platform/tests/conformance-checkers/html-aria/author-requirements/572.html => testing/web-platform/tests/conformance-checkers/html-aria/author-requirements/572-haswarn.html rename : testing/web-platform/tests/conformance-checkers/html-aria/author-requirements/573.html => testing/web-platform/tests/conformance-checkers/html-aria/author-requirements/573-haswarn.html rename : testing/web-platform/tests/conformance-checkers/html-aria/combobox-autocomplete-list/div.html => testing/web-platform/tests/conformance-checkers/html-aria/combobox-autocomplete-list/div-haswarn.html rename : testing/web-platform/tests/conformance-checkers/html-aria/host-language/implicit-semantics-checkbox-disparity.html => testing/web-platform/tests/conformance-checkers/html-aria/host-language/implicit-semantics-checkbox-disparity-haswarn.html rename : testing/web-platform/tests/conformance-checkers/html-aria/host-language/implicit-semantics-checkbox-role.html => testing/web-platform/tests/conformance-checkers/html-aria/host-language/implicit-semantics-checkbox-role-haswarn.html --- testing/web-platform/meta/MANIFEST.json | 302 ++++-------------- .../meta/mixed-content/__dir__.ini | 1 - testing/web-platform/meta/mozilla-sync | 2 +- .../Opera/script_scheduling/111.html.ini | 6 + testing/web-platform/tests/.travis.yml | 3 +- .../tests/FileAPI/blob/Blob-constructor.html | 5 +- .../tests/FileAPI/idlharness.html | 158 ++------- .../web-platform/tests/FileAPI/idlharness.idl | 81 +++++ .../tests/FileAPI/idlharness.worker.js | 45 +++ .../DOMException-constructor.html | 66 ++++ .../{571.html => 571-haswarn.html} | 0 .../{572.html => 572-haswarn.html} | 0 .../{573.html => 573-haswarn.html} | 0 .../{div.html => div-haswarn.html} | 0 ...semantics-checkbox-disparity-haswarn.html} | 0 ...icit-semantics-checkbox-role-haswarn.html} | 0 .../tests/conformance-checkers/messages.json | 6 + .../blink-contrib/resources/alert-pass.js | 1 - .../blink-contrib/resources/child-src-test.js | 66 ---- .../blink-contrib/resources/dump-as-text.js | 2 - .../resources/frame-ancestors-test.js | 109 ------- .../resources/mixed-content-with-csp.html | 2 - .../resources/multiple-iframe-plugin-test.js | 54 ---- .../resources/multiple-iframe-test.js | 53 --- .../blink-contrib/resources/referrer-test.js | 62 ---- .../reflected-xss-and-xss-protection.js | 41 --- .../blink-contrib/resources/script-src.html | 11 - .../resources/securitypolicy-tests-base.js | 18 -- .../resources/securitypolicyviolation-test.js | 13 - .../resources/shared-worker-make-xhr.js | 10 - .../blink-contrib/resources/style.xsl | 20 -- .../resources/transform-to-img.xsl | 19 -- .../tests/dom/nodes/Element-matches.html | 22 +- .../tests/dom/nodes/Node-isEqualNode.xhtml | 24 ++ .../dom/nodes/Node-lookupNamespaceURI.html | 119 +++++++ .../nodes/ParentNode-querySelector-All.html | 32 +- .../dom/nodes/ParentNode-querySelector-All.js | 4 +- .../nodes/ParentNode-querySelector-All.xht | 32 +- .../tests/dom/ranges/Range-cloneContents.html | 15 +- .../min-width-not-important.html | 54 ++++ .../the-fieldset-element-0/ref.html | 21 ++ ...form-validation-validity-stepMismatch.html | 2 +- .../the-label-element/label-attributes.html | 4 + .../keep-scheme-redirect/allowed.https.html | 25 +- .../top-level/no-redirect/allowed.https.html | 25 +- .../keep-scheme-redirect/allowed.https.html | 25 +- .../top-level/no-redirect/allowed.https.html | 25 +- .../keep-scheme-redirect/allowed.https.html | 25 +- .../top-level/no-redirect/allowed.https.html | 25 +- .../keep-scheme-redirect/allowed.https.html | 25 +- .../top-level/no-redirect/allowed.https.html | 25 +- .../keep-scheme-redirect/allowed.https.html | 25 +- .../top-level/no-redirect/allowed.https.html | 25 +- .../keep-scheme-redirect/allowed.https.html | 25 +- .../top-level/no-redirect/allowed.https.html | 25 +- .../keep-scheme-redirect/allowed.https.html | 25 +- .../top-level/no-redirect/allowed.https.html | 25 +- .../keep-scheme-redirect/allowed.https.html | 25 +- .../top-level/no-redirect/allowed.https.html | 25 +- .../keep-scheme-redirect/allowed.https.html | 25 +- .../top-level/no-redirect/allowed.https.html | 25 +- .../keep-scheme-redirect/allowed.https.html | 25 +- .../top-level/no-redirect/allowed.https.html | 25 +- .../keep-scheme-redirect/allowed.https.html | 25 +- .../top-level/no-redirect/allowed.https.html | 25 +- .../keep-scheme-redirect/allowed.https.html | 25 +- .../top-level/no-redirect/allowed.https.html | 25 +- .../keep-scheme-redirect/allowed.https.html | 25 +- .../top-level/no-redirect/allowed.https.html | 25 +- .../top-level/no-redirect/allowed.https.html | 27 +- .../top-level/no-redirect/allowed.https.html | 27 +- .../top-level/no-redirect/allowed.https.html | 27 +- .../top-level/no-redirect/allowed.https.html | 27 +- .../top-level/no-redirect/allowed.https.html | 27 +- .../top-level/no-redirect/allowed.https.html | 27 +- .../top-level/no-redirect/allowed.https.html | 27 +- .../top-level/no-redirect/allowed.https.html | 27 +- .../top-level/no-redirect/allowed.https.html | 27 +- .../top-level/no-redirect/allowed.https.html | 27 +- .../top-level/no-redirect/allowed.https.html | 27 +- .../top-level/no-redirect/allowed.https.html | 27 +- .../top-level/no-redirect/allowed.https.html | 27 +- .../keep-scheme-redirect/allowed.https.html | 25 +- .../top-level/no-redirect/allowed.https.html | 25 +- .../keep-scheme-redirect/allowed.https.html | 25 +- .../top-level/no-redirect/allowed.https.html | 25 +- .../keep-scheme-redirect/allowed.https.html | 25 +- .../top-level/no-redirect/allowed.https.html | 25 +- .../keep-scheme-redirect/allowed.https.html | 25 +- .../top-level/no-redirect/allowed.https.html | 25 +- .../keep-scheme-redirect/allowed.https.html | 25 +- .../top-level/no-redirect/allowed.https.html | 25 +- .../keep-scheme-redirect/allowed.https.html | 25 +- .../top-level/no-redirect/allowed.https.html | 25 +- .../keep-scheme-redirect/allowed.https.html | 25 +- .../top-level/no-redirect/allowed.https.html | 25 +- .../keep-scheme-redirect/allowed.https.html | 25 +- .../top-level/no-redirect/allowed.https.html | 25 +- .../keep-scheme-redirect/allowed.https.html | 25 +- .../top-level/no-redirect/allowed.https.html | 25 +- .../keep-scheme-redirect/allowed.https.html | 25 +- .../top-level/no-redirect/allowed.https.html | 25 +- .../keep-scheme-redirect/allowed.https.html | 25 +- .../top-level/no-redirect/allowed.https.html | 25 +- .../keep-scheme-redirect/allowed.https.html | 25 +- .../top-level/no-redirect/allowed.https.html | 25 +- .../keep-scheme-redirect/allowed.https.html | 25 +- .../top-level/no-redirect/allowed.https.html | 25 +- .../opt-in-blocks.https.html | 25 +- .../no-redirect/opt-in-blocks.https.html | 25 +- .../opt-in-blocks.https.html | 25 +- .../opt-in-blocks.https.html | 25 +- .../no-redirect/opt-in-blocks.https.html | 25 +- .../opt-in-blocks.https.html | 25 +- .../opt-in-blocks.https.html | 25 +- .../no-redirect/opt-in-blocks.https.html | 25 +- .../opt-in-blocks.https.html | 25 +- .../opt-in-blocks.https.html | 25 +- .../no-redirect/opt-in-blocks.https.html | 25 +- .../opt-in-blocks.https.html | 25 +- .../opt-in-blocks.https.html | 25 +- .../no-redirect/opt-in-blocks.https.html | 25 +- .../opt-in-blocks.https.html | 25 +- .../opt-in-blocks.https.html | 25 +- .../no-redirect/opt-in-blocks.https.html | 25 +- .../opt-in-blocks.https.html | 25 +- .../opt-in-blocks.https.html | 25 +- .../no-redirect/opt-in-blocks.https.html | 25 +- .../opt-in-blocks.https.html | 25 +- .../opt-in-blocks.https.html | 25 +- .../no-redirect/opt-in-blocks.https.html | 25 +- .../opt-in-blocks.https.html | 25 +- .../opt-in-blocks.https.html | 25 +- .../no-redirect/opt-in-blocks.https.html | 25 +- .../opt-in-blocks.https.html | 25 +- .../opt-in-blocks.https.html | 25 +- .../no-redirect/opt-in-blocks.https.html | 25 +- .../opt-in-blocks.https.html | 25 +- .../opt-in-blocks.https.html | 25 +- .../no-redirect/opt-in-blocks.https.html | 25 +- .../opt-in-blocks.https.html | 25 +- .../opt-in-blocks.https.html | 25 +- .../no-redirect/opt-in-blocks.https.html | 25 +- .../opt-in-blocks.https.html | 25 +- .../opt-in-blocks.https.html | 25 +- .../no-redirect/opt-in-blocks.https.html | 25 +- .../opt-in-blocks.https.html | 25 +- .../opt-in-blocks.https.html | 25 +- .../no-redirect/opt-in-blocks.https.html | 25 +- .../opt-in-blocks.https.html | 25 +- .../opt-in-blocks.https.html | 25 +- .../no-redirect/opt-in-blocks.https.html | 25 +- .../opt-in-blocks.https.html | 25 +- .../opt-in-blocks.https.html | 25 +- .../no-redirect/opt-in-blocks.https.html | 25 +- .../opt-in-blocks.https.html | 25 +- .../opt-in-blocks.https.html | 25 +- .../no-redirect/opt-in-blocks.https.html | 25 +- .../opt-in-blocks.https.html | 25 +- .../opt-in-blocks.https.html | 25 +- .../no-redirect/opt-in-blocks.https.html | 25 +- .../opt-in-blocks.https.html | 25 +- .../no-redirect/opt-in-blocks.https.html | 27 +- .../no-redirect/opt-in-blocks.https.html | 27 +- .../no-redirect/opt-in-blocks.https.html | 27 +- .../no-redirect/opt-in-blocks.https.html | 27 +- .../no-redirect/opt-in-blocks.https.html | 27 +- .../no-redirect/opt-in-blocks.https.html | 27 +- .../no-redirect/opt-in-blocks.https.html | 27 +- .../no-redirect/opt-in-blocks.https.html | 27 +- .../no-redirect/opt-in-blocks.https.html | 27 +- .../no-redirect/opt-in-blocks.https.html | 27 +- .../no-redirect/opt-in-blocks.https.html | 27 +- .../no-redirect/opt-in-blocks.https.html | 27 +- .../no-redirect/opt-in-blocks.https.html | 27 +- .../no-redirect/opt-in-blocks.https.html | 27 +- .../no-redirect/opt-in-blocks.https.html | 27 +- .../no-redirect/opt-in-blocks.https.html | 27 +- .../no-redirect/opt-in-blocks.https.html | 27 +- .../no-redirect/opt-in-blocks.https.html | 27 +- .../no-opt-in-blocks.https.html | 25 +- .../no-redirect/no-opt-in-blocks.https.html | 25 +- .../no-opt-in-blocks.https.html | 25 +- .../no-opt-in-blocks.https.html | 25 +- .../no-redirect/no-opt-in-blocks.https.html | 25 +- .../no-opt-in-blocks.https.html | 25 +- .../no-opt-in-blocks.https.html | 25 +- .../no-redirect/no-opt-in-blocks.https.html | 25 +- .../no-opt-in-blocks.https.html | 25 +- .../no-opt-in-blocks.https.html | 25 +- .../no-redirect/no-opt-in-blocks.https.html | 25 +- .../no-opt-in-blocks.https.html | 25 +- .../no-opt-in-blocks.https.html | 25 +- .../no-redirect/no-opt-in-blocks.https.html | 25 +- .../no-opt-in-blocks.https.html | 25 +- .../no-opt-in-blocks.https.html | 25 +- .../no-redirect/no-opt-in-blocks.https.html | 25 +- .../no-opt-in-blocks.https.html | 25 +- .../no-opt-in-blocks.https.html | 25 +- .../no-redirect/no-opt-in-blocks.https.html | 25 +- .../no-opt-in-blocks.https.html | 25 +- .../no-opt-in-blocks.https.html | 25 +- .../no-redirect/no-opt-in-blocks.https.html | 25 +- .../no-opt-in-blocks.https.html | 25 +- .../no-opt-in-blocks.https.html | 25 +- .../no-redirect/no-opt-in-blocks.https.html | 25 +- .../no-opt-in-blocks.https.html | 25 +- .../no-opt-in-blocks.https.html | 25 +- .../no-redirect/no-opt-in-blocks.https.html | 25 +- .../no-opt-in-blocks.https.html | 25 +- .../no-opt-in-blocks.https.html | 25 +- .../no-redirect/no-opt-in-blocks.https.html | 25 +- .../no-opt-in-blocks.https.html | 25 +- .../no-opt-in-blocks.https.html | 25 +- .../no-redirect/no-opt-in-blocks.https.html | 25 +- .../no-opt-in-blocks.https.html | 25 +- .../no-opt-in-blocks.https.html | 25 +- .../no-redirect/no-opt-in-blocks.https.html | 25 +- .../no-opt-in-blocks.https.html | 25 +- .../no-opt-in-blocks.https.html | 25 +- .../no-redirect/no-opt-in-blocks.https.html | 25 +- .../no-opt-in-blocks.https.html | 25 +- .../no-opt-in-blocks.https.html | 25 +- .../no-redirect/no-opt-in-blocks.https.html | 25 +- .../no-opt-in-blocks.https.html | 25 +- .../no-opt-in-blocks.https.html | 25 +- .../no-redirect/no-opt-in-blocks.https.html | 25 +- .../no-opt-in-blocks.https.html | 25 +- .../no-opt-in-blocks.https.html | 25 +- .../no-redirect/no-opt-in-blocks.https.html | 25 +- .../no-opt-in-blocks.https.html | 25 +- .../no-opt-in-blocks.https.html | 25 +- .../no-redirect/no-opt-in-blocks.https.html | 25 +- .../no-opt-in-blocks.https.html | 25 +- .../tests/mixed-content/generic/common.js | 1 + .../generic/mixed-content-test-case.js | 14 +- .../mixed-content/generic/sanity-checker.js | 19 +- .../opt-in-blocks.https.html | 25 +- .../no-redirect/opt-in-blocks.https.html | 25 +- .../opt-in-blocks.https.html | 25 +- .../opt-in-blocks.https.html | 25 +- .../no-redirect/opt-in-blocks.https.html | 25 +- .../opt-in-blocks.https.html | 25 +- .../opt-in-blocks.https.html | 25 +- .../no-redirect/opt-in-blocks.https.html | 25 +- .../opt-in-blocks.https.html | 25 +- .../opt-in-blocks.https.html | 25 +- .../no-redirect/opt-in-blocks.https.html | 25 +- .../opt-in-blocks.https.html | 25 +- .../opt-in-blocks.https.html | 25 +- .../no-redirect/opt-in-blocks.https.html | 25 +- .../opt-in-blocks.https.html | 25 +- .../opt-in-blocks.https.html | 25 +- .../no-redirect/opt-in-blocks.https.html | 25 +- .../opt-in-blocks.https.html | 25 +- .../opt-in-blocks.https.html | 25 +- .../no-redirect/opt-in-blocks.https.html | 25 +- .../opt-in-blocks.https.html | 25 +- .../opt-in-blocks.https.html | 25 +- .../no-redirect/opt-in-blocks.https.html | 25 +- .../opt-in-blocks.https.html | 25 +- .../no-redirect/opt-in-blocks.https.html | 27 +- .../no-redirect/opt-in-blocks.https.html | 27 +- .../no-redirect/opt-in-blocks.https.html | 27 +- .../no-redirect/opt-in-blocks.https.html | 27 +- .../no-redirect/opt-in-blocks.https.html | 27 +- .../no-redirect/opt-in-blocks.https.html | 27 +- .../no-redirect/opt-in-blocks.https.html | 27 +- .../no-redirect/opt-in-blocks.https.html | 27 +- .../no-opt-in-allows.https.html | 25 +- .../no-redirect/no-opt-in-allows.https.html | 25 +- .../no-opt-in-allows.https.html | 25 +- .../no-opt-in-allows.https.html | 25 +- .../no-redirect/no-opt-in-allows.https.html | 25 +- .../no-opt-in-allows.https.html | 25 +- .../no-opt-in-allows.https.html | 25 +- .../no-redirect/no-opt-in-allows.https.html | 25 +- .../no-opt-in-allows.https.html | 25 +- .../no-opt-in-allows.https.html | 25 +- .../no-redirect/no-opt-in-allows.https.html | 25 +- .../no-opt-in-allows.https.html | 25 +- .../no-opt-in-allows.https.html | 25 +- .../no-redirect/no-opt-in-allows.https.html | 25 +- .../no-opt-in-allows.https.html | 25 +- .../no-opt-in-allows.https.html | 25 +- .../no-redirect/no-opt-in-allows.https.html | 25 +- .../no-opt-in-allows.https.html | 25 +- .../no-opt-in-allows.https.html | 25 +- .../no-redirect/no-opt-in-allows.https.html | 25 +- .../no-opt-in-allows.https.html | 25 +- .../no-opt-in-allows.https.html | 25 +- .../no-redirect/no-opt-in-allows.https.html | 25 +- .../no-opt-in-allows.https.html | 25 +- .../Notification-permission.html | 17 - ...ation-requestPermission-denied-manual.html | 22 -- ...tion-requestPermission-granted-manual.html | 22 -- .../tests/notifications/README.md | 5 - .../notifications/body-basic-manual.html | 28 ++ .../notifications/body-empty-manual.html | 31 ++ .../tests/notifications/common.js | 48 +++ .../notifications/constructor-basic.html | 21 ++ .../notifications/constructor-invalid.html | 19 ++ .../notifications/event-onclick-manual.html | 43 ++- .../tests/notifications/event-onclose.html | 47 ++- .../event-onerror-default-manual.html | 44 +-- .../event-onerror-denied-manual.html | 53 ++- .../tests/notifications/event-onshow.html | 42 ++- .../notifications/icon-basic-manual.html | 28 ++ .../notifications/icon-empty-manual.html | 27 ++ .../tests/notifications/instance.html | 101 +++--- .../tests/notifications/interfaces.html | 4 +- .../{notification-lang.html => lang.html} | 44 +-- .../notification-body-basic-manual.html | 17 - .../notification-body-empty-manual.html | 17 - .../notification-close-manual.html | 21 -- .../notification-constructor-basic.html | 20 -- .../notification-constructor-invalid.html | 19 -- .../notification-dir-auto-manual.html | 18 -- .../notification-dir-ltr-manual.html | 18 -- .../notification-dir-rtl-manual.html | 18 -- .../notification-icon-basic-manual.html | 19 -- .../notification-icon-empty-manual.html | 18 -- .../notification-tag-different-manual.html | 23 -- .../notification-tag-same-manual.html | 23 -- .../tests/notifications/permission.html | 14 + .../requestPermission-denied-manual.html | 22 ++ .../requestPermission-granted-manual.html | 18 ++ .../notifications/tag-different-manual.html | 37 +++ .../tests/notifications/tag-same-manual.html | 37 +++ .../tests/referrer-policy/generic/common.js | 2 - .../web-platform/tests/resources/docs/api.md | Bin 23670 -> 24846 bytes .../tests/resources/testharness.js | 17 + .../Opera/ParentNode-query-queryAll.html | 30 +- .../Opera/ParentNode-query-queryAll.js | 2 +- .../shadowroot-methods/test-002.html | 83 ----- .../shadowroot-methods/test-003.html | 154 --------- .../shadowroot-methods/test-004.html | 2 +- .../shadowroot-methods/test-005.html | 80 ----- .../shadowroot-methods/test-006.html | 18 +- .../test-004.html | 27 -- .../content-pseudo-element/test-001.html | 2 +- .../content-pseudo-element/test-002.html | 2 +- ...hosting-multiple-shadow-trees-002-ref.html | 15 - .../hosting-multiple-shadow-trees-002.html | 23 -- ...hosting-multiple-shadow-trees-003-ref.html | 15 - .../hosting-multiple-shadow-trees-003.html | 23 -- ...hosting-multiple-shadow-trees-004-ref.html | 14 - .../hosting-multiple-shadow-trees-004.html | 23 -- ...hosting-multiple-shadow-trees-005-ref.html | 14 - .../hosting-multiple-shadow-trees-005.html | 23 -- ...hosting-multiple-shadow-trees-006-ref.html | 15 - .../hosting-multiple-shadow-trees-006.html | 23 -- .../test-001.html | 128 -------- .../test-002.html | 86 ----- .../test-003.html | 88 ----- .../test-006.html | 58 ---- .../test-007.html | 59 ---- .../test-008.html | 59 ---- .../test-009.html | 59 ---- .../test-010.html | 59 ---- .../test-011.html | 61 ---- .../test-012.html | 67 ---- .../test-013.html | 67 ---- .../test-014.html | 67 ---- .../test-015.html | 67 ---- .../test-016.html | 67 ---- .../test-017.html | 67 ---- .../test-018.html | 67 ---- .../test-019.html | 67 ---- .../test-020.html | 79 ----- .../shadow-trees/text-decoration-001.html | 2 +- .../tests/shadow-dom/styles/test-001.html | 2 - .../tests/shadow-dom/styles/test-002.html | 149 --------- .../tests/subresource-integrity/alternate.css | 1 + .../subresource-integrity.html | 209 +++++++++--- .../interfaces/WebSocket/url/resolve.html | 12 + 376 files changed, 2353 insertions(+), 8678 deletions(-) delete mode 100644 testing/web-platform/meta/mixed-content/__dir__.ini create mode 100644 testing/web-platform/meta/old-tests/submission/Opera/script_scheduling/111.html.ini create mode 100644 testing/web-platform/tests/FileAPI/idlharness.idl create mode 100644 testing/web-platform/tests/FileAPI/idlharness.worker.js rename testing/web-platform/tests/conformance-checkers/html-aria/author-requirements/{571.html => 571-haswarn.html} (100%) rename testing/web-platform/tests/conformance-checkers/html-aria/author-requirements/{572.html => 572-haswarn.html} (100%) rename testing/web-platform/tests/conformance-checkers/html-aria/author-requirements/{573.html => 573-haswarn.html} (100%) rename testing/web-platform/tests/conformance-checkers/html-aria/combobox-autocomplete-list/{div.html => div-haswarn.html} (100%) rename testing/web-platform/tests/conformance-checkers/html-aria/host-language/{implicit-semantics-checkbox-disparity.html => implicit-semantics-checkbox-disparity-haswarn.html} (100%) rename testing/web-platform/tests/conformance-checkers/html-aria/host-language/{implicit-semantics-checkbox-role.html => implicit-semantics-checkbox-role-haswarn.html} (100%) delete mode 100644 testing/web-platform/tests/content-security-policy/blink-contrib/resources/alert-pass.js delete mode 100644 testing/web-platform/tests/content-security-policy/blink-contrib/resources/child-src-test.js delete mode 100644 testing/web-platform/tests/content-security-policy/blink-contrib/resources/dump-as-text.js delete mode 100644 testing/web-platform/tests/content-security-policy/blink-contrib/resources/frame-ancestors-test.js delete mode 100644 testing/web-platform/tests/content-security-policy/blink-contrib/resources/mixed-content-with-csp.html delete mode 100644 testing/web-platform/tests/content-security-policy/blink-contrib/resources/multiple-iframe-plugin-test.js delete mode 100644 testing/web-platform/tests/content-security-policy/blink-contrib/resources/multiple-iframe-test.js delete mode 100644 testing/web-platform/tests/content-security-policy/blink-contrib/resources/referrer-test.js delete mode 100644 testing/web-platform/tests/content-security-policy/blink-contrib/resources/reflected-xss-and-xss-protection.js delete mode 100644 testing/web-platform/tests/content-security-policy/blink-contrib/resources/script-src.html delete mode 100644 testing/web-platform/tests/content-security-policy/blink-contrib/resources/securitypolicy-tests-base.js delete mode 100644 testing/web-platform/tests/content-security-policy/blink-contrib/resources/securitypolicyviolation-test.js delete mode 100644 testing/web-platform/tests/content-security-policy/blink-contrib/resources/shared-worker-make-xhr.js delete mode 100644 testing/web-platform/tests/content-security-policy/blink-contrib/resources/style.xsl delete mode 100644 testing/web-platform/tests/content-security-policy/blink-contrib/resources/transform-to-img.xsl create mode 100644 testing/web-platform/tests/dom/nodes/Node-lookupNamespaceURI.html create mode 100644 testing/web-platform/tests/html/rendering/non-replaced-elements/the-fieldset-element-0/min-width-not-important.html create mode 100644 testing/web-platform/tests/html/rendering/non-replaced-elements/the-fieldset-element-0/ref.html delete mode 100644 testing/web-platform/tests/notifications/Notification-permission.html delete mode 100644 testing/web-platform/tests/notifications/Notification-requestPermission-denied-manual.html delete mode 100644 testing/web-platform/tests/notifications/Notification-requestPermission-granted-manual.html delete mode 100644 testing/web-platform/tests/notifications/README.md create mode 100644 testing/web-platform/tests/notifications/body-basic-manual.html create mode 100644 testing/web-platform/tests/notifications/body-empty-manual.html create mode 100644 testing/web-platform/tests/notifications/common.js create mode 100644 testing/web-platform/tests/notifications/constructor-basic.html create mode 100644 testing/web-platform/tests/notifications/constructor-invalid.html create mode 100644 testing/web-platform/tests/notifications/icon-basic-manual.html create mode 100644 testing/web-platform/tests/notifications/icon-empty-manual.html rename testing/web-platform/tests/notifications/{notification-lang.html => lang.html} (69%) delete mode 100644 testing/web-platform/tests/notifications/notification-body-basic-manual.html delete mode 100644 testing/web-platform/tests/notifications/notification-body-empty-manual.html delete mode 100644 testing/web-platform/tests/notifications/notification-close-manual.html delete mode 100644 testing/web-platform/tests/notifications/notification-constructor-basic.html delete mode 100644 testing/web-platform/tests/notifications/notification-constructor-invalid.html delete mode 100644 testing/web-platform/tests/notifications/notification-dir-auto-manual.html delete mode 100644 testing/web-platform/tests/notifications/notification-dir-ltr-manual.html delete mode 100644 testing/web-platform/tests/notifications/notification-dir-rtl-manual.html delete mode 100644 testing/web-platform/tests/notifications/notification-icon-basic-manual.html delete mode 100644 testing/web-platform/tests/notifications/notification-icon-empty-manual.html delete mode 100644 testing/web-platform/tests/notifications/notification-tag-different-manual.html delete mode 100644 testing/web-platform/tests/notifications/notification-tag-same-manual.html create mode 100644 testing/web-platform/tests/notifications/permission.html create mode 100644 testing/web-platform/tests/notifications/requestPermission-denied-manual.html create mode 100644 testing/web-platform/tests/notifications/requestPermission-granted-manual.html create mode 100644 testing/web-platform/tests/notifications/tag-different-manual.html create mode 100644 testing/web-platform/tests/notifications/tag-same-manual.html delete mode 100644 testing/web-platform/tests/shadow-dom/elements-and-dom-objects/shadowroot-object/shadowroot-methods/test-002.html delete mode 100644 testing/web-platform/tests/shadow-dom/elements-and-dom-objects/shadowroot-object/shadowroot-methods/test-003.html delete mode 100644 testing/web-platform/tests/shadow-dom/elements-and-dom-objects/shadowroot-object/shadowroot-methods/test-005.html delete mode 100644 testing/web-platform/tests/shadow-dom/shadow-trees/hosting-multiple-shadow-trees-002-ref.html delete mode 100644 testing/web-platform/tests/shadow-dom/shadow-trees/hosting-multiple-shadow-trees-002.html delete mode 100644 testing/web-platform/tests/shadow-dom/shadow-trees/hosting-multiple-shadow-trees-003-ref.html delete mode 100644 testing/web-platform/tests/shadow-dom/shadow-trees/hosting-multiple-shadow-trees-003.html delete mode 100644 testing/web-platform/tests/shadow-dom/shadow-trees/hosting-multiple-shadow-trees-004-ref.html delete mode 100644 testing/web-platform/tests/shadow-dom/shadow-trees/hosting-multiple-shadow-trees-004.html delete mode 100644 testing/web-platform/tests/shadow-dom/shadow-trees/hosting-multiple-shadow-trees-005-ref.html delete mode 100644 testing/web-platform/tests/shadow-dom/shadow-trees/hosting-multiple-shadow-trees-005.html delete mode 100644 testing/web-platform/tests/shadow-dom/shadow-trees/hosting-multiple-shadow-trees-006-ref.html delete mode 100644 testing/web-platform/tests/shadow-dom/shadow-trees/hosting-multiple-shadow-trees-006.html delete mode 100644 testing/web-platform/tests/shadow-dom/shadow-trees/hosting-multiple-shadow-trees/test-001.html delete mode 100644 testing/web-platform/tests/shadow-dom/shadow-trees/hosting-multiple-shadow-trees/test-002.html delete mode 100644 testing/web-platform/tests/shadow-dom/shadow-trees/hosting-multiple-shadow-trees/test-003.html delete mode 100644 testing/web-platform/tests/shadow-dom/shadow-trees/satisfying-matching-criteria/test-006.html delete mode 100644 testing/web-platform/tests/shadow-dom/shadow-trees/satisfying-matching-criteria/test-007.html delete mode 100644 testing/web-platform/tests/shadow-dom/shadow-trees/satisfying-matching-criteria/test-008.html delete mode 100644 testing/web-platform/tests/shadow-dom/shadow-trees/satisfying-matching-criteria/test-009.html delete mode 100644 testing/web-platform/tests/shadow-dom/shadow-trees/satisfying-matching-criteria/test-010.html delete mode 100644 testing/web-platform/tests/shadow-dom/shadow-trees/satisfying-matching-criteria/test-011.html delete mode 100644 testing/web-platform/tests/shadow-dom/shadow-trees/satisfying-matching-criteria/test-012.html delete mode 100644 testing/web-platform/tests/shadow-dom/shadow-trees/satisfying-matching-criteria/test-013.html delete mode 100644 testing/web-platform/tests/shadow-dom/shadow-trees/satisfying-matching-criteria/test-014.html delete mode 100644 testing/web-platform/tests/shadow-dom/shadow-trees/satisfying-matching-criteria/test-015.html delete mode 100644 testing/web-platform/tests/shadow-dom/shadow-trees/satisfying-matching-criteria/test-016.html delete mode 100644 testing/web-platform/tests/shadow-dom/shadow-trees/satisfying-matching-criteria/test-017.html delete mode 100644 testing/web-platform/tests/shadow-dom/shadow-trees/satisfying-matching-criteria/test-018.html delete mode 100644 testing/web-platform/tests/shadow-dom/shadow-trees/satisfying-matching-criteria/test-019.html delete mode 100644 testing/web-platform/tests/shadow-dom/shadow-trees/satisfying-matching-criteria/test-020.html delete mode 100644 testing/web-platform/tests/shadow-dom/styles/test-002.html create mode 100644 testing/web-platform/tests/subresource-integrity/alternate.css create mode 100644 testing/web-platform/tests/websockets/interfaces/WebSocket/url/resolve.html diff --git a/testing/web-platform/meta/MANIFEST.json b/testing/web-platform/meta/MANIFEST.json index 3aabd09e0df4..d397a4c20eb2 100644 --- a/testing/web-platform/meta/MANIFEST.json +++ b/testing/web-platform/meta/MANIFEST.json @@ -746,12 +746,12 @@ "url": "/mediacapture-streams/stream-api/mediastream/mediastream-id-manual.html" }, { - "path": "notifications/Notification-requestPermission-denied-manual.html", - "url": "/notifications/Notification-requestPermission-denied-manual.html" + "path": "notifications/body-basic-manual.html", + "url": "/notifications/body-basic-manual.html" }, { - "path": "notifications/Notification-requestPermission-granted-manual.html", - "url": "/notifications/Notification-requestPermission-granted-manual.html" + "path": "notifications/body-empty-manual.html", + "url": "/notifications/body-empty-manual.html" }, { "path": "notifications/event-onclick-manual.html", @@ -766,44 +766,28 @@ "url": "/notifications/event-onerror-denied-manual.html" }, { - "path": "notifications/notification-body-basic-manual.html", - "url": "/notifications/notification-body-basic-manual.html" + "path": "notifications/icon-basic-manual.html", + "url": "/notifications/icon-basic-manual.html" }, { - "path": "notifications/notification-body-empty-manual.html", - "url": "/notifications/notification-body-empty-manual.html" + "path": "notifications/icon-empty-manual.html", + "url": "/notifications/icon-empty-manual.html" }, { - "path": "notifications/notification-close-manual.html", - "url": "/notifications/notification-close-manual.html" + "path": "notifications/requestPermission-denied-manual.html", + "url": "/notifications/requestPermission-denied-manual.html" }, { - "path": "notifications/notification-dir-auto-manual.html", - "url": "/notifications/notification-dir-auto-manual.html" + "path": "notifications/requestPermission-granted-manual.html", + "url": "/notifications/requestPermission-granted-manual.html" }, { - "path": "notifications/notification-dir-ltr-manual.html", - "url": "/notifications/notification-dir-ltr-manual.html" + "path": "notifications/tag-different-manual.html", + "url": "/notifications/tag-different-manual.html" }, { - "path": "notifications/notification-dir-rtl-manual.html", - "url": "/notifications/notification-dir-rtl-manual.html" - }, - { - "path": "notifications/notification-icon-basic-manual.html", - "url": "/notifications/notification-icon-basic-manual.html" - }, - { - "path": "notifications/notification-icon-empty-manual.html", - "url": "/notifications/notification-icon-empty-manual.html" - }, - { - "path": "notifications/notification-tag-different-manual.html", - "url": "/notifications/notification-tag-different-manual.html" - }, - { - "path": "notifications/notification-tag-same-manual.html", - "url": "/notifications/notification-tag-same-manual.html" + "path": "notifications/tag-same-manual.html", + "url": "/notifications/tag-same-manual.html" }, { "path": "page-visibility/test_minimize-manual.html", @@ -4265,6 +4249,16 @@ ], "url": "/html/rendering/non-replaced-elements/tables/table-width-150percent.html" }, + { + "path": "html/rendering/non-replaced-elements/the-fieldset-element-0/min-width-not-important.html", + "references": [ + [ + "/html/rendering/non-replaced-elements/the-fieldset-element-0/ref.html", + "==" + ] + ], + "url": "/html/rendering/non-replaced-elements/the-fieldset-element-0/min-width-not-important.html" + }, { "path": "html/rendering/non-replaced-elements/the-page/body_text_00ffff.xhtml", "references": [ @@ -4865,56 +4859,6 @@ ], "url": "/quirks-mode/font-element-text-decoration-color/001-x.xhtml" }, - { - "path": "shadow-dom/shadow-trees/hosting-multiple-shadow-trees-002.html", - "references": [ - [ - "/shadow-dom/shadow-trees/hosting-multiple-shadow-trees-002-ref.html", - "==" - ] - ], - "url": "/shadow-dom/shadow-trees/hosting-multiple-shadow-trees-002.html" - }, - { - "path": "shadow-dom/shadow-trees/hosting-multiple-shadow-trees-003.html", - "references": [ - [ - "/shadow-dom/shadow-trees/hosting-multiple-shadow-trees-003-ref.html", - "==" - ] - ], - "url": "/shadow-dom/shadow-trees/hosting-multiple-shadow-trees-003.html" - }, - { - "path": "shadow-dom/shadow-trees/hosting-multiple-shadow-trees-004.html", - "references": [ - [ - "/shadow-dom/shadow-trees/hosting-multiple-shadow-trees-004-ref.html", - "==" - ] - ], - "url": "/shadow-dom/shadow-trees/hosting-multiple-shadow-trees-004.html" - }, - { - "path": "shadow-dom/shadow-trees/hosting-multiple-shadow-trees-005.html", - "references": [ - [ - "/shadow-dom/shadow-trees/hosting-multiple-shadow-trees-005-ref.html", - "==" - ] - ], - "url": "/shadow-dom/shadow-trees/hosting-multiple-shadow-trees-005.html" - }, - { - "path": "shadow-dom/shadow-trees/hosting-multiple-shadow-trees-006.html", - "references": [ - [ - "/shadow-dom/shadow-trees/hosting-multiple-shadow-trees-006-ref.html", - "==" - ] - ], - "url": "/shadow-dom/shadow-trees/hosting-multiple-shadow-trees-006.html" - }, { "path": "shadow-dom/shadow-trees/lower-boundary-encapsulation/distribution-001.html", "references": [ @@ -10463,6 +10407,10 @@ "path": "FileAPI/idlharness.html", "url": "/FileAPI/idlharness.html" }, + { + "path": "FileAPI/idlharness.worker.js", + "url": "/FileAPI/idlharness.worker" + }, { "path": "FileAPI/reading-data-section/Determining-Encoding.html", "url": "/FileAPI/reading-data-section/Determining-Encoding.html" @@ -13607,6 +13555,10 @@ "path": "dom/nodes/Node-isEqualNode.xhtml", "url": "/dom/nodes/Node-isEqualNode.xhtml" }, + { + "path": "dom/nodes/Node-lookupNamespaceURI.html", + "url": "/dom/nodes/Node-lookupNamespaceURI.html" + }, { "path": "dom/nodes/Node-lookupPrefix.xhtml", "url": "/dom/nodes/Node-lookupPrefix.xhtml" @@ -19256,8 +19208,12 @@ "url": "/navigation-timing/test_unique_performance_objects.html" }, { - "path": "notifications/Notification-permission.html", - "url": "/notifications/Notification-permission.html" + "path": "notifications/constructor-basic.html", + "url": "/notifications/constructor-basic.html" + }, + { + "path": "notifications/constructor-invalid.html", + "url": "/notifications/constructor-invalid.html" }, { "path": "notifications/event-onclose.html", @@ -19276,16 +19232,12 @@ "url": "/notifications/interfaces.html" }, { - "path": "notifications/notification-constructor-basic.html", - "url": "/notifications/notification-constructor-basic.html" + "path": "notifications/lang.html", + "url": "/notifications/lang.html" }, { - "path": "notifications/notification-constructor-invalid.html", - "url": "/notifications/notification-constructor-invalid.html" - }, - { - "path": "notifications/notification-lang.html", - "url": "/notifications/notification-lang.html" + "path": "notifications/permission.html", + "url": "/notifications/permission.html" }, { "path": "old-tests/submission/Microsoft/dragdrop/dragdrop_004.htm", @@ -24779,22 +24731,10 @@ "path": "shadow-dom/elements-and-dom-objects/shadowroot-object/shadowroot-methods/test-001.html", "url": "/shadow-dom/elements-and-dom-objects/shadowroot-object/shadowroot-methods/test-001.html" }, - { - "path": "shadow-dom/elements-and-dom-objects/shadowroot-object/shadowroot-methods/test-002.html", - "url": "/shadow-dom/elements-and-dom-objects/shadowroot-object/shadowroot-methods/test-002.html" - }, - { - "path": "shadow-dom/elements-and-dom-objects/shadowroot-object/shadowroot-methods/test-003.html", - "url": "/shadow-dom/elements-and-dom-objects/shadowroot-object/shadowroot-methods/test-003.html" - }, { "path": "shadow-dom/elements-and-dom-objects/shadowroot-object/shadowroot-methods/test-004.html", "url": "/shadow-dom/elements-and-dom-objects/shadowroot-object/shadowroot-methods/test-004.html" }, - { - "path": "shadow-dom/elements-and-dom-objects/shadowroot-object/shadowroot-methods/test-005.html", - "url": "/shadow-dom/elements-and-dom-objects/shadowroot-object/shadowroot-methods/test-005.html" - }, { "path": "shadow-dom/elements-and-dom-objects/shadowroot-object/shadowroot-methods/test-006.html", "url": "/shadow-dom/elements-and-dom-objects/shadowroot-object/shadowroot-methods/test-006.html" @@ -24991,18 +24931,6 @@ "path": "shadow-dom/shadow-trees/custom-pseudo-elements/test-001.html", "url": "/shadow-dom/shadow-trees/custom-pseudo-elements/test-001.html" }, - { - "path": "shadow-dom/shadow-trees/hosting-multiple-shadow-trees/test-001.html", - "url": "/shadow-dom/shadow-trees/hosting-multiple-shadow-trees/test-001.html" - }, - { - "path": "shadow-dom/shadow-trees/hosting-multiple-shadow-trees/test-002.html", - "url": "/shadow-dom/shadow-trees/hosting-multiple-shadow-trees/test-002.html" - }, - { - "path": "shadow-dom/shadow-trees/hosting-multiple-shadow-trees/test-003.html", - "url": "/shadow-dom/shadow-trees/hosting-multiple-shadow-trees/test-003.html" - }, { "path": "shadow-dom/shadow-trees/lower-boundary-encapsulation/distribution-003.html", "url": "/shadow-dom/shadow-trees/lower-boundary-encapsulation/distribution-003.html" @@ -25051,66 +24979,6 @@ "path": "shadow-dom/shadow-trees/satisfying-matching-criteria/test-005.html", "url": "/shadow-dom/shadow-trees/satisfying-matching-criteria/test-005.html" }, - { - "path": "shadow-dom/shadow-trees/satisfying-matching-criteria/test-006.html", - "url": "/shadow-dom/shadow-trees/satisfying-matching-criteria/test-006.html" - }, - { - "path": "shadow-dom/shadow-trees/satisfying-matching-criteria/test-007.html", - "url": "/shadow-dom/shadow-trees/satisfying-matching-criteria/test-007.html" - }, - { - "path": "shadow-dom/shadow-trees/satisfying-matching-criteria/test-008.html", - "url": "/shadow-dom/shadow-trees/satisfying-matching-criteria/test-008.html" - }, - { - "path": "shadow-dom/shadow-trees/satisfying-matching-criteria/test-009.html", - "url": "/shadow-dom/shadow-trees/satisfying-matching-criteria/test-009.html" - }, - { - "path": "shadow-dom/shadow-trees/satisfying-matching-criteria/test-010.html", - "url": "/shadow-dom/shadow-trees/satisfying-matching-criteria/test-010.html" - }, - { - "path": "shadow-dom/shadow-trees/satisfying-matching-criteria/test-011.html", - "url": "/shadow-dom/shadow-trees/satisfying-matching-criteria/test-011.html" - }, - { - "path": "shadow-dom/shadow-trees/satisfying-matching-criteria/test-012.html", - "url": "/shadow-dom/shadow-trees/satisfying-matching-criteria/test-012.html" - }, - { - "path": "shadow-dom/shadow-trees/satisfying-matching-criteria/test-013.html", - "url": "/shadow-dom/shadow-trees/satisfying-matching-criteria/test-013.html" - }, - { - "path": "shadow-dom/shadow-trees/satisfying-matching-criteria/test-014.html", - "url": "/shadow-dom/shadow-trees/satisfying-matching-criteria/test-014.html" - }, - { - "path": "shadow-dom/shadow-trees/satisfying-matching-criteria/test-015.html", - "url": "/shadow-dom/shadow-trees/satisfying-matching-criteria/test-015.html" - }, - { - "path": "shadow-dom/shadow-trees/satisfying-matching-criteria/test-016.html", - "url": "/shadow-dom/shadow-trees/satisfying-matching-criteria/test-016.html" - }, - { - "path": "shadow-dom/shadow-trees/satisfying-matching-criteria/test-017.html", - "url": "/shadow-dom/shadow-trees/satisfying-matching-criteria/test-017.html" - }, - { - "path": "shadow-dom/shadow-trees/satisfying-matching-criteria/test-018.html", - "url": "/shadow-dom/shadow-trees/satisfying-matching-criteria/test-018.html" - }, - { - "path": "shadow-dom/shadow-trees/satisfying-matching-criteria/test-019.html", - "url": "/shadow-dom/shadow-trees/satisfying-matching-criteria/test-019.html" - }, - { - "path": "shadow-dom/shadow-trees/satisfying-matching-criteria/test-020.html", - "url": "/shadow-dom/shadow-trees/satisfying-matching-criteria/test-020.html" - }, { "path": "shadow-dom/shadow-trees/upper-boundary-encapsulation/dom-tree-accessors-001.html", "url": "/shadow-dom/shadow-trees/upper-boundary-encapsulation/dom-tree-accessors-001.html" @@ -25183,10 +25051,6 @@ "path": "shadow-dom/styles/test-001.html", "url": "/shadow-dom/styles/test-001.html" }, - { - "path": "shadow-dom/styles/test-002.html", - "url": "/shadow-dom/styles/test-002.html" - }, { "path": "shadow-dom/styles/test-003.html", "url": "/shadow-dom/styles/test-003.html" @@ -26539,6 +26403,10 @@ "path": "websockets/interfaces/WebSocket/url/006.html", "url": "/websockets/interfaces/WebSocket/url/006.html" }, + { + "path": "websockets/interfaces/WebSocket/url/resolve.html", + "url": "/websockets/interfaces/WebSocket/url/resolve.html" + }, { "path": "websockets/opening-handshake/001.html", "url": "/websockets/opening-handshake/001.html" @@ -30633,6 +30501,18 @@ "url": "/html/rendering/non-replaced-elements/tables/table-width-150percent.html" } ], + "html/rendering/non-replaced-elements/the-fieldset-element-0/min-width-not-important.html": [ + { + "path": "html/rendering/non-replaced-elements/the-fieldset-element-0/min-width-not-important.html", + "references": [ + [ + "/html/rendering/non-replaced-elements/the-fieldset-element-0/ref.html", + "==" + ] + ], + "url": "/html/rendering/non-replaced-elements/the-fieldset-element-0/min-width-not-important.html" + } + ], "html/rendering/non-replaced-elements/the-page/body_text_00ffff.xhtml": [ { "path": "html/rendering/non-replaced-elements/the-page/body_text_00ffff.xhtml", @@ -31473,66 +31353,6 @@ "url": "/quirks-mode/font-element-text-decoration-color/001-x.xhtml" } ], - "shadow-dom/shadow-trees/hosting-multiple-shadow-trees-002.html": [ - { - "path": "shadow-dom/shadow-trees/hosting-multiple-shadow-trees-002.html", - "references": [ - [ - "/shadow-dom/shadow-trees/hosting-multiple-shadow-trees-002-ref.html", - "==" - ] - ], - "url": "/shadow-dom/shadow-trees/hosting-multiple-shadow-trees-002.html" - } - ], - "shadow-dom/shadow-trees/hosting-multiple-shadow-trees-003.html": [ - { - "path": "shadow-dom/shadow-trees/hosting-multiple-shadow-trees-003.html", - "references": [ - [ - "/shadow-dom/shadow-trees/hosting-multiple-shadow-trees-003-ref.html", - "==" - ] - ], - "url": "/shadow-dom/shadow-trees/hosting-multiple-shadow-trees-003.html" - } - ], - "shadow-dom/shadow-trees/hosting-multiple-shadow-trees-004.html": [ - { - "path": "shadow-dom/shadow-trees/hosting-multiple-shadow-trees-004.html", - "references": [ - [ - "/shadow-dom/shadow-trees/hosting-multiple-shadow-trees-004-ref.html", - "==" - ] - ], - "url": "/shadow-dom/shadow-trees/hosting-multiple-shadow-trees-004.html" - } - ], - "shadow-dom/shadow-trees/hosting-multiple-shadow-trees-005.html": [ - { - "path": "shadow-dom/shadow-trees/hosting-multiple-shadow-trees-005.html", - "references": [ - [ - "/shadow-dom/shadow-trees/hosting-multiple-shadow-trees-005-ref.html", - "==" - ] - ], - "url": "/shadow-dom/shadow-trees/hosting-multiple-shadow-trees-005.html" - } - ], - "shadow-dom/shadow-trees/hosting-multiple-shadow-trees-006.html": [ - { - "path": "shadow-dom/shadow-trees/hosting-multiple-shadow-trees-006.html", - "references": [ - [ - "/shadow-dom/shadow-trees/hosting-multiple-shadow-trees-006-ref.html", - "==" - ] - ], - "url": "/shadow-dom/shadow-trees/hosting-multiple-shadow-trees-006.html" - } - ], "shadow-dom/shadow-trees/lower-boundary-encapsulation/distribution-001.html": [ { "path": "shadow-dom/shadow-trees/lower-boundary-encapsulation/distribution-001.html", @@ -34294,7 +34114,7 @@ } ] }, - "rev": "593fd27931d7e9d573d2796fe10df9fff778d56f", + "rev": "4bc69f287365a67585d470300a2ef109689cf465", "url_base": "/", "version": 2 } \ No newline at end of file diff --git a/testing/web-platform/meta/mixed-content/__dir__.ini b/testing/web-platform/meta/mixed-content/__dir__.ini deleted file mode 100644 index 7c12d1fa1a27..000000000000 --- a/testing/web-platform/meta/mixed-content/__dir__.ini +++ /dev/null @@ -1 +0,0 @@ -disabled: https://bugzilla.mozilla.org/show_bug.cgi?id=1183627 \ No newline at end of file diff --git a/testing/web-platform/meta/mozilla-sync b/testing/web-platform/meta/mozilla-sync index fc8761d7c857..694d9b853a56 100644 --- a/testing/web-platform/meta/mozilla-sync +++ b/testing/web-platform/meta/mozilla-sync @@ -1 +1 @@ -42f9dbdd5a391201681d88dabea815fee6426e52 \ No newline at end of file +757fde6c364d5c1ae56ad135b1ffe15bf455e5ff \ No newline at end of file diff --git a/testing/web-platform/meta/old-tests/submission/Opera/script_scheduling/111.html.ini b/testing/web-platform/meta/old-tests/submission/Opera/script_scheduling/111.html.ini new file mode 100644 index 000000000000..422030c6d6ea --- /dev/null +++ b/testing/web-platform/meta/old-tests/submission/Opera/script_scheduling/111.html.ini @@ -0,0 +1,6 @@ +[111.html] + type: testharness + [ scheduler: removing async attribute at runtime] + expected: + if debug and (os == "linux") and (version == "Ubuntu 12.04") and (processor == "x86") and (bits == 32): FAIL + diff --git a/testing/web-platform/tests/.travis.yml b/testing/web-platform/tests/.travis.yml index 566fe18a9a62..a3ee2c288419 100644 --- a/testing/web-platform/tests/.travis.yml +++ b/testing/web-platform/tests/.travis.yml @@ -1,7 +1,8 @@ +sudo: false # cause Travis to start builds much faster language: python python: - "2.7" before_install: - git submodule update --init --recursive # command to run tests, e.g. python setup.py test -script: ./lint \ No newline at end of file +script: ./lint diff --git a/testing/web-platform/tests/FileAPI/blob/Blob-constructor.html b/testing/web-platform/tests/FileAPI/blob/Blob-constructor.html index 54dca00a96ed..dced17de0a51 100644 --- a/testing/web-platform/tests/FileAPI/blob/Blob-constructor.html +++ b/testing/web-platform/tests/FileAPI/blob/Blob-constructor.html @@ -29,10 +29,7 @@ test(function() { assert_equals(blob.type, ""); }, "no-argument Blob constructor"); test(function() { - var blob = Blob(); - assert_true(blob instanceof Blob); - assert_equals(blob.size, 0); - assert_equals(blob.type, ""); + assert_throws(new TypeError(), function() { var blob = Blob(); }); }, "no-argument Blob constructor without 'new'"); test(function() { var blob = new Blob; diff --git a/testing/web-platform/tests/FileAPI/idlharness.html b/testing/web-platform/tests/FileAPI/idlharness.html index 64a9c8508b37..0ef37000d318 100644 --- a/testing/web-platform/tests/FileAPI/idlharness.html +++ b/testing/web-platform/tests/FileAPI/idlharness.html @@ -15,144 +15,46 @@
- - - -
+ diff --git a/testing/web-platform/tests/FileAPI/idlharness.idl b/testing/web-platform/tests/FileAPI/idlharness.idl new file mode 100644 index 000000000000..ae83a9cb1fd0 --- /dev/null +++ b/testing/web-platform/tests/FileAPI/idlharness.idl @@ -0,0 +1,81 @@ +[Constructor, + Constructor(sequence<(ArrayBuffer or ArrayBufferView or Blob or DOMString)> blobParts, optional BlobPropertyBag options), Exposed=Window,Worker] +interface Blob { + + readonly attribute unsigned long long size; + readonly attribute DOMString type; + readonly attribute boolean isClosed; + + //slice Blob into byte-ranged chunks + + Blob slice([Clamp] optional long long start, + [Clamp] optional long long end, + optional DOMString contentType); + void close(); + +}; + +dictionary BlobPropertyBag { + DOMString type = ""; +}; + +[Constructor(sequence<(Blob or DOMString or ArrayBufferView or ArrayBuffer)> fileBits, +[EnsureUTF16] DOMString fileName, optional FilePropertyBag options), Exposed=Window,Worker] +interface File : Blob { + + readonly attribute DOMString name; + readonly attribute long long lastModified; + +}; + +dictionary FilePropertyBag { + + DOMString type = ""; + long long lastModified; + +}; + +[Exposed=Window,Worker] interface FileList { + getter File? item(unsigned long index); + readonly attribute unsigned long length; +}; + +[Constructor, Exposed=Window,Worker] +interface FileReader: EventTarget { + + // async read methods + void readAsArrayBuffer(Blob blob); + void readAsText(Blob blob, optional DOMString label); + void readAsDataURL(Blob blob); + + void abort(); + + // states + const unsigned short EMPTY = 0; + const unsigned short LOADING = 1; + const unsigned short DONE = 2; + + readonly attribute unsigned short readyState; + + // File or Blob data + readonly attribute (DOMString or ArrayBuffer)? result; + + readonly attribute DOMError? error; + + // event handler attributes + attribute EventHandler onloadstart; + attribute EventHandler onprogress; + attribute EventHandler onload; + attribute EventHandler onabort; + attribute EventHandler onerror; + attribute EventHandler onloadend; + +}; + +partial interface URL { + + static DOMString createObjectURL(Blob blob); + static DOMString createFor(Blob blob); + static void revokeObjectURL(DOMString url); + +}; diff --git a/testing/web-platform/tests/FileAPI/idlharness.worker.js b/testing/web-platform/tests/FileAPI/idlharness.worker.js new file mode 100644 index 000000000000..40ba81699b06 --- /dev/null +++ b/testing/web-platform/tests/FileAPI/idlharness.worker.js @@ -0,0 +1,45 @@ +importScripts("/resources/testharness.js"); +importScripts("/resources/WebIDLParser.js", "/resources/idlharness.js"); + +var request = new XMLHttpRequest(); +request.open("GET", "idlharness.idl"); +request.send(); +request.onload = function() { + var idl_array = new IdlArray(); + var idls = request.responseText; + + idl_array.add_untested_idls("[Global] interface Window { };"); + + idl_array.add_untested_idls("interface ArrayBuffer {};"); + idl_array.add_untested_idls("interface ArrayBufferView {};"); + idl_array.add_untested_idls("interface URL {};"); + idl_array.add_untested_idls("interface EventTarget {};"); + idl_array.add_untested_idls("interface Event {};"); + idl_array.add_untested_idls("[TreatNonCallableAsNull] callback EventHandlerNonNull = any (Event event);"); + idl_array.add_untested_idls("typedef EventHandlerNonNull? EventHandler;"); + + + var worker_idls = + '[Constructor, Exposed=Worker]\n' + + 'interface FileReaderSync {\n' + + '\n' + + ' // Synchronously return strings\n' + + '\n' + + ' ArrayBuffer readAsArrayBuffer(Blob blob);\n' + + ' DOMString readAsText(Blob blob, optional DOMString label);\n' + + ' DOMString readAsDataURL(Blob blob);\n' + + '};'; + + idl_array.add_idls(idls); + idl_array.add_idls(worker_idls); + + idl_array.add_objects({ + Blob: ['new Blob(["TEST"])'], + File: ['new File(["myFileBits"], "myFileName")'], + FileReader: ['new FileReader()'], + FileReaderSync: ['new FileReaderSync()'] + }); + + idl_array.test(); + done(); +}; diff --git a/testing/web-platform/tests/WebIDL/ecmascript-binding/es-exceptions/DOMException-constructor.html b/testing/web-platform/tests/WebIDL/ecmascript-binding/es-exceptions/DOMException-constructor.html index 9dc6d9918a37..0e5ffea7d328 100644 --- a/testing/web-platform/tests/WebIDL/ecmascript-binding/es-exceptions/DOMException-constructor.html +++ b/testing/web-platform/tests/WebIDL/ecmascript-binding/es-exceptions/DOMException-constructor.html @@ -24,6 +24,14 @@ test(function() { "The message property should be inherited"); }, 'new DOMException(): own-ness'); +test(function() { + var ex = new DOMException(null); + assert_equals(ex.name, "Error", + "Not passing a name should end up with 'Error' as the name"); + assert_equals(ex.message, "null", + "Passing null as message should end up with stringified 'null' as the message"); +}, 'new DOMException(null)'); + test(function() { var ex = new DOMException(undefined); assert_equals(ex.name, "Error", @@ -55,6 +63,13 @@ test(function() { "The message property should be own"); }, 'new DOMException("foo"): own-ness'); +test(function() { + var ex = new DOMException("bar", undefined); + assert_equals(ex.name, "Error", + "Passing undefined for name should end up with 'Error' as the name"); + assert_equals(ex.message, "bar", "Should still be using passed-in message"); +}, 'new DOMException("bar", undefined)'); + test(function() { var ex = new DOMException("bar", "NotSupportedError"); assert_equals(ex.name, "NotSupportedError", "Should be using the passed-in name"); @@ -70,4 +85,55 @@ test(function() { assert_true(ex.hasOwnProperty("message"), "The message property should be own"); }, 'new DOMException("bar", "NotSupportedError"): own-ness'); + +test(function() { + var ex = new DOMException("bar", "foo"); + assert_equals(ex.name, "foo", "Should be using the passed-in name"); + assert_equals(ex.message, "bar", "Should still be using passed-in message"); + assert_equals(ex.code, 0, + "Should have 0 for code for a name not in the exception names table"); +}, 'new DOMException("bar", "foo")'); + +[ + {name: "IndexSizeError", code: 1}, + {name: "HierarchyRequestError", code: 3}, + {name: "WrongDocumentError", code: 4}, + {name: "InvalidCharacterError", code: 5}, + {name: "NoModificationAllowedError", code: 7}, + {name: "NotFoundError", code: 8}, + {name: "NotSupportedError", code: 9}, + {name: "InUseAttributeError", code: 10}, + {name: "InvalidStateError", code: 11}, + {name: "SyntaxError", code: 12}, + {name: "InvalidModificationError", code: 13}, + {name: "NamespaceError", code: 14}, + {name: "InvalidAccessError", code: 15}, + {name: "SecurityError", code: 18}, + {name: "NetworkError", code: 19}, + {name: "AbortError", code: 20}, + {name: "URLMismatchError", code: 21}, + {name: "QuotaExceededError", code: 22}, + {name: "TimeoutError", code: 23}, + {name: "InvalidNodeTypeError", code: 24}, + {name: "DataCloneError", code: 25} +].forEach(function(test_case) { + test(function() { + var ex = new DOMException("msg", test_case.name); + assert_equals(ex.name, test_case.name, + "Should be using the passed-in name"); + assert_equals(ex.message, "msg", + "Should be using the passed-in message"); + assert_equals(ex.code, test_case.code, + "Should have matching legacy code from error names table"); + },'new DOMexception("msg", "' + test_case.name + '")'); +}); + +test(function() { + var ex = new DOMException("bar", "UnknownError"); + assert_equals(ex.name, "UnknownError", "Should be using the passed-in name"); + assert_equals(ex.message, "bar", "Should still be using passed-in message"); + assert_equals(ex.code, 0, + "Should have 0 for code for a name in the exception names table with no legacy code"); +}, 'new DOMException("bar", "UnknownError")'); + diff --git a/testing/web-platform/tests/conformance-checkers/html-aria/author-requirements/571.html b/testing/web-platform/tests/conformance-checkers/html-aria/author-requirements/571-haswarn.html similarity index 100% rename from testing/web-platform/tests/conformance-checkers/html-aria/author-requirements/571.html rename to testing/web-platform/tests/conformance-checkers/html-aria/author-requirements/571-haswarn.html diff --git a/testing/web-platform/tests/conformance-checkers/html-aria/author-requirements/572.html b/testing/web-platform/tests/conformance-checkers/html-aria/author-requirements/572-haswarn.html similarity index 100% rename from testing/web-platform/tests/conformance-checkers/html-aria/author-requirements/572.html rename to testing/web-platform/tests/conformance-checkers/html-aria/author-requirements/572-haswarn.html diff --git a/testing/web-platform/tests/conformance-checkers/html-aria/author-requirements/573.html b/testing/web-platform/tests/conformance-checkers/html-aria/author-requirements/573-haswarn.html similarity index 100% rename from testing/web-platform/tests/conformance-checkers/html-aria/author-requirements/573.html rename to testing/web-platform/tests/conformance-checkers/html-aria/author-requirements/573-haswarn.html diff --git a/testing/web-platform/tests/conformance-checkers/html-aria/combobox-autocomplete-list/div.html b/testing/web-platform/tests/conformance-checkers/html-aria/combobox-autocomplete-list/div-haswarn.html similarity index 100% rename from testing/web-platform/tests/conformance-checkers/html-aria/combobox-autocomplete-list/div.html rename to testing/web-platform/tests/conformance-checkers/html-aria/combobox-autocomplete-list/div-haswarn.html diff --git a/testing/web-platform/tests/conformance-checkers/html-aria/host-language/implicit-semantics-checkbox-disparity.html b/testing/web-platform/tests/conformance-checkers/html-aria/host-language/implicit-semantics-checkbox-disparity-haswarn.html similarity index 100% rename from testing/web-platform/tests/conformance-checkers/html-aria/host-language/implicit-semantics-checkbox-disparity.html rename to testing/web-platform/tests/conformance-checkers/html-aria/host-language/implicit-semantics-checkbox-disparity-haswarn.html diff --git a/testing/web-platform/tests/conformance-checkers/html-aria/host-language/implicit-semantics-checkbox-role.html b/testing/web-platform/tests/conformance-checkers/html-aria/host-language/implicit-semantics-checkbox-role-haswarn.html similarity index 100% rename from testing/web-platform/tests/conformance-checkers/html-aria/host-language/implicit-semantics-checkbox-role.html rename to testing/web-platform/tests/conformance-checkers/html-aria/host-language/implicit-semantics-checkbox-role-haswarn.html diff --git a/testing/web-platform/tests/conformance-checkers/messages.json b/testing/web-platform/tests/conformance-checkers/messages.json index 34990c022005..1b5daba1f65a 100644 --- a/testing/web-platform/tests/conformance-checkers/messages.json +++ b/testing/web-platform/tests/conformance-checkers/messages.json @@ -1,4 +1,10 @@ { + "html-aria/author-requirements/571-haswarn.html": "The \u201ctextbox\u201d role is unnecessary for an \u201cinput\u201d element that has no \u201clist\u201d attribute and whose type is \u201ctext\u201d.", + "html-aria/author-requirements/572-haswarn.html": "The \u201ctextbox\u201d role is unnecessary for an \u201cinput\u201d element that has no \u201clist\u201d attribute and whose type is \u201ctext\u201d.", + "html-aria/author-requirements/573-haswarn.html": "The \u201ctextbox\u201d role is unnecessary for an \u201cinput\u201d element that has no \u201clist\u201d attribute and whose type is \u201ctext\u201d.", + "html-aria/combobox-autocomplete-list/div-haswarn.html": "The \u201ctextbox\u201d role is unnecessary for an \u201cinput\u201d element that has no \u201clist\u201d attribute and whose type is \u201ctext\u201d.", + "html-aria/host-language/implicit-semantics-checkbox-disparity-haswarn.html": "The \u201ccheckbox\u201d role is unnecessary for element \u201cinput\u201d whose type is \u201ccheckbox\u201d.", + "html-aria/host-language/implicit-semantics-checkbox-role-haswarn.html": "The \u201ccheckbox\u201d role is unnecessary for element \u201cinput\u201d whose type is \u201ccheckbox\u201d.", "html-rdfa/0019-novalid.html": "Attribute \u201chref\u201d not allowed on element \u201cdiv\u201d in this context.", "html-rdfa/0035-novalid.html": "Attribute \u201chref\u201d not allowed on element \u201cimg\u201d in this context.", "html-rdfa/0037-novalid.html": "Attribute \u201chref\u201d not allowed on element \u201cimg\u201d in this context.", diff --git a/testing/web-platform/tests/content-security-policy/blink-contrib/resources/alert-pass.js b/testing/web-platform/tests/content-security-policy/blink-contrib/resources/alert-pass.js deleted file mode 100644 index ec2f0076d57e..000000000000 --- a/testing/web-platform/tests/content-security-policy/blink-contrib/resources/alert-pass.js +++ /dev/null @@ -1 +0,0 @@ -alert_assert('PASS'); diff --git a/testing/web-platform/tests/content-security-policy/blink-contrib/resources/child-src-test.js b/testing/web-platform/tests/content-security-policy/blink-contrib/resources/child-src-test.js deleted file mode 100644 index fd09f153716a..000000000000 --- a/testing/web-platform/tests/content-security-policy/blink-contrib/resources/child-src-test.js +++ /dev/null @@ -1,66 +0,0 @@ -var EXPECT_BLOCK = true; -var EXPECT_LOAD = false; - -window.jsTestIsAsync = true; -window.wasPostTestScriptParsed = true; - -var iframe; - -function injectFrame(url, shouldBlock) { - window.onload = function() { - iframe = document.createElement('iframe'); - iframe.onload = iframeLoaded(shouldBlock); - iframe.src = url; - document.body.appendChild(iframe); - }; -} - -function iframeLoaded(expectBlock) { - return function(ev) { - var failed = true; - try { - console.log("IFrame load event fired: the IFrame's location is '" + ev.target.contentWindow.location.href + "'."); - if (expectBlock) { - testFailed("The IFrame should have been blocked (or cross-origin). It wasn't."); - failed = true; - } else { - testPassed("The IFrame should not have been blocked. It wasn't."); - failed = false; - } - } catch (ex) { - debug("IFrame load event fired: the IFrame is cross-origin (or was blocked)."); - if (expectBlock) { - testPassed("The IFrame should have been blocked (or cross-origin). It was."); - failed = false; - } else { - testFailed("The IFrame should not have been blocked. It was."); - failed = true; - } - } - finishJSTest(); - }; -} - -function injectFrameRedirectingTo(url, shouldBlock) { - injectFrame("/security/contentSecurityPolicy/resources/redir.php?url=" + url, shouldBlock); -} - -function injectWorker(url, expectBlock) { - window.onload = function() { - if (expectBlock == EXPECT_BLOCK) - shouldThrow("var w = new Worker('" + url + "');"); - else - shouldNotThrow("var w = new Worker('" + url + "');"); - finishJSTest(); - }; -} - -function injectSharedWorker(url, expectBlock) { - window.onload = function() { - if (expectBlock == EXPECT_BLOCK) - shouldThrow("var w = new SharedWorker('" + url + "');"); - else - shouldNotThrow("var w = new SharedWorker('" + url + "');"); - finishJSTest(); - }; -} diff --git a/testing/web-platform/tests/content-security-policy/blink-contrib/resources/dump-as-text.js b/testing/web-platform/tests/content-security-policy/blink-contrib/resources/dump-as-text.js deleted file mode 100644 index a229b1fc75c2..000000000000 --- a/testing/web-platform/tests/content-security-policy/blink-contrib/resources/dump-as-text.js +++ /dev/null @@ -1,2 +0,0 @@ -if (window.testRunner) - testRunner.dumpAsText(); diff --git a/testing/web-platform/tests/content-security-policy/blink-contrib/resources/frame-ancestors-test.js b/testing/web-platform/tests/content-security-policy/blink-contrib/resources/frame-ancestors-test.js deleted file mode 100644 index e4b12d4faf76..000000000000 --- a/testing/web-platform/tests/content-security-policy/blink-contrib/resources/frame-ancestors-test.js +++ /dev/null @@ -1,109 +0,0 @@ -var SAME_ORIGIN = true; -var CROSS_ORIGIN = false; - -var EXPECT_BLOCK = true; -var EXPECT_LOAD = false; - -var SAMEORIGIN_ORIGIN = "http://127.0.0.1:8000"; -var CROSSORIGIN_ORIGIN = "http://localhost:8080"; - -window.jsTestIsAsync = true; -window.wasPostTestScriptParsed = true; - -if (window.testRunner) - testRunner.dumpChildFramesAsText(); - -window.addEventListener("message", function(e) { - if (window.parent != window) { - window.parent.postMessage(e.data, "*"); - } else { - if (e.data) - testFailed("The inner IFrame failed."); - else - testPassed("The inner IFrame passed."); - - finishJSTest(); - } -}); - -function injectNestedIframe(policy, parent, child, expectation) { - var iframe = document.createElement("iframe"); - - var url = "/security/contentSecurityPolicy/resources/frame-in-frame.pl?" + "policy=" + policy + "&parent=" + parent + "&child=" + child + "&expectation=" + expectation; - url = (parent == "same" ? SAMEORIGIN_ORIGIN : CROSSORIGIN_ORIGIN) + url; - - iframe.src = url; - document.body.appendChild(iframe); -} - -function injectIFrame(policy, sameOrigin, expectBlock) { - var iframe = document.createElement("iframe"); - iframe.addEventListener("load", iframeLoaded(expectBlock)); - iframe.addEventListener("error", iframeLoaded(expectBlock)); - - var url = "/security/contentSecurityPolicy/resources/frame-ancestors.pl?policy=" + policy; - if (!sameOrigin) - url = CROSSORIGIN_ORIGIN + url; - - iframe.src = url; - document.body.appendChild(iframe); -} - -function iframeLoaded(expectBlock) { - return function(ev) { - var failed = true; - try { - console.log("IFrame load event fired: the IFrame's location is '" + ev.target.contentWindow.location.href + "'."); - if (expectBlock) { - testFailed("The IFrame should have been blocked (or cross-origin). It wasn't."); - failed = true; - } else { - testPassed("The IFrame should not have been blocked. It wasn't."); - failed = false; - } - } catch (ex) { - debug("IFrame load event fired: the IFrame is cross-origin (or was blocked)."); - if (expectBlock) { - testPassed("The IFrame should have been blocked (or cross-origin). It was."); - failed = false; - } else { - testFailed("The IFrame should not have been blocked. It was."); - failed = true; - } - } - if (window.parent != window) - window.parent.postMessage(failed, '*'); - else - finishJSTest(); - }; -} - -function crossOriginFrameShouldBeBlocked(policy) { - window.onload = function() { - injectIFrame(policy, CROSS_ORIGIN, EXPECT_BLOCK); - }; -} - -function crossOriginFrameShouldBeAllowed(policy) { - window.onload = function() { - injectIFrame(policy, CROSS_ORIGIN, EXPECT_LOAD); - }; -} - -function sameOriginFrameShouldBeBlocked(policy) { - window.onload = function() { - injectIFrame(policy, SAME_ORIGIN, EXPECT_BLOCK); - }; -} - -function sameOriginFrameShouldBeAllowed(policy) { - window.onload = function() { - injectIFrame(policy, SAME_ORIGIN, EXPECT_LOAD); - }; -} - -function testNestedIFrame(policy, parent, child, expectation) { - window.onload = function() { - injectNestedIframe(policy, parent == SAME_ORIGIN ? "same" : "cross", child == SAME_ORIGIN ? "same" : "cross", expectation == EXPECT_LOAD ? "Allowed" : "Blocked"); - }; -} diff --git a/testing/web-platform/tests/content-security-policy/blink-contrib/resources/mixed-content-with-csp.html b/testing/web-platform/tests/content-security-policy/blink-contrib/resources/mixed-content-with-csp.html deleted file mode 100644 index 77f47cf3b1c8..000000000000 --- a/testing/web-platform/tests/content-security-policy/blink-contrib/resources/mixed-content-with-csp.html +++ /dev/null @@ -1,2 +0,0 @@ - This page includes an insecure script that alerts "FAIL", but that script is blocked by CSP. - diff --git a/testing/web-platform/tests/content-security-policy/blink-contrib/resources/multiple-iframe-plugin-test.js b/testing/web-platform/tests/content-security-policy/blink-contrib/resources/multiple-iframe-plugin-test.js deleted file mode 100644 index 0a6f0c5e1bee..000000000000 --- a/testing/web-platform/tests/content-security-policy/blink-contrib/resources/multiple-iframe-plugin-test.js +++ /dev/null @@ -1,54 +0,0 @@ -if (window.testRunner) { - testRunner.waitUntilDone(); - testRunner.dumpAsText(); - testRunner.dumpChildFramesAsText(); -} - -function testExperimentalPolicy() { - testImpl(true); -} - -function test() { - testImpl(false); -} - -function testImpl(experimental) { - if (tests.length === 0) - return finishTesting(); - var baseURL = "/security/contentSecurityPolicy/"; - var current = tests.shift(); - var iframe = document.createElement("iframe"); - iframe.src = baseURL + "resources/echo-object-data.pl?" + - "experimental=" + (experimental ? "true" : "false") + - "&csp=" + escape(current[1]); - - if (current[0]) - iframe.src += "&log=PASS."; - else - iframe.src += "&log=FAIL."; - - if (current[2]) - iframe.src += "&plugin=" + escape(current[2]); - else { - iframe.src += "&plugin=data:application/x-webkit-test-netscape,logifloaded"; - } - - if (current[3] !== undefined) - iframe.src += "&type=" + escape(current[3]); - else - iframe.src += "&type=application/x-webkit-test-netscape"; - - iframe.onload = function() { - if (window.internals) - internals.updateLayoutIgnorePendingStylesheetsAndRunPostLayoutTasks(iframe); - testImpl(experimental); - }; - document.body.appendChild(iframe); -} - -function finishTesting() { - if (window.testRunner) { - setTimeout("testRunner.notifyDone()", 0); - } - return true; -} diff --git a/testing/web-platform/tests/content-security-policy/blink-contrib/resources/multiple-iframe-test.js b/testing/web-platform/tests/content-security-policy/blink-contrib/resources/multiple-iframe-test.js deleted file mode 100644 index d5139dcd87a3..000000000000 --- a/testing/web-platform/tests/content-security-policy/blink-contrib/resources/multiple-iframe-test.js +++ /dev/null @@ -1,53 +0,0 @@ -if (window.testRunner) { - testRunner.waitUntilDone(); - testRunner.dumpAsText(); - testRunner.dumpChildFramesAsText(); -} - -function testPreescapedPolicy() { - testImpl(false, true); -} - -function testExperimentalPolicy() { - testImpl(true, false); -} - -function test() { - testImpl(false, false); -} - -function testImpl(experimental, preescapedPolicy) { - if (tests.length === 0) - return finishTesting(); - - var baseURL = "/security/contentSecurityPolicy/"; - var current = tests.shift(); - var iframe = document.createElement("iframe"); - - var policy = current[1]; - if (!preescapedPolicy) - policy = encodeURIComponent(policy); - - var scriptToLoad = baseURL + encodeURIComponent(current[2]); - if (current[2].match(/^data:/) || current[2].match(/^https?:/)) - scriptToLoad = encodeURIComponent(current[2]); - - iframe.src = baseURL + "resources/echo-script-src.pl?" + - "experimental=" + (experimental ? "true" : "false") + - "&should_run=" + encodeURIComponent(current[0]) + - "&csp=" + policy + "&q=" + scriptToLoad; - if (current[3] !== undefined) - iframe.src += "&nonce=" + encodeURIComponent(current[3]); - - iframe.onload = function() { - testImpl(experimental, preescapedPolicy); - }; - document.body.appendChild(iframe); -} - -function finishTesting() { - if (window.testRunner) { - setTimeout("testRunner.notifyDone()", 0); - } - return true; -} diff --git a/testing/web-platform/tests/content-security-policy/blink-contrib/resources/referrer-test.js b/testing/web-platform/tests/content-security-policy/blink-contrib/resources/referrer-test.js deleted file mode 100644 index 7dafc9f9cf52..000000000000 --- a/testing/web-platform/tests/content-security-policy/blink-contrib/resources/referrer-test.js +++ /dev/null @@ -1,62 +0,0 @@ -var ReferrerTest = { - NO_REFERRER: "no-referrer", - NO_REFERRER_WHEN_DOWNGRADE: "no-referrer-when-downgrade", - ORIGIN: "origin", - ORIGIN_WHEN_CROSS_ORIGIN: "origin-when-cross-origin", - UNSAFE_URL: "unsafe-url", - - INVALID: "invalid", - EMPTY: "", - - HTTP: "http", - HTTPS: "https", - - bindHandler: function(func) { - window.addEventListener("message", function(e) { - ReferrerTest.referrerResult = undefined; - func(e.data); - finishJSTest(); - }); - }, - - base: function(scheme) { - return scheme == "http" ? "http://127.0.0.1:8000/" : "https://127.0.0.1:8443/"; - }, - - generateFrameURL: function(policy, from, to) { - return ReferrerTest.base(from) + "security/contentSecurityPolicy/resources/referrer-test.php?policy=" + policy + "&to=" + to; - }, - - injectFrame: function(policy, from, to) { - var iframe = document.createElement("iframe"); - iframe.src = ReferrerTest.generateFrameURL(policy, from, to); - document.body.appendChild(iframe); - } -}; - -function expectFullReferrer(policy, from, to) { - ReferrerTest.bindHandler(function(referrer) { - ReferrerTest.referrerResult = referrer; - shouldBeEqualToString("ReferrerTest.referrerResult", ReferrerTest.generateFrameURL(policy, from, to)); - }); - ReferrerTest.injectFrame(policy, from, to); -} - -function expectNoReferrer(policy, from, to) { - ReferrerTest.bindHandler(function(referrer) { - ReferrerTest.referrerResult = referrer; - shouldBeEqualToString("ReferrerTest.referrerResult", ""); - }); - ReferrerTest.injectFrame(policy, from, to); -} - -function expectOriginReferrer(policy, from, to) { - ReferrerTest.bindHandler(function(referrer) { - ReferrerTest.referrerResult = referrer; - shouldBeEqualToString("ReferrerTest.referrerResult", ReferrerTest.base(from)); - }); - ReferrerTest.injectFrame(policy, from, to); -} - -window.wasPostTestScriptParsed = true; -window.jsTestIsAsync = true; diff --git a/testing/web-platform/tests/content-security-policy/blink-contrib/resources/reflected-xss-and-xss-protection.js b/testing/web-platform/tests/content-security-policy/blink-contrib/resources/reflected-xss-and-xss-protection.js deleted file mode 100644 index a7ba8ebbd0c8..000000000000 --- a/testing/web-platform/tests/content-security-policy/blink-contrib/resources/reflected-xss-and-xss-protection.js +++ /dev/null @@ -1,41 +0,0 @@ -if (window.testRunner) { - testRunner.dumpAsText(); - testRunner.dumpChildFramesAsText(); - testRunner.setXSSAuditorEnabled(true); - testRunner.waitUntilDone(); -} - -function testMixedHeader(csp, xssProtection) { - var params = [ - 'q= - - - diff --git a/testing/web-platform/tests/content-security-policy/blink-contrib/resources/securitypolicy-tests-base.js b/testing/web-platform/tests/content-security-policy/blink-contrib/resources/securitypolicy-tests-base.js deleted file mode 100644 index f403e52e62a3..000000000000 --- a/testing/web-platform/tests/content-security-policy/blink-contrib/resources/securitypolicy-tests-base.js +++ /dev/null @@ -1,18 +0,0 @@ -if (window.testRunner) - testRunner.dumpAsText(); - -function log(msg) { - var txt = document.createTextNode(msg); - document.querySelector('body').appendChild(txt); - document.querySelector('body').appendChild(document.createElement('br')); -} - -function injectPolicy(policy) { - var meta = document.createElement('meta'); - meta.setAttribute('http-equiv', 'Content-Security-Policy'); - meta.setAttribute('content', policy); - document.head.appendChild(meta); -} - -if (!document.securityPolicy) - log('FAIL document.securityPolicy is not defined.') diff --git a/testing/web-platform/tests/content-security-policy/blink-contrib/resources/securitypolicyviolation-test.js b/testing/web-platform/tests/content-security-policy/blink-contrib/resources/securitypolicyviolation-test.js deleted file mode 100644 index cd16d94b3e02..000000000000 --- a/testing/web-platform/tests/content-security-policy/blink-contrib/resources/securitypolicyviolation-test.js +++ /dev/null @@ -1,13 +0,0 @@ -window.jsTestIsAsync = true; - -document.addEventListener('securitypolicyviolation', function handleEvent(e) { - window.e = e; - for (key in expectations) - shouldBe('window.e.' + key, JSON.stringify(expectations[key])); - finishJSTest(); -}); - -window.addEventListener('load', function() { - debug('Kicking off the tests:'); - run(); -}); diff --git a/testing/web-platform/tests/content-security-policy/blink-contrib/resources/shared-worker-make-xhr.js b/testing/web-platform/tests/content-security-policy/blink-contrib/resources/shared-worker-make-xhr.js deleted file mode 100644 index 04e68d61b4f5..000000000000 --- a/testing/web-platform/tests/content-security-policy/blink-contrib/resources/shared-worker-make-xhr.js +++ /dev/null @@ -1,10 +0,0 @@ -onconnect = function(event) { - var port = event.ports[0]; - try { - var xhr = new XMLHttpRequest; - xhr.open("GET", "http://www1.{{host}}:{{ports[http][0]}}/content-security-policy/blink-contrib/resources/blue.css", true); - port.postMessage("xhr allowed"); - } catch (e) { - port.postMessage("xhr blocked"); - } -}; diff --git a/testing/web-platform/tests/content-security-policy/blink-contrib/resources/style.xsl b/testing/web-platform/tests/content-security-policy/blink-contrib/resources/style.xsl deleted file mode 100644 index 6d83dfc059b3..000000000000 --- a/testing/web-platform/tests/content-security-policy/blink-contrib/resources/style.xsl +++ /dev/null @@ -1,20 +0,0 @@ - - - - - - - - - - - Style sheet applied. - - - - diff --git a/testing/web-platform/tests/content-security-policy/blink-contrib/resources/transform-to-img.xsl b/testing/web-platform/tests/content-security-policy/blink-contrib/resources/transform-to-img.xsl deleted file mode 100644 index 8d4ccf33487b..000000000000 --- a/testing/web-platform/tests/content-security-policy/blink-contrib/resources/transform-to-img.xsl +++ /dev/null @@ -1,19 +0,0 @@ - - - - - - - - - Here is an image: - - - - - diff --git a/testing/web-platform/tests/dom/nodes/Element-matches.html b/testing/web-platform/tests/dom/nodes/Element-matches.html index 44e5112ee35c..e04c0f9d19a8 100644 --- a/testing/web-platform/tests/dom/nodes/Element-matches.html +++ b/testing/web-platform/tests/dom/nodes/Element-matches.html @@ -12,16 +12,14 @@
This test requires JavaScript.
+ + + +

LookupNamespaceURI and IsDefaultNamespace

+
+ + + diff --git a/testing/web-platform/tests/dom/nodes/ParentNode-querySelector-All.html b/testing/web-platform/tests/dom/nodes/ParentNode-querySelector-All.html index 1899882ed6a5..159b0b967a84 100644 --- a/testing/web-platform/tests/dom/nodes/ParentNode-querySelector-All.html +++ b/testing/web-platform/tests/dom/nodes/ParentNode-querySelector-All.html @@ -10,17 +10,14 @@
This test requires JavaScript.
diff --git a/testing/web-platform/tests/mixed-content/allowed/http-csp/same-host-https/audio-tag/top-level/keep-scheme-redirect/allowed.https.html b/testing/web-platform/tests/mixed-content/allowed/http-csp/same-host-https/audio-tag/top-level/keep-scheme-redirect/allowed.https.html index 0f7b9cdf8f74..5e6b8cbe168b 100644 --- a/testing/web-platform/tests/mixed-content/allowed/http-csp/same-host-https/audio-tag/top-level/keep-scheme-redirect/allowed.https.html +++ b/testing/web-platform/tests/mixed-content/allowed/http-csp/same-host-https/audio-tag/top-level/keep-scheme-redirect/allowed.https.html @@ -1,10 +1,12 @@ - + Mixed-Content: Allowed content + + - - - - - - -

Allowed content

-

Test behavior of allowed content.

-
opt_in_method: http-csp
-                                 origin: same-host-https
-                                 source_scheme: https
-                                 context_nesting: top-level
-                                 redirection: keep-scheme-redirect
-                                 subresource: audio-tag
-                                 expectation: allowed
- -

See specification - details for this test.

- -
+
diff --git a/testing/web-platform/tests/mixed-content/allowed/http-csp/same-host-https/audio-tag/top-level/no-redirect/allowed.https.html b/testing/web-platform/tests/mixed-content/allowed/http-csp/same-host-https/audio-tag/top-level/no-redirect/allowed.https.html index aacf82bea18f..0adc65f828b2 100644 --- a/testing/web-platform/tests/mixed-content/allowed/http-csp/same-host-https/audio-tag/top-level/no-redirect/allowed.https.html +++ b/testing/web-platform/tests/mixed-content/allowed/http-csp/same-host-https/audio-tag/top-level/no-redirect/allowed.https.html @@ -1,10 +1,12 @@ - + Mixed-Content: Allowed content + + - - - - - - -

Allowed content

-

Test behavior of allowed content.

-
opt_in_method: http-csp
-                                 origin: same-host-https
-                                 source_scheme: https
-                                 context_nesting: top-level
-                                 redirection: no-redirect
-                                 subresource: audio-tag
-                                 expectation: allowed
- -

See specification - details for this test.

- -
+
diff --git a/testing/web-platform/tests/mixed-content/allowed/http-csp/same-host-https/fetch-request/top-level/keep-scheme-redirect/allowed.https.html b/testing/web-platform/tests/mixed-content/allowed/http-csp/same-host-https/fetch-request/top-level/keep-scheme-redirect/allowed.https.html index 93a02452ceeb..260fb14b0424 100644 --- a/testing/web-platform/tests/mixed-content/allowed/http-csp/same-host-https/fetch-request/top-level/keep-scheme-redirect/allowed.https.html +++ b/testing/web-platform/tests/mixed-content/allowed/http-csp/same-host-https/fetch-request/top-level/keep-scheme-redirect/allowed.https.html @@ -1,10 +1,12 @@ - + Mixed-Content: Allowed content + + - - - - - - -

Allowed content

-

Test behavior of allowed content.

-
opt_in_method: http-csp
-                                 origin: same-host-https
-                                 source_scheme: https
-                                 context_nesting: top-level
-                                 redirection: keep-scheme-redirect
-                                 subresource: fetch-request
-                                 expectation: allowed
- -

See specification - details for this test.

- -
+
diff --git a/testing/web-platform/tests/mixed-content/allowed/http-csp/same-host-https/fetch-request/top-level/no-redirect/allowed.https.html b/testing/web-platform/tests/mixed-content/allowed/http-csp/same-host-https/fetch-request/top-level/no-redirect/allowed.https.html index b21770be3b37..9b18ebb78b21 100644 --- a/testing/web-platform/tests/mixed-content/allowed/http-csp/same-host-https/fetch-request/top-level/no-redirect/allowed.https.html +++ b/testing/web-platform/tests/mixed-content/allowed/http-csp/same-host-https/fetch-request/top-level/no-redirect/allowed.https.html @@ -1,10 +1,12 @@ - + Mixed-Content: Allowed content + + - - - - - - -

Allowed content

-

Test behavior of allowed content.

-
opt_in_method: http-csp
-                                 origin: same-host-https
-                                 source_scheme: https
-                                 context_nesting: top-level
-                                 redirection: no-redirect
-                                 subresource: fetch-request
-                                 expectation: allowed
- -

See specification - details for this test.

- -
+
diff --git a/testing/web-platform/tests/mixed-content/allowed/http-csp/same-host-https/form-tag/top-level/keep-scheme-redirect/allowed.https.html b/testing/web-platform/tests/mixed-content/allowed/http-csp/same-host-https/form-tag/top-level/keep-scheme-redirect/allowed.https.html index 6f551bef74a9..742363922fb0 100644 --- a/testing/web-platform/tests/mixed-content/allowed/http-csp/same-host-https/form-tag/top-level/keep-scheme-redirect/allowed.https.html +++ b/testing/web-platform/tests/mixed-content/allowed/http-csp/same-host-https/form-tag/top-level/keep-scheme-redirect/allowed.https.html @@ -1,10 +1,12 @@ - + Mixed-Content: Allowed content + + - - - - - - -

Allowed content

-

Test behavior of allowed content.

-
opt_in_method: http-csp
-                                 origin: same-host-https
-                                 source_scheme: https
-                                 context_nesting: top-level
-                                 redirection: keep-scheme-redirect
-                                 subresource: form-tag
-                                 expectation: allowed
- -

See specification - details for this test.

- -
+
diff --git a/testing/web-platform/tests/mixed-content/allowed/http-csp/same-host-https/form-tag/top-level/no-redirect/allowed.https.html b/testing/web-platform/tests/mixed-content/allowed/http-csp/same-host-https/form-tag/top-level/no-redirect/allowed.https.html index 6f00a97c23c7..3f781b8201a7 100644 --- a/testing/web-platform/tests/mixed-content/allowed/http-csp/same-host-https/form-tag/top-level/no-redirect/allowed.https.html +++ b/testing/web-platform/tests/mixed-content/allowed/http-csp/same-host-https/form-tag/top-level/no-redirect/allowed.https.html @@ -1,10 +1,12 @@ - + Mixed-Content: Allowed content + + - - - - - - -

Allowed content

-

Test behavior of allowed content.

-
opt_in_method: http-csp
-                                 origin: same-host-https
-                                 source_scheme: https
-                                 context_nesting: top-level
-                                 redirection: no-redirect
-                                 subresource: form-tag
-                                 expectation: allowed
- -

See specification - details for this test.

- -
+
diff --git a/testing/web-platform/tests/mixed-content/allowed/http-csp/same-host-https/iframe-tag/top-level/keep-scheme-redirect/allowed.https.html b/testing/web-platform/tests/mixed-content/allowed/http-csp/same-host-https/iframe-tag/top-level/keep-scheme-redirect/allowed.https.html index dd96415dce34..f584e0be95a7 100644 --- a/testing/web-platform/tests/mixed-content/allowed/http-csp/same-host-https/iframe-tag/top-level/keep-scheme-redirect/allowed.https.html +++ b/testing/web-platform/tests/mixed-content/allowed/http-csp/same-host-https/iframe-tag/top-level/keep-scheme-redirect/allowed.https.html @@ -1,10 +1,12 @@ - + Mixed-Content: Allowed content + + - - - - - - -

Allowed content

-

Test behavior of allowed content.

-
opt_in_method: http-csp
-                                 origin: same-host-https
-                                 source_scheme: https
-                                 context_nesting: top-level
-                                 redirection: keep-scheme-redirect
-                                 subresource: iframe-tag
-                                 expectation: allowed
- -

See specification - details for this test.

- -
+
diff --git a/testing/web-platform/tests/mixed-content/allowed/http-csp/same-host-https/iframe-tag/top-level/no-redirect/allowed.https.html b/testing/web-platform/tests/mixed-content/allowed/http-csp/same-host-https/iframe-tag/top-level/no-redirect/allowed.https.html index 0b627378b1af..eb24a71a7969 100644 --- a/testing/web-platform/tests/mixed-content/allowed/http-csp/same-host-https/iframe-tag/top-level/no-redirect/allowed.https.html +++ b/testing/web-platform/tests/mixed-content/allowed/http-csp/same-host-https/iframe-tag/top-level/no-redirect/allowed.https.html @@ -1,10 +1,12 @@ - + Mixed-Content: Allowed content + + - - - - - - -

Allowed content

-

Test behavior of allowed content.

-
opt_in_method: http-csp
-                                 origin: same-host-https
-                                 source_scheme: https
-                                 context_nesting: top-level
-                                 redirection: no-redirect
-                                 subresource: iframe-tag
-                                 expectation: allowed
- -

See specification - details for this test.

- -
+
diff --git a/testing/web-platform/tests/mixed-content/allowed/http-csp/same-host-https/img-tag/top-level/keep-scheme-redirect/allowed.https.html b/testing/web-platform/tests/mixed-content/allowed/http-csp/same-host-https/img-tag/top-level/keep-scheme-redirect/allowed.https.html index c1f35d39a74d..77adba6442ac 100644 --- a/testing/web-platform/tests/mixed-content/allowed/http-csp/same-host-https/img-tag/top-level/keep-scheme-redirect/allowed.https.html +++ b/testing/web-platform/tests/mixed-content/allowed/http-csp/same-host-https/img-tag/top-level/keep-scheme-redirect/allowed.https.html @@ -1,10 +1,12 @@ - + Mixed-Content: Allowed content + + - - - - - - -

Allowed content

-

Test behavior of allowed content.

-
opt_in_method: http-csp
-                                 origin: same-host-https
-                                 source_scheme: https
-                                 context_nesting: top-level
-                                 redirection: keep-scheme-redirect
-                                 subresource: img-tag
-                                 expectation: allowed
- -

See specification - details for this test.

- -
+
diff --git a/testing/web-platform/tests/mixed-content/allowed/http-csp/same-host-https/img-tag/top-level/no-redirect/allowed.https.html b/testing/web-platform/tests/mixed-content/allowed/http-csp/same-host-https/img-tag/top-level/no-redirect/allowed.https.html index 46251b244b8f..b08d413e8ebb 100644 --- a/testing/web-platform/tests/mixed-content/allowed/http-csp/same-host-https/img-tag/top-level/no-redirect/allowed.https.html +++ b/testing/web-platform/tests/mixed-content/allowed/http-csp/same-host-https/img-tag/top-level/no-redirect/allowed.https.html @@ -1,10 +1,12 @@ - + Mixed-Content: Allowed content + + - - - - - - -

Allowed content

-

Test behavior of allowed content.

-
opt_in_method: http-csp
-                                 origin: same-host-https
-                                 source_scheme: https
-                                 context_nesting: top-level
-                                 redirection: no-redirect
-                                 subresource: img-tag
-                                 expectation: allowed
- -

See specification - details for this test.

- -
+
diff --git a/testing/web-platform/tests/mixed-content/allowed/http-csp/same-host-https/link-css-tag/top-level/keep-scheme-redirect/allowed.https.html b/testing/web-platform/tests/mixed-content/allowed/http-csp/same-host-https/link-css-tag/top-level/keep-scheme-redirect/allowed.https.html index 4a502ef111dd..606887e3dd52 100644 --- a/testing/web-platform/tests/mixed-content/allowed/http-csp/same-host-https/link-css-tag/top-level/keep-scheme-redirect/allowed.https.html +++ b/testing/web-platform/tests/mixed-content/allowed/http-csp/same-host-https/link-css-tag/top-level/keep-scheme-redirect/allowed.https.html @@ -1,10 +1,12 @@ - + Mixed-Content: Allowed content + + - - - - - - -

Allowed content

-

Test behavior of allowed content.

-
opt_in_method: http-csp
-                                 origin: same-host-https
-                                 source_scheme: https
-                                 context_nesting: top-level
-                                 redirection: keep-scheme-redirect
-                                 subresource: link-css-tag
-                                 expectation: allowed
- -

See specification - details for this test.

- -
+
diff --git a/testing/web-platform/tests/mixed-content/allowed/http-csp/same-host-https/link-css-tag/top-level/no-redirect/allowed.https.html b/testing/web-platform/tests/mixed-content/allowed/http-csp/same-host-https/link-css-tag/top-level/no-redirect/allowed.https.html index d9761930854e..2f4f750de9fc 100644 --- a/testing/web-platform/tests/mixed-content/allowed/http-csp/same-host-https/link-css-tag/top-level/no-redirect/allowed.https.html +++ b/testing/web-platform/tests/mixed-content/allowed/http-csp/same-host-https/link-css-tag/top-level/no-redirect/allowed.https.html @@ -1,10 +1,12 @@ - + Mixed-Content: Allowed content + + - - - - - - -

Allowed content

-

Test behavior of allowed content.

-
opt_in_method: http-csp
-                                 origin: same-host-https
-                                 source_scheme: https
-                                 context_nesting: top-level
-                                 redirection: no-redirect
-                                 subresource: link-css-tag
-                                 expectation: allowed
- -

See specification - details for this test.

- -
+
diff --git a/testing/web-platform/tests/mixed-content/allowed/http-csp/same-host-https/link-prefetch-tag/top-level/keep-scheme-redirect/allowed.https.html b/testing/web-platform/tests/mixed-content/allowed/http-csp/same-host-https/link-prefetch-tag/top-level/keep-scheme-redirect/allowed.https.html index 69d69d3a73c1..a047941dcd48 100644 --- a/testing/web-platform/tests/mixed-content/allowed/http-csp/same-host-https/link-prefetch-tag/top-level/keep-scheme-redirect/allowed.https.html +++ b/testing/web-platform/tests/mixed-content/allowed/http-csp/same-host-https/link-prefetch-tag/top-level/keep-scheme-redirect/allowed.https.html @@ -1,10 +1,12 @@ - + Mixed-Content: Allowed content + + - - - - - - -

Allowed content

-

Test behavior of allowed content.

-
opt_in_method: http-csp
-                                 origin: same-host-https
-                                 source_scheme: https
-                                 context_nesting: top-level
-                                 redirection: keep-scheme-redirect
-                                 subresource: link-prefetch-tag
-                                 expectation: allowed
- -

See specification - details for this test.

- -
+
diff --git a/testing/web-platform/tests/mixed-content/allowed/http-csp/same-host-https/link-prefetch-tag/top-level/no-redirect/allowed.https.html b/testing/web-platform/tests/mixed-content/allowed/http-csp/same-host-https/link-prefetch-tag/top-level/no-redirect/allowed.https.html index e482ae3500ee..bd24109afe28 100644 --- a/testing/web-platform/tests/mixed-content/allowed/http-csp/same-host-https/link-prefetch-tag/top-level/no-redirect/allowed.https.html +++ b/testing/web-platform/tests/mixed-content/allowed/http-csp/same-host-https/link-prefetch-tag/top-level/no-redirect/allowed.https.html @@ -1,10 +1,12 @@ - + Mixed-Content: Allowed content + + - - - - - - -

Allowed content

-

Test behavior of allowed content.

-
opt_in_method: http-csp
-                                 origin: same-host-https
-                                 source_scheme: https
-                                 context_nesting: top-level
-                                 redirection: no-redirect
-                                 subresource: link-prefetch-tag
-                                 expectation: allowed
- -

See specification - details for this test.

- -
+
diff --git a/testing/web-platform/tests/mixed-content/allowed/http-csp/same-host-https/object-tag/top-level/keep-scheme-redirect/allowed.https.html b/testing/web-platform/tests/mixed-content/allowed/http-csp/same-host-https/object-tag/top-level/keep-scheme-redirect/allowed.https.html index 0bc7b32d141d..d1be723f15d5 100644 --- a/testing/web-platform/tests/mixed-content/allowed/http-csp/same-host-https/object-tag/top-level/keep-scheme-redirect/allowed.https.html +++ b/testing/web-platform/tests/mixed-content/allowed/http-csp/same-host-https/object-tag/top-level/keep-scheme-redirect/allowed.https.html @@ -1,10 +1,12 @@ - + Mixed-Content: Allowed content + + - - - - - - -

Allowed content

-

Test behavior of allowed content.

-
opt_in_method: http-csp
-                                 origin: same-host-https
-                                 source_scheme: https
-                                 context_nesting: top-level
-                                 redirection: keep-scheme-redirect
-                                 subresource: object-tag
-                                 expectation: allowed
- -

See specification - details for this test.

- -
+
diff --git a/testing/web-platform/tests/mixed-content/allowed/http-csp/same-host-https/object-tag/top-level/no-redirect/allowed.https.html b/testing/web-platform/tests/mixed-content/allowed/http-csp/same-host-https/object-tag/top-level/no-redirect/allowed.https.html index 412894cc6205..3f8ec136a1c5 100644 --- a/testing/web-platform/tests/mixed-content/allowed/http-csp/same-host-https/object-tag/top-level/no-redirect/allowed.https.html +++ b/testing/web-platform/tests/mixed-content/allowed/http-csp/same-host-https/object-tag/top-level/no-redirect/allowed.https.html @@ -1,10 +1,12 @@ - + Mixed-Content: Allowed content + + - - - - - - -

Allowed content

-

Test behavior of allowed content.

-
opt_in_method: http-csp
-                                 origin: same-host-https
-                                 source_scheme: https
-                                 context_nesting: top-level
-                                 redirection: no-redirect
-                                 subresource: object-tag
-                                 expectation: allowed
- -

See specification - details for this test.

- -
+
diff --git a/testing/web-platform/tests/mixed-content/allowed/http-csp/same-host-https/picture-tag/top-level/keep-scheme-redirect/allowed.https.html b/testing/web-platform/tests/mixed-content/allowed/http-csp/same-host-https/picture-tag/top-level/keep-scheme-redirect/allowed.https.html index 8c1400c09792..3ae09e2e3f31 100644 --- a/testing/web-platform/tests/mixed-content/allowed/http-csp/same-host-https/picture-tag/top-level/keep-scheme-redirect/allowed.https.html +++ b/testing/web-platform/tests/mixed-content/allowed/http-csp/same-host-https/picture-tag/top-level/keep-scheme-redirect/allowed.https.html @@ -1,10 +1,12 @@ - + Mixed-Content: Allowed content + + - - - - - - -

Allowed content

-

Test behavior of allowed content.

-
opt_in_method: http-csp
-                                 origin: same-host-https
-                                 source_scheme: https
-                                 context_nesting: top-level
-                                 redirection: keep-scheme-redirect
-                                 subresource: picture-tag
-                                 expectation: allowed
- -

See specification - details for this test.

- -
+
diff --git a/testing/web-platform/tests/mixed-content/allowed/http-csp/same-host-https/picture-tag/top-level/no-redirect/allowed.https.html b/testing/web-platform/tests/mixed-content/allowed/http-csp/same-host-https/picture-tag/top-level/no-redirect/allowed.https.html index bb40013c9c86..883c0bbdf780 100644 --- a/testing/web-platform/tests/mixed-content/allowed/http-csp/same-host-https/picture-tag/top-level/no-redirect/allowed.https.html +++ b/testing/web-platform/tests/mixed-content/allowed/http-csp/same-host-https/picture-tag/top-level/no-redirect/allowed.https.html @@ -1,10 +1,12 @@ - + Mixed-Content: Allowed content + + - - - - - - -

Allowed content

-

Test behavior of allowed content.

-
opt_in_method: http-csp
-                                 origin: same-host-https
-                                 source_scheme: https
-                                 context_nesting: top-level
-                                 redirection: no-redirect
-                                 subresource: picture-tag
-                                 expectation: allowed
- -

See specification - details for this test.

- -
+
diff --git a/testing/web-platform/tests/mixed-content/allowed/http-csp/same-host-https/script-tag/top-level/keep-scheme-redirect/allowed.https.html b/testing/web-platform/tests/mixed-content/allowed/http-csp/same-host-https/script-tag/top-level/keep-scheme-redirect/allowed.https.html index e7a11db559fe..cb3528e03c90 100644 --- a/testing/web-platform/tests/mixed-content/allowed/http-csp/same-host-https/script-tag/top-level/keep-scheme-redirect/allowed.https.html +++ b/testing/web-platform/tests/mixed-content/allowed/http-csp/same-host-https/script-tag/top-level/keep-scheme-redirect/allowed.https.html @@ -1,10 +1,12 @@ - + Mixed-Content: Allowed content + + - - - - - - -

Allowed content

-

Test behavior of allowed content.

-
opt_in_method: http-csp
-                                 origin: same-host-https
-                                 source_scheme: https
-                                 context_nesting: top-level
-                                 redirection: keep-scheme-redirect
-                                 subresource: script-tag
-                                 expectation: allowed
- -

See specification - details for this test.

- -
+
diff --git a/testing/web-platform/tests/mixed-content/allowed/http-csp/same-host-https/script-tag/top-level/no-redirect/allowed.https.html b/testing/web-platform/tests/mixed-content/allowed/http-csp/same-host-https/script-tag/top-level/no-redirect/allowed.https.html index b94f116e47fe..7bffa299c5dd 100644 --- a/testing/web-platform/tests/mixed-content/allowed/http-csp/same-host-https/script-tag/top-level/no-redirect/allowed.https.html +++ b/testing/web-platform/tests/mixed-content/allowed/http-csp/same-host-https/script-tag/top-level/no-redirect/allowed.https.html @@ -1,10 +1,12 @@ - + Mixed-Content: Allowed content + + - - - - - - -

Allowed content

-

Test behavior of allowed content.

-
opt_in_method: http-csp
-                                 origin: same-host-https
-                                 source_scheme: https
-                                 context_nesting: top-level
-                                 redirection: no-redirect
-                                 subresource: script-tag
-                                 expectation: allowed
- -

See specification - details for this test.

- -
+
diff --git a/testing/web-platform/tests/mixed-content/allowed/http-csp/same-host-https/video-tag/top-level/keep-scheme-redirect/allowed.https.html b/testing/web-platform/tests/mixed-content/allowed/http-csp/same-host-https/video-tag/top-level/keep-scheme-redirect/allowed.https.html index 48d4a2886679..ce72664408e0 100644 --- a/testing/web-platform/tests/mixed-content/allowed/http-csp/same-host-https/video-tag/top-level/keep-scheme-redirect/allowed.https.html +++ b/testing/web-platform/tests/mixed-content/allowed/http-csp/same-host-https/video-tag/top-level/keep-scheme-redirect/allowed.https.html @@ -1,10 +1,12 @@ - + Mixed-Content: Allowed content + + - - - - - - -

Allowed content

-

Test behavior of allowed content.

-
opt_in_method: http-csp
-                                 origin: same-host-https
-                                 source_scheme: https
-                                 context_nesting: top-level
-                                 redirection: keep-scheme-redirect
-                                 subresource: video-tag
-                                 expectation: allowed
- -

See specification - details for this test.

- -
+
diff --git a/testing/web-platform/tests/mixed-content/allowed/http-csp/same-host-https/video-tag/top-level/no-redirect/allowed.https.html b/testing/web-platform/tests/mixed-content/allowed/http-csp/same-host-https/video-tag/top-level/no-redirect/allowed.https.html index bd00bd6324ea..b9ddc78ff18c 100644 --- a/testing/web-platform/tests/mixed-content/allowed/http-csp/same-host-https/video-tag/top-level/no-redirect/allowed.https.html +++ b/testing/web-platform/tests/mixed-content/allowed/http-csp/same-host-https/video-tag/top-level/no-redirect/allowed.https.html @@ -1,10 +1,12 @@ - + Mixed-Content: Allowed content + + - - - - - - -

Allowed content

-

Test behavior of allowed content.

-
opt_in_method: http-csp
-                                 origin: same-host-https
-                                 source_scheme: https
-                                 context_nesting: top-level
-                                 redirection: no-redirect
-                                 subresource: video-tag
-                                 expectation: allowed
- -

See specification - details for this test.

- -
+
diff --git a/testing/web-platform/tests/mixed-content/allowed/http-csp/same-host-https/worker-request/top-level/keep-scheme-redirect/allowed.https.html b/testing/web-platform/tests/mixed-content/allowed/http-csp/same-host-https/worker-request/top-level/keep-scheme-redirect/allowed.https.html index 7f772955e246..1a9053e4c3eb 100644 --- a/testing/web-platform/tests/mixed-content/allowed/http-csp/same-host-https/worker-request/top-level/keep-scheme-redirect/allowed.https.html +++ b/testing/web-platform/tests/mixed-content/allowed/http-csp/same-host-https/worker-request/top-level/keep-scheme-redirect/allowed.https.html @@ -1,10 +1,12 @@ - + Mixed-Content: Allowed content + + - - - - - - -

Allowed content

-

Test behavior of allowed content.

-
opt_in_method: http-csp
-                                 origin: same-host-https
-                                 source_scheme: https
-                                 context_nesting: top-level
-                                 redirection: keep-scheme-redirect
-                                 subresource: worker-request
-                                 expectation: allowed
- -

See specification - details for this test.

- -
+
diff --git a/testing/web-platform/tests/mixed-content/allowed/http-csp/same-host-https/worker-request/top-level/no-redirect/allowed.https.html b/testing/web-platform/tests/mixed-content/allowed/http-csp/same-host-https/worker-request/top-level/no-redirect/allowed.https.html index 620ec69295e5..0488b1337550 100644 --- a/testing/web-platform/tests/mixed-content/allowed/http-csp/same-host-https/worker-request/top-level/no-redirect/allowed.https.html +++ b/testing/web-platform/tests/mixed-content/allowed/http-csp/same-host-https/worker-request/top-level/no-redirect/allowed.https.html @@ -1,10 +1,12 @@ - + Mixed-Content: Allowed content + + - - - - - - -

Allowed content

-

Test behavior of allowed content.

-
opt_in_method: http-csp
-                                 origin: same-host-https
-                                 source_scheme: https
-                                 context_nesting: top-level
-                                 redirection: no-redirect
-                                 subresource: worker-request
-                                 expectation: allowed
- -

See specification - details for this test.

- -
+
diff --git a/testing/web-platform/tests/mixed-content/allowed/http-csp/same-host-https/xhr-request/top-level/keep-scheme-redirect/allowed.https.html b/testing/web-platform/tests/mixed-content/allowed/http-csp/same-host-https/xhr-request/top-level/keep-scheme-redirect/allowed.https.html index 7994c9c9a4f9..23f0a1fc89d3 100644 --- a/testing/web-platform/tests/mixed-content/allowed/http-csp/same-host-https/xhr-request/top-level/keep-scheme-redirect/allowed.https.html +++ b/testing/web-platform/tests/mixed-content/allowed/http-csp/same-host-https/xhr-request/top-level/keep-scheme-redirect/allowed.https.html @@ -1,10 +1,12 @@ - + Mixed-Content: Allowed content + + - - - - - - -

Allowed content

-

Test behavior of allowed content.

-
opt_in_method: http-csp
-                                 origin: same-host-https
-                                 source_scheme: https
-                                 context_nesting: top-level
-                                 redirection: keep-scheme-redirect
-                                 subresource: xhr-request
-                                 expectation: allowed
- -

See specification - details for this test.

- -
+
diff --git a/testing/web-platform/tests/mixed-content/allowed/http-csp/same-host-https/xhr-request/top-level/no-redirect/allowed.https.html b/testing/web-platform/tests/mixed-content/allowed/http-csp/same-host-https/xhr-request/top-level/no-redirect/allowed.https.html index 968a1961dff1..7baa3e54a98f 100644 --- a/testing/web-platform/tests/mixed-content/allowed/http-csp/same-host-https/xhr-request/top-level/no-redirect/allowed.https.html +++ b/testing/web-platform/tests/mixed-content/allowed/http-csp/same-host-https/xhr-request/top-level/no-redirect/allowed.https.html @@ -1,10 +1,12 @@ - + Mixed-Content: Allowed content + + - - - - - - -

Allowed content

-

Test behavior of allowed content.

-
opt_in_method: http-csp
-                                 origin: same-host-https
-                                 source_scheme: https
-                                 context_nesting: top-level
-                                 redirection: no-redirect
-                                 subresource: xhr-request
-                                 expectation: allowed
- -

See specification - details for this test.

- -
+
diff --git a/testing/web-platform/tests/mixed-content/allowed/meta-csp/same-host-https/audio-tag/top-level/no-redirect/allowed.https.html b/testing/web-platform/tests/mixed-content/allowed/meta-csp/same-host-https/audio-tag/top-level/no-redirect/allowed.https.html index 420d1505a8c1..721e31d399a1 100644 --- a/testing/web-platform/tests/mixed-content/allowed/meta-csp/same-host-https/audio-tag/top-level/no-redirect/allowed.https.html +++ b/testing/web-platform/tests/mixed-content/allowed/meta-csp/same-host-https/audio-tag/top-level/no-redirect/allowed.https.html @@ -1,43 +1,25 @@ - + Mixed-Content: Allowed content + + + expectation: allowed"> - - - - - - -

Allowed content

-

Test behavior of allowed content.

-
opt_in_method: meta-csp
-                                 origin: same-host-https
-                                 source_scheme: https
-                                 context_nesting: top-level
-                                 redirection: no-redirect
-                                 subresource: audio-tag
-                                 expectation: allowed
- -

See specification - details for this test.

- -
+
diff --git a/testing/web-platform/tests/mixed-content/allowed/meta-csp/same-host-https/fetch-request/top-level/no-redirect/allowed.https.html b/testing/web-platform/tests/mixed-content/allowed/meta-csp/same-host-https/fetch-request/top-level/no-redirect/allowed.https.html index 51fb3a591e60..e78f5493f914 100644 --- a/testing/web-platform/tests/mixed-content/allowed/meta-csp/same-host-https/fetch-request/top-level/no-redirect/allowed.https.html +++ b/testing/web-platform/tests/mixed-content/allowed/meta-csp/same-host-https/fetch-request/top-level/no-redirect/allowed.https.html @@ -1,43 +1,25 @@ - + Mixed-Content: Allowed content + + + expectation: allowed"> - - - - - - -

Allowed content

-

Test behavior of allowed content.

-
opt_in_method: meta-csp
-                                 origin: same-host-https
-                                 source_scheme: https
-                                 context_nesting: top-level
-                                 redirection: no-redirect
-                                 subresource: fetch-request
-                                 expectation: allowed
- -

See specification - details for this test.

- -
+
diff --git a/testing/web-platform/tests/mixed-content/allowed/meta-csp/same-host-https/form-tag/top-level/no-redirect/allowed.https.html b/testing/web-platform/tests/mixed-content/allowed/meta-csp/same-host-https/form-tag/top-level/no-redirect/allowed.https.html index fc4c0869503d..7b8652238ffa 100644 --- a/testing/web-platform/tests/mixed-content/allowed/meta-csp/same-host-https/form-tag/top-level/no-redirect/allowed.https.html +++ b/testing/web-platform/tests/mixed-content/allowed/meta-csp/same-host-https/form-tag/top-level/no-redirect/allowed.https.html @@ -1,43 +1,25 @@ - + Mixed-Content: Allowed content + + + expectation: allowed"> - - - - - - -

Allowed content

-

Test behavior of allowed content.

-
opt_in_method: meta-csp
-                                 origin: same-host-https
-                                 source_scheme: https
-                                 context_nesting: top-level
-                                 redirection: no-redirect
-                                 subresource: form-tag
-                                 expectation: allowed
- -

See specification - details for this test.

- -
+
diff --git a/testing/web-platform/tests/mixed-content/allowed/meta-csp/same-host-https/iframe-tag/top-level/no-redirect/allowed.https.html b/testing/web-platform/tests/mixed-content/allowed/meta-csp/same-host-https/iframe-tag/top-level/no-redirect/allowed.https.html index 6a5650251a4b..a3430f19368b 100644 --- a/testing/web-platform/tests/mixed-content/allowed/meta-csp/same-host-https/iframe-tag/top-level/no-redirect/allowed.https.html +++ b/testing/web-platform/tests/mixed-content/allowed/meta-csp/same-host-https/iframe-tag/top-level/no-redirect/allowed.https.html @@ -1,43 +1,25 @@ - + Mixed-Content: Allowed content + + + expectation: allowed"> - - - - - - -

Allowed content

-

Test behavior of allowed content.

-
opt_in_method: meta-csp
-                                 origin: same-host-https
-                                 source_scheme: https
-                                 context_nesting: top-level
-                                 redirection: no-redirect
-                                 subresource: iframe-tag
-                                 expectation: allowed
- -

See specification - details for this test.

- -
+
diff --git a/testing/web-platform/tests/mixed-content/allowed/meta-csp/same-host-https/img-tag/top-level/no-redirect/allowed.https.html b/testing/web-platform/tests/mixed-content/allowed/meta-csp/same-host-https/img-tag/top-level/no-redirect/allowed.https.html index 7cedf27a751e..46ece8f0caa0 100644 --- a/testing/web-platform/tests/mixed-content/allowed/meta-csp/same-host-https/img-tag/top-level/no-redirect/allowed.https.html +++ b/testing/web-platform/tests/mixed-content/allowed/meta-csp/same-host-https/img-tag/top-level/no-redirect/allowed.https.html @@ -1,43 +1,25 @@ - + Mixed-Content: Allowed content + + + expectation: allowed"> - - - - - - -

Allowed content

-

Test behavior of allowed content.

-
opt_in_method: meta-csp
-                                 origin: same-host-https
-                                 source_scheme: https
-                                 context_nesting: top-level
-                                 redirection: no-redirect
-                                 subresource: img-tag
-                                 expectation: allowed
- -

See specification - details for this test.

- -
+
diff --git a/testing/web-platform/tests/mixed-content/allowed/meta-csp/same-host-https/link-css-tag/top-level/no-redirect/allowed.https.html b/testing/web-platform/tests/mixed-content/allowed/meta-csp/same-host-https/link-css-tag/top-level/no-redirect/allowed.https.html index 7b61d3cdd265..51d062746029 100644 --- a/testing/web-platform/tests/mixed-content/allowed/meta-csp/same-host-https/link-css-tag/top-level/no-redirect/allowed.https.html +++ b/testing/web-platform/tests/mixed-content/allowed/meta-csp/same-host-https/link-css-tag/top-level/no-redirect/allowed.https.html @@ -1,43 +1,25 @@ - + Mixed-Content: Allowed content + + + expectation: allowed"> - - - - - - -

Allowed content

-

Test behavior of allowed content.

-
opt_in_method: meta-csp
-                                 origin: same-host-https
-                                 source_scheme: https
-                                 context_nesting: top-level
-                                 redirection: no-redirect
-                                 subresource: link-css-tag
-                                 expectation: allowed
- -

See specification - details for this test.

- -
+
diff --git a/testing/web-platform/tests/mixed-content/allowed/meta-csp/same-host-https/link-prefetch-tag/top-level/no-redirect/allowed.https.html b/testing/web-platform/tests/mixed-content/allowed/meta-csp/same-host-https/link-prefetch-tag/top-level/no-redirect/allowed.https.html index 8ff7c5427d03..3763052b387b 100644 --- a/testing/web-platform/tests/mixed-content/allowed/meta-csp/same-host-https/link-prefetch-tag/top-level/no-redirect/allowed.https.html +++ b/testing/web-platform/tests/mixed-content/allowed/meta-csp/same-host-https/link-prefetch-tag/top-level/no-redirect/allowed.https.html @@ -1,43 +1,25 @@ - + Mixed-Content: Allowed content + + + expectation: allowed"> - - - - - - -

Allowed content

-

Test behavior of allowed content.

-
opt_in_method: meta-csp
-                                 origin: same-host-https
-                                 source_scheme: https
-                                 context_nesting: top-level
-                                 redirection: no-redirect
-                                 subresource: link-prefetch-tag
-                                 expectation: allowed
- -

See specification - details for this test.

- -
+
diff --git a/testing/web-platform/tests/mixed-content/allowed/meta-csp/same-host-https/object-tag/top-level/no-redirect/allowed.https.html b/testing/web-platform/tests/mixed-content/allowed/meta-csp/same-host-https/object-tag/top-level/no-redirect/allowed.https.html index 727c13ac86b7..7a5e5dfa3502 100644 --- a/testing/web-platform/tests/mixed-content/allowed/meta-csp/same-host-https/object-tag/top-level/no-redirect/allowed.https.html +++ b/testing/web-platform/tests/mixed-content/allowed/meta-csp/same-host-https/object-tag/top-level/no-redirect/allowed.https.html @@ -1,43 +1,25 @@ - + Mixed-Content: Allowed content + + + expectation: allowed"> - - - - - - -

Allowed content

-

Test behavior of allowed content.

-
opt_in_method: meta-csp
-                                 origin: same-host-https
-                                 source_scheme: https
-                                 context_nesting: top-level
-                                 redirection: no-redirect
-                                 subresource: object-tag
-                                 expectation: allowed
- -

See specification - details for this test.

- -
+
diff --git a/testing/web-platform/tests/mixed-content/allowed/meta-csp/same-host-https/picture-tag/top-level/no-redirect/allowed.https.html b/testing/web-platform/tests/mixed-content/allowed/meta-csp/same-host-https/picture-tag/top-level/no-redirect/allowed.https.html index fd0f57816330..c9885eb85778 100644 --- a/testing/web-platform/tests/mixed-content/allowed/meta-csp/same-host-https/picture-tag/top-level/no-redirect/allowed.https.html +++ b/testing/web-platform/tests/mixed-content/allowed/meta-csp/same-host-https/picture-tag/top-level/no-redirect/allowed.https.html @@ -1,43 +1,25 @@ - + Mixed-Content: Allowed content + + + expectation: allowed"> - - - - - - -

Allowed content

-

Test behavior of allowed content.

-
opt_in_method: meta-csp
-                                 origin: same-host-https
-                                 source_scheme: https
-                                 context_nesting: top-level
-                                 redirection: no-redirect
-                                 subresource: picture-tag
-                                 expectation: allowed
- -

See specification - details for this test.

- -
+
diff --git a/testing/web-platform/tests/mixed-content/allowed/meta-csp/same-host-https/script-tag/top-level/no-redirect/allowed.https.html b/testing/web-platform/tests/mixed-content/allowed/meta-csp/same-host-https/script-tag/top-level/no-redirect/allowed.https.html index 97fd7c546784..c0e7eb867965 100644 --- a/testing/web-platform/tests/mixed-content/allowed/meta-csp/same-host-https/script-tag/top-level/no-redirect/allowed.https.html +++ b/testing/web-platform/tests/mixed-content/allowed/meta-csp/same-host-https/script-tag/top-level/no-redirect/allowed.https.html @@ -1,43 +1,25 @@ - + Mixed-Content: Allowed content + + + expectation: allowed"> - - - - - - -

Allowed content

-

Test behavior of allowed content.

-
opt_in_method: meta-csp
-                                 origin: same-host-https
-                                 source_scheme: https
-                                 context_nesting: top-level
-                                 redirection: no-redirect
-                                 subresource: script-tag
-                                 expectation: allowed
- -

See specification - details for this test.

- -
+
diff --git a/testing/web-platform/tests/mixed-content/allowed/meta-csp/same-host-https/video-tag/top-level/no-redirect/allowed.https.html b/testing/web-platform/tests/mixed-content/allowed/meta-csp/same-host-https/video-tag/top-level/no-redirect/allowed.https.html index 47ce11386582..2799f5af02f8 100644 --- a/testing/web-platform/tests/mixed-content/allowed/meta-csp/same-host-https/video-tag/top-level/no-redirect/allowed.https.html +++ b/testing/web-platform/tests/mixed-content/allowed/meta-csp/same-host-https/video-tag/top-level/no-redirect/allowed.https.html @@ -1,43 +1,25 @@ - + Mixed-Content: Allowed content + + + expectation: allowed"> - - - - - - -

Allowed content

-

Test behavior of allowed content.

-
opt_in_method: meta-csp
-                                 origin: same-host-https
-                                 source_scheme: https
-                                 context_nesting: top-level
-                                 redirection: no-redirect
-                                 subresource: video-tag
-                                 expectation: allowed
- -

See specification - details for this test.

- -
+
diff --git a/testing/web-platform/tests/mixed-content/allowed/meta-csp/same-host-https/worker-request/top-level/no-redirect/allowed.https.html b/testing/web-platform/tests/mixed-content/allowed/meta-csp/same-host-https/worker-request/top-level/no-redirect/allowed.https.html index dfe4c0d2b96b..091bc03c1618 100644 --- a/testing/web-platform/tests/mixed-content/allowed/meta-csp/same-host-https/worker-request/top-level/no-redirect/allowed.https.html +++ b/testing/web-platform/tests/mixed-content/allowed/meta-csp/same-host-https/worker-request/top-level/no-redirect/allowed.https.html @@ -1,43 +1,25 @@ - + Mixed-Content: Allowed content + + + expectation: allowed"> - - - - - - -

Allowed content

-

Test behavior of allowed content.

-
opt_in_method: meta-csp
-                                 origin: same-host-https
-                                 source_scheme: https
-                                 context_nesting: top-level
-                                 redirection: no-redirect
-                                 subresource: worker-request
-                                 expectation: allowed
- -

See specification - details for this test.

- -
+
diff --git a/testing/web-platform/tests/mixed-content/allowed/meta-csp/same-host-https/xhr-request/top-level/no-redirect/allowed.https.html b/testing/web-platform/tests/mixed-content/allowed/meta-csp/same-host-https/xhr-request/top-level/no-redirect/allowed.https.html index 890c5a068e0d..4044ccec1fc2 100644 --- a/testing/web-platform/tests/mixed-content/allowed/meta-csp/same-host-https/xhr-request/top-level/no-redirect/allowed.https.html +++ b/testing/web-platform/tests/mixed-content/allowed/meta-csp/same-host-https/xhr-request/top-level/no-redirect/allowed.https.html @@ -1,43 +1,25 @@ - + Mixed-Content: Allowed content + + + expectation: allowed"> - - - - - - -

Allowed content

-

Test behavior of allowed content.

-
opt_in_method: meta-csp
-                                 origin: same-host-https
-                                 source_scheme: https
-                                 context_nesting: top-level
-                                 redirection: no-redirect
-                                 subresource: xhr-request
-                                 expectation: allowed
- -

See specification - details for this test.

- -
+
diff --git a/testing/web-platform/tests/mixed-content/allowed/no-opt-in/same-host-https/audio-tag/top-level/keep-scheme-redirect/allowed.https.html b/testing/web-platform/tests/mixed-content/allowed/no-opt-in/same-host-https/audio-tag/top-level/keep-scheme-redirect/allowed.https.html index ef20ab3dd20f..b30f28b2aab6 100644 --- a/testing/web-platform/tests/mixed-content/allowed/no-opt-in/same-host-https/audio-tag/top-level/keep-scheme-redirect/allowed.https.html +++ b/testing/web-platform/tests/mixed-content/allowed/no-opt-in/same-host-https/audio-tag/top-level/keep-scheme-redirect/allowed.https.html @@ -1,10 +1,12 @@ - + Mixed-Content: Allowed content + + - - - - - - -

Allowed content

-

Test behavior of allowed content.

-
opt_in_method: no-opt-in
-                                 origin: same-host-https
-                                 source_scheme: https
-                                 context_nesting: top-level
-                                 redirection: keep-scheme-redirect
-                                 subresource: audio-tag
-                                 expectation: allowed
- -

See specification - details for this test.

- -
+
diff --git a/testing/web-platform/tests/mixed-content/allowed/no-opt-in/same-host-https/audio-tag/top-level/no-redirect/allowed.https.html b/testing/web-platform/tests/mixed-content/allowed/no-opt-in/same-host-https/audio-tag/top-level/no-redirect/allowed.https.html index 7947998f3b1c..c13fd88e47e9 100644 --- a/testing/web-platform/tests/mixed-content/allowed/no-opt-in/same-host-https/audio-tag/top-level/no-redirect/allowed.https.html +++ b/testing/web-platform/tests/mixed-content/allowed/no-opt-in/same-host-https/audio-tag/top-level/no-redirect/allowed.https.html @@ -1,10 +1,12 @@ - + Mixed-Content: Allowed content + + - - - - - - -

Allowed content

-

Test behavior of allowed content.

-
opt_in_method: no-opt-in
-                                 origin: same-host-https
-                                 source_scheme: https
-                                 context_nesting: top-level
-                                 redirection: no-redirect
-                                 subresource: audio-tag
-                                 expectation: allowed
- -

See specification - details for this test.

- -
+
diff --git a/testing/web-platform/tests/mixed-content/allowed/no-opt-in/same-host-https/fetch-request/top-level/keep-scheme-redirect/allowed.https.html b/testing/web-platform/tests/mixed-content/allowed/no-opt-in/same-host-https/fetch-request/top-level/keep-scheme-redirect/allowed.https.html index 259edb91093c..9045019de11f 100644 --- a/testing/web-platform/tests/mixed-content/allowed/no-opt-in/same-host-https/fetch-request/top-level/keep-scheme-redirect/allowed.https.html +++ b/testing/web-platform/tests/mixed-content/allowed/no-opt-in/same-host-https/fetch-request/top-level/keep-scheme-redirect/allowed.https.html @@ -1,10 +1,12 @@ - + Mixed-Content: Allowed content + + - - - - - - -

Allowed content

-

Test behavior of allowed content.

-
opt_in_method: no-opt-in
-                                 origin: same-host-https
-                                 source_scheme: https
-                                 context_nesting: top-level
-                                 redirection: keep-scheme-redirect
-                                 subresource: fetch-request
-                                 expectation: allowed
- -

See specification - details for this test.

- -
+
diff --git a/testing/web-platform/tests/mixed-content/allowed/no-opt-in/same-host-https/fetch-request/top-level/no-redirect/allowed.https.html b/testing/web-platform/tests/mixed-content/allowed/no-opt-in/same-host-https/fetch-request/top-level/no-redirect/allowed.https.html index e2ad2c00a115..d4b8292af324 100644 --- a/testing/web-platform/tests/mixed-content/allowed/no-opt-in/same-host-https/fetch-request/top-level/no-redirect/allowed.https.html +++ b/testing/web-platform/tests/mixed-content/allowed/no-opt-in/same-host-https/fetch-request/top-level/no-redirect/allowed.https.html @@ -1,10 +1,12 @@ - + Mixed-Content: Allowed content + + - - - - - - -

Allowed content

-

Test behavior of allowed content.

-
opt_in_method: no-opt-in
-                                 origin: same-host-https
-                                 source_scheme: https
-                                 context_nesting: top-level
-                                 redirection: no-redirect
-                                 subresource: fetch-request
-                                 expectation: allowed
- -

See specification - details for this test.

- -
+
diff --git a/testing/web-platform/tests/mixed-content/allowed/no-opt-in/same-host-https/form-tag/top-level/keep-scheme-redirect/allowed.https.html b/testing/web-platform/tests/mixed-content/allowed/no-opt-in/same-host-https/form-tag/top-level/keep-scheme-redirect/allowed.https.html index c1fbed161ac3..a640ddee7d93 100644 --- a/testing/web-platform/tests/mixed-content/allowed/no-opt-in/same-host-https/form-tag/top-level/keep-scheme-redirect/allowed.https.html +++ b/testing/web-platform/tests/mixed-content/allowed/no-opt-in/same-host-https/form-tag/top-level/keep-scheme-redirect/allowed.https.html @@ -1,10 +1,12 @@ - + Mixed-Content: Allowed content + + - - - - - - -

Allowed content

-

Test behavior of allowed content.

-
opt_in_method: no-opt-in
-                                 origin: same-host-https
-                                 source_scheme: https
-                                 context_nesting: top-level
-                                 redirection: keep-scheme-redirect
-                                 subresource: form-tag
-                                 expectation: allowed
- -

See specification - details for this test.

- -
+
diff --git a/testing/web-platform/tests/mixed-content/allowed/no-opt-in/same-host-https/form-tag/top-level/no-redirect/allowed.https.html b/testing/web-platform/tests/mixed-content/allowed/no-opt-in/same-host-https/form-tag/top-level/no-redirect/allowed.https.html index ea646752bc6e..48f005a386eb 100644 --- a/testing/web-platform/tests/mixed-content/allowed/no-opt-in/same-host-https/form-tag/top-level/no-redirect/allowed.https.html +++ b/testing/web-platform/tests/mixed-content/allowed/no-opt-in/same-host-https/form-tag/top-level/no-redirect/allowed.https.html @@ -1,10 +1,12 @@ - + Mixed-Content: Allowed content + + - - - - - - -

Allowed content

-

Test behavior of allowed content.

-
opt_in_method: no-opt-in
-                                 origin: same-host-https
-                                 source_scheme: https
-                                 context_nesting: top-level
-                                 redirection: no-redirect
-                                 subresource: form-tag
-                                 expectation: allowed
- -

See specification - details for this test.

- -
+
diff --git a/testing/web-platform/tests/mixed-content/allowed/no-opt-in/same-host-https/iframe-tag/top-level/keep-scheme-redirect/allowed.https.html b/testing/web-platform/tests/mixed-content/allowed/no-opt-in/same-host-https/iframe-tag/top-level/keep-scheme-redirect/allowed.https.html index fb7626fcfb8e..f44a0b54d66a 100644 --- a/testing/web-platform/tests/mixed-content/allowed/no-opt-in/same-host-https/iframe-tag/top-level/keep-scheme-redirect/allowed.https.html +++ b/testing/web-platform/tests/mixed-content/allowed/no-opt-in/same-host-https/iframe-tag/top-level/keep-scheme-redirect/allowed.https.html @@ -1,10 +1,12 @@ - + Mixed-Content: Allowed content + + - - - - - - -

Allowed content

-

Test behavior of allowed content.

-
opt_in_method: no-opt-in
-                                 origin: same-host-https
-                                 source_scheme: https
-                                 context_nesting: top-level
-                                 redirection: keep-scheme-redirect
-                                 subresource: iframe-tag
-                                 expectation: allowed
- -

See specification - details for this test.

- -
+
diff --git a/testing/web-platform/tests/mixed-content/allowed/no-opt-in/same-host-https/iframe-tag/top-level/no-redirect/allowed.https.html b/testing/web-platform/tests/mixed-content/allowed/no-opt-in/same-host-https/iframe-tag/top-level/no-redirect/allowed.https.html index e0e31ce25e17..9cd4f1ba4216 100644 --- a/testing/web-platform/tests/mixed-content/allowed/no-opt-in/same-host-https/iframe-tag/top-level/no-redirect/allowed.https.html +++ b/testing/web-platform/tests/mixed-content/allowed/no-opt-in/same-host-https/iframe-tag/top-level/no-redirect/allowed.https.html @@ -1,10 +1,12 @@ - + Mixed-Content: Allowed content + + - - - - - - -

Allowed content

-

Test behavior of allowed content.

-
opt_in_method: no-opt-in
-                                 origin: same-host-https
-                                 source_scheme: https
-                                 context_nesting: top-level
-                                 redirection: no-redirect
-                                 subresource: iframe-tag
-                                 expectation: allowed
- -

See specification - details for this test.

- -
+
diff --git a/testing/web-platform/tests/mixed-content/allowed/no-opt-in/same-host-https/img-tag/top-level/keep-scheme-redirect/allowed.https.html b/testing/web-platform/tests/mixed-content/allowed/no-opt-in/same-host-https/img-tag/top-level/keep-scheme-redirect/allowed.https.html index 3732ca0c34bf..54bb60accf14 100644 --- a/testing/web-platform/tests/mixed-content/allowed/no-opt-in/same-host-https/img-tag/top-level/keep-scheme-redirect/allowed.https.html +++ b/testing/web-platform/tests/mixed-content/allowed/no-opt-in/same-host-https/img-tag/top-level/keep-scheme-redirect/allowed.https.html @@ -1,10 +1,12 @@ - + Mixed-Content: Allowed content + + - - - - - - -

Allowed content

-

Test behavior of allowed content.

-
opt_in_method: no-opt-in
-                                 origin: same-host-https
-                                 source_scheme: https
-                                 context_nesting: top-level
-                                 redirection: keep-scheme-redirect
-                                 subresource: img-tag
-                                 expectation: allowed
- -

See specification - details for this test.

- -
+
diff --git a/testing/web-platform/tests/mixed-content/allowed/no-opt-in/same-host-https/img-tag/top-level/no-redirect/allowed.https.html b/testing/web-platform/tests/mixed-content/allowed/no-opt-in/same-host-https/img-tag/top-level/no-redirect/allowed.https.html index cd098fcc6bc9..26d7d2390aee 100644 --- a/testing/web-platform/tests/mixed-content/allowed/no-opt-in/same-host-https/img-tag/top-level/no-redirect/allowed.https.html +++ b/testing/web-platform/tests/mixed-content/allowed/no-opt-in/same-host-https/img-tag/top-level/no-redirect/allowed.https.html @@ -1,10 +1,12 @@ - + Mixed-Content: Allowed content + + - - - - - - -

Allowed content

-

Test behavior of allowed content.

-
opt_in_method: no-opt-in
-                                 origin: same-host-https
-                                 source_scheme: https
-                                 context_nesting: top-level
-                                 redirection: no-redirect
-                                 subresource: img-tag
-                                 expectation: allowed
- -

See specification - details for this test.

- -
+
diff --git a/testing/web-platform/tests/mixed-content/allowed/no-opt-in/same-host-https/link-css-tag/top-level/keep-scheme-redirect/allowed.https.html b/testing/web-platform/tests/mixed-content/allowed/no-opt-in/same-host-https/link-css-tag/top-level/keep-scheme-redirect/allowed.https.html index 98dc8f5b8b04..7d620f8da936 100644 --- a/testing/web-platform/tests/mixed-content/allowed/no-opt-in/same-host-https/link-css-tag/top-level/keep-scheme-redirect/allowed.https.html +++ b/testing/web-platform/tests/mixed-content/allowed/no-opt-in/same-host-https/link-css-tag/top-level/keep-scheme-redirect/allowed.https.html @@ -1,10 +1,12 @@ - + Mixed-Content: Allowed content + + - - - - - - -

Allowed content

-

Test behavior of allowed content.

-
opt_in_method: no-opt-in
-                                 origin: same-host-https
-                                 source_scheme: https
-                                 context_nesting: top-level
-                                 redirection: keep-scheme-redirect
-                                 subresource: link-css-tag
-                                 expectation: allowed
- -

See specification - details for this test.

- -
+
diff --git a/testing/web-platform/tests/mixed-content/allowed/no-opt-in/same-host-https/link-css-tag/top-level/no-redirect/allowed.https.html b/testing/web-platform/tests/mixed-content/allowed/no-opt-in/same-host-https/link-css-tag/top-level/no-redirect/allowed.https.html index 2cf47e953ac6..f6d23405dd5e 100644 --- a/testing/web-platform/tests/mixed-content/allowed/no-opt-in/same-host-https/link-css-tag/top-level/no-redirect/allowed.https.html +++ b/testing/web-platform/tests/mixed-content/allowed/no-opt-in/same-host-https/link-css-tag/top-level/no-redirect/allowed.https.html @@ -1,10 +1,12 @@ - + Mixed-Content: Allowed content + + - - - - - - -

Allowed content

-

Test behavior of allowed content.

-
opt_in_method: no-opt-in
-                                 origin: same-host-https
-                                 source_scheme: https
-                                 context_nesting: top-level
-                                 redirection: no-redirect
-                                 subresource: link-css-tag
-                                 expectation: allowed
- -

See specification - details for this test.

- -
+
diff --git a/testing/web-platform/tests/mixed-content/allowed/no-opt-in/same-host-https/link-prefetch-tag/top-level/keep-scheme-redirect/allowed.https.html b/testing/web-platform/tests/mixed-content/allowed/no-opt-in/same-host-https/link-prefetch-tag/top-level/keep-scheme-redirect/allowed.https.html index ff96861c443c..c3ea33fdb700 100644 --- a/testing/web-platform/tests/mixed-content/allowed/no-opt-in/same-host-https/link-prefetch-tag/top-level/keep-scheme-redirect/allowed.https.html +++ b/testing/web-platform/tests/mixed-content/allowed/no-opt-in/same-host-https/link-prefetch-tag/top-level/keep-scheme-redirect/allowed.https.html @@ -1,10 +1,12 @@ - + Mixed-Content: Allowed content + + - - - - - - -

Allowed content

-

Test behavior of allowed content.

-
opt_in_method: no-opt-in
-                                 origin: same-host-https
-                                 source_scheme: https
-                                 context_nesting: top-level
-                                 redirection: keep-scheme-redirect
-                                 subresource: link-prefetch-tag
-                                 expectation: allowed
- -

See specification - details for this test.

- -
+
diff --git a/testing/web-platform/tests/mixed-content/allowed/no-opt-in/same-host-https/link-prefetch-tag/top-level/no-redirect/allowed.https.html b/testing/web-platform/tests/mixed-content/allowed/no-opt-in/same-host-https/link-prefetch-tag/top-level/no-redirect/allowed.https.html index a590f6a0013c..4c5911153911 100644 --- a/testing/web-platform/tests/mixed-content/allowed/no-opt-in/same-host-https/link-prefetch-tag/top-level/no-redirect/allowed.https.html +++ b/testing/web-platform/tests/mixed-content/allowed/no-opt-in/same-host-https/link-prefetch-tag/top-level/no-redirect/allowed.https.html @@ -1,10 +1,12 @@ - + Mixed-Content: Allowed content + + - - - - - - -

Allowed content

-

Test behavior of allowed content.

-
opt_in_method: no-opt-in
-                                 origin: same-host-https
-                                 source_scheme: https
-                                 context_nesting: top-level
-                                 redirection: no-redirect
-                                 subresource: link-prefetch-tag
-                                 expectation: allowed
- -

See specification - details for this test.

- -
+
diff --git a/testing/web-platform/tests/mixed-content/allowed/no-opt-in/same-host-https/object-tag/top-level/keep-scheme-redirect/allowed.https.html b/testing/web-platform/tests/mixed-content/allowed/no-opt-in/same-host-https/object-tag/top-level/keep-scheme-redirect/allowed.https.html index 90eeccc43464..ebfb5195eb17 100644 --- a/testing/web-platform/tests/mixed-content/allowed/no-opt-in/same-host-https/object-tag/top-level/keep-scheme-redirect/allowed.https.html +++ b/testing/web-platform/tests/mixed-content/allowed/no-opt-in/same-host-https/object-tag/top-level/keep-scheme-redirect/allowed.https.html @@ -1,10 +1,12 @@ - + Mixed-Content: Allowed content + + - - - - - - -

Allowed content

-

Test behavior of allowed content.

-
opt_in_method: no-opt-in
-                                 origin: same-host-https
-                                 source_scheme: https
-                                 context_nesting: top-level
-                                 redirection: keep-scheme-redirect
-                                 subresource: object-tag
-                                 expectation: allowed
- -

See specification - details for this test.

- -
+
diff --git a/testing/web-platform/tests/mixed-content/allowed/no-opt-in/same-host-https/object-tag/top-level/no-redirect/allowed.https.html b/testing/web-platform/tests/mixed-content/allowed/no-opt-in/same-host-https/object-tag/top-level/no-redirect/allowed.https.html index 59c4b5b27e27..f5ffcf3a8b2f 100644 --- a/testing/web-platform/tests/mixed-content/allowed/no-opt-in/same-host-https/object-tag/top-level/no-redirect/allowed.https.html +++ b/testing/web-platform/tests/mixed-content/allowed/no-opt-in/same-host-https/object-tag/top-level/no-redirect/allowed.https.html @@ -1,10 +1,12 @@ - + Mixed-Content: Allowed content + + - - - - - - -

Allowed content

-

Test behavior of allowed content.

-
opt_in_method: no-opt-in
-                                 origin: same-host-https
-                                 source_scheme: https
-                                 context_nesting: top-level
-                                 redirection: no-redirect
-                                 subresource: object-tag
-                                 expectation: allowed
- -

See specification - details for this test.

- -
+
diff --git a/testing/web-platform/tests/mixed-content/allowed/no-opt-in/same-host-https/picture-tag/top-level/keep-scheme-redirect/allowed.https.html b/testing/web-platform/tests/mixed-content/allowed/no-opt-in/same-host-https/picture-tag/top-level/keep-scheme-redirect/allowed.https.html index fa4e129441ee..57efd6f5ec43 100644 --- a/testing/web-platform/tests/mixed-content/allowed/no-opt-in/same-host-https/picture-tag/top-level/keep-scheme-redirect/allowed.https.html +++ b/testing/web-platform/tests/mixed-content/allowed/no-opt-in/same-host-https/picture-tag/top-level/keep-scheme-redirect/allowed.https.html @@ -1,10 +1,12 @@ - + Mixed-Content: Allowed content + + - - - - - - -

Allowed content

-

Test behavior of allowed content.

-
opt_in_method: no-opt-in
-                                 origin: same-host-https
-                                 source_scheme: https
-                                 context_nesting: top-level
-                                 redirection: keep-scheme-redirect
-                                 subresource: picture-tag
-                                 expectation: allowed
- -

See specification - details for this test.

- -
+
diff --git a/testing/web-platform/tests/mixed-content/allowed/no-opt-in/same-host-https/picture-tag/top-level/no-redirect/allowed.https.html b/testing/web-platform/tests/mixed-content/allowed/no-opt-in/same-host-https/picture-tag/top-level/no-redirect/allowed.https.html index cb0c1c27c1cc..e3113a84c9f4 100644 --- a/testing/web-platform/tests/mixed-content/allowed/no-opt-in/same-host-https/picture-tag/top-level/no-redirect/allowed.https.html +++ b/testing/web-platform/tests/mixed-content/allowed/no-opt-in/same-host-https/picture-tag/top-level/no-redirect/allowed.https.html @@ -1,10 +1,12 @@ - + Mixed-Content: Allowed content + + - - - - - - -

Allowed content

-

Test behavior of allowed content.

-
opt_in_method: no-opt-in
-                                 origin: same-host-https
-                                 source_scheme: https
-                                 context_nesting: top-level
-                                 redirection: no-redirect
-                                 subresource: picture-tag
-                                 expectation: allowed
- -

See specification - details for this test.

- -
+
diff --git a/testing/web-platform/tests/mixed-content/allowed/no-opt-in/same-host-https/script-tag/top-level/keep-scheme-redirect/allowed.https.html b/testing/web-platform/tests/mixed-content/allowed/no-opt-in/same-host-https/script-tag/top-level/keep-scheme-redirect/allowed.https.html index 964ef1f74c48..9dc0bb122c47 100644 --- a/testing/web-platform/tests/mixed-content/allowed/no-opt-in/same-host-https/script-tag/top-level/keep-scheme-redirect/allowed.https.html +++ b/testing/web-platform/tests/mixed-content/allowed/no-opt-in/same-host-https/script-tag/top-level/keep-scheme-redirect/allowed.https.html @@ -1,10 +1,12 @@ - + Mixed-Content: Allowed content + + - - - - - - -

Allowed content

-

Test behavior of allowed content.

-
opt_in_method: no-opt-in
-                                 origin: same-host-https
-                                 source_scheme: https
-                                 context_nesting: top-level
-                                 redirection: keep-scheme-redirect
-                                 subresource: script-tag
-                                 expectation: allowed
- -

See specification - details for this test.

- -
+
diff --git a/testing/web-platform/tests/mixed-content/allowed/no-opt-in/same-host-https/script-tag/top-level/no-redirect/allowed.https.html b/testing/web-platform/tests/mixed-content/allowed/no-opt-in/same-host-https/script-tag/top-level/no-redirect/allowed.https.html index 1f63f808b604..bad7e7f21044 100644 --- a/testing/web-platform/tests/mixed-content/allowed/no-opt-in/same-host-https/script-tag/top-level/no-redirect/allowed.https.html +++ b/testing/web-platform/tests/mixed-content/allowed/no-opt-in/same-host-https/script-tag/top-level/no-redirect/allowed.https.html @@ -1,10 +1,12 @@ - + Mixed-Content: Allowed content + + - - - - - - -

Allowed content

-

Test behavior of allowed content.

-
opt_in_method: no-opt-in
-                                 origin: same-host-https
-                                 source_scheme: https
-                                 context_nesting: top-level
-                                 redirection: no-redirect
-                                 subresource: script-tag
-                                 expectation: allowed
- -

See specification - details for this test.

- -
+
diff --git a/testing/web-platform/tests/mixed-content/allowed/no-opt-in/same-host-https/video-tag/top-level/keep-scheme-redirect/allowed.https.html b/testing/web-platform/tests/mixed-content/allowed/no-opt-in/same-host-https/video-tag/top-level/keep-scheme-redirect/allowed.https.html index a27066a3de40..f044783e62ba 100644 --- a/testing/web-platform/tests/mixed-content/allowed/no-opt-in/same-host-https/video-tag/top-level/keep-scheme-redirect/allowed.https.html +++ b/testing/web-platform/tests/mixed-content/allowed/no-opt-in/same-host-https/video-tag/top-level/keep-scheme-redirect/allowed.https.html @@ -1,10 +1,12 @@ - + Mixed-Content: Allowed content + + - - - - - - -

Allowed content

-

Test behavior of allowed content.

-
opt_in_method: no-opt-in
-                                 origin: same-host-https
-                                 source_scheme: https
-                                 context_nesting: top-level
-                                 redirection: keep-scheme-redirect
-                                 subresource: video-tag
-                                 expectation: allowed
- -

See specification - details for this test.

- -
+
diff --git a/testing/web-platform/tests/mixed-content/allowed/no-opt-in/same-host-https/video-tag/top-level/no-redirect/allowed.https.html b/testing/web-platform/tests/mixed-content/allowed/no-opt-in/same-host-https/video-tag/top-level/no-redirect/allowed.https.html index 19a05ae3f2ba..fd0a1f923a78 100644 --- a/testing/web-platform/tests/mixed-content/allowed/no-opt-in/same-host-https/video-tag/top-level/no-redirect/allowed.https.html +++ b/testing/web-platform/tests/mixed-content/allowed/no-opt-in/same-host-https/video-tag/top-level/no-redirect/allowed.https.html @@ -1,10 +1,12 @@ - + Mixed-Content: Allowed content + + - - - - - - -

Allowed content

-

Test behavior of allowed content.

-
opt_in_method: no-opt-in
-                                 origin: same-host-https
-                                 source_scheme: https
-                                 context_nesting: top-level
-                                 redirection: no-redirect
-                                 subresource: video-tag
-                                 expectation: allowed
- -

See specification - details for this test.

- -
+
diff --git a/testing/web-platform/tests/mixed-content/allowed/no-opt-in/same-host-https/worker-request/top-level/keep-scheme-redirect/allowed.https.html b/testing/web-platform/tests/mixed-content/allowed/no-opt-in/same-host-https/worker-request/top-level/keep-scheme-redirect/allowed.https.html index 7e0fb6d0420a..d720fc4fa993 100644 --- a/testing/web-platform/tests/mixed-content/allowed/no-opt-in/same-host-https/worker-request/top-level/keep-scheme-redirect/allowed.https.html +++ b/testing/web-platform/tests/mixed-content/allowed/no-opt-in/same-host-https/worker-request/top-level/keep-scheme-redirect/allowed.https.html @@ -1,10 +1,12 @@ - + Mixed-Content: Allowed content + + - - - - - - -

Allowed content

-

Test behavior of allowed content.

-
opt_in_method: no-opt-in
-                                 origin: same-host-https
-                                 source_scheme: https
-                                 context_nesting: top-level
-                                 redirection: keep-scheme-redirect
-                                 subresource: worker-request
-                                 expectation: allowed
- -

See specification - details for this test.

- -
+
diff --git a/testing/web-platform/tests/mixed-content/allowed/no-opt-in/same-host-https/worker-request/top-level/no-redirect/allowed.https.html b/testing/web-platform/tests/mixed-content/allowed/no-opt-in/same-host-https/worker-request/top-level/no-redirect/allowed.https.html index 7176f33e09ac..bd69a14a9dee 100644 --- a/testing/web-platform/tests/mixed-content/allowed/no-opt-in/same-host-https/worker-request/top-level/no-redirect/allowed.https.html +++ b/testing/web-platform/tests/mixed-content/allowed/no-opt-in/same-host-https/worker-request/top-level/no-redirect/allowed.https.html @@ -1,10 +1,12 @@ - + Mixed-Content: Allowed content + + - - - - - - -

Allowed content

-

Test behavior of allowed content.

-
opt_in_method: no-opt-in
-                                 origin: same-host-https
-                                 source_scheme: https
-                                 context_nesting: top-level
-                                 redirection: no-redirect
-                                 subresource: worker-request
-                                 expectation: allowed
- -

See specification - details for this test.

- -
+
diff --git a/testing/web-platform/tests/mixed-content/allowed/no-opt-in/same-host-https/xhr-request/top-level/keep-scheme-redirect/allowed.https.html b/testing/web-platform/tests/mixed-content/allowed/no-opt-in/same-host-https/xhr-request/top-level/keep-scheme-redirect/allowed.https.html index 109dd139400b..9da0d9f98ecb 100644 --- a/testing/web-platform/tests/mixed-content/allowed/no-opt-in/same-host-https/xhr-request/top-level/keep-scheme-redirect/allowed.https.html +++ b/testing/web-platform/tests/mixed-content/allowed/no-opt-in/same-host-https/xhr-request/top-level/keep-scheme-redirect/allowed.https.html @@ -1,10 +1,12 @@ - + Mixed-Content: Allowed content + + - - - - - - -

Allowed content

-

Test behavior of allowed content.

-
opt_in_method: no-opt-in
-                                 origin: same-host-https
-                                 source_scheme: https
-                                 context_nesting: top-level
-                                 redirection: keep-scheme-redirect
-                                 subresource: xhr-request
-                                 expectation: allowed
- -

See specification - details for this test.

- -
+
diff --git a/testing/web-platform/tests/mixed-content/allowed/no-opt-in/same-host-https/xhr-request/top-level/no-redirect/allowed.https.html b/testing/web-platform/tests/mixed-content/allowed/no-opt-in/same-host-https/xhr-request/top-level/no-redirect/allowed.https.html index d7725fd0f270..b0fff36eb946 100644 --- a/testing/web-platform/tests/mixed-content/allowed/no-opt-in/same-host-https/xhr-request/top-level/no-redirect/allowed.https.html +++ b/testing/web-platform/tests/mixed-content/allowed/no-opt-in/same-host-https/xhr-request/top-level/no-redirect/allowed.https.html @@ -1,10 +1,12 @@ - + Mixed-Content: Allowed content + + - - - - - - -

Allowed content

-

Test behavior of allowed content.

-
opt_in_method: no-opt-in
-                                 origin: same-host-https
-                                 source_scheme: https
-                                 context_nesting: top-level
-                                 redirection: no-redirect
-                                 subresource: xhr-request
-                                 expectation: allowed
- -

See specification - details for this test.

- -
+
diff --git a/testing/web-platform/tests/mixed-content/blockable/http-csp/cross-origin-http/fetch-request/top-level/keep-scheme-redirect/opt-in-blocks.https.html b/testing/web-platform/tests/mixed-content/blockable/http-csp/cross-origin-http/fetch-request/top-level/keep-scheme-redirect/opt-in-blocks.https.html index 539754e8d07c..012bd3540a1a 100644 --- a/testing/web-platform/tests/mixed-content/blockable/http-csp/cross-origin-http/fetch-request/top-level/keep-scheme-redirect/opt-in-blocks.https.html +++ b/testing/web-platform/tests/mixed-content/blockable/http-csp/cross-origin-http/fetch-request/top-level/keep-scheme-redirect/opt-in-blocks.https.html @@ -1,10 +1,12 @@ - + Mixed-Content: Blockable content + + - - - - - - -

Blockable content

-

Test behavior of blockable content.

-
opt_in_method: http-csp
-                                 origin: cross-origin-http
-                                 source_scheme: https
-                                 context_nesting: top-level
-                                 redirection: keep-scheme-redirect
-                                 subresource: fetch-request
-                                 expectation: blocked
- -

See specification - details for this test.

- -
+
diff --git a/testing/web-platform/tests/mixed-content/blockable/http-csp/cross-origin-http/fetch-request/top-level/no-redirect/opt-in-blocks.https.html b/testing/web-platform/tests/mixed-content/blockable/http-csp/cross-origin-http/fetch-request/top-level/no-redirect/opt-in-blocks.https.html index 3b2e413efec5..54fbe3a8477b 100644 --- a/testing/web-platform/tests/mixed-content/blockable/http-csp/cross-origin-http/fetch-request/top-level/no-redirect/opt-in-blocks.https.html +++ b/testing/web-platform/tests/mixed-content/blockable/http-csp/cross-origin-http/fetch-request/top-level/no-redirect/opt-in-blocks.https.html @@ -1,10 +1,12 @@ - + Mixed-Content: Blockable content + + - - - - - - -

Blockable content

-

Test behavior of blockable content.

-
opt_in_method: http-csp
-                                 origin: cross-origin-http
-                                 source_scheme: https
-                                 context_nesting: top-level
-                                 redirection: no-redirect
-                                 subresource: fetch-request
-                                 expectation: blocked
- -

See specification - details for this test.

- -
+
diff --git a/testing/web-platform/tests/mixed-content/blockable/http-csp/cross-origin-http/fetch-request/top-level/swap-scheme-redirect/opt-in-blocks.https.html b/testing/web-platform/tests/mixed-content/blockable/http-csp/cross-origin-http/fetch-request/top-level/swap-scheme-redirect/opt-in-blocks.https.html index d135154c8f73..f95554558076 100644 --- a/testing/web-platform/tests/mixed-content/blockable/http-csp/cross-origin-http/fetch-request/top-level/swap-scheme-redirect/opt-in-blocks.https.html +++ b/testing/web-platform/tests/mixed-content/blockable/http-csp/cross-origin-http/fetch-request/top-level/swap-scheme-redirect/opt-in-blocks.https.html @@ -1,10 +1,12 @@ - + Mixed-Content: Blockable content + + - - - - - - -

Blockable content

-

Test behavior of blockable content.

-
opt_in_method: http-csp
-                                 origin: cross-origin-http
-                                 source_scheme: https
-                                 context_nesting: top-level
-                                 redirection: swap-scheme-redirect
-                                 subresource: fetch-request
-                                 expectation: blocked
- -

See specification - details for this test.

- -
+
diff --git a/testing/web-platform/tests/mixed-content/blockable/http-csp/cross-origin-http/form-tag/top-level/keep-scheme-redirect/opt-in-blocks.https.html b/testing/web-platform/tests/mixed-content/blockable/http-csp/cross-origin-http/form-tag/top-level/keep-scheme-redirect/opt-in-blocks.https.html index d239302da256..277d47891806 100644 --- a/testing/web-platform/tests/mixed-content/blockable/http-csp/cross-origin-http/form-tag/top-level/keep-scheme-redirect/opt-in-blocks.https.html +++ b/testing/web-platform/tests/mixed-content/blockable/http-csp/cross-origin-http/form-tag/top-level/keep-scheme-redirect/opt-in-blocks.https.html @@ -1,10 +1,12 @@ - + Mixed-Content: Blockable content + + - - - - - - -

Blockable content

-

Test behavior of blockable content.

-
opt_in_method: http-csp
-                                 origin: cross-origin-http
-                                 source_scheme: https
-                                 context_nesting: top-level
-                                 redirection: keep-scheme-redirect
-                                 subresource: form-tag
-                                 expectation: blocked
- -

See specification - details for this test.

- -
+
diff --git a/testing/web-platform/tests/mixed-content/blockable/http-csp/cross-origin-http/form-tag/top-level/no-redirect/opt-in-blocks.https.html b/testing/web-platform/tests/mixed-content/blockable/http-csp/cross-origin-http/form-tag/top-level/no-redirect/opt-in-blocks.https.html index b4742c92b8b6..582ed6012b1b 100644 --- a/testing/web-platform/tests/mixed-content/blockable/http-csp/cross-origin-http/form-tag/top-level/no-redirect/opt-in-blocks.https.html +++ b/testing/web-platform/tests/mixed-content/blockable/http-csp/cross-origin-http/form-tag/top-level/no-redirect/opt-in-blocks.https.html @@ -1,10 +1,12 @@ - + Mixed-Content: Blockable content + + - - - - - - -

Blockable content

-

Test behavior of blockable content.

-
opt_in_method: http-csp
-                                 origin: cross-origin-http
-                                 source_scheme: https
-                                 context_nesting: top-level
-                                 redirection: no-redirect
-                                 subresource: form-tag
-                                 expectation: blocked
- -

See specification - details for this test.

- -
+
diff --git a/testing/web-platform/tests/mixed-content/blockable/http-csp/cross-origin-http/form-tag/top-level/swap-scheme-redirect/opt-in-blocks.https.html b/testing/web-platform/tests/mixed-content/blockable/http-csp/cross-origin-http/form-tag/top-level/swap-scheme-redirect/opt-in-blocks.https.html index be3c57b59050..37d4db54b491 100644 --- a/testing/web-platform/tests/mixed-content/blockable/http-csp/cross-origin-http/form-tag/top-level/swap-scheme-redirect/opt-in-blocks.https.html +++ b/testing/web-platform/tests/mixed-content/blockable/http-csp/cross-origin-http/form-tag/top-level/swap-scheme-redirect/opt-in-blocks.https.html @@ -1,10 +1,12 @@ - + Mixed-Content: Blockable content + + - - - - - - -

Blockable content

-

Test behavior of blockable content.

-
opt_in_method: http-csp
-                                 origin: cross-origin-http
-                                 source_scheme: https
-                                 context_nesting: top-level
-                                 redirection: swap-scheme-redirect
-                                 subresource: form-tag
-                                 expectation: blocked
- -

See specification - details for this test.

- -
+
diff --git a/testing/web-platform/tests/mixed-content/blockable/http-csp/cross-origin-http/iframe-tag/top-level/keep-scheme-redirect/opt-in-blocks.https.html b/testing/web-platform/tests/mixed-content/blockable/http-csp/cross-origin-http/iframe-tag/top-level/keep-scheme-redirect/opt-in-blocks.https.html index 7d8b398b0a6f..b4957a41eb17 100644 --- a/testing/web-platform/tests/mixed-content/blockable/http-csp/cross-origin-http/iframe-tag/top-level/keep-scheme-redirect/opt-in-blocks.https.html +++ b/testing/web-platform/tests/mixed-content/blockable/http-csp/cross-origin-http/iframe-tag/top-level/keep-scheme-redirect/opt-in-blocks.https.html @@ -1,10 +1,12 @@ - + Mixed-Content: Blockable content + + - - - - - - -

Blockable content

-

Test behavior of blockable content.

-
opt_in_method: http-csp
-                                 origin: cross-origin-http
-                                 source_scheme: https
-                                 context_nesting: top-level
-                                 redirection: keep-scheme-redirect
-                                 subresource: iframe-tag
-                                 expectation: blocked
- -

See specification - details for this test.

- -
+
diff --git a/testing/web-platform/tests/mixed-content/blockable/http-csp/cross-origin-http/iframe-tag/top-level/no-redirect/opt-in-blocks.https.html b/testing/web-platform/tests/mixed-content/blockable/http-csp/cross-origin-http/iframe-tag/top-level/no-redirect/opt-in-blocks.https.html index c89b2df2bba2..e910a0ab7be4 100644 --- a/testing/web-platform/tests/mixed-content/blockable/http-csp/cross-origin-http/iframe-tag/top-level/no-redirect/opt-in-blocks.https.html +++ b/testing/web-platform/tests/mixed-content/blockable/http-csp/cross-origin-http/iframe-tag/top-level/no-redirect/opt-in-blocks.https.html @@ -1,10 +1,12 @@ - + Mixed-Content: Blockable content + + - - - - - - -

Blockable content

-

Test behavior of blockable content.

-
opt_in_method: http-csp
-                                 origin: cross-origin-http
-                                 source_scheme: https
-                                 context_nesting: top-level
-                                 redirection: no-redirect
-                                 subresource: iframe-tag
-                                 expectation: blocked
- -

See specification - details for this test.

- -
+
diff --git a/testing/web-platform/tests/mixed-content/blockable/http-csp/cross-origin-http/iframe-tag/top-level/swap-scheme-redirect/opt-in-blocks.https.html b/testing/web-platform/tests/mixed-content/blockable/http-csp/cross-origin-http/iframe-tag/top-level/swap-scheme-redirect/opt-in-blocks.https.html index 919be4b5bd82..1f8763010f02 100644 --- a/testing/web-platform/tests/mixed-content/blockable/http-csp/cross-origin-http/iframe-tag/top-level/swap-scheme-redirect/opt-in-blocks.https.html +++ b/testing/web-platform/tests/mixed-content/blockable/http-csp/cross-origin-http/iframe-tag/top-level/swap-scheme-redirect/opt-in-blocks.https.html @@ -1,10 +1,12 @@ - + Mixed-Content: Blockable content + + - - - - - - -

Blockable content

-

Test behavior of blockable content.

-
opt_in_method: http-csp
-                                 origin: cross-origin-http
-                                 source_scheme: https
-                                 context_nesting: top-level
-                                 redirection: swap-scheme-redirect
-                                 subresource: iframe-tag
-                                 expectation: blocked
- -

See specification - details for this test.

- -
+
diff --git a/testing/web-platform/tests/mixed-content/blockable/http-csp/cross-origin-http/link-css-tag/top-level/keep-scheme-redirect/opt-in-blocks.https.html b/testing/web-platform/tests/mixed-content/blockable/http-csp/cross-origin-http/link-css-tag/top-level/keep-scheme-redirect/opt-in-blocks.https.html index cf64424bece6..7376626e2e19 100644 --- a/testing/web-platform/tests/mixed-content/blockable/http-csp/cross-origin-http/link-css-tag/top-level/keep-scheme-redirect/opt-in-blocks.https.html +++ b/testing/web-platform/tests/mixed-content/blockable/http-csp/cross-origin-http/link-css-tag/top-level/keep-scheme-redirect/opt-in-blocks.https.html @@ -1,10 +1,12 @@ - + Mixed-Content: Blockable content + + - - - - - - -

Blockable content

-

Test behavior of blockable content.

-
opt_in_method: http-csp
-                                 origin: cross-origin-http
-                                 source_scheme: https
-                                 context_nesting: top-level
-                                 redirection: keep-scheme-redirect
-                                 subresource: link-css-tag
-                                 expectation: blocked
- -

See specification - details for this test.

- -
+
diff --git a/testing/web-platform/tests/mixed-content/blockable/http-csp/cross-origin-http/link-css-tag/top-level/no-redirect/opt-in-blocks.https.html b/testing/web-platform/tests/mixed-content/blockable/http-csp/cross-origin-http/link-css-tag/top-level/no-redirect/opt-in-blocks.https.html index d5bcff9defac..fc123d9638d8 100644 --- a/testing/web-platform/tests/mixed-content/blockable/http-csp/cross-origin-http/link-css-tag/top-level/no-redirect/opt-in-blocks.https.html +++ b/testing/web-platform/tests/mixed-content/blockable/http-csp/cross-origin-http/link-css-tag/top-level/no-redirect/opt-in-blocks.https.html @@ -1,10 +1,12 @@ - + Mixed-Content: Blockable content + + - - - - - - -

Blockable content

-

Test behavior of blockable content.

-
opt_in_method: http-csp
-                                 origin: cross-origin-http
-                                 source_scheme: https
-                                 context_nesting: top-level
-                                 redirection: no-redirect
-                                 subresource: link-css-tag
-                                 expectation: blocked
- -

See specification - details for this test.

- -
+
diff --git a/testing/web-platform/tests/mixed-content/blockable/http-csp/cross-origin-http/link-css-tag/top-level/swap-scheme-redirect/opt-in-blocks.https.html b/testing/web-platform/tests/mixed-content/blockable/http-csp/cross-origin-http/link-css-tag/top-level/swap-scheme-redirect/opt-in-blocks.https.html index 29b7c7d61503..f7fd32cbf9bf 100644 --- a/testing/web-platform/tests/mixed-content/blockable/http-csp/cross-origin-http/link-css-tag/top-level/swap-scheme-redirect/opt-in-blocks.https.html +++ b/testing/web-platform/tests/mixed-content/blockable/http-csp/cross-origin-http/link-css-tag/top-level/swap-scheme-redirect/opt-in-blocks.https.html @@ -1,10 +1,12 @@ - + Mixed-Content: Blockable content + + - - - - - - -

Blockable content

-

Test behavior of blockable content.

-
opt_in_method: http-csp
-                                 origin: cross-origin-http
-                                 source_scheme: https
-                                 context_nesting: top-level
-                                 redirection: swap-scheme-redirect
-                                 subresource: link-css-tag
-                                 expectation: blocked
- -

See specification - details for this test.

- -
+
diff --git a/testing/web-platform/tests/mixed-content/blockable/http-csp/cross-origin-http/object-tag/top-level/keep-scheme-redirect/opt-in-blocks.https.html b/testing/web-platform/tests/mixed-content/blockable/http-csp/cross-origin-http/object-tag/top-level/keep-scheme-redirect/opt-in-blocks.https.html index 2563337805ff..8ebd99b0118e 100644 --- a/testing/web-platform/tests/mixed-content/blockable/http-csp/cross-origin-http/object-tag/top-level/keep-scheme-redirect/opt-in-blocks.https.html +++ b/testing/web-platform/tests/mixed-content/blockable/http-csp/cross-origin-http/object-tag/top-level/keep-scheme-redirect/opt-in-blocks.https.html @@ -1,10 +1,12 @@ - + Mixed-Content: Blockable content + + - - - - - - -

Blockable content

-

Test behavior of blockable content.

-
opt_in_method: http-csp
-                                 origin: cross-origin-http
-                                 source_scheme: https
-                                 context_nesting: top-level
-                                 redirection: keep-scheme-redirect
-                                 subresource: object-tag
-                                 expectation: blocked
- -

See specification - details for this test.

- -
+
diff --git a/testing/web-platform/tests/mixed-content/blockable/http-csp/cross-origin-http/object-tag/top-level/no-redirect/opt-in-blocks.https.html b/testing/web-platform/tests/mixed-content/blockable/http-csp/cross-origin-http/object-tag/top-level/no-redirect/opt-in-blocks.https.html index a3fb49fdc6fc..b7743daa64c8 100644 --- a/testing/web-platform/tests/mixed-content/blockable/http-csp/cross-origin-http/object-tag/top-level/no-redirect/opt-in-blocks.https.html +++ b/testing/web-platform/tests/mixed-content/blockable/http-csp/cross-origin-http/object-tag/top-level/no-redirect/opt-in-blocks.https.html @@ -1,10 +1,12 @@ - + Mixed-Content: Blockable content + + - - - - - - -

Blockable content

-

Test behavior of blockable content.

-
opt_in_method: http-csp
-                                 origin: cross-origin-http
-                                 source_scheme: https
-                                 context_nesting: top-level
-                                 redirection: no-redirect
-                                 subresource: object-tag
-                                 expectation: blocked
- -

See specification - details for this test.

- -
+
diff --git a/testing/web-platform/tests/mixed-content/blockable/http-csp/cross-origin-http/object-tag/top-level/swap-scheme-redirect/opt-in-blocks.https.html b/testing/web-platform/tests/mixed-content/blockable/http-csp/cross-origin-http/object-tag/top-level/swap-scheme-redirect/opt-in-blocks.https.html index fa599d1c9e85..3fe162a2f7cb 100644 --- a/testing/web-platform/tests/mixed-content/blockable/http-csp/cross-origin-http/object-tag/top-level/swap-scheme-redirect/opt-in-blocks.https.html +++ b/testing/web-platform/tests/mixed-content/blockable/http-csp/cross-origin-http/object-tag/top-level/swap-scheme-redirect/opt-in-blocks.https.html @@ -1,10 +1,12 @@ - + Mixed-Content: Blockable content + + - - - - - - -

Blockable content

-

Test behavior of blockable content.

-
opt_in_method: http-csp
-                                 origin: cross-origin-http
-                                 source_scheme: https
-                                 context_nesting: top-level
-                                 redirection: swap-scheme-redirect
-                                 subresource: object-tag
-                                 expectation: blocked
- -

See specification - details for this test.

- -
+
diff --git a/testing/web-platform/tests/mixed-content/blockable/http-csp/cross-origin-http/picture-tag/top-level/keep-scheme-redirect/opt-in-blocks.https.html b/testing/web-platform/tests/mixed-content/blockable/http-csp/cross-origin-http/picture-tag/top-level/keep-scheme-redirect/opt-in-blocks.https.html index 00d7cd5127a8..6f71158c2160 100644 --- a/testing/web-platform/tests/mixed-content/blockable/http-csp/cross-origin-http/picture-tag/top-level/keep-scheme-redirect/opt-in-blocks.https.html +++ b/testing/web-platform/tests/mixed-content/blockable/http-csp/cross-origin-http/picture-tag/top-level/keep-scheme-redirect/opt-in-blocks.https.html @@ -1,10 +1,12 @@ - + Mixed-Content: Blockable content + + - - - - - - -

Blockable content

-

Test behavior of blockable content.

-
opt_in_method: http-csp
-                                 origin: cross-origin-http
-                                 source_scheme: https
-                                 context_nesting: top-level
-                                 redirection: keep-scheme-redirect
-                                 subresource: picture-tag
-                                 expectation: blocked
- -

See specification - details for this test.

- -
+
diff --git a/testing/web-platform/tests/mixed-content/blockable/http-csp/cross-origin-http/picture-tag/top-level/no-redirect/opt-in-blocks.https.html b/testing/web-platform/tests/mixed-content/blockable/http-csp/cross-origin-http/picture-tag/top-level/no-redirect/opt-in-blocks.https.html index 6712dfda071f..48012dfe5504 100644 --- a/testing/web-platform/tests/mixed-content/blockable/http-csp/cross-origin-http/picture-tag/top-level/no-redirect/opt-in-blocks.https.html +++ b/testing/web-platform/tests/mixed-content/blockable/http-csp/cross-origin-http/picture-tag/top-level/no-redirect/opt-in-blocks.https.html @@ -1,10 +1,12 @@ - + Mixed-Content: Blockable content + + - - - - - - -

Blockable content

-

Test behavior of blockable content.

-
opt_in_method: http-csp
-                                 origin: cross-origin-http
-                                 source_scheme: https
-                                 context_nesting: top-level
-                                 redirection: no-redirect
-                                 subresource: picture-tag
-                                 expectation: blocked
- -

See specification - details for this test.

- -
+
diff --git a/testing/web-platform/tests/mixed-content/blockable/http-csp/cross-origin-http/picture-tag/top-level/swap-scheme-redirect/opt-in-blocks.https.html b/testing/web-platform/tests/mixed-content/blockable/http-csp/cross-origin-http/picture-tag/top-level/swap-scheme-redirect/opt-in-blocks.https.html index d2c147423595..b76c48a658af 100644 --- a/testing/web-platform/tests/mixed-content/blockable/http-csp/cross-origin-http/picture-tag/top-level/swap-scheme-redirect/opt-in-blocks.https.html +++ b/testing/web-platform/tests/mixed-content/blockable/http-csp/cross-origin-http/picture-tag/top-level/swap-scheme-redirect/opt-in-blocks.https.html @@ -1,10 +1,12 @@ - + Mixed-Content: Blockable content + + - - - - - - -

Blockable content

-

Test behavior of blockable content.

-
opt_in_method: http-csp
-                                 origin: cross-origin-http
-                                 source_scheme: https
-                                 context_nesting: top-level
-                                 redirection: swap-scheme-redirect
-                                 subresource: picture-tag
-                                 expectation: blocked
- -

See specification - details for this test.

- -
+
diff --git a/testing/web-platform/tests/mixed-content/blockable/http-csp/cross-origin-http/script-tag/top-level/keep-scheme-redirect/opt-in-blocks.https.html b/testing/web-platform/tests/mixed-content/blockable/http-csp/cross-origin-http/script-tag/top-level/keep-scheme-redirect/opt-in-blocks.https.html index bf7ef43097c0..61f10dfbff3c 100644 --- a/testing/web-platform/tests/mixed-content/blockable/http-csp/cross-origin-http/script-tag/top-level/keep-scheme-redirect/opt-in-blocks.https.html +++ b/testing/web-platform/tests/mixed-content/blockable/http-csp/cross-origin-http/script-tag/top-level/keep-scheme-redirect/opt-in-blocks.https.html @@ -1,10 +1,12 @@ - + Mixed-Content: Blockable content + + - - - - - - -

Blockable content

-

Test behavior of blockable content.

-
opt_in_method: http-csp
-                                 origin: cross-origin-http
-                                 source_scheme: https
-                                 context_nesting: top-level
-                                 redirection: keep-scheme-redirect
-                                 subresource: script-tag
-                                 expectation: blocked
- -

See specification - details for this test.

- -
+
diff --git a/testing/web-platform/tests/mixed-content/blockable/http-csp/cross-origin-http/script-tag/top-level/no-redirect/opt-in-blocks.https.html b/testing/web-platform/tests/mixed-content/blockable/http-csp/cross-origin-http/script-tag/top-level/no-redirect/opt-in-blocks.https.html index b3d6c9eef0b2..69210c6061d8 100644 --- a/testing/web-platform/tests/mixed-content/blockable/http-csp/cross-origin-http/script-tag/top-level/no-redirect/opt-in-blocks.https.html +++ b/testing/web-platform/tests/mixed-content/blockable/http-csp/cross-origin-http/script-tag/top-level/no-redirect/opt-in-blocks.https.html @@ -1,10 +1,12 @@ - + Mixed-Content: Blockable content + + - - - - - - -

Blockable content

-

Test behavior of blockable content.

-
opt_in_method: http-csp
-                                 origin: cross-origin-http
-                                 source_scheme: https
-                                 context_nesting: top-level
-                                 redirection: no-redirect
-                                 subresource: script-tag
-                                 expectation: blocked
- -

See specification - details for this test.

- -
+
diff --git a/testing/web-platform/tests/mixed-content/blockable/http-csp/cross-origin-http/script-tag/top-level/swap-scheme-redirect/opt-in-blocks.https.html b/testing/web-platform/tests/mixed-content/blockable/http-csp/cross-origin-http/script-tag/top-level/swap-scheme-redirect/opt-in-blocks.https.html index 643daa0c202d..a2201a2132a4 100644 --- a/testing/web-platform/tests/mixed-content/blockable/http-csp/cross-origin-http/script-tag/top-level/swap-scheme-redirect/opt-in-blocks.https.html +++ b/testing/web-platform/tests/mixed-content/blockable/http-csp/cross-origin-http/script-tag/top-level/swap-scheme-redirect/opt-in-blocks.https.html @@ -1,10 +1,12 @@ - + Mixed-Content: Blockable content + + - - - - - - -

Blockable content

-

Test behavior of blockable content.

-
opt_in_method: http-csp
-                                 origin: cross-origin-http
-                                 source_scheme: https
-                                 context_nesting: top-level
-                                 redirection: swap-scheme-redirect
-                                 subresource: script-tag
-                                 expectation: blocked
- -

See specification - details for this test.

- -
+
diff --git a/testing/web-platform/tests/mixed-content/blockable/http-csp/cross-origin-http/worker-request/top-level/keep-scheme-redirect/opt-in-blocks.https.html b/testing/web-platform/tests/mixed-content/blockable/http-csp/cross-origin-http/worker-request/top-level/keep-scheme-redirect/opt-in-blocks.https.html index 77d1f3e6ff30..8fc3283a0acd 100644 --- a/testing/web-platform/tests/mixed-content/blockable/http-csp/cross-origin-http/worker-request/top-level/keep-scheme-redirect/opt-in-blocks.https.html +++ b/testing/web-platform/tests/mixed-content/blockable/http-csp/cross-origin-http/worker-request/top-level/keep-scheme-redirect/opt-in-blocks.https.html @@ -1,10 +1,12 @@ - + Mixed-Content: Blockable content + + - - - - - - -

Blockable content

-

Test behavior of blockable content.

-
opt_in_method: http-csp
-                                 origin: cross-origin-http
-                                 source_scheme: https
-                                 context_nesting: top-level
-                                 redirection: keep-scheme-redirect
-                                 subresource: worker-request
-                                 expectation: blocked
- -

See specification - details for this test.

- -
+
diff --git a/testing/web-platform/tests/mixed-content/blockable/http-csp/cross-origin-http/worker-request/top-level/no-redirect/opt-in-blocks.https.html b/testing/web-platform/tests/mixed-content/blockable/http-csp/cross-origin-http/worker-request/top-level/no-redirect/opt-in-blocks.https.html index 1f2cf69ab3e7..21f63bd73074 100644 --- a/testing/web-platform/tests/mixed-content/blockable/http-csp/cross-origin-http/worker-request/top-level/no-redirect/opt-in-blocks.https.html +++ b/testing/web-platform/tests/mixed-content/blockable/http-csp/cross-origin-http/worker-request/top-level/no-redirect/opt-in-blocks.https.html @@ -1,10 +1,12 @@ - + Mixed-Content: Blockable content + + - - - - - - -

Blockable content

-

Test behavior of blockable content.

-
opt_in_method: http-csp
-                                 origin: cross-origin-http
-                                 source_scheme: https
-                                 context_nesting: top-level
-                                 redirection: no-redirect
-                                 subresource: worker-request
-                                 expectation: blocked
- -

See specification - details for this test.

- -
+
diff --git a/testing/web-platform/tests/mixed-content/blockable/http-csp/cross-origin-http/worker-request/top-level/swap-scheme-redirect/opt-in-blocks.https.html b/testing/web-platform/tests/mixed-content/blockable/http-csp/cross-origin-http/worker-request/top-level/swap-scheme-redirect/opt-in-blocks.https.html index bf8eaef23d91..d4c437147aa3 100644 --- a/testing/web-platform/tests/mixed-content/blockable/http-csp/cross-origin-http/worker-request/top-level/swap-scheme-redirect/opt-in-blocks.https.html +++ b/testing/web-platform/tests/mixed-content/blockable/http-csp/cross-origin-http/worker-request/top-level/swap-scheme-redirect/opt-in-blocks.https.html @@ -1,10 +1,12 @@ - + Mixed-Content: Blockable content + + - - - - - - -

Blockable content

-

Test behavior of blockable content.

-
opt_in_method: http-csp
-                                 origin: cross-origin-http
-                                 source_scheme: https
-                                 context_nesting: top-level
-                                 redirection: swap-scheme-redirect
-                                 subresource: worker-request
-                                 expectation: blocked
- -

See specification - details for this test.

- -
+
diff --git a/testing/web-platform/tests/mixed-content/blockable/http-csp/cross-origin-http/xhr-request/top-level/keep-scheme-redirect/opt-in-blocks.https.html b/testing/web-platform/tests/mixed-content/blockable/http-csp/cross-origin-http/xhr-request/top-level/keep-scheme-redirect/opt-in-blocks.https.html index 76d3dddf51e7..314f09789057 100644 --- a/testing/web-platform/tests/mixed-content/blockable/http-csp/cross-origin-http/xhr-request/top-level/keep-scheme-redirect/opt-in-blocks.https.html +++ b/testing/web-platform/tests/mixed-content/blockable/http-csp/cross-origin-http/xhr-request/top-level/keep-scheme-redirect/opt-in-blocks.https.html @@ -1,10 +1,12 @@ - + Mixed-Content: Blockable content + + - - - - - - -

Blockable content

-

Test behavior of blockable content.

-
opt_in_method: http-csp
-                                 origin: cross-origin-http
-                                 source_scheme: https
-                                 context_nesting: top-level
-                                 redirection: keep-scheme-redirect
-                                 subresource: xhr-request
-                                 expectation: blocked
- -

See specification - details for this test.

- -
+
diff --git a/testing/web-platform/tests/mixed-content/blockable/http-csp/cross-origin-http/xhr-request/top-level/no-redirect/opt-in-blocks.https.html b/testing/web-platform/tests/mixed-content/blockable/http-csp/cross-origin-http/xhr-request/top-level/no-redirect/opt-in-blocks.https.html index 6c227ca5f8cf..d44e65bcd190 100644 --- a/testing/web-platform/tests/mixed-content/blockable/http-csp/cross-origin-http/xhr-request/top-level/no-redirect/opt-in-blocks.https.html +++ b/testing/web-platform/tests/mixed-content/blockable/http-csp/cross-origin-http/xhr-request/top-level/no-redirect/opt-in-blocks.https.html @@ -1,10 +1,12 @@ - + Mixed-Content: Blockable content + + - - - - - - -

Blockable content

-

Test behavior of blockable content.

-
opt_in_method: http-csp
-                                 origin: cross-origin-http
-                                 source_scheme: https
-                                 context_nesting: top-level
-                                 redirection: no-redirect
-                                 subresource: xhr-request
-                                 expectation: blocked
- -

See specification - details for this test.

- -
+
diff --git a/testing/web-platform/tests/mixed-content/blockable/http-csp/cross-origin-http/xhr-request/top-level/swap-scheme-redirect/opt-in-blocks.https.html b/testing/web-platform/tests/mixed-content/blockable/http-csp/cross-origin-http/xhr-request/top-level/swap-scheme-redirect/opt-in-blocks.https.html index 18e2fbfc73f1..973db8006fc6 100644 --- a/testing/web-platform/tests/mixed-content/blockable/http-csp/cross-origin-http/xhr-request/top-level/swap-scheme-redirect/opt-in-blocks.https.html +++ b/testing/web-platform/tests/mixed-content/blockable/http-csp/cross-origin-http/xhr-request/top-level/swap-scheme-redirect/opt-in-blocks.https.html @@ -1,10 +1,12 @@ - + Mixed-Content: Blockable content + + - - - - - - -

Blockable content

-

Test behavior of blockable content.

-
opt_in_method: http-csp
-                                 origin: cross-origin-http
-                                 source_scheme: https
-                                 context_nesting: top-level
-                                 redirection: swap-scheme-redirect
-                                 subresource: xhr-request
-                                 expectation: blocked
- -

See specification - details for this test.

- -
+
diff --git a/testing/web-platform/tests/mixed-content/blockable/http-csp/same-host-http/fetch-request/top-level/keep-scheme-redirect/opt-in-blocks.https.html b/testing/web-platform/tests/mixed-content/blockable/http-csp/same-host-http/fetch-request/top-level/keep-scheme-redirect/opt-in-blocks.https.html index bf6576a67f62..c03b96f01fa1 100644 --- a/testing/web-platform/tests/mixed-content/blockable/http-csp/same-host-http/fetch-request/top-level/keep-scheme-redirect/opt-in-blocks.https.html +++ b/testing/web-platform/tests/mixed-content/blockable/http-csp/same-host-http/fetch-request/top-level/keep-scheme-redirect/opt-in-blocks.https.html @@ -1,10 +1,12 @@ - + Mixed-Content: Blockable content + + - - - - - - -

Blockable content

-

Test behavior of blockable content.

-
opt_in_method: http-csp
-                                 origin: same-host-http
-                                 source_scheme: https
-                                 context_nesting: top-level
-                                 redirection: keep-scheme-redirect
-                                 subresource: fetch-request
-                                 expectation: blocked
- -

See specification - details for this test.

- -
+
diff --git a/testing/web-platform/tests/mixed-content/blockable/http-csp/same-host-http/fetch-request/top-level/no-redirect/opt-in-blocks.https.html b/testing/web-platform/tests/mixed-content/blockable/http-csp/same-host-http/fetch-request/top-level/no-redirect/opt-in-blocks.https.html index 91d1a3f1265e..a7ce2a53055c 100644 --- a/testing/web-platform/tests/mixed-content/blockable/http-csp/same-host-http/fetch-request/top-level/no-redirect/opt-in-blocks.https.html +++ b/testing/web-platform/tests/mixed-content/blockable/http-csp/same-host-http/fetch-request/top-level/no-redirect/opt-in-blocks.https.html @@ -1,10 +1,12 @@ - + Mixed-Content: Blockable content + + - - - - - - -

Blockable content

-

Test behavior of blockable content.

-
opt_in_method: http-csp
-                                 origin: same-host-http
-                                 source_scheme: https
-                                 context_nesting: top-level
-                                 redirection: no-redirect
-                                 subresource: fetch-request
-                                 expectation: blocked
- -

See specification - details for this test.

- -
+
diff --git a/testing/web-platform/tests/mixed-content/blockable/http-csp/same-host-http/fetch-request/top-level/swap-scheme-redirect/opt-in-blocks.https.html b/testing/web-platform/tests/mixed-content/blockable/http-csp/same-host-http/fetch-request/top-level/swap-scheme-redirect/opt-in-blocks.https.html index 3cacff2de7d6..1eec54d3b2c8 100644 --- a/testing/web-platform/tests/mixed-content/blockable/http-csp/same-host-http/fetch-request/top-level/swap-scheme-redirect/opt-in-blocks.https.html +++ b/testing/web-platform/tests/mixed-content/blockable/http-csp/same-host-http/fetch-request/top-level/swap-scheme-redirect/opt-in-blocks.https.html @@ -1,10 +1,12 @@ - + Mixed-Content: Blockable content + + - - - - - - -

Blockable content

-

Test behavior of blockable content.

-
opt_in_method: http-csp
-                                 origin: same-host-http
-                                 source_scheme: https
-                                 context_nesting: top-level
-                                 redirection: swap-scheme-redirect
-                                 subresource: fetch-request
-                                 expectation: blocked
- -

See specification - details for this test.

- -
+
diff --git a/testing/web-platform/tests/mixed-content/blockable/http-csp/same-host-http/form-tag/top-level/keep-scheme-redirect/opt-in-blocks.https.html b/testing/web-platform/tests/mixed-content/blockable/http-csp/same-host-http/form-tag/top-level/keep-scheme-redirect/opt-in-blocks.https.html index eb2b540f5451..6d67e4d0e407 100644 --- a/testing/web-platform/tests/mixed-content/blockable/http-csp/same-host-http/form-tag/top-level/keep-scheme-redirect/opt-in-blocks.https.html +++ b/testing/web-platform/tests/mixed-content/blockable/http-csp/same-host-http/form-tag/top-level/keep-scheme-redirect/opt-in-blocks.https.html @@ -1,10 +1,12 @@ - + Mixed-Content: Blockable content + + - - - - - - -

Blockable content

-

Test behavior of blockable content.

-
opt_in_method: http-csp
-                                 origin: same-host-http
-                                 source_scheme: https
-                                 context_nesting: top-level
-                                 redirection: keep-scheme-redirect
-                                 subresource: form-tag
-                                 expectation: blocked
- -

See specification - details for this test.

- -
+
diff --git a/testing/web-platform/tests/mixed-content/blockable/http-csp/same-host-http/form-tag/top-level/no-redirect/opt-in-blocks.https.html b/testing/web-platform/tests/mixed-content/blockable/http-csp/same-host-http/form-tag/top-level/no-redirect/opt-in-blocks.https.html index c94668ad7265..0d8b5ebdbd10 100644 --- a/testing/web-platform/tests/mixed-content/blockable/http-csp/same-host-http/form-tag/top-level/no-redirect/opt-in-blocks.https.html +++ b/testing/web-platform/tests/mixed-content/blockable/http-csp/same-host-http/form-tag/top-level/no-redirect/opt-in-blocks.https.html @@ -1,10 +1,12 @@ - + Mixed-Content: Blockable content + + - - - - - - -

Blockable content

-

Test behavior of blockable content.

-
opt_in_method: http-csp
-                                 origin: same-host-http
-                                 source_scheme: https
-                                 context_nesting: top-level
-                                 redirection: no-redirect
-                                 subresource: form-tag
-                                 expectation: blocked
- -

See specification - details for this test.

- -
+
diff --git a/testing/web-platform/tests/mixed-content/blockable/http-csp/same-host-http/form-tag/top-level/swap-scheme-redirect/opt-in-blocks.https.html b/testing/web-platform/tests/mixed-content/blockable/http-csp/same-host-http/form-tag/top-level/swap-scheme-redirect/opt-in-blocks.https.html index 3f74ebf7bc51..326ca747cb42 100644 --- a/testing/web-platform/tests/mixed-content/blockable/http-csp/same-host-http/form-tag/top-level/swap-scheme-redirect/opt-in-blocks.https.html +++ b/testing/web-platform/tests/mixed-content/blockable/http-csp/same-host-http/form-tag/top-level/swap-scheme-redirect/opt-in-blocks.https.html @@ -1,10 +1,12 @@ - + Mixed-Content: Blockable content + + - - - - - - -

Blockable content

-

Test behavior of blockable content.

-
opt_in_method: http-csp
-                                 origin: same-host-http
-                                 source_scheme: https
-                                 context_nesting: top-level
-                                 redirection: swap-scheme-redirect
-                                 subresource: form-tag
-                                 expectation: blocked
- -

See specification - details for this test.

- -
+
diff --git a/testing/web-platform/tests/mixed-content/blockable/http-csp/same-host-http/iframe-tag/top-level/keep-scheme-redirect/opt-in-blocks.https.html b/testing/web-platform/tests/mixed-content/blockable/http-csp/same-host-http/iframe-tag/top-level/keep-scheme-redirect/opt-in-blocks.https.html index a3d5fddcb1cb..35e3102a5dd5 100644 --- a/testing/web-platform/tests/mixed-content/blockable/http-csp/same-host-http/iframe-tag/top-level/keep-scheme-redirect/opt-in-blocks.https.html +++ b/testing/web-platform/tests/mixed-content/blockable/http-csp/same-host-http/iframe-tag/top-level/keep-scheme-redirect/opt-in-blocks.https.html @@ -1,10 +1,12 @@ - + Mixed-Content: Blockable content + + - - - - - - -

Blockable content

-

Test behavior of blockable content.

-
opt_in_method: http-csp
-                                 origin: same-host-http
-                                 source_scheme: https
-                                 context_nesting: top-level
-                                 redirection: keep-scheme-redirect
-                                 subresource: iframe-tag
-                                 expectation: blocked
- -

See specification - details for this test.

- -
+
diff --git a/testing/web-platform/tests/mixed-content/blockable/http-csp/same-host-http/iframe-tag/top-level/no-redirect/opt-in-blocks.https.html b/testing/web-platform/tests/mixed-content/blockable/http-csp/same-host-http/iframe-tag/top-level/no-redirect/opt-in-blocks.https.html index e8c3c2096716..eaa1cc5d7292 100644 --- a/testing/web-platform/tests/mixed-content/blockable/http-csp/same-host-http/iframe-tag/top-level/no-redirect/opt-in-blocks.https.html +++ b/testing/web-platform/tests/mixed-content/blockable/http-csp/same-host-http/iframe-tag/top-level/no-redirect/opt-in-blocks.https.html @@ -1,10 +1,12 @@ - + Mixed-Content: Blockable content + + - - - - - - -

Blockable content

-

Test behavior of blockable content.

-
opt_in_method: http-csp
-                                 origin: same-host-http
-                                 source_scheme: https
-                                 context_nesting: top-level
-                                 redirection: no-redirect
-                                 subresource: iframe-tag
-                                 expectation: blocked
- -

See specification - details for this test.

- -
+
diff --git a/testing/web-platform/tests/mixed-content/blockable/http-csp/same-host-http/iframe-tag/top-level/swap-scheme-redirect/opt-in-blocks.https.html b/testing/web-platform/tests/mixed-content/blockable/http-csp/same-host-http/iframe-tag/top-level/swap-scheme-redirect/opt-in-blocks.https.html index 8a1708b4e0a1..ff99ecf9bbd0 100644 --- a/testing/web-platform/tests/mixed-content/blockable/http-csp/same-host-http/iframe-tag/top-level/swap-scheme-redirect/opt-in-blocks.https.html +++ b/testing/web-platform/tests/mixed-content/blockable/http-csp/same-host-http/iframe-tag/top-level/swap-scheme-redirect/opt-in-blocks.https.html @@ -1,10 +1,12 @@ - + Mixed-Content: Blockable content + + - - - - - - -

Blockable content

-

Test behavior of blockable content.

-
opt_in_method: http-csp
-                                 origin: same-host-http
-                                 source_scheme: https
-                                 context_nesting: top-level
-                                 redirection: swap-scheme-redirect
-                                 subresource: iframe-tag
-                                 expectation: blocked
- -

See specification - details for this test.

- -
+
diff --git a/testing/web-platform/tests/mixed-content/blockable/http-csp/same-host-http/link-css-tag/top-level/keep-scheme-redirect/opt-in-blocks.https.html b/testing/web-platform/tests/mixed-content/blockable/http-csp/same-host-http/link-css-tag/top-level/keep-scheme-redirect/opt-in-blocks.https.html index c5dde9eaa3f0..b93d17784229 100644 --- a/testing/web-platform/tests/mixed-content/blockable/http-csp/same-host-http/link-css-tag/top-level/keep-scheme-redirect/opt-in-blocks.https.html +++ b/testing/web-platform/tests/mixed-content/blockable/http-csp/same-host-http/link-css-tag/top-level/keep-scheme-redirect/opt-in-blocks.https.html @@ -1,10 +1,12 @@ - + Mixed-Content: Blockable content + + - - - - - - -

Blockable content

-

Test behavior of blockable content.

-
opt_in_method: http-csp
-                                 origin: same-host-http
-                                 source_scheme: https
-                                 context_nesting: top-level
-                                 redirection: keep-scheme-redirect
-                                 subresource: link-css-tag
-                                 expectation: blocked
- -

See specification - details for this test.

- -
+
diff --git a/testing/web-platform/tests/mixed-content/blockable/http-csp/same-host-http/link-css-tag/top-level/no-redirect/opt-in-blocks.https.html b/testing/web-platform/tests/mixed-content/blockable/http-csp/same-host-http/link-css-tag/top-level/no-redirect/opt-in-blocks.https.html index da5b01e6b1f9..b23f9f0eb68c 100644 --- a/testing/web-platform/tests/mixed-content/blockable/http-csp/same-host-http/link-css-tag/top-level/no-redirect/opt-in-blocks.https.html +++ b/testing/web-platform/tests/mixed-content/blockable/http-csp/same-host-http/link-css-tag/top-level/no-redirect/opt-in-blocks.https.html @@ -1,10 +1,12 @@ - + Mixed-Content: Blockable content + + - - - - - - -

Blockable content

-

Test behavior of blockable content.

-
opt_in_method: http-csp
-                                 origin: same-host-http
-                                 source_scheme: https
-                                 context_nesting: top-level
-                                 redirection: no-redirect
-                                 subresource: link-css-tag
-                                 expectation: blocked
- -

See specification - details for this test.

- -
+
diff --git a/testing/web-platform/tests/mixed-content/blockable/http-csp/same-host-http/link-css-tag/top-level/swap-scheme-redirect/opt-in-blocks.https.html b/testing/web-platform/tests/mixed-content/blockable/http-csp/same-host-http/link-css-tag/top-level/swap-scheme-redirect/opt-in-blocks.https.html index b852778af0c3..122ee404dc74 100644 --- a/testing/web-platform/tests/mixed-content/blockable/http-csp/same-host-http/link-css-tag/top-level/swap-scheme-redirect/opt-in-blocks.https.html +++ b/testing/web-platform/tests/mixed-content/blockable/http-csp/same-host-http/link-css-tag/top-level/swap-scheme-redirect/opt-in-blocks.https.html @@ -1,10 +1,12 @@ - + Mixed-Content: Blockable content + + - - - - - - -

Blockable content

-

Test behavior of blockable content.

-
opt_in_method: http-csp
-                                 origin: same-host-http
-                                 source_scheme: https
-                                 context_nesting: top-level
-                                 redirection: swap-scheme-redirect
-                                 subresource: link-css-tag
-                                 expectation: blocked
- -

See specification - details for this test.

- -
+
diff --git a/testing/web-platform/tests/mixed-content/blockable/http-csp/same-host-http/object-tag/top-level/keep-scheme-redirect/opt-in-blocks.https.html b/testing/web-platform/tests/mixed-content/blockable/http-csp/same-host-http/object-tag/top-level/keep-scheme-redirect/opt-in-blocks.https.html index 3045cec23d2c..4c43f3aea647 100644 --- a/testing/web-platform/tests/mixed-content/blockable/http-csp/same-host-http/object-tag/top-level/keep-scheme-redirect/opt-in-blocks.https.html +++ b/testing/web-platform/tests/mixed-content/blockable/http-csp/same-host-http/object-tag/top-level/keep-scheme-redirect/opt-in-blocks.https.html @@ -1,10 +1,12 @@ - + Mixed-Content: Blockable content + + - - - - - - -

Blockable content

-

Test behavior of blockable content.

-
opt_in_method: http-csp
-                                 origin: same-host-http
-                                 source_scheme: https
-                                 context_nesting: top-level
-                                 redirection: keep-scheme-redirect
-                                 subresource: object-tag
-                                 expectation: blocked
- -

See specification - details for this test.

- -
+
diff --git a/testing/web-platform/tests/mixed-content/blockable/http-csp/same-host-http/object-tag/top-level/no-redirect/opt-in-blocks.https.html b/testing/web-platform/tests/mixed-content/blockable/http-csp/same-host-http/object-tag/top-level/no-redirect/opt-in-blocks.https.html index e13d6d25b37e..27da8b421be6 100644 --- a/testing/web-platform/tests/mixed-content/blockable/http-csp/same-host-http/object-tag/top-level/no-redirect/opt-in-blocks.https.html +++ b/testing/web-platform/tests/mixed-content/blockable/http-csp/same-host-http/object-tag/top-level/no-redirect/opt-in-blocks.https.html @@ -1,10 +1,12 @@ - + Mixed-Content: Blockable content + + - - - - - - -

Blockable content

-

Test behavior of blockable content.

-
opt_in_method: http-csp
-                                 origin: same-host-http
-                                 source_scheme: https
-                                 context_nesting: top-level
-                                 redirection: no-redirect
-                                 subresource: object-tag
-                                 expectation: blocked
- -

See specification - details for this test.

- -
+
diff --git a/testing/web-platform/tests/mixed-content/blockable/http-csp/same-host-http/object-tag/top-level/swap-scheme-redirect/opt-in-blocks.https.html b/testing/web-platform/tests/mixed-content/blockable/http-csp/same-host-http/object-tag/top-level/swap-scheme-redirect/opt-in-blocks.https.html index 974e6b771daa..01df78229ff9 100644 --- a/testing/web-platform/tests/mixed-content/blockable/http-csp/same-host-http/object-tag/top-level/swap-scheme-redirect/opt-in-blocks.https.html +++ b/testing/web-platform/tests/mixed-content/blockable/http-csp/same-host-http/object-tag/top-level/swap-scheme-redirect/opt-in-blocks.https.html @@ -1,10 +1,12 @@ - + Mixed-Content: Blockable content + + - - - - - - -

Blockable content

-

Test behavior of blockable content.

-
opt_in_method: http-csp
-                                 origin: same-host-http
-                                 source_scheme: https
-                                 context_nesting: top-level
-                                 redirection: swap-scheme-redirect
-                                 subresource: object-tag
-                                 expectation: blocked
- -

See specification - details for this test.

- -
+
diff --git a/testing/web-platform/tests/mixed-content/blockable/http-csp/same-host-http/picture-tag/top-level/keep-scheme-redirect/opt-in-blocks.https.html b/testing/web-platform/tests/mixed-content/blockable/http-csp/same-host-http/picture-tag/top-level/keep-scheme-redirect/opt-in-blocks.https.html index e45e810791ea..27e971ac49c1 100644 --- a/testing/web-platform/tests/mixed-content/blockable/http-csp/same-host-http/picture-tag/top-level/keep-scheme-redirect/opt-in-blocks.https.html +++ b/testing/web-platform/tests/mixed-content/blockable/http-csp/same-host-http/picture-tag/top-level/keep-scheme-redirect/opt-in-blocks.https.html @@ -1,10 +1,12 @@ - + Mixed-Content: Blockable content + + - - - - - - -

Blockable content

-

Test behavior of blockable content.

-
opt_in_method: http-csp
-                                 origin: same-host-http
-                                 source_scheme: https
-                                 context_nesting: top-level
-                                 redirection: keep-scheme-redirect
-                                 subresource: picture-tag
-                                 expectation: blocked
- -

See specification - details for this test.

- -
+
diff --git a/testing/web-platform/tests/mixed-content/blockable/http-csp/same-host-http/picture-tag/top-level/no-redirect/opt-in-blocks.https.html b/testing/web-platform/tests/mixed-content/blockable/http-csp/same-host-http/picture-tag/top-level/no-redirect/opt-in-blocks.https.html index 32d1c139e43a..0fe505a4b05c 100644 --- a/testing/web-platform/tests/mixed-content/blockable/http-csp/same-host-http/picture-tag/top-level/no-redirect/opt-in-blocks.https.html +++ b/testing/web-platform/tests/mixed-content/blockable/http-csp/same-host-http/picture-tag/top-level/no-redirect/opt-in-blocks.https.html @@ -1,10 +1,12 @@ - + Mixed-Content: Blockable content + + - - - - - - -

Blockable content

-

Test behavior of blockable content.

-
opt_in_method: http-csp
-                                 origin: same-host-http
-                                 source_scheme: https
-                                 context_nesting: top-level
-                                 redirection: no-redirect
-                                 subresource: picture-tag
-                                 expectation: blocked
- -

See specification - details for this test.

- -
+
diff --git a/testing/web-platform/tests/mixed-content/blockable/http-csp/same-host-http/picture-tag/top-level/swap-scheme-redirect/opt-in-blocks.https.html b/testing/web-platform/tests/mixed-content/blockable/http-csp/same-host-http/picture-tag/top-level/swap-scheme-redirect/opt-in-blocks.https.html index 6dbd29b3e05c..d066d7f4af16 100644 --- a/testing/web-platform/tests/mixed-content/blockable/http-csp/same-host-http/picture-tag/top-level/swap-scheme-redirect/opt-in-blocks.https.html +++ b/testing/web-platform/tests/mixed-content/blockable/http-csp/same-host-http/picture-tag/top-level/swap-scheme-redirect/opt-in-blocks.https.html @@ -1,10 +1,12 @@ - + Mixed-Content: Blockable content + + - - - - - - -

Blockable content

-

Test behavior of blockable content.

-
opt_in_method: http-csp
-                                 origin: same-host-http
-                                 source_scheme: https
-                                 context_nesting: top-level
-                                 redirection: swap-scheme-redirect
-                                 subresource: picture-tag
-                                 expectation: blocked
- -

See specification - details for this test.

- -
+
diff --git a/testing/web-platform/tests/mixed-content/blockable/http-csp/same-host-http/script-tag/top-level/keep-scheme-redirect/opt-in-blocks.https.html b/testing/web-platform/tests/mixed-content/blockable/http-csp/same-host-http/script-tag/top-level/keep-scheme-redirect/opt-in-blocks.https.html index ef2583c98f5e..011e515da176 100644 --- a/testing/web-platform/tests/mixed-content/blockable/http-csp/same-host-http/script-tag/top-level/keep-scheme-redirect/opt-in-blocks.https.html +++ b/testing/web-platform/tests/mixed-content/blockable/http-csp/same-host-http/script-tag/top-level/keep-scheme-redirect/opt-in-blocks.https.html @@ -1,10 +1,12 @@ - + Mixed-Content: Blockable content + + - - - - - - -

Blockable content

-

Test behavior of blockable content.

-
opt_in_method: http-csp
-                                 origin: same-host-http
-                                 source_scheme: https
-                                 context_nesting: top-level
-                                 redirection: keep-scheme-redirect
-                                 subresource: script-tag
-                                 expectation: blocked
- -

See specification - details for this test.

- -
+
diff --git a/testing/web-platform/tests/mixed-content/blockable/http-csp/same-host-http/script-tag/top-level/no-redirect/opt-in-blocks.https.html b/testing/web-platform/tests/mixed-content/blockable/http-csp/same-host-http/script-tag/top-level/no-redirect/opt-in-blocks.https.html index 7e9799a483ed..5c8d860a6957 100644 --- a/testing/web-platform/tests/mixed-content/blockable/http-csp/same-host-http/script-tag/top-level/no-redirect/opt-in-blocks.https.html +++ b/testing/web-platform/tests/mixed-content/blockable/http-csp/same-host-http/script-tag/top-level/no-redirect/opt-in-blocks.https.html @@ -1,10 +1,12 @@ - + Mixed-Content: Blockable content + + - - - - - - -

Blockable content

-

Test behavior of blockable content.

-
opt_in_method: http-csp
-                                 origin: same-host-http
-                                 source_scheme: https
-                                 context_nesting: top-level
-                                 redirection: no-redirect
-                                 subresource: script-tag
-                                 expectation: blocked
- -

See specification - details for this test.

- -
+
diff --git a/testing/web-platform/tests/mixed-content/blockable/http-csp/same-host-http/script-tag/top-level/swap-scheme-redirect/opt-in-blocks.https.html b/testing/web-platform/tests/mixed-content/blockable/http-csp/same-host-http/script-tag/top-level/swap-scheme-redirect/opt-in-blocks.https.html index e2341178abff..123e53d2027f 100644 --- a/testing/web-platform/tests/mixed-content/blockable/http-csp/same-host-http/script-tag/top-level/swap-scheme-redirect/opt-in-blocks.https.html +++ b/testing/web-platform/tests/mixed-content/blockable/http-csp/same-host-http/script-tag/top-level/swap-scheme-redirect/opt-in-blocks.https.html @@ -1,10 +1,12 @@ - + Mixed-Content: Blockable content + + - - - - - - -

Blockable content

-

Test behavior of blockable content.

-
opt_in_method: http-csp
-                                 origin: same-host-http
-                                 source_scheme: https
-                                 context_nesting: top-level
-                                 redirection: swap-scheme-redirect
-                                 subresource: script-tag
-                                 expectation: blocked
- -

See specification - details for this test.

- -
+
diff --git a/testing/web-platform/tests/mixed-content/blockable/http-csp/same-host-http/worker-request/top-level/keep-scheme-redirect/opt-in-blocks.https.html b/testing/web-platform/tests/mixed-content/blockable/http-csp/same-host-http/worker-request/top-level/keep-scheme-redirect/opt-in-blocks.https.html index 741ac1d23375..735c267a88a8 100644 --- a/testing/web-platform/tests/mixed-content/blockable/http-csp/same-host-http/worker-request/top-level/keep-scheme-redirect/opt-in-blocks.https.html +++ b/testing/web-platform/tests/mixed-content/blockable/http-csp/same-host-http/worker-request/top-level/keep-scheme-redirect/opt-in-blocks.https.html @@ -1,10 +1,12 @@ - + Mixed-Content: Blockable content + + - - - - - - -

Blockable content

-

Test behavior of blockable content.

-
opt_in_method: http-csp
-                                 origin: same-host-http
-                                 source_scheme: https
-                                 context_nesting: top-level
-                                 redirection: keep-scheme-redirect
-                                 subresource: worker-request
-                                 expectation: blocked
- -

See specification - details for this test.

- -
+
diff --git a/testing/web-platform/tests/mixed-content/blockable/http-csp/same-host-http/worker-request/top-level/no-redirect/opt-in-blocks.https.html b/testing/web-platform/tests/mixed-content/blockable/http-csp/same-host-http/worker-request/top-level/no-redirect/opt-in-blocks.https.html index f17779c3a865..d70b85768974 100644 --- a/testing/web-platform/tests/mixed-content/blockable/http-csp/same-host-http/worker-request/top-level/no-redirect/opt-in-blocks.https.html +++ b/testing/web-platform/tests/mixed-content/blockable/http-csp/same-host-http/worker-request/top-level/no-redirect/opt-in-blocks.https.html @@ -1,10 +1,12 @@ - + Mixed-Content: Blockable content + + - - - - - - -

Blockable content

-

Test behavior of blockable content.

-
opt_in_method: http-csp
-                                 origin: same-host-http
-                                 source_scheme: https
-                                 context_nesting: top-level
-                                 redirection: no-redirect
-                                 subresource: worker-request
-                                 expectation: blocked
- -

See specification - details for this test.

- -
+
diff --git a/testing/web-platform/tests/mixed-content/blockable/http-csp/same-host-http/worker-request/top-level/swap-scheme-redirect/opt-in-blocks.https.html b/testing/web-platform/tests/mixed-content/blockable/http-csp/same-host-http/worker-request/top-level/swap-scheme-redirect/opt-in-blocks.https.html index f05454aaa7f7..bf77ac6d77ef 100644 --- a/testing/web-platform/tests/mixed-content/blockable/http-csp/same-host-http/worker-request/top-level/swap-scheme-redirect/opt-in-blocks.https.html +++ b/testing/web-platform/tests/mixed-content/blockable/http-csp/same-host-http/worker-request/top-level/swap-scheme-redirect/opt-in-blocks.https.html @@ -1,10 +1,12 @@ - + Mixed-Content: Blockable content + + - - - - - - -

Blockable content

-

Test behavior of blockable content.

-
opt_in_method: http-csp
-                                 origin: same-host-http
-                                 source_scheme: https
-                                 context_nesting: top-level
-                                 redirection: swap-scheme-redirect
-                                 subresource: worker-request
-                                 expectation: blocked
- -

See specification - details for this test.

- -
+
diff --git a/testing/web-platform/tests/mixed-content/blockable/http-csp/same-host-http/xhr-request/top-level/keep-scheme-redirect/opt-in-blocks.https.html b/testing/web-platform/tests/mixed-content/blockable/http-csp/same-host-http/xhr-request/top-level/keep-scheme-redirect/opt-in-blocks.https.html index bbeb517dd658..f8509416232c 100644 --- a/testing/web-platform/tests/mixed-content/blockable/http-csp/same-host-http/xhr-request/top-level/keep-scheme-redirect/opt-in-blocks.https.html +++ b/testing/web-platform/tests/mixed-content/blockable/http-csp/same-host-http/xhr-request/top-level/keep-scheme-redirect/opt-in-blocks.https.html @@ -1,10 +1,12 @@ - + Mixed-Content: Blockable content + + - - - - - - -

Blockable content

-

Test behavior of blockable content.

-
opt_in_method: http-csp
-                                 origin: same-host-http
-                                 source_scheme: https
-                                 context_nesting: top-level
-                                 redirection: keep-scheme-redirect
-                                 subresource: xhr-request
-                                 expectation: blocked
- -

See specification - details for this test.

- -
+
diff --git a/testing/web-platform/tests/mixed-content/blockable/http-csp/same-host-http/xhr-request/top-level/no-redirect/opt-in-blocks.https.html b/testing/web-platform/tests/mixed-content/blockable/http-csp/same-host-http/xhr-request/top-level/no-redirect/opt-in-blocks.https.html index 272556d9822a..0dd9e88e885f 100644 --- a/testing/web-platform/tests/mixed-content/blockable/http-csp/same-host-http/xhr-request/top-level/no-redirect/opt-in-blocks.https.html +++ b/testing/web-platform/tests/mixed-content/blockable/http-csp/same-host-http/xhr-request/top-level/no-redirect/opt-in-blocks.https.html @@ -1,10 +1,12 @@ - + Mixed-Content: Blockable content + + - - - - - - -

Blockable content

-

Test behavior of blockable content.

-
opt_in_method: http-csp
-                                 origin: same-host-http
-                                 source_scheme: https
-                                 context_nesting: top-level
-                                 redirection: no-redirect
-                                 subresource: xhr-request
-                                 expectation: blocked
- -

See specification - details for this test.

- -
+
diff --git a/testing/web-platform/tests/mixed-content/blockable/http-csp/same-host-http/xhr-request/top-level/swap-scheme-redirect/opt-in-blocks.https.html b/testing/web-platform/tests/mixed-content/blockable/http-csp/same-host-http/xhr-request/top-level/swap-scheme-redirect/opt-in-blocks.https.html index 11edffe12aff..eb7f7ea2c739 100644 --- a/testing/web-platform/tests/mixed-content/blockable/http-csp/same-host-http/xhr-request/top-level/swap-scheme-redirect/opt-in-blocks.https.html +++ b/testing/web-platform/tests/mixed-content/blockable/http-csp/same-host-http/xhr-request/top-level/swap-scheme-redirect/opt-in-blocks.https.html @@ -1,10 +1,12 @@ - + Mixed-Content: Blockable content + + - - - - - - -

Blockable content

-

Test behavior of blockable content.

-
opt_in_method: http-csp
-                                 origin: same-host-http
-                                 source_scheme: https
-                                 context_nesting: top-level
-                                 redirection: swap-scheme-redirect
-                                 subresource: xhr-request
-                                 expectation: blocked
- -

See specification - details for this test.

- -
+
diff --git a/testing/web-platform/tests/mixed-content/blockable/meta-csp/cross-origin-http/fetch-request/top-level/no-redirect/opt-in-blocks.https.html b/testing/web-platform/tests/mixed-content/blockable/meta-csp/cross-origin-http/fetch-request/top-level/no-redirect/opt-in-blocks.https.html index a320a2ad1908..ccc8e9b0b862 100644 --- a/testing/web-platform/tests/mixed-content/blockable/meta-csp/cross-origin-http/fetch-request/top-level/no-redirect/opt-in-blocks.https.html +++ b/testing/web-platform/tests/mixed-content/blockable/meta-csp/cross-origin-http/fetch-request/top-level/no-redirect/opt-in-blocks.https.html @@ -1,43 +1,25 @@ - + Mixed-Content: Blockable content + + + expectation: blocked"> - - - - - - -

Blockable content

-

Test behavior of blockable content.

-
opt_in_method: meta-csp
-                                 origin: cross-origin-http
-                                 source_scheme: https
-                                 context_nesting: top-level
-                                 redirection: no-redirect
-                                 subresource: fetch-request
-                                 expectation: blocked
- -

See specification - details for this test.

- -
+
diff --git a/testing/web-platform/tests/mixed-content/blockable/meta-csp/cross-origin-http/form-tag/top-level/no-redirect/opt-in-blocks.https.html b/testing/web-platform/tests/mixed-content/blockable/meta-csp/cross-origin-http/form-tag/top-level/no-redirect/opt-in-blocks.https.html index c02e468a94e9..147bd58578da 100644 --- a/testing/web-platform/tests/mixed-content/blockable/meta-csp/cross-origin-http/form-tag/top-level/no-redirect/opt-in-blocks.https.html +++ b/testing/web-platform/tests/mixed-content/blockable/meta-csp/cross-origin-http/form-tag/top-level/no-redirect/opt-in-blocks.https.html @@ -1,43 +1,25 @@ - + Mixed-Content: Blockable content + + + expectation: blocked"> - - - - - - -

Blockable content

-

Test behavior of blockable content.

-
opt_in_method: meta-csp
-                                 origin: cross-origin-http
-                                 source_scheme: https
-                                 context_nesting: top-level
-                                 redirection: no-redirect
-                                 subresource: form-tag
-                                 expectation: blocked
- -

See specification - details for this test.

- -
+
diff --git a/testing/web-platform/tests/mixed-content/blockable/meta-csp/cross-origin-http/iframe-tag/top-level/no-redirect/opt-in-blocks.https.html b/testing/web-platform/tests/mixed-content/blockable/meta-csp/cross-origin-http/iframe-tag/top-level/no-redirect/opt-in-blocks.https.html index 0f4c63bfe929..84af99aca91b 100644 --- a/testing/web-platform/tests/mixed-content/blockable/meta-csp/cross-origin-http/iframe-tag/top-level/no-redirect/opt-in-blocks.https.html +++ b/testing/web-platform/tests/mixed-content/blockable/meta-csp/cross-origin-http/iframe-tag/top-level/no-redirect/opt-in-blocks.https.html @@ -1,43 +1,25 @@ - + Mixed-Content: Blockable content + + + expectation: blocked"> - - - - - - -

Blockable content

-

Test behavior of blockable content.

-
opt_in_method: meta-csp
-                                 origin: cross-origin-http
-                                 source_scheme: https
-                                 context_nesting: top-level
-                                 redirection: no-redirect
-                                 subresource: iframe-tag
-                                 expectation: blocked
- -

See specification - details for this test.

- -
+
diff --git a/testing/web-platform/tests/mixed-content/blockable/meta-csp/cross-origin-http/link-css-tag/top-level/no-redirect/opt-in-blocks.https.html b/testing/web-platform/tests/mixed-content/blockable/meta-csp/cross-origin-http/link-css-tag/top-level/no-redirect/opt-in-blocks.https.html index 98dd2c36fe22..bf9b606aed99 100644 --- a/testing/web-platform/tests/mixed-content/blockable/meta-csp/cross-origin-http/link-css-tag/top-level/no-redirect/opt-in-blocks.https.html +++ b/testing/web-platform/tests/mixed-content/blockable/meta-csp/cross-origin-http/link-css-tag/top-level/no-redirect/opt-in-blocks.https.html @@ -1,43 +1,25 @@ - + Mixed-Content: Blockable content + + + expectation: blocked"> - - - - - - -

Blockable content

-

Test behavior of blockable content.

-
opt_in_method: meta-csp
-                                 origin: cross-origin-http
-                                 source_scheme: https
-                                 context_nesting: top-level
-                                 redirection: no-redirect
-                                 subresource: link-css-tag
-                                 expectation: blocked
- -

See specification - details for this test.

- -
+
diff --git a/testing/web-platform/tests/mixed-content/blockable/meta-csp/cross-origin-http/object-tag/top-level/no-redirect/opt-in-blocks.https.html b/testing/web-platform/tests/mixed-content/blockable/meta-csp/cross-origin-http/object-tag/top-level/no-redirect/opt-in-blocks.https.html index 956d09f91b04..128c08dcd6ed 100644 --- a/testing/web-platform/tests/mixed-content/blockable/meta-csp/cross-origin-http/object-tag/top-level/no-redirect/opt-in-blocks.https.html +++ b/testing/web-platform/tests/mixed-content/blockable/meta-csp/cross-origin-http/object-tag/top-level/no-redirect/opt-in-blocks.https.html @@ -1,43 +1,25 @@ - + Mixed-Content: Blockable content + + + expectation: blocked"> - - - - - - -

Blockable content

-

Test behavior of blockable content.

-
opt_in_method: meta-csp
-                                 origin: cross-origin-http
-                                 source_scheme: https
-                                 context_nesting: top-level
-                                 redirection: no-redirect
-                                 subresource: object-tag
-                                 expectation: blocked
- -

See specification - details for this test.

- -
+
diff --git a/testing/web-platform/tests/mixed-content/blockable/meta-csp/cross-origin-http/picture-tag/top-level/no-redirect/opt-in-blocks.https.html b/testing/web-platform/tests/mixed-content/blockable/meta-csp/cross-origin-http/picture-tag/top-level/no-redirect/opt-in-blocks.https.html index 6f2a7c1b14ef..debd088dbb96 100644 --- a/testing/web-platform/tests/mixed-content/blockable/meta-csp/cross-origin-http/picture-tag/top-level/no-redirect/opt-in-blocks.https.html +++ b/testing/web-platform/tests/mixed-content/blockable/meta-csp/cross-origin-http/picture-tag/top-level/no-redirect/opt-in-blocks.https.html @@ -1,43 +1,25 @@ - + Mixed-Content: Blockable content + + + expectation: blocked"> - - - - - - -

Blockable content

-

Test behavior of blockable content.

-
opt_in_method: meta-csp
-                                 origin: cross-origin-http
-                                 source_scheme: https
-                                 context_nesting: top-level
-                                 redirection: no-redirect
-                                 subresource: picture-tag
-                                 expectation: blocked
- -

See specification - details for this test.

- -
+
diff --git a/testing/web-platform/tests/mixed-content/blockable/meta-csp/cross-origin-http/script-tag/top-level/no-redirect/opt-in-blocks.https.html b/testing/web-platform/tests/mixed-content/blockable/meta-csp/cross-origin-http/script-tag/top-level/no-redirect/opt-in-blocks.https.html index 3a8e8aefc5c8..4872269168da 100644 --- a/testing/web-platform/tests/mixed-content/blockable/meta-csp/cross-origin-http/script-tag/top-level/no-redirect/opt-in-blocks.https.html +++ b/testing/web-platform/tests/mixed-content/blockable/meta-csp/cross-origin-http/script-tag/top-level/no-redirect/opt-in-blocks.https.html @@ -1,43 +1,25 @@ - + Mixed-Content: Blockable content + + + expectation: blocked"> - - - - - - -

Blockable content

-

Test behavior of blockable content.

-
opt_in_method: meta-csp
-                                 origin: cross-origin-http
-                                 source_scheme: https
-                                 context_nesting: top-level
-                                 redirection: no-redirect
-                                 subresource: script-tag
-                                 expectation: blocked
- -

See specification - details for this test.

- -
+
diff --git a/testing/web-platform/tests/mixed-content/blockable/meta-csp/cross-origin-http/worker-request/top-level/no-redirect/opt-in-blocks.https.html b/testing/web-platform/tests/mixed-content/blockable/meta-csp/cross-origin-http/worker-request/top-level/no-redirect/opt-in-blocks.https.html index 52f49cc0950c..b4bfdb8781c0 100644 --- a/testing/web-platform/tests/mixed-content/blockable/meta-csp/cross-origin-http/worker-request/top-level/no-redirect/opt-in-blocks.https.html +++ b/testing/web-platform/tests/mixed-content/blockable/meta-csp/cross-origin-http/worker-request/top-level/no-redirect/opt-in-blocks.https.html @@ -1,43 +1,25 @@ - + Mixed-Content: Blockable content + + + expectation: blocked"> - - - - - - -

Blockable content

-

Test behavior of blockable content.

-
opt_in_method: meta-csp
-                                 origin: cross-origin-http
-                                 source_scheme: https
-                                 context_nesting: top-level
-                                 redirection: no-redirect
-                                 subresource: worker-request
-                                 expectation: blocked
- -

See specification - details for this test.

- -
+
diff --git a/testing/web-platform/tests/mixed-content/blockable/meta-csp/cross-origin-http/xhr-request/top-level/no-redirect/opt-in-blocks.https.html b/testing/web-platform/tests/mixed-content/blockable/meta-csp/cross-origin-http/xhr-request/top-level/no-redirect/opt-in-blocks.https.html index 68a41936b775..39a44b4524fe 100644 --- a/testing/web-platform/tests/mixed-content/blockable/meta-csp/cross-origin-http/xhr-request/top-level/no-redirect/opt-in-blocks.https.html +++ b/testing/web-platform/tests/mixed-content/blockable/meta-csp/cross-origin-http/xhr-request/top-level/no-redirect/opt-in-blocks.https.html @@ -1,43 +1,25 @@ - + Mixed-Content: Blockable content + + + expectation: blocked"> - - - - - - -

Blockable content

-

Test behavior of blockable content.

-
opt_in_method: meta-csp
-                                 origin: cross-origin-http
-                                 source_scheme: https
-                                 context_nesting: top-level
-                                 redirection: no-redirect
-                                 subresource: xhr-request
-                                 expectation: blocked
- -

See specification - details for this test.

- -
+
diff --git a/testing/web-platform/tests/mixed-content/blockable/meta-csp/same-host-http/fetch-request/top-level/no-redirect/opt-in-blocks.https.html b/testing/web-platform/tests/mixed-content/blockable/meta-csp/same-host-http/fetch-request/top-level/no-redirect/opt-in-blocks.https.html index 065f3322f7fe..85be9eb2b7d1 100644 --- a/testing/web-platform/tests/mixed-content/blockable/meta-csp/same-host-http/fetch-request/top-level/no-redirect/opt-in-blocks.https.html +++ b/testing/web-platform/tests/mixed-content/blockable/meta-csp/same-host-http/fetch-request/top-level/no-redirect/opt-in-blocks.https.html @@ -1,43 +1,25 @@ - + Mixed-Content: Blockable content + + + expectation: blocked"> - - - - - - -

Blockable content

-

Test behavior of blockable content.

-
opt_in_method: meta-csp
-                                 origin: same-host-http
-                                 source_scheme: https
-                                 context_nesting: top-level
-                                 redirection: no-redirect
-                                 subresource: fetch-request
-                                 expectation: blocked
- -

See specification - details for this test.

- -
+
diff --git a/testing/web-platform/tests/mixed-content/blockable/meta-csp/same-host-http/form-tag/top-level/no-redirect/opt-in-blocks.https.html b/testing/web-platform/tests/mixed-content/blockable/meta-csp/same-host-http/form-tag/top-level/no-redirect/opt-in-blocks.https.html index 21195e63b87f..f5a0bf5dc920 100644 --- a/testing/web-platform/tests/mixed-content/blockable/meta-csp/same-host-http/form-tag/top-level/no-redirect/opt-in-blocks.https.html +++ b/testing/web-platform/tests/mixed-content/blockable/meta-csp/same-host-http/form-tag/top-level/no-redirect/opt-in-blocks.https.html @@ -1,43 +1,25 @@ - + Mixed-Content: Blockable content + + + expectation: blocked"> - - - - - - -

Blockable content

-

Test behavior of blockable content.

-
opt_in_method: meta-csp
-                                 origin: same-host-http
-                                 source_scheme: https
-                                 context_nesting: top-level
-                                 redirection: no-redirect
-                                 subresource: form-tag
-                                 expectation: blocked
- -

See specification - details for this test.

- -
+
diff --git a/testing/web-platform/tests/mixed-content/blockable/meta-csp/same-host-http/iframe-tag/top-level/no-redirect/opt-in-blocks.https.html b/testing/web-platform/tests/mixed-content/blockable/meta-csp/same-host-http/iframe-tag/top-level/no-redirect/opt-in-blocks.https.html index 9d9ae1a5b11f..6a70032ecdf6 100644 --- a/testing/web-platform/tests/mixed-content/blockable/meta-csp/same-host-http/iframe-tag/top-level/no-redirect/opt-in-blocks.https.html +++ b/testing/web-platform/tests/mixed-content/blockable/meta-csp/same-host-http/iframe-tag/top-level/no-redirect/opt-in-blocks.https.html @@ -1,43 +1,25 @@ - + Mixed-Content: Blockable content + + + expectation: blocked"> - - - - - - -

Blockable content

-

Test behavior of blockable content.

-
opt_in_method: meta-csp
-                                 origin: same-host-http
-                                 source_scheme: https
-                                 context_nesting: top-level
-                                 redirection: no-redirect
-                                 subresource: iframe-tag
-                                 expectation: blocked
- -

See specification - details for this test.

- -
+
diff --git a/testing/web-platform/tests/mixed-content/blockable/meta-csp/same-host-http/link-css-tag/top-level/no-redirect/opt-in-blocks.https.html b/testing/web-platform/tests/mixed-content/blockable/meta-csp/same-host-http/link-css-tag/top-level/no-redirect/opt-in-blocks.https.html index c692dddfda4f..68b5ac7066cb 100644 --- a/testing/web-platform/tests/mixed-content/blockable/meta-csp/same-host-http/link-css-tag/top-level/no-redirect/opt-in-blocks.https.html +++ b/testing/web-platform/tests/mixed-content/blockable/meta-csp/same-host-http/link-css-tag/top-level/no-redirect/opt-in-blocks.https.html @@ -1,43 +1,25 @@ - + Mixed-Content: Blockable content + + + expectation: blocked"> - - - - - - -

Blockable content

-

Test behavior of blockable content.

-
opt_in_method: meta-csp
-                                 origin: same-host-http
-                                 source_scheme: https
-                                 context_nesting: top-level
-                                 redirection: no-redirect
-                                 subresource: link-css-tag
-                                 expectation: blocked
- -

See specification - details for this test.

- -
+
diff --git a/testing/web-platform/tests/mixed-content/blockable/meta-csp/same-host-http/object-tag/top-level/no-redirect/opt-in-blocks.https.html b/testing/web-platform/tests/mixed-content/blockable/meta-csp/same-host-http/object-tag/top-level/no-redirect/opt-in-blocks.https.html index 0b74f62647f0..a71d608c404a 100644 --- a/testing/web-platform/tests/mixed-content/blockable/meta-csp/same-host-http/object-tag/top-level/no-redirect/opt-in-blocks.https.html +++ b/testing/web-platform/tests/mixed-content/blockable/meta-csp/same-host-http/object-tag/top-level/no-redirect/opt-in-blocks.https.html @@ -1,43 +1,25 @@ - + Mixed-Content: Blockable content + + + expectation: blocked"> - - - - - - -

Blockable content

-

Test behavior of blockable content.

-
opt_in_method: meta-csp
-                                 origin: same-host-http
-                                 source_scheme: https
-                                 context_nesting: top-level
-                                 redirection: no-redirect
-                                 subresource: object-tag
-                                 expectation: blocked
- -

See specification - details for this test.

- -
+
diff --git a/testing/web-platform/tests/mixed-content/blockable/meta-csp/same-host-http/picture-tag/top-level/no-redirect/opt-in-blocks.https.html b/testing/web-platform/tests/mixed-content/blockable/meta-csp/same-host-http/picture-tag/top-level/no-redirect/opt-in-blocks.https.html index 3a086d69def1..b1cf804b339b 100644 --- a/testing/web-platform/tests/mixed-content/blockable/meta-csp/same-host-http/picture-tag/top-level/no-redirect/opt-in-blocks.https.html +++ b/testing/web-platform/tests/mixed-content/blockable/meta-csp/same-host-http/picture-tag/top-level/no-redirect/opt-in-blocks.https.html @@ -1,43 +1,25 @@ - + Mixed-Content: Blockable content + + + expectation: blocked"> - - - - - - -

Blockable content

-

Test behavior of blockable content.

-
opt_in_method: meta-csp
-                                 origin: same-host-http
-                                 source_scheme: https
-                                 context_nesting: top-level
-                                 redirection: no-redirect
-                                 subresource: picture-tag
-                                 expectation: blocked
- -

See specification - details for this test.

- -
+
diff --git a/testing/web-platform/tests/mixed-content/blockable/meta-csp/same-host-http/script-tag/top-level/no-redirect/opt-in-blocks.https.html b/testing/web-platform/tests/mixed-content/blockable/meta-csp/same-host-http/script-tag/top-level/no-redirect/opt-in-blocks.https.html index 45028df06e50..05201512b34a 100644 --- a/testing/web-platform/tests/mixed-content/blockable/meta-csp/same-host-http/script-tag/top-level/no-redirect/opt-in-blocks.https.html +++ b/testing/web-platform/tests/mixed-content/blockable/meta-csp/same-host-http/script-tag/top-level/no-redirect/opt-in-blocks.https.html @@ -1,43 +1,25 @@ - + Mixed-Content: Blockable content + + + expectation: blocked"> - - - - - - -

Blockable content

-

Test behavior of blockable content.

-
opt_in_method: meta-csp
-                                 origin: same-host-http
-                                 source_scheme: https
-                                 context_nesting: top-level
-                                 redirection: no-redirect
-                                 subresource: script-tag
-                                 expectation: blocked
- -

See specification - details for this test.

- -
+
diff --git a/testing/web-platform/tests/mixed-content/blockable/meta-csp/same-host-http/worker-request/top-level/no-redirect/opt-in-blocks.https.html b/testing/web-platform/tests/mixed-content/blockable/meta-csp/same-host-http/worker-request/top-level/no-redirect/opt-in-blocks.https.html index 48d69822c970..599a5280f195 100644 --- a/testing/web-platform/tests/mixed-content/blockable/meta-csp/same-host-http/worker-request/top-level/no-redirect/opt-in-blocks.https.html +++ b/testing/web-platform/tests/mixed-content/blockable/meta-csp/same-host-http/worker-request/top-level/no-redirect/opt-in-blocks.https.html @@ -1,43 +1,25 @@ - + Mixed-Content: Blockable content + + + expectation: blocked"> - - - - - - -

Blockable content

-

Test behavior of blockable content.

-
opt_in_method: meta-csp
-                                 origin: same-host-http
-                                 source_scheme: https
-                                 context_nesting: top-level
-                                 redirection: no-redirect
-                                 subresource: worker-request
-                                 expectation: blocked
- -

See specification - details for this test.

- -
+
diff --git a/testing/web-platform/tests/mixed-content/blockable/meta-csp/same-host-http/xhr-request/top-level/no-redirect/opt-in-blocks.https.html b/testing/web-platform/tests/mixed-content/blockable/meta-csp/same-host-http/xhr-request/top-level/no-redirect/opt-in-blocks.https.html index 08215b4aecc2..fd22ba37e550 100644 --- a/testing/web-platform/tests/mixed-content/blockable/meta-csp/same-host-http/xhr-request/top-level/no-redirect/opt-in-blocks.https.html +++ b/testing/web-platform/tests/mixed-content/blockable/meta-csp/same-host-http/xhr-request/top-level/no-redirect/opt-in-blocks.https.html @@ -1,43 +1,25 @@ - + Mixed-Content: Blockable content + + + expectation: blocked"> - - - - - - -

Blockable content

-

Test behavior of blockable content.

-
opt_in_method: meta-csp
-                                 origin: same-host-http
-                                 source_scheme: https
-                                 context_nesting: top-level
-                                 redirection: no-redirect
-                                 subresource: xhr-request
-                                 expectation: blocked
- -

See specification - details for this test.

- -
+
diff --git a/testing/web-platform/tests/mixed-content/blockable/no-opt-in/cross-origin-http/fetch-request/top-level/keep-scheme-redirect/no-opt-in-blocks.https.html b/testing/web-platform/tests/mixed-content/blockable/no-opt-in/cross-origin-http/fetch-request/top-level/keep-scheme-redirect/no-opt-in-blocks.https.html index 7719e757c7d7..f35fd03dae8e 100644 --- a/testing/web-platform/tests/mixed-content/blockable/no-opt-in/cross-origin-http/fetch-request/top-level/keep-scheme-redirect/no-opt-in-blocks.https.html +++ b/testing/web-platform/tests/mixed-content/blockable/no-opt-in/cross-origin-http/fetch-request/top-level/keep-scheme-redirect/no-opt-in-blocks.https.html @@ -1,10 +1,12 @@ - + Mixed-Content: Blockable content + + - - - - - - -

Blockable content

-

Test behavior of blockable content.

-
opt_in_method: no-opt-in
-                                 origin: cross-origin-http
-                                 source_scheme: https
-                                 context_nesting: top-level
-                                 redirection: keep-scheme-redirect
-                                 subresource: fetch-request
-                                 expectation: blocked
- -

See specification - details for this test.

- -
+
diff --git a/testing/web-platform/tests/mixed-content/blockable/no-opt-in/cross-origin-http/fetch-request/top-level/no-redirect/no-opt-in-blocks.https.html b/testing/web-platform/tests/mixed-content/blockable/no-opt-in/cross-origin-http/fetch-request/top-level/no-redirect/no-opt-in-blocks.https.html index 0c9cc94d746b..3b2d158d6317 100644 --- a/testing/web-platform/tests/mixed-content/blockable/no-opt-in/cross-origin-http/fetch-request/top-level/no-redirect/no-opt-in-blocks.https.html +++ b/testing/web-platform/tests/mixed-content/blockable/no-opt-in/cross-origin-http/fetch-request/top-level/no-redirect/no-opt-in-blocks.https.html @@ -1,10 +1,12 @@ - + Mixed-Content: Blockable content + + - - - - - - -

Blockable content

-

Test behavior of blockable content.

-
opt_in_method: no-opt-in
-                                 origin: cross-origin-http
-                                 source_scheme: https
-                                 context_nesting: top-level
-                                 redirection: no-redirect
-                                 subresource: fetch-request
-                                 expectation: blocked
- -

See specification - details for this test.

- -
+
diff --git a/testing/web-platform/tests/mixed-content/blockable/no-opt-in/cross-origin-http/fetch-request/top-level/swap-scheme-redirect/no-opt-in-blocks.https.html b/testing/web-platform/tests/mixed-content/blockable/no-opt-in/cross-origin-http/fetch-request/top-level/swap-scheme-redirect/no-opt-in-blocks.https.html index 5bef9697f3cd..24a1e8671d88 100644 --- a/testing/web-platform/tests/mixed-content/blockable/no-opt-in/cross-origin-http/fetch-request/top-level/swap-scheme-redirect/no-opt-in-blocks.https.html +++ b/testing/web-platform/tests/mixed-content/blockable/no-opt-in/cross-origin-http/fetch-request/top-level/swap-scheme-redirect/no-opt-in-blocks.https.html @@ -1,10 +1,12 @@ - + Mixed-Content: Blockable content + + - - - - - - -

Blockable content

-

Test behavior of blockable content.

-
opt_in_method: no-opt-in
-                                 origin: cross-origin-http
-                                 source_scheme: https
-                                 context_nesting: top-level
-                                 redirection: swap-scheme-redirect
-                                 subresource: fetch-request
-                                 expectation: blocked
- -

See specification - details for this test.

- -
+
diff --git a/testing/web-platform/tests/mixed-content/blockable/no-opt-in/cross-origin-http/form-tag/top-level/keep-scheme-redirect/no-opt-in-blocks.https.html b/testing/web-platform/tests/mixed-content/blockable/no-opt-in/cross-origin-http/form-tag/top-level/keep-scheme-redirect/no-opt-in-blocks.https.html index fa08dd71affb..aaeaf76737f3 100644 --- a/testing/web-platform/tests/mixed-content/blockable/no-opt-in/cross-origin-http/form-tag/top-level/keep-scheme-redirect/no-opt-in-blocks.https.html +++ b/testing/web-platform/tests/mixed-content/blockable/no-opt-in/cross-origin-http/form-tag/top-level/keep-scheme-redirect/no-opt-in-blocks.https.html @@ -1,10 +1,12 @@ - + Mixed-Content: Blockable content + + - - - - - - -

Blockable content

-

Test behavior of blockable content.

-
opt_in_method: no-opt-in
-                                 origin: cross-origin-http
-                                 source_scheme: https
-                                 context_nesting: top-level
-                                 redirection: keep-scheme-redirect
-                                 subresource: form-tag
-                                 expectation: blocked
- -

See specification - details for this test.

- -
+
diff --git a/testing/web-platform/tests/mixed-content/blockable/no-opt-in/cross-origin-http/form-tag/top-level/no-redirect/no-opt-in-blocks.https.html b/testing/web-platform/tests/mixed-content/blockable/no-opt-in/cross-origin-http/form-tag/top-level/no-redirect/no-opt-in-blocks.https.html index 073e4c1b2616..a649f4de4841 100644 --- a/testing/web-platform/tests/mixed-content/blockable/no-opt-in/cross-origin-http/form-tag/top-level/no-redirect/no-opt-in-blocks.https.html +++ b/testing/web-platform/tests/mixed-content/blockable/no-opt-in/cross-origin-http/form-tag/top-level/no-redirect/no-opt-in-blocks.https.html @@ -1,10 +1,12 @@ - + Mixed-Content: Blockable content + + - - - - - - -

Blockable content

-

Test behavior of blockable content.

-
opt_in_method: no-opt-in
-                                 origin: cross-origin-http
-                                 source_scheme: https
-                                 context_nesting: top-level
-                                 redirection: no-redirect
-                                 subresource: form-tag
-                                 expectation: blocked
- -

See specification - details for this test.

- -
+
diff --git a/testing/web-platform/tests/mixed-content/blockable/no-opt-in/cross-origin-http/form-tag/top-level/swap-scheme-redirect/no-opt-in-blocks.https.html b/testing/web-platform/tests/mixed-content/blockable/no-opt-in/cross-origin-http/form-tag/top-level/swap-scheme-redirect/no-opt-in-blocks.https.html index 971bbfccd73a..fa1d0fe9094c 100644 --- a/testing/web-platform/tests/mixed-content/blockable/no-opt-in/cross-origin-http/form-tag/top-level/swap-scheme-redirect/no-opt-in-blocks.https.html +++ b/testing/web-platform/tests/mixed-content/blockable/no-opt-in/cross-origin-http/form-tag/top-level/swap-scheme-redirect/no-opt-in-blocks.https.html @@ -1,10 +1,12 @@ - + Mixed-Content: Blockable content + + - - - - - - -

Blockable content

-

Test behavior of blockable content.

-
opt_in_method: no-opt-in
-                                 origin: cross-origin-http
-                                 source_scheme: https
-                                 context_nesting: top-level
-                                 redirection: swap-scheme-redirect
-                                 subresource: form-tag
-                                 expectation: blocked
- -

See specification - details for this test.

- -
+
diff --git a/testing/web-platform/tests/mixed-content/blockable/no-opt-in/cross-origin-http/iframe-tag/top-level/keep-scheme-redirect/no-opt-in-blocks.https.html b/testing/web-platform/tests/mixed-content/blockable/no-opt-in/cross-origin-http/iframe-tag/top-level/keep-scheme-redirect/no-opt-in-blocks.https.html index 1f01aade06f1..0dad760aad33 100644 --- a/testing/web-platform/tests/mixed-content/blockable/no-opt-in/cross-origin-http/iframe-tag/top-level/keep-scheme-redirect/no-opt-in-blocks.https.html +++ b/testing/web-platform/tests/mixed-content/blockable/no-opt-in/cross-origin-http/iframe-tag/top-level/keep-scheme-redirect/no-opt-in-blocks.https.html @@ -1,10 +1,12 @@ - + Mixed-Content: Blockable content + + - - - - - - -

Blockable content

-

Test behavior of blockable content.

-
opt_in_method: no-opt-in
-                                 origin: cross-origin-http
-                                 source_scheme: https
-                                 context_nesting: top-level
-                                 redirection: keep-scheme-redirect
-                                 subresource: iframe-tag
-                                 expectation: blocked
- -

See specification - details for this test.

- -
+
diff --git a/testing/web-platform/tests/mixed-content/blockable/no-opt-in/cross-origin-http/iframe-tag/top-level/no-redirect/no-opt-in-blocks.https.html b/testing/web-platform/tests/mixed-content/blockable/no-opt-in/cross-origin-http/iframe-tag/top-level/no-redirect/no-opt-in-blocks.https.html index 8eca3a1b2ebc..ed11ad73e8d9 100644 --- a/testing/web-platform/tests/mixed-content/blockable/no-opt-in/cross-origin-http/iframe-tag/top-level/no-redirect/no-opt-in-blocks.https.html +++ b/testing/web-platform/tests/mixed-content/blockable/no-opt-in/cross-origin-http/iframe-tag/top-level/no-redirect/no-opt-in-blocks.https.html @@ -1,10 +1,12 @@ - + Mixed-Content: Blockable content + + - - - - - - -

Blockable content

-

Test behavior of blockable content.

-
opt_in_method: no-opt-in
-                                 origin: cross-origin-http
-                                 source_scheme: https
-                                 context_nesting: top-level
-                                 redirection: no-redirect
-                                 subresource: iframe-tag
-                                 expectation: blocked
- -

See specification - details for this test.

- -
+
diff --git a/testing/web-platform/tests/mixed-content/blockable/no-opt-in/cross-origin-http/iframe-tag/top-level/swap-scheme-redirect/no-opt-in-blocks.https.html b/testing/web-platform/tests/mixed-content/blockable/no-opt-in/cross-origin-http/iframe-tag/top-level/swap-scheme-redirect/no-opt-in-blocks.https.html index fd5a0e866054..de84e1278b66 100644 --- a/testing/web-platform/tests/mixed-content/blockable/no-opt-in/cross-origin-http/iframe-tag/top-level/swap-scheme-redirect/no-opt-in-blocks.https.html +++ b/testing/web-platform/tests/mixed-content/blockable/no-opt-in/cross-origin-http/iframe-tag/top-level/swap-scheme-redirect/no-opt-in-blocks.https.html @@ -1,10 +1,12 @@ - + Mixed-Content: Blockable content + + - - - - - - -

Blockable content

-

Test behavior of blockable content.

-
opt_in_method: no-opt-in
-                                 origin: cross-origin-http
-                                 source_scheme: https
-                                 context_nesting: top-level
-                                 redirection: swap-scheme-redirect
-                                 subresource: iframe-tag
-                                 expectation: blocked
- -

See specification - details for this test.

- -
+
diff --git a/testing/web-platform/tests/mixed-content/blockable/no-opt-in/cross-origin-http/link-css-tag/top-level/keep-scheme-redirect/no-opt-in-blocks.https.html b/testing/web-platform/tests/mixed-content/blockable/no-opt-in/cross-origin-http/link-css-tag/top-level/keep-scheme-redirect/no-opt-in-blocks.https.html index cc5e4864e4b6..13c536f3eb58 100644 --- a/testing/web-platform/tests/mixed-content/blockable/no-opt-in/cross-origin-http/link-css-tag/top-level/keep-scheme-redirect/no-opt-in-blocks.https.html +++ b/testing/web-platform/tests/mixed-content/blockable/no-opt-in/cross-origin-http/link-css-tag/top-level/keep-scheme-redirect/no-opt-in-blocks.https.html @@ -1,10 +1,12 @@ - + Mixed-Content: Blockable content + + - - - - - - -

Blockable content

-

Test behavior of blockable content.

-
opt_in_method: no-opt-in
-                                 origin: cross-origin-http
-                                 source_scheme: https
-                                 context_nesting: top-level
-                                 redirection: keep-scheme-redirect
-                                 subresource: link-css-tag
-                                 expectation: blocked
- -

See specification - details for this test.

- -
+
diff --git a/testing/web-platform/tests/mixed-content/blockable/no-opt-in/cross-origin-http/link-css-tag/top-level/no-redirect/no-opt-in-blocks.https.html b/testing/web-platform/tests/mixed-content/blockable/no-opt-in/cross-origin-http/link-css-tag/top-level/no-redirect/no-opt-in-blocks.https.html index 7091e3516625..e941030043ee 100644 --- a/testing/web-platform/tests/mixed-content/blockable/no-opt-in/cross-origin-http/link-css-tag/top-level/no-redirect/no-opt-in-blocks.https.html +++ b/testing/web-platform/tests/mixed-content/blockable/no-opt-in/cross-origin-http/link-css-tag/top-level/no-redirect/no-opt-in-blocks.https.html @@ -1,10 +1,12 @@ - + Mixed-Content: Blockable content + + - - - - - - -

Blockable content

-

Test behavior of blockable content.

-
opt_in_method: no-opt-in
-                                 origin: cross-origin-http
-                                 source_scheme: https
-                                 context_nesting: top-level
-                                 redirection: no-redirect
-                                 subresource: link-css-tag
-                                 expectation: blocked
- -

See specification - details for this test.

- -
+
diff --git a/testing/web-platform/tests/mixed-content/blockable/no-opt-in/cross-origin-http/link-css-tag/top-level/swap-scheme-redirect/no-opt-in-blocks.https.html b/testing/web-platform/tests/mixed-content/blockable/no-opt-in/cross-origin-http/link-css-tag/top-level/swap-scheme-redirect/no-opt-in-blocks.https.html index 98d50834796e..c9efe54e44a7 100644 --- a/testing/web-platform/tests/mixed-content/blockable/no-opt-in/cross-origin-http/link-css-tag/top-level/swap-scheme-redirect/no-opt-in-blocks.https.html +++ b/testing/web-platform/tests/mixed-content/blockable/no-opt-in/cross-origin-http/link-css-tag/top-level/swap-scheme-redirect/no-opt-in-blocks.https.html @@ -1,10 +1,12 @@ - + Mixed-Content: Blockable content + + - - - - - - -

Blockable content

-

Test behavior of blockable content.

-
opt_in_method: no-opt-in
-                                 origin: cross-origin-http
-                                 source_scheme: https
-                                 context_nesting: top-level
-                                 redirection: swap-scheme-redirect
-                                 subresource: link-css-tag
-                                 expectation: blocked
- -

See specification - details for this test.

- -
+
diff --git a/testing/web-platform/tests/mixed-content/blockable/no-opt-in/cross-origin-http/object-tag/top-level/keep-scheme-redirect/no-opt-in-blocks.https.html b/testing/web-platform/tests/mixed-content/blockable/no-opt-in/cross-origin-http/object-tag/top-level/keep-scheme-redirect/no-opt-in-blocks.https.html index 0335c8ecc47c..23e6badf7ea7 100644 --- a/testing/web-platform/tests/mixed-content/blockable/no-opt-in/cross-origin-http/object-tag/top-level/keep-scheme-redirect/no-opt-in-blocks.https.html +++ b/testing/web-platform/tests/mixed-content/blockable/no-opt-in/cross-origin-http/object-tag/top-level/keep-scheme-redirect/no-opt-in-blocks.https.html @@ -1,10 +1,12 @@ - + Mixed-Content: Blockable content + + - - - - - - -

Blockable content

-

Test behavior of blockable content.

-
opt_in_method: no-opt-in
-                                 origin: cross-origin-http
-                                 source_scheme: https
-                                 context_nesting: top-level
-                                 redirection: keep-scheme-redirect
-                                 subresource: object-tag
-                                 expectation: blocked
- -

See specification - details for this test.

- -
+
diff --git a/testing/web-platform/tests/mixed-content/blockable/no-opt-in/cross-origin-http/object-tag/top-level/no-redirect/no-opt-in-blocks.https.html b/testing/web-platform/tests/mixed-content/blockable/no-opt-in/cross-origin-http/object-tag/top-level/no-redirect/no-opt-in-blocks.https.html index f50f0aa5db2a..482024535f9a 100644 --- a/testing/web-platform/tests/mixed-content/blockable/no-opt-in/cross-origin-http/object-tag/top-level/no-redirect/no-opt-in-blocks.https.html +++ b/testing/web-platform/tests/mixed-content/blockable/no-opt-in/cross-origin-http/object-tag/top-level/no-redirect/no-opt-in-blocks.https.html @@ -1,10 +1,12 @@ - + Mixed-Content: Blockable content + + - - - - - - -

Blockable content

-

Test behavior of blockable content.

-
opt_in_method: no-opt-in
-                                 origin: cross-origin-http
-                                 source_scheme: https
-                                 context_nesting: top-level
-                                 redirection: no-redirect
-                                 subresource: object-tag
-                                 expectation: blocked
- -

See specification - details for this test.

- -
+
diff --git a/testing/web-platform/tests/mixed-content/blockable/no-opt-in/cross-origin-http/object-tag/top-level/swap-scheme-redirect/no-opt-in-blocks.https.html b/testing/web-platform/tests/mixed-content/blockable/no-opt-in/cross-origin-http/object-tag/top-level/swap-scheme-redirect/no-opt-in-blocks.https.html index d61c4c8ad657..f91df5037e7f 100644 --- a/testing/web-platform/tests/mixed-content/blockable/no-opt-in/cross-origin-http/object-tag/top-level/swap-scheme-redirect/no-opt-in-blocks.https.html +++ b/testing/web-platform/tests/mixed-content/blockable/no-opt-in/cross-origin-http/object-tag/top-level/swap-scheme-redirect/no-opt-in-blocks.https.html @@ -1,10 +1,12 @@ - + Mixed-Content: Blockable content + + - - - - - - -

Blockable content

-

Test behavior of blockable content.

-
opt_in_method: no-opt-in
-                                 origin: cross-origin-http
-                                 source_scheme: https
-                                 context_nesting: top-level
-                                 redirection: swap-scheme-redirect
-                                 subresource: object-tag
-                                 expectation: blocked
- -

See specification - details for this test.

- -
+
diff --git a/testing/web-platform/tests/mixed-content/blockable/no-opt-in/cross-origin-http/picture-tag/top-level/keep-scheme-redirect/no-opt-in-blocks.https.html b/testing/web-platform/tests/mixed-content/blockable/no-opt-in/cross-origin-http/picture-tag/top-level/keep-scheme-redirect/no-opt-in-blocks.https.html index 15dba41092a1..09fadc8d3fb9 100644 --- a/testing/web-platform/tests/mixed-content/blockable/no-opt-in/cross-origin-http/picture-tag/top-level/keep-scheme-redirect/no-opt-in-blocks.https.html +++ b/testing/web-platform/tests/mixed-content/blockable/no-opt-in/cross-origin-http/picture-tag/top-level/keep-scheme-redirect/no-opt-in-blocks.https.html @@ -1,10 +1,12 @@ - + Mixed-Content: Blockable content + + - - - - - - -

Blockable content

-

Test behavior of blockable content.

-
opt_in_method: no-opt-in
-                                 origin: cross-origin-http
-                                 source_scheme: https
-                                 context_nesting: top-level
-                                 redirection: keep-scheme-redirect
-                                 subresource: picture-tag
-                                 expectation: blocked
- -

See specification - details for this test.

- -
+
diff --git a/testing/web-platform/tests/mixed-content/blockable/no-opt-in/cross-origin-http/picture-tag/top-level/no-redirect/no-opt-in-blocks.https.html b/testing/web-platform/tests/mixed-content/blockable/no-opt-in/cross-origin-http/picture-tag/top-level/no-redirect/no-opt-in-blocks.https.html index 0846e19e7852..63505012881f 100644 --- a/testing/web-platform/tests/mixed-content/blockable/no-opt-in/cross-origin-http/picture-tag/top-level/no-redirect/no-opt-in-blocks.https.html +++ b/testing/web-platform/tests/mixed-content/blockable/no-opt-in/cross-origin-http/picture-tag/top-level/no-redirect/no-opt-in-blocks.https.html @@ -1,10 +1,12 @@ - + Mixed-Content: Blockable content + + - - - - - - -

Blockable content

-

Test behavior of blockable content.

-
opt_in_method: no-opt-in
-                                 origin: cross-origin-http
-                                 source_scheme: https
-                                 context_nesting: top-level
-                                 redirection: no-redirect
-                                 subresource: picture-tag
-                                 expectation: blocked
- -

See specification - details for this test.

- -
+
diff --git a/testing/web-platform/tests/mixed-content/blockable/no-opt-in/cross-origin-http/picture-tag/top-level/swap-scheme-redirect/no-opt-in-blocks.https.html b/testing/web-platform/tests/mixed-content/blockable/no-opt-in/cross-origin-http/picture-tag/top-level/swap-scheme-redirect/no-opt-in-blocks.https.html index 8d3684a05c5a..c3bedd387d71 100644 --- a/testing/web-platform/tests/mixed-content/blockable/no-opt-in/cross-origin-http/picture-tag/top-level/swap-scheme-redirect/no-opt-in-blocks.https.html +++ b/testing/web-platform/tests/mixed-content/blockable/no-opt-in/cross-origin-http/picture-tag/top-level/swap-scheme-redirect/no-opt-in-blocks.https.html @@ -1,10 +1,12 @@ - + Mixed-Content: Blockable content + + - - - - - - -

Blockable content

-

Test behavior of blockable content.

-
opt_in_method: no-opt-in
-                                 origin: cross-origin-http
-                                 source_scheme: https
-                                 context_nesting: top-level
-                                 redirection: swap-scheme-redirect
-                                 subresource: picture-tag
-                                 expectation: blocked
- -

See specification - details for this test.

- -
+
diff --git a/testing/web-platform/tests/mixed-content/blockable/no-opt-in/cross-origin-http/script-tag/top-level/keep-scheme-redirect/no-opt-in-blocks.https.html b/testing/web-platform/tests/mixed-content/blockable/no-opt-in/cross-origin-http/script-tag/top-level/keep-scheme-redirect/no-opt-in-blocks.https.html index 8327609cb0bd..4c375acd1577 100644 --- a/testing/web-platform/tests/mixed-content/blockable/no-opt-in/cross-origin-http/script-tag/top-level/keep-scheme-redirect/no-opt-in-blocks.https.html +++ b/testing/web-platform/tests/mixed-content/blockable/no-opt-in/cross-origin-http/script-tag/top-level/keep-scheme-redirect/no-opt-in-blocks.https.html @@ -1,10 +1,12 @@ - + Mixed-Content: Blockable content + + - - - - - - -

Blockable content

-

Test behavior of blockable content.

-
opt_in_method: no-opt-in
-                                 origin: cross-origin-http
-                                 source_scheme: https
-                                 context_nesting: top-level
-                                 redirection: keep-scheme-redirect
-                                 subresource: script-tag
-                                 expectation: blocked
- -

See specification - details for this test.

- -
+
diff --git a/testing/web-platform/tests/mixed-content/blockable/no-opt-in/cross-origin-http/script-tag/top-level/no-redirect/no-opt-in-blocks.https.html b/testing/web-platform/tests/mixed-content/blockable/no-opt-in/cross-origin-http/script-tag/top-level/no-redirect/no-opt-in-blocks.https.html index 0d043a690024..21d152557194 100644 --- a/testing/web-platform/tests/mixed-content/blockable/no-opt-in/cross-origin-http/script-tag/top-level/no-redirect/no-opt-in-blocks.https.html +++ b/testing/web-platform/tests/mixed-content/blockable/no-opt-in/cross-origin-http/script-tag/top-level/no-redirect/no-opt-in-blocks.https.html @@ -1,10 +1,12 @@ - + Mixed-Content: Blockable content + + - - - - - - -

Blockable content

-

Test behavior of blockable content.

-
opt_in_method: no-opt-in
-                                 origin: cross-origin-http
-                                 source_scheme: https
-                                 context_nesting: top-level
-                                 redirection: no-redirect
-                                 subresource: script-tag
-                                 expectation: blocked
- -

See specification - details for this test.

- -
+
diff --git a/testing/web-platform/tests/mixed-content/blockable/no-opt-in/cross-origin-http/script-tag/top-level/swap-scheme-redirect/no-opt-in-blocks.https.html b/testing/web-platform/tests/mixed-content/blockable/no-opt-in/cross-origin-http/script-tag/top-level/swap-scheme-redirect/no-opt-in-blocks.https.html index 9d56544f27d6..cd56451c5e4e 100644 --- a/testing/web-platform/tests/mixed-content/blockable/no-opt-in/cross-origin-http/script-tag/top-level/swap-scheme-redirect/no-opt-in-blocks.https.html +++ b/testing/web-platform/tests/mixed-content/blockable/no-opt-in/cross-origin-http/script-tag/top-level/swap-scheme-redirect/no-opt-in-blocks.https.html @@ -1,10 +1,12 @@ - + Mixed-Content: Blockable content + + - - - - - - -

Blockable content

-

Test behavior of blockable content.

-
opt_in_method: no-opt-in
-                                 origin: cross-origin-http
-                                 source_scheme: https
-                                 context_nesting: top-level
-                                 redirection: swap-scheme-redirect
-                                 subresource: script-tag
-                                 expectation: blocked
- -

See specification - details for this test.

- -
+
diff --git a/testing/web-platform/tests/mixed-content/blockable/no-opt-in/cross-origin-http/worker-request/top-level/keep-scheme-redirect/no-opt-in-blocks.https.html b/testing/web-platform/tests/mixed-content/blockable/no-opt-in/cross-origin-http/worker-request/top-level/keep-scheme-redirect/no-opt-in-blocks.https.html index b536c01465ec..4feea4b7dc0a 100644 --- a/testing/web-platform/tests/mixed-content/blockable/no-opt-in/cross-origin-http/worker-request/top-level/keep-scheme-redirect/no-opt-in-blocks.https.html +++ b/testing/web-platform/tests/mixed-content/blockable/no-opt-in/cross-origin-http/worker-request/top-level/keep-scheme-redirect/no-opt-in-blocks.https.html @@ -1,10 +1,12 @@ - + Mixed-Content: Blockable content + + - - - - - - -

Blockable content

-

Test behavior of blockable content.

-
opt_in_method: no-opt-in
-                                 origin: cross-origin-http
-                                 source_scheme: https
-                                 context_nesting: top-level
-                                 redirection: keep-scheme-redirect
-                                 subresource: worker-request
-                                 expectation: blocked
- -

See specification - details for this test.

- -
+
diff --git a/testing/web-platform/tests/mixed-content/blockable/no-opt-in/cross-origin-http/worker-request/top-level/no-redirect/no-opt-in-blocks.https.html b/testing/web-platform/tests/mixed-content/blockable/no-opt-in/cross-origin-http/worker-request/top-level/no-redirect/no-opt-in-blocks.https.html index da677d1a301d..2d4f15b13e20 100644 --- a/testing/web-platform/tests/mixed-content/blockable/no-opt-in/cross-origin-http/worker-request/top-level/no-redirect/no-opt-in-blocks.https.html +++ b/testing/web-platform/tests/mixed-content/blockable/no-opt-in/cross-origin-http/worker-request/top-level/no-redirect/no-opt-in-blocks.https.html @@ -1,10 +1,12 @@ - + Mixed-Content: Blockable content + + - - - - - - -

Blockable content

-

Test behavior of blockable content.

-
opt_in_method: no-opt-in
-                                 origin: cross-origin-http
-                                 source_scheme: https
-                                 context_nesting: top-level
-                                 redirection: no-redirect
-                                 subresource: worker-request
-                                 expectation: blocked
- -

See specification - details for this test.

- -
+
diff --git a/testing/web-platform/tests/mixed-content/blockable/no-opt-in/cross-origin-http/worker-request/top-level/swap-scheme-redirect/no-opt-in-blocks.https.html b/testing/web-platform/tests/mixed-content/blockable/no-opt-in/cross-origin-http/worker-request/top-level/swap-scheme-redirect/no-opt-in-blocks.https.html index da62f80f75ca..a6782c7e5b88 100644 --- a/testing/web-platform/tests/mixed-content/blockable/no-opt-in/cross-origin-http/worker-request/top-level/swap-scheme-redirect/no-opt-in-blocks.https.html +++ b/testing/web-platform/tests/mixed-content/blockable/no-opt-in/cross-origin-http/worker-request/top-level/swap-scheme-redirect/no-opt-in-blocks.https.html @@ -1,10 +1,12 @@ - + Mixed-Content: Blockable content + + - - - - - - -

Blockable content

-

Test behavior of blockable content.

-
opt_in_method: no-opt-in
-                                 origin: cross-origin-http
-                                 source_scheme: https
-                                 context_nesting: top-level
-                                 redirection: swap-scheme-redirect
-                                 subresource: worker-request
-                                 expectation: blocked
- -

See specification - details for this test.

- -
+
diff --git a/testing/web-platform/tests/mixed-content/blockable/no-opt-in/cross-origin-http/xhr-request/top-level/keep-scheme-redirect/no-opt-in-blocks.https.html b/testing/web-platform/tests/mixed-content/blockable/no-opt-in/cross-origin-http/xhr-request/top-level/keep-scheme-redirect/no-opt-in-blocks.https.html index 64b05b0fceeb..b2ee591a74aa 100644 --- a/testing/web-platform/tests/mixed-content/blockable/no-opt-in/cross-origin-http/xhr-request/top-level/keep-scheme-redirect/no-opt-in-blocks.https.html +++ b/testing/web-platform/tests/mixed-content/blockable/no-opt-in/cross-origin-http/xhr-request/top-level/keep-scheme-redirect/no-opt-in-blocks.https.html @@ -1,10 +1,12 @@ - + Mixed-Content: Blockable content + + - - - - - - -

Blockable content

-

Test behavior of blockable content.

-
opt_in_method: no-opt-in
-                                 origin: cross-origin-http
-                                 source_scheme: https
-                                 context_nesting: top-level
-                                 redirection: keep-scheme-redirect
-                                 subresource: xhr-request
-                                 expectation: blocked
- -

See specification - details for this test.

- -
+
diff --git a/testing/web-platform/tests/mixed-content/blockable/no-opt-in/cross-origin-http/xhr-request/top-level/no-redirect/no-opt-in-blocks.https.html b/testing/web-platform/tests/mixed-content/blockable/no-opt-in/cross-origin-http/xhr-request/top-level/no-redirect/no-opt-in-blocks.https.html index fe1c25317918..e49db79f3d38 100644 --- a/testing/web-platform/tests/mixed-content/blockable/no-opt-in/cross-origin-http/xhr-request/top-level/no-redirect/no-opt-in-blocks.https.html +++ b/testing/web-platform/tests/mixed-content/blockable/no-opt-in/cross-origin-http/xhr-request/top-level/no-redirect/no-opt-in-blocks.https.html @@ -1,10 +1,12 @@ - + Mixed-Content: Blockable content + + - - - - - - -

Blockable content

-

Test behavior of blockable content.

-
opt_in_method: no-opt-in
-                                 origin: cross-origin-http
-                                 source_scheme: https
-                                 context_nesting: top-level
-                                 redirection: no-redirect
-                                 subresource: xhr-request
-                                 expectation: blocked
- -

See specification - details for this test.

- -
+
diff --git a/testing/web-platform/tests/mixed-content/blockable/no-opt-in/cross-origin-http/xhr-request/top-level/swap-scheme-redirect/no-opt-in-blocks.https.html b/testing/web-platform/tests/mixed-content/blockable/no-opt-in/cross-origin-http/xhr-request/top-level/swap-scheme-redirect/no-opt-in-blocks.https.html index d719df447bd4..ffd8aeb9c0b9 100644 --- a/testing/web-platform/tests/mixed-content/blockable/no-opt-in/cross-origin-http/xhr-request/top-level/swap-scheme-redirect/no-opt-in-blocks.https.html +++ b/testing/web-platform/tests/mixed-content/blockable/no-opt-in/cross-origin-http/xhr-request/top-level/swap-scheme-redirect/no-opt-in-blocks.https.html @@ -1,10 +1,12 @@ - + Mixed-Content: Blockable content + + - - - - - - -

Blockable content

-

Test behavior of blockable content.

-
opt_in_method: no-opt-in
-                                 origin: cross-origin-http
-                                 source_scheme: https
-                                 context_nesting: top-level
-                                 redirection: swap-scheme-redirect
-                                 subresource: xhr-request
-                                 expectation: blocked
- -

See specification - details for this test.

- -
+
diff --git a/testing/web-platform/tests/mixed-content/blockable/no-opt-in/same-host-http/fetch-request/top-level/keep-scheme-redirect/no-opt-in-blocks.https.html b/testing/web-platform/tests/mixed-content/blockable/no-opt-in/same-host-http/fetch-request/top-level/keep-scheme-redirect/no-opt-in-blocks.https.html index f09de3a87c2f..d7aa3899bfaa 100644 --- a/testing/web-platform/tests/mixed-content/blockable/no-opt-in/same-host-http/fetch-request/top-level/keep-scheme-redirect/no-opt-in-blocks.https.html +++ b/testing/web-platform/tests/mixed-content/blockable/no-opt-in/same-host-http/fetch-request/top-level/keep-scheme-redirect/no-opt-in-blocks.https.html @@ -1,10 +1,12 @@ - + Mixed-Content: Blockable content + + - - - - - - -

Blockable content

-

Test behavior of blockable content.

-
opt_in_method: no-opt-in
-                                 origin: same-host-http
-                                 source_scheme: https
-                                 context_nesting: top-level
-                                 redirection: keep-scheme-redirect
-                                 subresource: fetch-request
-                                 expectation: blocked
- -

See specification - details for this test.

- -
+
diff --git a/testing/web-platform/tests/mixed-content/blockable/no-opt-in/same-host-http/fetch-request/top-level/no-redirect/no-opt-in-blocks.https.html b/testing/web-platform/tests/mixed-content/blockable/no-opt-in/same-host-http/fetch-request/top-level/no-redirect/no-opt-in-blocks.https.html index c97f703f5c4e..55c768525d1b 100644 --- a/testing/web-platform/tests/mixed-content/blockable/no-opt-in/same-host-http/fetch-request/top-level/no-redirect/no-opt-in-blocks.https.html +++ b/testing/web-platform/tests/mixed-content/blockable/no-opt-in/same-host-http/fetch-request/top-level/no-redirect/no-opt-in-blocks.https.html @@ -1,10 +1,12 @@ - + Mixed-Content: Blockable content + + - - - - - - -

Blockable content

-

Test behavior of blockable content.

-
opt_in_method: no-opt-in
-                                 origin: same-host-http
-                                 source_scheme: https
-                                 context_nesting: top-level
-                                 redirection: no-redirect
-                                 subresource: fetch-request
-                                 expectation: blocked
- -

See specification - details for this test.

- -
+
diff --git a/testing/web-platform/tests/mixed-content/blockable/no-opt-in/same-host-http/fetch-request/top-level/swap-scheme-redirect/no-opt-in-blocks.https.html b/testing/web-platform/tests/mixed-content/blockable/no-opt-in/same-host-http/fetch-request/top-level/swap-scheme-redirect/no-opt-in-blocks.https.html index a83aa3536959..13de80df73c3 100644 --- a/testing/web-platform/tests/mixed-content/blockable/no-opt-in/same-host-http/fetch-request/top-level/swap-scheme-redirect/no-opt-in-blocks.https.html +++ b/testing/web-platform/tests/mixed-content/blockable/no-opt-in/same-host-http/fetch-request/top-level/swap-scheme-redirect/no-opt-in-blocks.https.html @@ -1,10 +1,12 @@ - + Mixed-Content: Blockable content + + - - - - - - -

Blockable content

-

Test behavior of blockable content.

-
opt_in_method: no-opt-in
-                                 origin: same-host-http
-                                 source_scheme: https
-                                 context_nesting: top-level
-                                 redirection: swap-scheme-redirect
-                                 subresource: fetch-request
-                                 expectation: blocked
- -

See specification - details for this test.

- -
+
diff --git a/testing/web-platform/tests/mixed-content/blockable/no-opt-in/same-host-http/form-tag/top-level/keep-scheme-redirect/no-opt-in-blocks.https.html b/testing/web-platform/tests/mixed-content/blockable/no-opt-in/same-host-http/form-tag/top-level/keep-scheme-redirect/no-opt-in-blocks.https.html index 6c5e403c4884..45a2764ade60 100644 --- a/testing/web-platform/tests/mixed-content/blockable/no-opt-in/same-host-http/form-tag/top-level/keep-scheme-redirect/no-opt-in-blocks.https.html +++ b/testing/web-platform/tests/mixed-content/blockable/no-opt-in/same-host-http/form-tag/top-level/keep-scheme-redirect/no-opt-in-blocks.https.html @@ -1,10 +1,12 @@ - + Mixed-Content: Blockable content + + - - - - - - -

Blockable content

-

Test behavior of blockable content.

-
opt_in_method: no-opt-in
-                                 origin: same-host-http
-                                 source_scheme: https
-                                 context_nesting: top-level
-                                 redirection: keep-scheme-redirect
-                                 subresource: form-tag
-                                 expectation: blocked
- -

See specification - details for this test.

- -
+
diff --git a/testing/web-platform/tests/mixed-content/blockable/no-opt-in/same-host-http/form-tag/top-level/no-redirect/no-opt-in-blocks.https.html b/testing/web-platform/tests/mixed-content/blockable/no-opt-in/same-host-http/form-tag/top-level/no-redirect/no-opt-in-blocks.https.html index 20651d5552f1..09e948a84b58 100644 --- a/testing/web-platform/tests/mixed-content/blockable/no-opt-in/same-host-http/form-tag/top-level/no-redirect/no-opt-in-blocks.https.html +++ b/testing/web-platform/tests/mixed-content/blockable/no-opt-in/same-host-http/form-tag/top-level/no-redirect/no-opt-in-blocks.https.html @@ -1,10 +1,12 @@ - + Mixed-Content: Blockable content + + - - - - - - -

Blockable content

-

Test behavior of blockable content.

-
opt_in_method: no-opt-in
-                                 origin: same-host-http
-                                 source_scheme: https
-                                 context_nesting: top-level
-                                 redirection: no-redirect
-                                 subresource: form-tag
-                                 expectation: blocked
- -

See specification - details for this test.

- -
+
diff --git a/testing/web-platform/tests/mixed-content/blockable/no-opt-in/same-host-http/form-tag/top-level/swap-scheme-redirect/no-opt-in-blocks.https.html b/testing/web-platform/tests/mixed-content/blockable/no-opt-in/same-host-http/form-tag/top-level/swap-scheme-redirect/no-opt-in-blocks.https.html index 4a7fc77ae4c0..f72d269d11ea 100644 --- a/testing/web-platform/tests/mixed-content/blockable/no-opt-in/same-host-http/form-tag/top-level/swap-scheme-redirect/no-opt-in-blocks.https.html +++ b/testing/web-platform/tests/mixed-content/blockable/no-opt-in/same-host-http/form-tag/top-level/swap-scheme-redirect/no-opt-in-blocks.https.html @@ -1,10 +1,12 @@ - + Mixed-Content: Blockable content + + - - - - - - -

Blockable content

-

Test behavior of blockable content.

-
opt_in_method: no-opt-in
-                                 origin: same-host-http
-                                 source_scheme: https
-                                 context_nesting: top-level
-                                 redirection: swap-scheme-redirect
-                                 subresource: form-tag
-                                 expectation: blocked
- -

See specification - details for this test.

- -
+
diff --git a/testing/web-platform/tests/mixed-content/blockable/no-opt-in/same-host-http/iframe-tag/top-level/keep-scheme-redirect/no-opt-in-blocks.https.html b/testing/web-platform/tests/mixed-content/blockable/no-opt-in/same-host-http/iframe-tag/top-level/keep-scheme-redirect/no-opt-in-blocks.https.html index 352f5af16ce3..a69f2bb412e6 100644 --- a/testing/web-platform/tests/mixed-content/blockable/no-opt-in/same-host-http/iframe-tag/top-level/keep-scheme-redirect/no-opt-in-blocks.https.html +++ b/testing/web-platform/tests/mixed-content/blockable/no-opt-in/same-host-http/iframe-tag/top-level/keep-scheme-redirect/no-opt-in-blocks.https.html @@ -1,10 +1,12 @@ - + Mixed-Content: Blockable content + + - - - - - - -

Blockable content

-

Test behavior of blockable content.

-
opt_in_method: no-opt-in
-                                 origin: same-host-http
-                                 source_scheme: https
-                                 context_nesting: top-level
-                                 redirection: keep-scheme-redirect
-                                 subresource: iframe-tag
-                                 expectation: blocked
- -

See specification - details for this test.

- -
+
diff --git a/testing/web-platform/tests/mixed-content/blockable/no-opt-in/same-host-http/iframe-tag/top-level/no-redirect/no-opt-in-blocks.https.html b/testing/web-platform/tests/mixed-content/blockable/no-opt-in/same-host-http/iframe-tag/top-level/no-redirect/no-opt-in-blocks.https.html index 37c55c40dfc5..f98fe6c4cdfd 100644 --- a/testing/web-platform/tests/mixed-content/blockable/no-opt-in/same-host-http/iframe-tag/top-level/no-redirect/no-opt-in-blocks.https.html +++ b/testing/web-platform/tests/mixed-content/blockable/no-opt-in/same-host-http/iframe-tag/top-level/no-redirect/no-opt-in-blocks.https.html @@ -1,10 +1,12 @@ - + Mixed-Content: Blockable content + + - - - - - - -

Blockable content

-

Test behavior of blockable content.

-
opt_in_method: no-opt-in
-                                 origin: same-host-http
-                                 source_scheme: https
-                                 context_nesting: top-level
-                                 redirection: no-redirect
-                                 subresource: iframe-tag
-                                 expectation: blocked
- -

See specification - details for this test.

- -
+
diff --git a/testing/web-platform/tests/mixed-content/blockable/no-opt-in/same-host-http/iframe-tag/top-level/swap-scheme-redirect/no-opt-in-blocks.https.html b/testing/web-platform/tests/mixed-content/blockable/no-opt-in/same-host-http/iframe-tag/top-level/swap-scheme-redirect/no-opt-in-blocks.https.html index 75f0e6f543d6..b891c73e8172 100644 --- a/testing/web-platform/tests/mixed-content/blockable/no-opt-in/same-host-http/iframe-tag/top-level/swap-scheme-redirect/no-opt-in-blocks.https.html +++ b/testing/web-platform/tests/mixed-content/blockable/no-opt-in/same-host-http/iframe-tag/top-level/swap-scheme-redirect/no-opt-in-blocks.https.html @@ -1,10 +1,12 @@ - + Mixed-Content: Blockable content + + - - - - - - -

Blockable content

-

Test behavior of blockable content.

-
opt_in_method: no-opt-in
-                                 origin: same-host-http
-                                 source_scheme: https
-                                 context_nesting: top-level
-                                 redirection: swap-scheme-redirect
-                                 subresource: iframe-tag
-                                 expectation: blocked
- -

See specification - details for this test.

- -
+
diff --git a/testing/web-platform/tests/mixed-content/blockable/no-opt-in/same-host-http/link-css-tag/top-level/keep-scheme-redirect/no-opt-in-blocks.https.html b/testing/web-platform/tests/mixed-content/blockable/no-opt-in/same-host-http/link-css-tag/top-level/keep-scheme-redirect/no-opt-in-blocks.https.html index a9b3c3001bcc..11d8f4877a76 100644 --- a/testing/web-platform/tests/mixed-content/blockable/no-opt-in/same-host-http/link-css-tag/top-level/keep-scheme-redirect/no-opt-in-blocks.https.html +++ b/testing/web-platform/tests/mixed-content/blockable/no-opt-in/same-host-http/link-css-tag/top-level/keep-scheme-redirect/no-opt-in-blocks.https.html @@ -1,10 +1,12 @@ - + Mixed-Content: Blockable content + + - - - - - - -

Blockable content

-

Test behavior of blockable content.

-
opt_in_method: no-opt-in
-                                 origin: same-host-http
-                                 source_scheme: https
-                                 context_nesting: top-level
-                                 redirection: keep-scheme-redirect
-                                 subresource: link-css-tag
-                                 expectation: blocked
- -

See specification - details for this test.

- -
+
diff --git a/testing/web-platform/tests/mixed-content/blockable/no-opt-in/same-host-http/link-css-tag/top-level/no-redirect/no-opt-in-blocks.https.html b/testing/web-platform/tests/mixed-content/blockable/no-opt-in/same-host-http/link-css-tag/top-level/no-redirect/no-opt-in-blocks.https.html index 094ea4f0dd4a..ce383d9aacb9 100644 --- a/testing/web-platform/tests/mixed-content/blockable/no-opt-in/same-host-http/link-css-tag/top-level/no-redirect/no-opt-in-blocks.https.html +++ b/testing/web-platform/tests/mixed-content/blockable/no-opt-in/same-host-http/link-css-tag/top-level/no-redirect/no-opt-in-blocks.https.html @@ -1,10 +1,12 @@ - + Mixed-Content: Blockable content + + - - - - - - -

Blockable content

-

Test behavior of blockable content.

-
opt_in_method: no-opt-in
-                                 origin: same-host-http
-                                 source_scheme: https
-                                 context_nesting: top-level
-                                 redirection: no-redirect
-                                 subresource: link-css-tag
-                                 expectation: blocked
- -

See specification - details for this test.

- -
+
diff --git a/testing/web-platform/tests/mixed-content/blockable/no-opt-in/same-host-http/link-css-tag/top-level/swap-scheme-redirect/no-opt-in-blocks.https.html b/testing/web-platform/tests/mixed-content/blockable/no-opt-in/same-host-http/link-css-tag/top-level/swap-scheme-redirect/no-opt-in-blocks.https.html index efad36e8b4cc..67b58e0096ca 100644 --- a/testing/web-platform/tests/mixed-content/blockable/no-opt-in/same-host-http/link-css-tag/top-level/swap-scheme-redirect/no-opt-in-blocks.https.html +++ b/testing/web-platform/tests/mixed-content/blockable/no-opt-in/same-host-http/link-css-tag/top-level/swap-scheme-redirect/no-opt-in-blocks.https.html @@ -1,10 +1,12 @@ - + Mixed-Content: Blockable content + + - - - - - - -

Blockable content

-

Test behavior of blockable content.

-
opt_in_method: no-opt-in
-                                 origin: same-host-http
-                                 source_scheme: https
-                                 context_nesting: top-level
-                                 redirection: swap-scheme-redirect
-                                 subresource: link-css-tag
-                                 expectation: blocked
- -

See specification - details for this test.

- -
+
diff --git a/testing/web-platform/tests/mixed-content/blockable/no-opt-in/same-host-http/object-tag/top-level/keep-scheme-redirect/no-opt-in-blocks.https.html b/testing/web-platform/tests/mixed-content/blockable/no-opt-in/same-host-http/object-tag/top-level/keep-scheme-redirect/no-opt-in-blocks.https.html index 0670e6ac2996..190b66b0d62c 100644 --- a/testing/web-platform/tests/mixed-content/blockable/no-opt-in/same-host-http/object-tag/top-level/keep-scheme-redirect/no-opt-in-blocks.https.html +++ b/testing/web-platform/tests/mixed-content/blockable/no-opt-in/same-host-http/object-tag/top-level/keep-scheme-redirect/no-opt-in-blocks.https.html @@ -1,10 +1,12 @@ - + Mixed-Content: Blockable content + + - - - - - - -

Blockable content

-

Test behavior of blockable content.

-
opt_in_method: no-opt-in
-                                 origin: same-host-http
-                                 source_scheme: https
-                                 context_nesting: top-level
-                                 redirection: keep-scheme-redirect
-                                 subresource: object-tag
-                                 expectation: blocked
- -

See specification - details for this test.

- -
+
diff --git a/testing/web-platform/tests/mixed-content/blockable/no-opt-in/same-host-http/object-tag/top-level/no-redirect/no-opt-in-blocks.https.html b/testing/web-platform/tests/mixed-content/blockable/no-opt-in/same-host-http/object-tag/top-level/no-redirect/no-opt-in-blocks.https.html index 09fc02e52341..c03d5036a385 100644 --- a/testing/web-platform/tests/mixed-content/blockable/no-opt-in/same-host-http/object-tag/top-level/no-redirect/no-opt-in-blocks.https.html +++ b/testing/web-platform/tests/mixed-content/blockable/no-opt-in/same-host-http/object-tag/top-level/no-redirect/no-opt-in-blocks.https.html @@ -1,10 +1,12 @@ - + Mixed-Content: Blockable content + + - - - - - - -

Blockable content

-

Test behavior of blockable content.

-
opt_in_method: no-opt-in
-                                 origin: same-host-http
-                                 source_scheme: https
-                                 context_nesting: top-level
-                                 redirection: no-redirect
-                                 subresource: object-tag
-                                 expectation: blocked
- -

See specification - details for this test.

- -
+
diff --git a/testing/web-platform/tests/mixed-content/blockable/no-opt-in/same-host-http/object-tag/top-level/swap-scheme-redirect/no-opt-in-blocks.https.html b/testing/web-platform/tests/mixed-content/blockable/no-opt-in/same-host-http/object-tag/top-level/swap-scheme-redirect/no-opt-in-blocks.https.html index 6ff553e4f3f7..d9a166609816 100644 --- a/testing/web-platform/tests/mixed-content/blockable/no-opt-in/same-host-http/object-tag/top-level/swap-scheme-redirect/no-opt-in-blocks.https.html +++ b/testing/web-platform/tests/mixed-content/blockable/no-opt-in/same-host-http/object-tag/top-level/swap-scheme-redirect/no-opt-in-blocks.https.html @@ -1,10 +1,12 @@ - + Mixed-Content: Blockable content + + - - - - - - -

Blockable content

-

Test behavior of blockable content.

-
opt_in_method: no-opt-in
-                                 origin: same-host-http
-                                 source_scheme: https
-                                 context_nesting: top-level
-                                 redirection: swap-scheme-redirect
-                                 subresource: object-tag
-                                 expectation: blocked
- -

See specification - details for this test.

- -
+
diff --git a/testing/web-platform/tests/mixed-content/blockable/no-opt-in/same-host-http/picture-tag/top-level/keep-scheme-redirect/no-opt-in-blocks.https.html b/testing/web-platform/tests/mixed-content/blockable/no-opt-in/same-host-http/picture-tag/top-level/keep-scheme-redirect/no-opt-in-blocks.https.html index bbf3a5d6c24f..0b2a8c8ff5a3 100644 --- a/testing/web-platform/tests/mixed-content/blockable/no-opt-in/same-host-http/picture-tag/top-level/keep-scheme-redirect/no-opt-in-blocks.https.html +++ b/testing/web-platform/tests/mixed-content/blockable/no-opt-in/same-host-http/picture-tag/top-level/keep-scheme-redirect/no-opt-in-blocks.https.html @@ -1,10 +1,12 @@ - + Mixed-Content: Blockable content + + - - - - - - -

Blockable content

-

Test behavior of blockable content.

-
opt_in_method: no-opt-in
-                                 origin: same-host-http
-                                 source_scheme: https
-                                 context_nesting: top-level
-                                 redirection: keep-scheme-redirect
-                                 subresource: picture-tag
-                                 expectation: blocked
- -

See specification - details for this test.

- -
+
diff --git a/testing/web-platform/tests/mixed-content/blockable/no-opt-in/same-host-http/picture-tag/top-level/no-redirect/no-opt-in-blocks.https.html b/testing/web-platform/tests/mixed-content/blockable/no-opt-in/same-host-http/picture-tag/top-level/no-redirect/no-opt-in-blocks.https.html index 51d6568f63f2..532c97bf066c 100644 --- a/testing/web-platform/tests/mixed-content/blockable/no-opt-in/same-host-http/picture-tag/top-level/no-redirect/no-opt-in-blocks.https.html +++ b/testing/web-platform/tests/mixed-content/blockable/no-opt-in/same-host-http/picture-tag/top-level/no-redirect/no-opt-in-blocks.https.html @@ -1,10 +1,12 @@ - + Mixed-Content: Blockable content + + - - - - - - -

Blockable content

-

Test behavior of blockable content.

-
opt_in_method: no-opt-in
-                                 origin: same-host-http
-                                 source_scheme: https
-                                 context_nesting: top-level
-                                 redirection: no-redirect
-                                 subresource: picture-tag
-                                 expectation: blocked
- -

See specification - details for this test.

- -
+
diff --git a/testing/web-platform/tests/mixed-content/blockable/no-opt-in/same-host-http/picture-tag/top-level/swap-scheme-redirect/no-opt-in-blocks.https.html b/testing/web-platform/tests/mixed-content/blockable/no-opt-in/same-host-http/picture-tag/top-level/swap-scheme-redirect/no-opt-in-blocks.https.html index 86771b07327a..662fc90485af 100644 --- a/testing/web-platform/tests/mixed-content/blockable/no-opt-in/same-host-http/picture-tag/top-level/swap-scheme-redirect/no-opt-in-blocks.https.html +++ b/testing/web-platform/tests/mixed-content/blockable/no-opt-in/same-host-http/picture-tag/top-level/swap-scheme-redirect/no-opt-in-blocks.https.html @@ -1,10 +1,12 @@ - + Mixed-Content: Blockable content + + - - - - - - -

Blockable content

-

Test behavior of blockable content.

-
opt_in_method: no-opt-in
-                                 origin: same-host-http
-                                 source_scheme: https
-                                 context_nesting: top-level
-                                 redirection: swap-scheme-redirect
-                                 subresource: picture-tag
-                                 expectation: blocked
- -

See specification - details for this test.

- -
+
diff --git a/testing/web-platform/tests/mixed-content/blockable/no-opt-in/same-host-http/script-tag/top-level/keep-scheme-redirect/no-opt-in-blocks.https.html b/testing/web-platform/tests/mixed-content/blockable/no-opt-in/same-host-http/script-tag/top-level/keep-scheme-redirect/no-opt-in-blocks.https.html index 465f68eb4c81..cc1c051a364f 100644 --- a/testing/web-platform/tests/mixed-content/blockable/no-opt-in/same-host-http/script-tag/top-level/keep-scheme-redirect/no-opt-in-blocks.https.html +++ b/testing/web-platform/tests/mixed-content/blockable/no-opt-in/same-host-http/script-tag/top-level/keep-scheme-redirect/no-opt-in-blocks.https.html @@ -1,10 +1,12 @@ - + Mixed-Content: Blockable content + + - - - - - - -

Blockable content

-

Test behavior of blockable content.

-
opt_in_method: no-opt-in
-                                 origin: same-host-http
-                                 source_scheme: https
-                                 context_nesting: top-level
-                                 redirection: keep-scheme-redirect
-                                 subresource: script-tag
-                                 expectation: blocked
- -

See specification - details for this test.

- -
+
diff --git a/testing/web-platform/tests/mixed-content/blockable/no-opt-in/same-host-http/script-tag/top-level/no-redirect/no-opt-in-blocks.https.html b/testing/web-platform/tests/mixed-content/blockable/no-opt-in/same-host-http/script-tag/top-level/no-redirect/no-opt-in-blocks.https.html index 546e32f28ee6..23efca0a54c1 100644 --- a/testing/web-platform/tests/mixed-content/blockable/no-opt-in/same-host-http/script-tag/top-level/no-redirect/no-opt-in-blocks.https.html +++ b/testing/web-platform/tests/mixed-content/blockable/no-opt-in/same-host-http/script-tag/top-level/no-redirect/no-opt-in-blocks.https.html @@ -1,10 +1,12 @@ - + Mixed-Content: Blockable content + + - - - - - - -

Blockable content

-

Test behavior of blockable content.

-
opt_in_method: no-opt-in
-                                 origin: same-host-http
-                                 source_scheme: https
-                                 context_nesting: top-level
-                                 redirection: no-redirect
-                                 subresource: script-tag
-                                 expectation: blocked
- -

See specification - details for this test.

- -
+
diff --git a/testing/web-platform/tests/mixed-content/blockable/no-opt-in/same-host-http/script-tag/top-level/swap-scheme-redirect/no-opt-in-blocks.https.html b/testing/web-platform/tests/mixed-content/blockable/no-opt-in/same-host-http/script-tag/top-level/swap-scheme-redirect/no-opt-in-blocks.https.html index 40ab7e083581..69e151519bb2 100644 --- a/testing/web-platform/tests/mixed-content/blockable/no-opt-in/same-host-http/script-tag/top-level/swap-scheme-redirect/no-opt-in-blocks.https.html +++ b/testing/web-platform/tests/mixed-content/blockable/no-opt-in/same-host-http/script-tag/top-level/swap-scheme-redirect/no-opt-in-blocks.https.html @@ -1,10 +1,12 @@ - + Mixed-Content: Blockable content + + - - - - - - -

Blockable content

-

Test behavior of blockable content.

-
opt_in_method: no-opt-in
-                                 origin: same-host-http
-                                 source_scheme: https
-                                 context_nesting: top-level
-                                 redirection: swap-scheme-redirect
-                                 subresource: script-tag
-                                 expectation: blocked
- -

See specification - details for this test.

- -
+
diff --git a/testing/web-platform/tests/mixed-content/blockable/no-opt-in/same-host-http/worker-request/top-level/keep-scheme-redirect/no-opt-in-blocks.https.html b/testing/web-platform/tests/mixed-content/blockable/no-opt-in/same-host-http/worker-request/top-level/keep-scheme-redirect/no-opt-in-blocks.https.html index f21e6a1f205a..065ff5ba526d 100644 --- a/testing/web-platform/tests/mixed-content/blockable/no-opt-in/same-host-http/worker-request/top-level/keep-scheme-redirect/no-opt-in-blocks.https.html +++ b/testing/web-platform/tests/mixed-content/blockable/no-opt-in/same-host-http/worker-request/top-level/keep-scheme-redirect/no-opt-in-blocks.https.html @@ -1,10 +1,12 @@ - + Mixed-Content: Blockable content + + - - - - - - -

Blockable content

-

Test behavior of blockable content.

-
opt_in_method: no-opt-in
-                                 origin: same-host-http
-                                 source_scheme: https
-                                 context_nesting: top-level
-                                 redirection: keep-scheme-redirect
-                                 subresource: worker-request
-                                 expectation: blocked
- -

See specification - details for this test.

- -
+
diff --git a/testing/web-platform/tests/mixed-content/blockable/no-opt-in/same-host-http/worker-request/top-level/no-redirect/no-opt-in-blocks.https.html b/testing/web-platform/tests/mixed-content/blockable/no-opt-in/same-host-http/worker-request/top-level/no-redirect/no-opt-in-blocks.https.html index 3cee8fc6a31d..3cd8a67482ca 100644 --- a/testing/web-platform/tests/mixed-content/blockable/no-opt-in/same-host-http/worker-request/top-level/no-redirect/no-opt-in-blocks.https.html +++ b/testing/web-platform/tests/mixed-content/blockable/no-opt-in/same-host-http/worker-request/top-level/no-redirect/no-opt-in-blocks.https.html @@ -1,10 +1,12 @@ - + Mixed-Content: Blockable content + + - - - - - - -

Blockable content

-

Test behavior of blockable content.

-
opt_in_method: no-opt-in
-                                 origin: same-host-http
-                                 source_scheme: https
-                                 context_nesting: top-level
-                                 redirection: no-redirect
-                                 subresource: worker-request
-                                 expectation: blocked
- -

See specification - details for this test.

- -
+
diff --git a/testing/web-platform/tests/mixed-content/blockable/no-opt-in/same-host-http/worker-request/top-level/swap-scheme-redirect/no-opt-in-blocks.https.html b/testing/web-platform/tests/mixed-content/blockable/no-opt-in/same-host-http/worker-request/top-level/swap-scheme-redirect/no-opt-in-blocks.https.html index 34ce2e6b7c00..3b3e17c27774 100644 --- a/testing/web-platform/tests/mixed-content/blockable/no-opt-in/same-host-http/worker-request/top-level/swap-scheme-redirect/no-opt-in-blocks.https.html +++ b/testing/web-platform/tests/mixed-content/blockable/no-opt-in/same-host-http/worker-request/top-level/swap-scheme-redirect/no-opt-in-blocks.https.html @@ -1,10 +1,12 @@ - + Mixed-Content: Blockable content + + - - - - - - -

Blockable content

-

Test behavior of blockable content.

-
opt_in_method: no-opt-in
-                                 origin: same-host-http
-                                 source_scheme: https
-                                 context_nesting: top-level
-                                 redirection: swap-scheme-redirect
-                                 subresource: worker-request
-                                 expectation: blocked
- -

See specification - details for this test.

- -
+
diff --git a/testing/web-platform/tests/mixed-content/blockable/no-opt-in/same-host-http/xhr-request/top-level/keep-scheme-redirect/no-opt-in-blocks.https.html b/testing/web-platform/tests/mixed-content/blockable/no-opt-in/same-host-http/xhr-request/top-level/keep-scheme-redirect/no-opt-in-blocks.https.html index de05e8f9e741..897354a798ac 100644 --- a/testing/web-platform/tests/mixed-content/blockable/no-opt-in/same-host-http/xhr-request/top-level/keep-scheme-redirect/no-opt-in-blocks.https.html +++ b/testing/web-platform/tests/mixed-content/blockable/no-opt-in/same-host-http/xhr-request/top-level/keep-scheme-redirect/no-opt-in-blocks.https.html @@ -1,10 +1,12 @@ - + Mixed-Content: Blockable content + + - - - - - - -

Blockable content

-

Test behavior of blockable content.

-
opt_in_method: no-opt-in
-                                 origin: same-host-http
-                                 source_scheme: https
-                                 context_nesting: top-level
-                                 redirection: keep-scheme-redirect
-                                 subresource: xhr-request
-                                 expectation: blocked
- -

See specification - details for this test.

- -
+
diff --git a/testing/web-platform/tests/mixed-content/blockable/no-opt-in/same-host-http/xhr-request/top-level/no-redirect/no-opt-in-blocks.https.html b/testing/web-platform/tests/mixed-content/blockable/no-opt-in/same-host-http/xhr-request/top-level/no-redirect/no-opt-in-blocks.https.html index be1c31bebdf5..ee787d05aa3c 100644 --- a/testing/web-platform/tests/mixed-content/blockable/no-opt-in/same-host-http/xhr-request/top-level/no-redirect/no-opt-in-blocks.https.html +++ b/testing/web-platform/tests/mixed-content/blockable/no-opt-in/same-host-http/xhr-request/top-level/no-redirect/no-opt-in-blocks.https.html @@ -1,10 +1,12 @@ - + Mixed-Content: Blockable content + + - - - - - - -

Blockable content

-

Test behavior of blockable content.

-
opt_in_method: no-opt-in
-                                 origin: same-host-http
-                                 source_scheme: https
-                                 context_nesting: top-level
-                                 redirection: no-redirect
-                                 subresource: xhr-request
-                                 expectation: blocked
- -

See specification - details for this test.

- -
+
diff --git a/testing/web-platform/tests/mixed-content/blockable/no-opt-in/same-host-http/xhr-request/top-level/swap-scheme-redirect/no-opt-in-blocks.https.html b/testing/web-platform/tests/mixed-content/blockable/no-opt-in/same-host-http/xhr-request/top-level/swap-scheme-redirect/no-opt-in-blocks.https.html index ed2d3e2834d4..9a9085b86ebf 100644 --- a/testing/web-platform/tests/mixed-content/blockable/no-opt-in/same-host-http/xhr-request/top-level/swap-scheme-redirect/no-opt-in-blocks.https.html +++ b/testing/web-platform/tests/mixed-content/blockable/no-opt-in/same-host-http/xhr-request/top-level/swap-scheme-redirect/no-opt-in-blocks.https.html @@ -1,10 +1,12 @@ - + Mixed-Content: Blockable content + + - - - - - - -

Blockable content

-

Test behavior of blockable content.

-
opt_in_method: no-opt-in
-                                 origin: same-host-http
-                                 source_scheme: https
-                                 context_nesting: top-level
-                                 redirection: swap-scheme-redirect
-                                 subresource: xhr-request
-                                 expectation: blocked
- -

See specification - details for this test.

- -
+
diff --git a/testing/web-platform/tests/mixed-content/generic/common.js b/testing/web-platform/tests/mixed-content/generic/common.js index d500f7ef52a6..54fd50f75314 100644 --- a/testing/web-platform/tests/mixed-content/generic/common.js +++ b/testing/web-platform/tests/mixed-content/generic/common.js @@ -358,3 +358,4 @@ function requestViaObject(url) { // mode. function SanityChecker() {} SanityChecker.prototype.checkScenario = function() {}; +SanityChecker.prototype.setFailTimeout = function(test, timeout) {}; diff --git a/testing/web-platform/tests/mixed-content/generic/mixed-content-test-case.js b/testing/web-platform/tests/mixed-content/generic/mixed-content-test-case.js index df140c9c47b5..4200b6d704c7 100644 --- a/testing/web-platform/tests/mixed-content/generic/mixed-content-test-case.js +++ b/testing/web-platform/tests/mixed-content/generic/mixed-content-test-case.js @@ -85,18 +85,7 @@ function MixedContentTestCase(scenario, description, sanityChecker) { var mixed_content_test = async_test(description); function runTest() { - var testCompleted = false; - - // Due to missing implementations, tests time out, so we fail them early. - // TODO(kristijanburnik): Once WPT rolled in: - // https://github.com/w3c/testharness.js/pull/127 - // Refactor to make use of step_timeout. - setTimeout(function() { - mixed_content_test.step(function() { - assert_true(testCompleted, "Expected test to complete."); - mixed_content_test.done(); - }) - }, 1000); + sanityChecker.setFailTimeout(mixed_content_test); var key = guid(); var value = guid(); @@ -147,7 +136,6 @@ function MixedContentTestCase(scenario, description, sanityChecker) { "'."); }, "Check if request was sent."); mixed_content_test.done(); - testCompleted = true; }); } // runTest diff --git a/testing/web-platform/tests/mixed-content/generic/sanity-checker.js b/testing/web-platform/tests/mixed-content/generic/sanity-checker.js index c711e0ee2361..55a103adf0f2 100644 --- a/testing/web-platform/tests/mixed-content/generic/sanity-checker.js +++ b/testing/web-platform/tests/mixed-content/generic/sanity-checker.js @@ -1,6 +1,6 @@ // The SanityChecker is used in debug mode to identify problems with the -// structure of the testsuite. In release mode it is mocked out to do nothing. - +// structure of the testsuite and to force early test failures. +// In release mode it is mocked out to do nothing. function SanityChecker() {} SanityChecker.prototype.checkScenario = function(scenario, resourceInvoker) { @@ -36,3 +36,18 @@ SanityChecker.prototype.checkScenario = function(scenario, resourceInvoker) { }, "[MixedContentTestCase] The test scenario should be valid."); } + +// For easier debugging runs, we can fail a test earlier. +SanityChecker.prototype.setFailTimeout = function(test, timeout) { + // Due to missing implementations, tests time out, so we fail them early. + // TODO(kristijanburnik): Once WPT rolled in: + // https://github.com/w3c/testharness.js/pull/127 + // Refactor to make use of step_timeout. + setTimeout(function() { + test.step(function() { + assert_equals(test.phase, test.phases.COMPLETE, + "Expected test to complete."); + test.done(); + }) + }, timeout || 1000); +} diff --git a/testing/web-platform/tests/mixed-content/optionally-blockable/http-csp/cross-origin-http/audio-tag/top-level/keep-scheme-redirect/opt-in-blocks.https.html b/testing/web-platform/tests/mixed-content/optionally-blockable/http-csp/cross-origin-http/audio-tag/top-level/keep-scheme-redirect/opt-in-blocks.https.html index 3cae7b1b2f2c..ac620c1075b7 100644 --- a/testing/web-platform/tests/mixed-content/optionally-blockable/http-csp/cross-origin-http/audio-tag/top-level/keep-scheme-redirect/opt-in-blocks.https.html +++ b/testing/web-platform/tests/mixed-content/optionally-blockable/http-csp/cross-origin-http/audio-tag/top-level/keep-scheme-redirect/opt-in-blocks.https.html @@ -1,10 +1,12 @@ - + Mixed-Content: Optionally-blockable content + + - - - - - - -

Optionally-blockable content

-

Test behavior of optionally-blockable content

-
opt_in_method: http-csp
-                                 origin: cross-origin-http
-                                 source_scheme: https
-                                 context_nesting: top-level
-                                 redirection: keep-scheme-redirect
-                                 subresource: audio-tag
-                                 expectation: blocked
- -

See specification - details for this test.

- -
+
diff --git a/testing/web-platform/tests/mixed-content/optionally-blockable/http-csp/cross-origin-http/audio-tag/top-level/no-redirect/opt-in-blocks.https.html b/testing/web-platform/tests/mixed-content/optionally-blockable/http-csp/cross-origin-http/audio-tag/top-level/no-redirect/opt-in-blocks.https.html index a6597f1f437c..abc81b30191f 100644 --- a/testing/web-platform/tests/mixed-content/optionally-blockable/http-csp/cross-origin-http/audio-tag/top-level/no-redirect/opt-in-blocks.https.html +++ b/testing/web-platform/tests/mixed-content/optionally-blockable/http-csp/cross-origin-http/audio-tag/top-level/no-redirect/opt-in-blocks.https.html @@ -1,10 +1,12 @@ - + Mixed-Content: Optionally-blockable content + + - - - - - - -

Optionally-blockable content

-

Test behavior of optionally-blockable content

-
opt_in_method: http-csp
-                                 origin: cross-origin-http
-                                 source_scheme: https
-                                 context_nesting: top-level
-                                 redirection: no-redirect
-                                 subresource: audio-tag
-                                 expectation: blocked
- -

See specification - details for this test.

- -
+
diff --git a/testing/web-platform/tests/mixed-content/optionally-blockable/http-csp/cross-origin-http/audio-tag/top-level/swap-scheme-redirect/opt-in-blocks.https.html b/testing/web-platform/tests/mixed-content/optionally-blockable/http-csp/cross-origin-http/audio-tag/top-level/swap-scheme-redirect/opt-in-blocks.https.html index 3b0dd9786c9b..27c67b081ddd 100644 --- a/testing/web-platform/tests/mixed-content/optionally-blockable/http-csp/cross-origin-http/audio-tag/top-level/swap-scheme-redirect/opt-in-blocks.https.html +++ b/testing/web-platform/tests/mixed-content/optionally-blockable/http-csp/cross-origin-http/audio-tag/top-level/swap-scheme-redirect/opt-in-blocks.https.html @@ -1,10 +1,12 @@ - + Mixed-Content: Optionally-blockable content + + - - - - - - -

Optionally-blockable content

-

Test behavior of optionally-blockable content

-
opt_in_method: http-csp
-                                 origin: cross-origin-http
-                                 source_scheme: https
-                                 context_nesting: top-level
-                                 redirection: swap-scheme-redirect
-                                 subresource: audio-tag
-                                 expectation: blocked
- -

See specification - details for this test.

- -
+
diff --git a/testing/web-platform/tests/mixed-content/optionally-blockable/http-csp/cross-origin-http/img-tag/top-level/keep-scheme-redirect/opt-in-blocks.https.html b/testing/web-platform/tests/mixed-content/optionally-blockable/http-csp/cross-origin-http/img-tag/top-level/keep-scheme-redirect/opt-in-blocks.https.html index 9a63f99ae00b..1816b4231bd5 100644 --- a/testing/web-platform/tests/mixed-content/optionally-blockable/http-csp/cross-origin-http/img-tag/top-level/keep-scheme-redirect/opt-in-blocks.https.html +++ b/testing/web-platform/tests/mixed-content/optionally-blockable/http-csp/cross-origin-http/img-tag/top-level/keep-scheme-redirect/opt-in-blocks.https.html @@ -1,10 +1,12 @@ - + Mixed-Content: Optionally-blockable content + + - - - - - - -

Optionally-blockable content

-

Test behavior of optionally-blockable content

-
opt_in_method: http-csp
-                                 origin: cross-origin-http
-                                 source_scheme: https
-                                 context_nesting: top-level
-                                 redirection: keep-scheme-redirect
-                                 subresource: img-tag
-                                 expectation: blocked
- -

See specification - details for this test.

- -
+
diff --git a/testing/web-platform/tests/mixed-content/optionally-blockable/http-csp/cross-origin-http/img-tag/top-level/no-redirect/opt-in-blocks.https.html b/testing/web-platform/tests/mixed-content/optionally-blockable/http-csp/cross-origin-http/img-tag/top-level/no-redirect/opt-in-blocks.https.html index e0d760323b7c..509fc34750f8 100644 --- a/testing/web-platform/tests/mixed-content/optionally-blockable/http-csp/cross-origin-http/img-tag/top-level/no-redirect/opt-in-blocks.https.html +++ b/testing/web-platform/tests/mixed-content/optionally-blockable/http-csp/cross-origin-http/img-tag/top-level/no-redirect/opt-in-blocks.https.html @@ -1,10 +1,12 @@ - + Mixed-Content: Optionally-blockable content + + - - - - - - -

Optionally-blockable content

-

Test behavior of optionally-blockable content

-
opt_in_method: http-csp
-                                 origin: cross-origin-http
-                                 source_scheme: https
-                                 context_nesting: top-level
-                                 redirection: no-redirect
-                                 subresource: img-tag
-                                 expectation: blocked
- -

See specification - details for this test.

- -
+
diff --git a/testing/web-platform/tests/mixed-content/optionally-blockable/http-csp/cross-origin-http/img-tag/top-level/swap-scheme-redirect/opt-in-blocks.https.html b/testing/web-platform/tests/mixed-content/optionally-blockable/http-csp/cross-origin-http/img-tag/top-level/swap-scheme-redirect/opt-in-blocks.https.html index aa689fad1a4b..61baeee7944a 100644 --- a/testing/web-platform/tests/mixed-content/optionally-blockable/http-csp/cross-origin-http/img-tag/top-level/swap-scheme-redirect/opt-in-blocks.https.html +++ b/testing/web-platform/tests/mixed-content/optionally-blockable/http-csp/cross-origin-http/img-tag/top-level/swap-scheme-redirect/opt-in-blocks.https.html @@ -1,10 +1,12 @@ - + Mixed-Content: Optionally-blockable content + + - - - - - - -

Optionally-blockable content

-

Test behavior of optionally-blockable content

-
opt_in_method: http-csp
-                                 origin: cross-origin-http
-                                 source_scheme: https
-                                 context_nesting: top-level
-                                 redirection: swap-scheme-redirect
-                                 subresource: img-tag
-                                 expectation: blocked
- -

See specification - details for this test.

- -
+
diff --git a/testing/web-platform/tests/mixed-content/optionally-blockable/http-csp/cross-origin-http/link-prefetch-tag/top-level/keep-scheme-redirect/opt-in-blocks.https.html b/testing/web-platform/tests/mixed-content/optionally-blockable/http-csp/cross-origin-http/link-prefetch-tag/top-level/keep-scheme-redirect/opt-in-blocks.https.html index a95ea4adfd2b..743515ed3510 100644 --- a/testing/web-platform/tests/mixed-content/optionally-blockable/http-csp/cross-origin-http/link-prefetch-tag/top-level/keep-scheme-redirect/opt-in-blocks.https.html +++ b/testing/web-platform/tests/mixed-content/optionally-blockable/http-csp/cross-origin-http/link-prefetch-tag/top-level/keep-scheme-redirect/opt-in-blocks.https.html @@ -1,10 +1,12 @@ - + Mixed-Content: Optionally-blockable content + + - - - - - - -

Optionally-blockable content

-

Test behavior of optionally-blockable content

-
opt_in_method: http-csp
-                                 origin: cross-origin-http
-                                 source_scheme: https
-                                 context_nesting: top-level
-                                 redirection: keep-scheme-redirect
-                                 subresource: link-prefetch-tag
-                                 expectation: blocked
- -

See specification - details for this test.

- -
+
diff --git a/testing/web-platform/tests/mixed-content/optionally-blockable/http-csp/cross-origin-http/link-prefetch-tag/top-level/no-redirect/opt-in-blocks.https.html b/testing/web-platform/tests/mixed-content/optionally-blockable/http-csp/cross-origin-http/link-prefetch-tag/top-level/no-redirect/opt-in-blocks.https.html index 87338d7de579..88a54250a122 100644 --- a/testing/web-platform/tests/mixed-content/optionally-blockable/http-csp/cross-origin-http/link-prefetch-tag/top-level/no-redirect/opt-in-blocks.https.html +++ b/testing/web-platform/tests/mixed-content/optionally-blockable/http-csp/cross-origin-http/link-prefetch-tag/top-level/no-redirect/opt-in-blocks.https.html @@ -1,10 +1,12 @@ - + Mixed-Content: Optionally-blockable content + + - - - - - - -

Optionally-blockable content

-

Test behavior of optionally-blockable content

-
opt_in_method: http-csp
-                                 origin: cross-origin-http
-                                 source_scheme: https
-                                 context_nesting: top-level
-                                 redirection: no-redirect
-                                 subresource: link-prefetch-tag
-                                 expectation: blocked
- -

See specification - details for this test.

- -
+
diff --git a/testing/web-platform/tests/mixed-content/optionally-blockable/http-csp/cross-origin-http/link-prefetch-tag/top-level/swap-scheme-redirect/opt-in-blocks.https.html b/testing/web-platform/tests/mixed-content/optionally-blockable/http-csp/cross-origin-http/link-prefetch-tag/top-level/swap-scheme-redirect/opt-in-blocks.https.html index f319137a7ca2..2098a60b628f 100644 --- a/testing/web-platform/tests/mixed-content/optionally-blockable/http-csp/cross-origin-http/link-prefetch-tag/top-level/swap-scheme-redirect/opt-in-blocks.https.html +++ b/testing/web-platform/tests/mixed-content/optionally-blockable/http-csp/cross-origin-http/link-prefetch-tag/top-level/swap-scheme-redirect/opt-in-blocks.https.html @@ -1,10 +1,12 @@ - + Mixed-Content: Optionally-blockable content + + - - - - - - -

Optionally-blockable content

-

Test behavior of optionally-blockable content

-
opt_in_method: http-csp
-                                 origin: cross-origin-http
-                                 source_scheme: https
-                                 context_nesting: top-level
-                                 redirection: swap-scheme-redirect
-                                 subresource: link-prefetch-tag
-                                 expectation: blocked
- -

See specification - details for this test.

- -
+
diff --git a/testing/web-platform/tests/mixed-content/optionally-blockable/http-csp/cross-origin-http/video-tag/top-level/keep-scheme-redirect/opt-in-blocks.https.html b/testing/web-platform/tests/mixed-content/optionally-blockable/http-csp/cross-origin-http/video-tag/top-level/keep-scheme-redirect/opt-in-blocks.https.html index 767bbaa01e57..029d34c4f417 100644 --- a/testing/web-platform/tests/mixed-content/optionally-blockable/http-csp/cross-origin-http/video-tag/top-level/keep-scheme-redirect/opt-in-blocks.https.html +++ b/testing/web-platform/tests/mixed-content/optionally-blockable/http-csp/cross-origin-http/video-tag/top-level/keep-scheme-redirect/opt-in-blocks.https.html @@ -1,10 +1,12 @@ - + Mixed-Content: Optionally-blockable content + + - - - - - - -

Optionally-blockable content

-

Test behavior of optionally-blockable content

-
opt_in_method: http-csp
-                                 origin: cross-origin-http
-                                 source_scheme: https
-                                 context_nesting: top-level
-                                 redirection: keep-scheme-redirect
-                                 subresource: video-tag
-                                 expectation: blocked
- -

See specification - details for this test.

- -
+
diff --git a/testing/web-platform/tests/mixed-content/optionally-blockable/http-csp/cross-origin-http/video-tag/top-level/no-redirect/opt-in-blocks.https.html b/testing/web-platform/tests/mixed-content/optionally-blockable/http-csp/cross-origin-http/video-tag/top-level/no-redirect/opt-in-blocks.https.html index 892c5f10d1f1..c72ca267fcbd 100644 --- a/testing/web-platform/tests/mixed-content/optionally-blockable/http-csp/cross-origin-http/video-tag/top-level/no-redirect/opt-in-blocks.https.html +++ b/testing/web-platform/tests/mixed-content/optionally-blockable/http-csp/cross-origin-http/video-tag/top-level/no-redirect/opt-in-blocks.https.html @@ -1,10 +1,12 @@ - + Mixed-Content: Optionally-blockable content + + - - - - - - -

Optionally-blockable content

-

Test behavior of optionally-blockable content

-
opt_in_method: http-csp
-                                 origin: cross-origin-http
-                                 source_scheme: https
-                                 context_nesting: top-level
-                                 redirection: no-redirect
-                                 subresource: video-tag
-                                 expectation: blocked
- -

See specification - details for this test.

- -
+
diff --git a/testing/web-platform/tests/mixed-content/optionally-blockable/http-csp/cross-origin-http/video-tag/top-level/swap-scheme-redirect/opt-in-blocks.https.html b/testing/web-platform/tests/mixed-content/optionally-blockable/http-csp/cross-origin-http/video-tag/top-level/swap-scheme-redirect/opt-in-blocks.https.html index 10513766f2ef..b50a7b70a01c 100644 --- a/testing/web-platform/tests/mixed-content/optionally-blockable/http-csp/cross-origin-http/video-tag/top-level/swap-scheme-redirect/opt-in-blocks.https.html +++ b/testing/web-platform/tests/mixed-content/optionally-blockable/http-csp/cross-origin-http/video-tag/top-level/swap-scheme-redirect/opt-in-blocks.https.html @@ -1,10 +1,12 @@ - + Mixed-Content: Optionally-blockable content + + - - - - - - -

Optionally-blockable content

-

Test behavior of optionally-blockable content

-
opt_in_method: http-csp
-                                 origin: cross-origin-http
-                                 source_scheme: https
-                                 context_nesting: top-level
-                                 redirection: swap-scheme-redirect
-                                 subresource: video-tag
-                                 expectation: blocked
- -

See specification - details for this test.

- -
+
diff --git a/testing/web-platform/tests/mixed-content/optionally-blockable/http-csp/same-host-http/audio-tag/top-level/keep-scheme-redirect/opt-in-blocks.https.html b/testing/web-platform/tests/mixed-content/optionally-blockable/http-csp/same-host-http/audio-tag/top-level/keep-scheme-redirect/opt-in-blocks.https.html index 0562b6ed924f..5fd63aa6d0b5 100644 --- a/testing/web-platform/tests/mixed-content/optionally-blockable/http-csp/same-host-http/audio-tag/top-level/keep-scheme-redirect/opt-in-blocks.https.html +++ b/testing/web-platform/tests/mixed-content/optionally-blockable/http-csp/same-host-http/audio-tag/top-level/keep-scheme-redirect/opt-in-blocks.https.html @@ -1,10 +1,12 @@ - + Mixed-Content: Optionally-blockable content + + - - - - - - -

Optionally-blockable content

-

Test behavior of optionally-blockable content

-
opt_in_method: http-csp
-                                 origin: same-host-http
-                                 source_scheme: https
-                                 context_nesting: top-level
-                                 redirection: keep-scheme-redirect
-                                 subresource: audio-tag
-                                 expectation: blocked
- -

See specification - details for this test.

- -
+
diff --git a/testing/web-platform/tests/mixed-content/optionally-blockable/http-csp/same-host-http/audio-tag/top-level/no-redirect/opt-in-blocks.https.html b/testing/web-platform/tests/mixed-content/optionally-blockable/http-csp/same-host-http/audio-tag/top-level/no-redirect/opt-in-blocks.https.html index 0246af6a9610..e6f742213cc0 100644 --- a/testing/web-platform/tests/mixed-content/optionally-blockable/http-csp/same-host-http/audio-tag/top-level/no-redirect/opt-in-blocks.https.html +++ b/testing/web-platform/tests/mixed-content/optionally-blockable/http-csp/same-host-http/audio-tag/top-level/no-redirect/opt-in-blocks.https.html @@ -1,10 +1,12 @@ - + Mixed-Content: Optionally-blockable content + + - - - - - - -

Optionally-blockable content

-

Test behavior of optionally-blockable content

-
opt_in_method: http-csp
-                                 origin: same-host-http
-                                 source_scheme: https
-                                 context_nesting: top-level
-                                 redirection: no-redirect
-                                 subresource: audio-tag
-                                 expectation: blocked
- -

See specification - details for this test.

- -
+
diff --git a/testing/web-platform/tests/mixed-content/optionally-blockable/http-csp/same-host-http/audio-tag/top-level/swap-scheme-redirect/opt-in-blocks.https.html b/testing/web-platform/tests/mixed-content/optionally-blockable/http-csp/same-host-http/audio-tag/top-level/swap-scheme-redirect/opt-in-blocks.https.html index 57989fdbccc7..522e94420724 100644 --- a/testing/web-platform/tests/mixed-content/optionally-blockable/http-csp/same-host-http/audio-tag/top-level/swap-scheme-redirect/opt-in-blocks.https.html +++ b/testing/web-platform/tests/mixed-content/optionally-blockable/http-csp/same-host-http/audio-tag/top-level/swap-scheme-redirect/opt-in-blocks.https.html @@ -1,10 +1,12 @@ - + Mixed-Content: Optionally-blockable content + + - - - - - - -

Optionally-blockable content

-

Test behavior of optionally-blockable content

-
opt_in_method: http-csp
-                                 origin: same-host-http
-                                 source_scheme: https
-                                 context_nesting: top-level
-                                 redirection: swap-scheme-redirect
-                                 subresource: audio-tag
-                                 expectation: blocked
- -

See specification - details for this test.

- -
+
diff --git a/testing/web-platform/tests/mixed-content/optionally-blockable/http-csp/same-host-http/img-tag/top-level/keep-scheme-redirect/opt-in-blocks.https.html b/testing/web-platform/tests/mixed-content/optionally-blockable/http-csp/same-host-http/img-tag/top-level/keep-scheme-redirect/opt-in-blocks.https.html index d496ea5435f4..ad615e9b23f2 100644 --- a/testing/web-platform/tests/mixed-content/optionally-blockable/http-csp/same-host-http/img-tag/top-level/keep-scheme-redirect/opt-in-blocks.https.html +++ b/testing/web-platform/tests/mixed-content/optionally-blockable/http-csp/same-host-http/img-tag/top-level/keep-scheme-redirect/opt-in-blocks.https.html @@ -1,10 +1,12 @@ - + Mixed-Content: Optionally-blockable content + + - - - - - - -

Optionally-blockable content

-

Test behavior of optionally-blockable content

-
opt_in_method: http-csp
-                                 origin: same-host-http
-                                 source_scheme: https
-                                 context_nesting: top-level
-                                 redirection: keep-scheme-redirect
-                                 subresource: img-tag
-                                 expectation: blocked
- -

See specification - details for this test.

- -
+
diff --git a/testing/web-platform/tests/mixed-content/optionally-blockable/http-csp/same-host-http/img-tag/top-level/no-redirect/opt-in-blocks.https.html b/testing/web-platform/tests/mixed-content/optionally-blockable/http-csp/same-host-http/img-tag/top-level/no-redirect/opt-in-blocks.https.html index 450b55565796..b6f92431a3a1 100644 --- a/testing/web-platform/tests/mixed-content/optionally-blockable/http-csp/same-host-http/img-tag/top-level/no-redirect/opt-in-blocks.https.html +++ b/testing/web-platform/tests/mixed-content/optionally-blockable/http-csp/same-host-http/img-tag/top-level/no-redirect/opt-in-blocks.https.html @@ -1,10 +1,12 @@ - + Mixed-Content: Optionally-blockable content + + - - - - - - -

Optionally-blockable content

-

Test behavior of optionally-blockable content

-
opt_in_method: http-csp
-                                 origin: same-host-http
-                                 source_scheme: https
-                                 context_nesting: top-level
-                                 redirection: no-redirect
-                                 subresource: img-tag
-                                 expectation: blocked
- -

See specification - details for this test.

- -
+
diff --git a/testing/web-platform/tests/mixed-content/optionally-blockable/http-csp/same-host-http/img-tag/top-level/swap-scheme-redirect/opt-in-blocks.https.html b/testing/web-platform/tests/mixed-content/optionally-blockable/http-csp/same-host-http/img-tag/top-level/swap-scheme-redirect/opt-in-blocks.https.html index 200d50cbec48..580f4b5492f3 100644 --- a/testing/web-platform/tests/mixed-content/optionally-blockable/http-csp/same-host-http/img-tag/top-level/swap-scheme-redirect/opt-in-blocks.https.html +++ b/testing/web-platform/tests/mixed-content/optionally-blockable/http-csp/same-host-http/img-tag/top-level/swap-scheme-redirect/opt-in-blocks.https.html @@ -1,10 +1,12 @@ - + Mixed-Content: Optionally-blockable content + + - - - - - - -

Optionally-blockable content

-

Test behavior of optionally-blockable content

-
opt_in_method: http-csp
-                                 origin: same-host-http
-                                 source_scheme: https
-                                 context_nesting: top-level
-                                 redirection: swap-scheme-redirect
-                                 subresource: img-tag
-                                 expectation: blocked
- -

See specification - details for this test.

- -
+
diff --git a/testing/web-platform/tests/mixed-content/optionally-blockable/http-csp/same-host-http/link-prefetch-tag/top-level/keep-scheme-redirect/opt-in-blocks.https.html b/testing/web-platform/tests/mixed-content/optionally-blockable/http-csp/same-host-http/link-prefetch-tag/top-level/keep-scheme-redirect/opt-in-blocks.https.html index fde66246b8e1..fa8bd8a1f492 100644 --- a/testing/web-platform/tests/mixed-content/optionally-blockable/http-csp/same-host-http/link-prefetch-tag/top-level/keep-scheme-redirect/opt-in-blocks.https.html +++ b/testing/web-platform/tests/mixed-content/optionally-blockable/http-csp/same-host-http/link-prefetch-tag/top-level/keep-scheme-redirect/opt-in-blocks.https.html @@ -1,10 +1,12 @@ - + Mixed-Content: Optionally-blockable content + + - - - - - - -

Optionally-blockable content

-

Test behavior of optionally-blockable content

-
opt_in_method: http-csp
-                                 origin: same-host-http
-                                 source_scheme: https
-                                 context_nesting: top-level
-                                 redirection: keep-scheme-redirect
-                                 subresource: link-prefetch-tag
-                                 expectation: blocked
- -

See specification - details for this test.

- -
+
diff --git a/testing/web-platform/tests/mixed-content/optionally-blockable/http-csp/same-host-http/link-prefetch-tag/top-level/no-redirect/opt-in-blocks.https.html b/testing/web-platform/tests/mixed-content/optionally-blockable/http-csp/same-host-http/link-prefetch-tag/top-level/no-redirect/opt-in-blocks.https.html index 21f01e59b78c..685f34582a08 100644 --- a/testing/web-platform/tests/mixed-content/optionally-blockable/http-csp/same-host-http/link-prefetch-tag/top-level/no-redirect/opt-in-blocks.https.html +++ b/testing/web-platform/tests/mixed-content/optionally-blockable/http-csp/same-host-http/link-prefetch-tag/top-level/no-redirect/opt-in-blocks.https.html @@ -1,10 +1,12 @@ - + Mixed-Content: Optionally-blockable content + + - - - - - - -

Optionally-blockable content

-

Test behavior of optionally-blockable content

-
opt_in_method: http-csp
-                                 origin: same-host-http
-                                 source_scheme: https
-                                 context_nesting: top-level
-                                 redirection: no-redirect
-                                 subresource: link-prefetch-tag
-                                 expectation: blocked
- -

See specification - details for this test.

- -
+
diff --git a/testing/web-platform/tests/mixed-content/optionally-blockable/http-csp/same-host-http/link-prefetch-tag/top-level/swap-scheme-redirect/opt-in-blocks.https.html b/testing/web-platform/tests/mixed-content/optionally-blockable/http-csp/same-host-http/link-prefetch-tag/top-level/swap-scheme-redirect/opt-in-blocks.https.html index 4e042058e5ef..ab0378461d15 100644 --- a/testing/web-platform/tests/mixed-content/optionally-blockable/http-csp/same-host-http/link-prefetch-tag/top-level/swap-scheme-redirect/opt-in-blocks.https.html +++ b/testing/web-platform/tests/mixed-content/optionally-blockable/http-csp/same-host-http/link-prefetch-tag/top-level/swap-scheme-redirect/opt-in-blocks.https.html @@ -1,10 +1,12 @@ - + Mixed-Content: Optionally-blockable content + + - - - - - - -

Optionally-blockable content

-

Test behavior of optionally-blockable content

-
opt_in_method: http-csp
-                                 origin: same-host-http
-                                 source_scheme: https
-                                 context_nesting: top-level
-                                 redirection: swap-scheme-redirect
-                                 subresource: link-prefetch-tag
-                                 expectation: blocked
- -

See specification - details for this test.

- -
+
diff --git a/testing/web-platform/tests/mixed-content/optionally-blockable/http-csp/same-host-http/video-tag/top-level/keep-scheme-redirect/opt-in-blocks.https.html b/testing/web-platform/tests/mixed-content/optionally-blockable/http-csp/same-host-http/video-tag/top-level/keep-scheme-redirect/opt-in-blocks.https.html index 532b96319027..8b64104bd2f2 100644 --- a/testing/web-platform/tests/mixed-content/optionally-blockable/http-csp/same-host-http/video-tag/top-level/keep-scheme-redirect/opt-in-blocks.https.html +++ b/testing/web-platform/tests/mixed-content/optionally-blockable/http-csp/same-host-http/video-tag/top-level/keep-scheme-redirect/opt-in-blocks.https.html @@ -1,10 +1,12 @@ - + Mixed-Content: Optionally-blockable content + + - - - - - - -

Optionally-blockable content

-

Test behavior of optionally-blockable content

-
opt_in_method: http-csp
-                                 origin: same-host-http
-                                 source_scheme: https
-                                 context_nesting: top-level
-                                 redirection: keep-scheme-redirect
-                                 subresource: video-tag
-                                 expectation: blocked
- -

See specification - details for this test.

- -
+
diff --git a/testing/web-platform/tests/mixed-content/optionally-blockable/http-csp/same-host-http/video-tag/top-level/no-redirect/opt-in-blocks.https.html b/testing/web-platform/tests/mixed-content/optionally-blockable/http-csp/same-host-http/video-tag/top-level/no-redirect/opt-in-blocks.https.html index e605a73136b4..abe3385b06a7 100644 --- a/testing/web-platform/tests/mixed-content/optionally-blockable/http-csp/same-host-http/video-tag/top-level/no-redirect/opt-in-blocks.https.html +++ b/testing/web-platform/tests/mixed-content/optionally-blockable/http-csp/same-host-http/video-tag/top-level/no-redirect/opt-in-blocks.https.html @@ -1,10 +1,12 @@ - + Mixed-Content: Optionally-blockable content + + - - - - - - -

Optionally-blockable content

-

Test behavior of optionally-blockable content

-
opt_in_method: http-csp
-                                 origin: same-host-http
-                                 source_scheme: https
-                                 context_nesting: top-level
-                                 redirection: no-redirect
-                                 subresource: video-tag
-                                 expectation: blocked
- -

See specification - details for this test.

- -
+
diff --git a/testing/web-platform/tests/mixed-content/optionally-blockable/http-csp/same-host-http/video-tag/top-level/swap-scheme-redirect/opt-in-blocks.https.html b/testing/web-platform/tests/mixed-content/optionally-blockable/http-csp/same-host-http/video-tag/top-level/swap-scheme-redirect/opt-in-blocks.https.html index e71c10ae4c3d..78d9f8d5d4e2 100644 --- a/testing/web-platform/tests/mixed-content/optionally-blockable/http-csp/same-host-http/video-tag/top-level/swap-scheme-redirect/opt-in-blocks.https.html +++ b/testing/web-platform/tests/mixed-content/optionally-blockable/http-csp/same-host-http/video-tag/top-level/swap-scheme-redirect/opt-in-blocks.https.html @@ -1,10 +1,12 @@ - + Mixed-Content: Optionally-blockable content + + - - - - - - -

Optionally-blockable content

-

Test behavior of optionally-blockable content

-
opt_in_method: http-csp
-                                 origin: same-host-http
-                                 source_scheme: https
-                                 context_nesting: top-level
-                                 redirection: swap-scheme-redirect
-                                 subresource: video-tag
-                                 expectation: blocked
- -

See specification - details for this test.

- -
+
diff --git a/testing/web-platform/tests/mixed-content/optionally-blockable/meta-csp/cross-origin-http/audio-tag/top-level/no-redirect/opt-in-blocks.https.html b/testing/web-platform/tests/mixed-content/optionally-blockable/meta-csp/cross-origin-http/audio-tag/top-level/no-redirect/opt-in-blocks.https.html index 40b5cddbddee..ddc860ba2fcd 100644 --- a/testing/web-platform/tests/mixed-content/optionally-blockable/meta-csp/cross-origin-http/audio-tag/top-level/no-redirect/opt-in-blocks.https.html +++ b/testing/web-platform/tests/mixed-content/optionally-blockable/meta-csp/cross-origin-http/audio-tag/top-level/no-redirect/opt-in-blocks.https.html @@ -1,43 +1,25 @@ - + Mixed-Content: Optionally-blockable content + + + expectation: blocked"> - - - - - - -

Optionally-blockable content

-

Test behavior of optionally-blockable content

-
opt_in_method: meta-csp
-                                 origin: cross-origin-http
-                                 source_scheme: https
-                                 context_nesting: top-level
-                                 redirection: no-redirect
-                                 subresource: audio-tag
-                                 expectation: blocked
- -

See specification - details for this test.

- -
+
diff --git a/testing/web-platform/tests/mixed-content/optionally-blockable/meta-csp/cross-origin-http/img-tag/top-level/no-redirect/opt-in-blocks.https.html b/testing/web-platform/tests/mixed-content/optionally-blockable/meta-csp/cross-origin-http/img-tag/top-level/no-redirect/opt-in-blocks.https.html index 7febc67f3260..44fdb8b7aa1a 100644 --- a/testing/web-platform/tests/mixed-content/optionally-blockable/meta-csp/cross-origin-http/img-tag/top-level/no-redirect/opt-in-blocks.https.html +++ b/testing/web-platform/tests/mixed-content/optionally-blockable/meta-csp/cross-origin-http/img-tag/top-level/no-redirect/opt-in-blocks.https.html @@ -1,43 +1,25 @@ - + Mixed-Content: Optionally-blockable content + + + expectation: blocked"> - - - - - - -

Optionally-blockable content

-

Test behavior of optionally-blockable content

-
opt_in_method: meta-csp
-                                 origin: cross-origin-http
-                                 source_scheme: https
-                                 context_nesting: top-level
-                                 redirection: no-redirect
-                                 subresource: img-tag
-                                 expectation: blocked
- -

See specification - details for this test.

- -
+
diff --git a/testing/web-platform/tests/mixed-content/optionally-blockable/meta-csp/cross-origin-http/link-prefetch-tag/top-level/no-redirect/opt-in-blocks.https.html b/testing/web-platform/tests/mixed-content/optionally-blockable/meta-csp/cross-origin-http/link-prefetch-tag/top-level/no-redirect/opt-in-blocks.https.html index 293be460d2f8..b5de46754ddc 100644 --- a/testing/web-platform/tests/mixed-content/optionally-blockable/meta-csp/cross-origin-http/link-prefetch-tag/top-level/no-redirect/opt-in-blocks.https.html +++ b/testing/web-platform/tests/mixed-content/optionally-blockable/meta-csp/cross-origin-http/link-prefetch-tag/top-level/no-redirect/opt-in-blocks.https.html @@ -1,43 +1,25 @@ - + Mixed-Content: Optionally-blockable content + + + expectation: blocked"> - - - - - - -

Optionally-blockable content

-

Test behavior of optionally-blockable content

-
opt_in_method: meta-csp
-                                 origin: cross-origin-http
-                                 source_scheme: https
-                                 context_nesting: top-level
-                                 redirection: no-redirect
-                                 subresource: link-prefetch-tag
-                                 expectation: blocked
- -

See specification - details for this test.

- -
+
diff --git a/testing/web-platform/tests/mixed-content/optionally-blockable/meta-csp/cross-origin-http/video-tag/top-level/no-redirect/opt-in-blocks.https.html b/testing/web-platform/tests/mixed-content/optionally-blockable/meta-csp/cross-origin-http/video-tag/top-level/no-redirect/opt-in-blocks.https.html index a4376a209f23..2aebedc78574 100644 --- a/testing/web-platform/tests/mixed-content/optionally-blockable/meta-csp/cross-origin-http/video-tag/top-level/no-redirect/opt-in-blocks.https.html +++ b/testing/web-platform/tests/mixed-content/optionally-blockable/meta-csp/cross-origin-http/video-tag/top-level/no-redirect/opt-in-blocks.https.html @@ -1,43 +1,25 @@ - + Mixed-Content: Optionally-blockable content + + + expectation: blocked"> - - - - - - -

Optionally-blockable content

-

Test behavior of optionally-blockable content

-
opt_in_method: meta-csp
-                                 origin: cross-origin-http
-                                 source_scheme: https
-                                 context_nesting: top-level
-                                 redirection: no-redirect
-                                 subresource: video-tag
-                                 expectation: blocked
- -

See specification - details for this test.

- -
+
diff --git a/testing/web-platform/tests/mixed-content/optionally-blockable/meta-csp/same-host-http/audio-tag/top-level/no-redirect/opt-in-blocks.https.html b/testing/web-platform/tests/mixed-content/optionally-blockable/meta-csp/same-host-http/audio-tag/top-level/no-redirect/opt-in-blocks.https.html index ade9c060d408..e066dd1e3e70 100644 --- a/testing/web-platform/tests/mixed-content/optionally-blockable/meta-csp/same-host-http/audio-tag/top-level/no-redirect/opt-in-blocks.https.html +++ b/testing/web-platform/tests/mixed-content/optionally-blockable/meta-csp/same-host-http/audio-tag/top-level/no-redirect/opt-in-blocks.https.html @@ -1,43 +1,25 @@ - + Mixed-Content: Optionally-blockable content + + + expectation: blocked"> - - - - - - -

Optionally-blockable content

-

Test behavior of optionally-blockable content

-
opt_in_method: meta-csp
-                                 origin: same-host-http
-                                 source_scheme: https
-                                 context_nesting: top-level
-                                 redirection: no-redirect
-                                 subresource: audio-tag
-                                 expectation: blocked
- -

See specification - details for this test.

- -
+
diff --git a/testing/web-platform/tests/mixed-content/optionally-blockable/meta-csp/same-host-http/img-tag/top-level/no-redirect/opt-in-blocks.https.html b/testing/web-platform/tests/mixed-content/optionally-blockable/meta-csp/same-host-http/img-tag/top-level/no-redirect/opt-in-blocks.https.html index f4bc1bc74b68..0572c8079bc4 100644 --- a/testing/web-platform/tests/mixed-content/optionally-blockable/meta-csp/same-host-http/img-tag/top-level/no-redirect/opt-in-blocks.https.html +++ b/testing/web-platform/tests/mixed-content/optionally-blockable/meta-csp/same-host-http/img-tag/top-level/no-redirect/opt-in-blocks.https.html @@ -1,43 +1,25 @@ - + Mixed-Content: Optionally-blockable content + + + expectation: blocked"> - - - - - - -

Optionally-blockable content

-

Test behavior of optionally-blockable content

-
opt_in_method: meta-csp
-                                 origin: same-host-http
-                                 source_scheme: https
-                                 context_nesting: top-level
-                                 redirection: no-redirect
-                                 subresource: img-tag
-                                 expectation: blocked
- -

See specification - details for this test.

- -
+
diff --git a/testing/web-platform/tests/mixed-content/optionally-blockable/meta-csp/same-host-http/link-prefetch-tag/top-level/no-redirect/opt-in-blocks.https.html b/testing/web-platform/tests/mixed-content/optionally-blockable/meta-csp/same-host-http/link-prefetch-tag/top-level/no-redirect/opt-in-blocks.https.html index 29a5afc0c990..3b1d36af2914 100644 --- a/testing/web-platform/tests/mixed-content/optionally-blockable/meta-csp/same-host-http/link-prefetch-tag/top-level/no-redirect/opt-in-blocks.https.html +++ b/testing/web-platform/tests/mixed-content/optionally-blockable/meta-csp/same-host-http/link-prefetch-tag/top-level/no-redirect/opt-in-blocks.https.html @@ -1,43 +1,25 @@ - + Mixed-Content: Optionally-blockable content + + + expectation: blocked"> - - - - - - -

Optionally-blockable content

-

Test behavior of optionally-blockable content

-
opt_in_method: meta-csp
-                                 origin: same-host-http
-                                 source_scheme: https
-                                 context_nesting: top-level
-                                 redirection: no-redirect
-                                 subresource: link-prefetch-tag
-                                 expectation: blocked
- -

See specification - details for this test.

- -
+
diff --git a/testing/web-platform/tests/mixed-content/optionally-blockable/meta-csp/same-host-http/video-tag/top-level/no-redirect/opt-in-blocks.https.html b/testing/web-platform/tests/mixed-content/optionally-blockable/meta-csp/same-host-http/video-tag/top-level/no-redirect/opt-in-blocks.https.html index 4a098da56b4b..c78aa6b99425 100644 --- a/testing/web-platform/tests/mixed-content/optionally-blockable/meta-csp/same-host-http/video-tag/top-level/no-redirect/opt-in-blocks.https.html +++ b/testing/web-platform/tests/mixed-content/optionally-blockable/meta-csp/same-host-http/video-tag/top-level/no-redirect/opt-in-blocks.https.html @@ -1,43 +1,25 @@ - + Mixed-Content: Optionally-blockable content + + + expectation: blocked"> - - - - - - -

Optionally-blockable content

-

Test behavior of optionally-blockable content

-
opt_in_method: meta-csp
-                                 origin: same-host-http
-                                 source_scheme: https
-                                 context_nesting: top-level
-                                 redirection: no-redirect
-                                 subresource: video-tag
-                                 expectation: blocked
- -

See specification - details for this test.

- -
+
diff --git a/testing/web-platform/tests/mixed-content/optionally-blockable/no-opt-in/cross-origin-http/audio-tag/top-level/keep-scheme-redirect/no-opt-in-allows.https.html b/testing/web-platform/tests/mixed-content/optionally-blockable/no-opt-in/cross-origin-http/audio-tag/top-level/keep-scheme-redirect/no-opt-in-allows.https.html index 235dcab68a62..15fe5d2afc1c 100644 --- a/testing/web-platform/tests/mixed-content/optionally-blockable/no-opt-in/cross-origin-http/audio-tag/top-level/keep-scheme-redirect/no-opt-in-allows.https.html +++ b/testing/web-platform/tests/mixed-content/optionally-blockable/no-opt-in/cross-origin-http/audio-tag/top-level/keep-scheme-redirect/no-opt-in-allows.https.html @@ -1,10 +1,12 @@ - + Mixed-Content: Optionally-blockable content + + - - - - - - -

Optionally-blockable content

-

Test behavior of optionally-blockable content

-
opt_in_method: no-opt-in
-                                 origin: cross-origin-http
-                                 source_scheme: https
-                                 context_nesting: top-level
-                                 redirection: keep-scheme-redirect
-                                 subresource: audio-tag
-                                 expectation: allowed
- -

See specification - details for this test.

- -
+
diff --git a/testing/web-platform/tests/mixed-content/optionally-blockable/no-opt-in/cross-origin-http/audio-tag/top-level/no-redirect/no-opt-in-allows.https.html b/testing/web-platform/tests/mixed-content/optionally-blockable/no-opt-in/cross-origin-http/audio-tag/top-level/no-redirect/no-opt-in-allows.https.html index f0f024cf7946..2da4a2b9361c 100644 --- a/testing/web-platform/tests/mixed-content/optionally-blockable/no-opt-in/cross-origin-http/audio-tag/top-level/no-redirect/no-opt-in-allows.https.html +++ b/testing/web-platform/tests/mixed-content/optionally-blockable/no-opt-in/cross-origin-http/audio-tag/top-level/no-redirect/no-opt-in-allows.https.html @@ -1,10 +1,12 @@ - + Mixed-Content: Optionally-blockable content + + - - - - - - -

Optionally-blockable content

-

Test behavior of optionally-blockable content

-
opt_in_method: no-opt-in
-                                 origin: cross-origin-http
-                                 source_scheme: https
-                                 context_nesting: top-level
-                                 redirection: no-redirect
-                                 subresource: audio-tag
-                                 expectation: allowed
- -

See specification - details for this test.

- -
+
diff --git a/testing/web-platform/tests/mixed-content/optionally-blockable/no-opt-in/cross-origin-http/audio-tag/top-level/swap-scheme-redirect/no-opt-in-allows.https.html b/testing/web-platform/tests/mixed-content/optionally-blockable/no-opt-in/cross-origin-http/audio-tag/top-level/swap-scheme-redirect/no-opt-in-allows.https.html index 76724ecbf69e..8b610ada7db6 100644 --- a/testing/web-platform/tests/mixed-content/optionally-blockable/no-opt-in/cross-origin-http/audio-tag/top-level/swap-scheme-redirect/no-opt-in-allows.https.html +++ b/testing/web-platform/tests/mixed-content/optionally-blockable/no-opt-in/cross-origin-http/audio-tag/top-level/swap-scheme-redirect/no-opt-in-allows.https.html @@ -1,10 +1,12 @@ - + Mixed-Content: Optionally-blockable content + + - - - - - - -

Optionally-blockable content

-

Test behavior of optionally-blockable content

-
opt_in_method: no-opt-in
-                                 origin: cross-origin-http
-                                 source_scheme: https
-                                 context_nesting: top-level
-                                 redirection: swap-scheme-redirect
-                                 subresource: audio-tag
-                                 expectation: allowed
- -

See specification - details for this test.

- -
+
diff --git a/testing/web-platform/tests/mixed-content/optionally-blockable/no-opt-in/cross-origin-http/img-tag/top-level/keep-scheme-redirect/no-opt-in-allows.https.html b/testing/web-platform/tests/mixed-content/optionally-blockable/no-opt-in/cross-origin-http/img-tag/top-level/keep-scheme-redirect/no-opt-in-allows.https.html index dccc6c8fad18..5a7bdc3b538f 100644 --- a/testing/web-platform/tests/mixed-content/optionally-blockable/no-opt-in/cross-origin-http/img-tag/top-level/keep-scheme-redirect/no-opt-in-allows.https.html +++ b/testing/web-platform/tests/mixed-content/optionally-blockable/no-opt-in/cross-origin-http/img-tag/top-level/keep-scheme-redirect/no-opt-in-allows.https.html @@ -1,10 +1,12 @@ - + Mixed-Content: Optionally-blockable content + + - - - - - - -

Optionally-blockable content

-

Test behavior of optionally-blockable content

-
opt_in_method: no-opt-in
-                                 origin: cross-origin-http
-                                 source_scheme: https
-                                 context_nesting: top-level
-                                 redirection: keep-scheme-redirect
-                                 subresource: img-tag
-                                 expectation: allowed
- -

See specification - details for this test.

- -
+
diff --git a/testing/web-platform/tests/mixed-content/optionally-blockable/no-opt-in/cross-origin-http/img-tag/top-level/no-redirect/no-opt-in-allows.https.html b/testing/web-platform/tests/mixed-content/optionally-blockable/no-opt-in/cross-origin-http/img-tag/top-level/no-redirect/no-opt-in-allows.https.html index 4c4933e919bd..6c0a9f5e6865 100644 --- a/testing/web-platform/tests/mixed-content/optionally-blockable/no-opt-in/cross-origin-http/img-tag/top-level/no-redirect/no-opt-in-allows.https.html +++ b/testing/web-platform/tests/mixed-content/optionally-blockable/no-opt-in/cross-origin-http/img-tag/top-level/no-redirect/no-opt-in-allows.https.html @@ -1,10 +1,12 @@ - + Mixed-Content: Optionally-blockable content + + - - - - - - -

Optionally-blockable content

-

Test behavior of optionally-blockable content

-
opt_in_method: no-opt-in
-                                 origin: cross-origin-http
-                                 source_scheme: https
-                                 context_nesting: top-level
-                                 redirection: no-redirect
-                                 subresource: img-tag
-                                 expectation: allowed
- -

See specification - details for this test.

- -
+
diff --git a/testing/web-platform/tests/mixed-content/optionally-blockable/no-opt-in/cross-origin-http/img-tag/top-level/swap-scheme-redirect/no-opt-in-allows.https.html b/testing/web-platform/tests/mixed-content/optionally-blockable/no-opt-in/cross-origin-http/img-tag/top-level/swap-scheme-redirect/no-opt-in-allows.https.html index f779562be893..c9ffbfd0c707 100644 --- a/testing/web-platform/tests/mixed-content/optionally-blockable/no-opt-in/cross-origin-http/img-tag/top-level/swap-scheme-redirect/no-opt-in-allows.https.html +++ b/testing/web-platform/tests/mixed-content/optionally-blockable/no-opt-in/cross-origin-http/img-tag/top-level/swap-scheme-redirect/no-opt-in-allows.https.html @@ -1,10 +1,12 @@ - + Mixed-Content: Optionally-blockable content + + - - - - - - -

Optionally-blockable content

-

Test behavior of optionally-blockable content

-
opt_in_method: no-opt-in
-                                 origin: cross-origin-http
-                                 source_scheme: https
-                                 context_nesting: top-level
-                                 redirection: swap-scheme-redirect
-                                 subresource: img-tag
-                                 expectation: allowed
- -

See specification - details for this test.

- -
+
diff --git a/testing/web-platform/tests/mixed-content/optionally-blockable/no-opt-in/cross-origin-http/link-prefetch-tag/top-level/keep-scheme-redirect/no-opt-in-allows.https.html b/testing/web-platform/tests/mixed-content/optionally-blockable/no-opt-in/cross-origin-http/link-prefetch-tag/top-level/keep-scheme-redirect/no-opt-in-allows.https.html index 67f09927adb5..766298614375 100644 --- a/testing/web-platform/tests/mixed-content/optionally-blockable/no-opt-in/cross-origin-http/link-prefetch-tag/top-level/keep-scheme-redirect/no-opt-in-allows.https.html +++ b/testing/web-platform/tests/mixed-content/optionally-blockable/no-opt-in/cross-origin-http/link-prefetch-tag/top-level/keep-scheme-redirect/no-opt-in-allows.https.html @@ -1,10 +1,12 @@ - + Mixed-Content: Optionally-blockable content + + - - - - - - -

Optionally-blockable content

-

Test behavior of optionally-blockable content

-
opt_in_method: no-opt-in
-                                 origin: cross-origin-http
-                                 source_scheme: https
-                                 context_nesting: top-level
-                                 redirection: keep-scheme-redirect
-                                 subresource: link-prefetch-tag
-                                 expectation: allowed
- -

See specification - details for this test.

- -
+
diff --git a/testing/web-platform/tests/mixed-content/optionally-blockable/no-opt-in/cross-origin-http/link-prefetch-tag/top-level/no-redirect/no-opt-in-allows.https.html b/testing/web-platform/tests/mixed-content/optionally-blockable/no-opt-in/cross-origin-http/link-prefetch-tag/top-level/no-redirect/no-opt-in-allows.https.html index 935d48e8a36c..5bcce0017dba 100644 --- a/testing/web-platform/tests/mixed-content/optionally-blockable/no-opt-in/cross-origin-http/link-prefetch-tag/top-level/no-redirect/no-opt-in-allows.https.html +++ b/testing/web-platform/tests/mixed-content/optionally-blockable/no-opt-in/cross-origin-http/link-prefetch-tag/top-level/no-redirect/no-opt-in-allows.https.html @@ -1,10 +1,12 @@ - + Mixed-Content: Optionally-blockable content + + - - - - - - -

Optionally-blockable content

-

Test behavior of optionally-blockable content

-
opt_in_method: no-opt-in
-                                 origin: cross-origin-http
-                                 source_scheme: https
-                                 context_nesting: top-level
-                                 redirection: no-redirect
-                                 subresource: link-prefetch-tag
-                                 expectation: allowed
- -

See specification - details for this test.

- -
+
diff --git a/testing/web-platform/tests/mixed-content/optionally-blockable/no-opt-in/cross-origin-http/link-prefetch-tag/top-level/swap-scheme-redirect/no-opt-in-allows.https.html b/testing/web-platform/tests/mixed-content/optionally-blockable/no-opt-in/cross-origin-http/link-prefetch-tag/top-level/swap-scheme-redirect/no-opt-in-allows.https.html index 84c2eb421d75..312303234969 100644 --- a/testing/web-platform/tests/mixed-content/optionally-blockable/no-opt-in/cross-origin-http/link-prefetch-tag/top-level/swap-scheme-redirect/no-opt-in-allows.https.html +++ b/testing/web-platform/tests/mixed-content/optionally-blockable/no-opt-in/cross-origin-http/link-prefetch-tag/top-level/swap-scheme-redirect/no-opt-in-allows.https.html @@ -1,10 +1,12 @@ - + Mixed-Content: Optionally-blockable content + + - - - - - - -

Optionally-blockable content

-

Test behavior of optionally-blockable content

-
opt_in_method: no-opt-in
-                                 origin: cross-origin-http
-                                 source_scheme: https
-                                 context_nesting: top-level
-                                 redirection: swap-scheme-redirect
-                                 subresource: link-prefetch-tag
-                                 expectation: allowed
- -

See specification - details for this test.

- -
+
diff --git a/testing/web-platform/tests/mixed-content/optionally-blockable/no-opt-in/cross-origin-http/video-tag/top-level/keep-scheme-redirect/no-opt-in-allows.https.html b/testing/web-platform/tests/mixed-content/optionally-blockable/no-opt-in/cross-origin-http/video-tag/top-level/keep-scheme-redirect/no-opt-in-allows.https.html index 7178e0fcf9d6..561a2f7c1b5f 100644 --- a/testing/web-platform/tests/mixed-content/optionally-blockable/no-opt-in/cross-origin-http/video-tag/top-level/keep-scheme-redirect/no-opt-in-allows.https.html +++ b/testing/web-platform/tests/mixed-content/optionally-blockable/no-opt-in/cross-origin-http/video-tag/top-level/keep-scheme-redirect/no-opt-in-allows.https.html @@ -1,10 +1,12 @@ - + Mixed-Content: Optionally-blockable content + + - - - - - - -

Optionally-blockable content

-

Test behavior of optionally-blockable content

-
opt_in_method: no-opt-in
-                                 origin: cross-origin-http
-                                 source_scheme: https
-                                 context_nesting: top-level
-                                 redirection: keep-scheme-redirect
-                                 subresource: video-tag
-                                 expectation: allowed
- -

See specification - details for this test.

- -
+
diff --git a/testing/web-platform/tests/mixed-content/optionally-blockable/no-opt-in/cross-origin-http/video-tag/top-level/no-redirect/no-opt-in-allows.https.html b/testing/web-platform/tests/mixed-content/optionally-blockable/no-opt-in/cross-origin-http/video-tag/top-level/no-redirect/no-opt-in-allows.https.html index 6cc20ef2fdc1..e02134b4acfe 100644 --- a/testing/web-platform/tests/mixed-content/optionally-blockable/no-opt-in/cross-origin-http/video-tag/top-level/no-redirect/no-opt-in-allows.https.html +++ b/testing/web-platform/tests/mixed-content/optionally-blockable/no-opt-in/cross-origin-http/video-tag/top-level/no-redirect/no-opt-in-allows.https.html @@ -1,10 +1,12 @@ - + Mixed-Content: Optionally-blockable content + + - - - - - - -

Optionally-blockable content

-

Test behavior of optionally-blockable content

-
opt_in_method: no-opt-in
-                                 origin: cross-origin-http
-                                 source_scheme: https
-                                 context_nesting: top-level
-                                 redirection: no-redirect
-                                 subresource: video-tag
-                                 expectation: allowed
- -

See specification - details for this test.

- -
+
diff --git a/testing/web-platform/tests/mixed-content/optionally-blockable/no-opt-in/cross-origin-http/video-tag/top-level/swap-scheme-redirect/no-opt-in-allows.https.html b/testing/web-platform/tests/mixed-content/optionally-blockable/no-opt-in/cross-origin-http/video-tag/top-level/swap-scheme-redirect/no-opt-in-allows.https.html index 2e8225bc21ed..f90575c137a6 100644 --- a/testing/web-platform/tests/mixed-content/optionally-blockable/no-opt-in/cross-origin-http/video-tag/top-level/swap-scheme-redirect/no-opt-in-allows.https.html +++ b/testing/web-platform/tests/mixed-content/optionally-blockable/no-opt-in/cross-origin-http/video-tag/top-level/swap-scheme-redirect/no-opt-in-allows.https.html @@ -1,10 +1,12 @@ - + Mixed-Content: Optionally-blockable content + + - - - - - - -

Optionally-blockable content

-

Test behavior of optionally-blockable content

-
opt_in_method: no-opt-in
-                                 origin: cross-origin-http
-                                 source_scheme: https
-                                 context_nesting: top-level
-                                 redirection: swap-scheme-redirect
-                                 subresource: video-tag
-                                 expectation: allowed
- -

See specification - details for this test.

- -
+
diff --git a/testing/web-platform/tests/mixed-content/optionally-blockable/no-opt-in/same-host-http/audio-tag/top-level/keep-scheme-redirect/no-opt-in-allows.https.html b/testing/web-platform/tests/mixed-content/optionally-blockable/no-opt-in/same-host-http/audio-tag/top-level/keep-scheme-redirect/no-opt-in-allows.https.html index 203f93f430c9..cd4d8a52e76a 100644 --- a/testing/web-platform/tests/mixed-content/optionally-blockable/no-opt-in/same-host-http/audio-tag/top-level/keep-scheme-redirect/no-opt-in-allows.https.html +++ b/testing/web-platform/tests/mixed-content/optionally-blockable/no-opt-in/same-host-http/audio-tag/top-level/keep-scheme-redirect/no-opt-in-allows.https.html @@ -1,10 +1,12 @@ - + Mixed-Content: Optionally-blockable content + + - - - - - - -

Optionally-blockable content

-

Test behavior of optionally-blockable content

-
opt_in_method: no-opt-in
-                                 origin: same-host-http
-                                 source_scheme: https
-                                 context_nesting: top-level
-                                 redirection: keep-scheme-redirect
-                                 subresource: audio-tag
-                                 expectation: allowed
- -

See specification - details for this test.

- -
+
diff --git a/testing/web-platform/tests/mixed-content/optionally-blockable/no-opt-in/same-host-http/audio-tag/top-level/no-redirect/no-opt-in-allows.https.html b/testing/web-platform/tests/mixed-content/optionally-blockable/no-opt-in/same-host-http/audio-tag/top-level/no-redirect/no-opt-in-allows.https.html index 7d096f0be49d..20d31cf690ed 100644 --- a/testing/web-platform/tests/mixed-content/optionally-blockable/no-opt-in/same-host-http/audio-tag/top-level/no-redirect/no-opt-in-allows.https.html +++ b/testing/web-platform/tests/mixed-content/optionally-blockable/no-opt-in/same-host-http/audio-tag/top-level/no-redirect/no-opt-in-allows.https.html @@ -1,10 +1,12 @@ - + Mixed-Content: Optionally-blockable content + + - - - - - - -

Optionally-blockable content

-

Test behavior of optionally-blockable content

-
opt_in_method: no-opt-in
-                                 origin: same-host-http
-                                 source_scheme: https
-                                 context_nesting: top-level
-                                 redirection: no-redirect
-                                 subresource: audio-tag
-                                 expectation: allowed
- -

See specification - details for this test.

- -
+
diff --git a/testing/web-platform/tests/mixed-content/optionally-blockable/no-opt-in/same-host-http/audio-tag/top-level/swap-scheme-redirect/no-opt-in-allows.https.html b/testing/web-platform/tests/mixed-content/optionally-blockable/no-opt-in/same-host-http/audio-tag/top-level/swap-scheme-redirect/no-opt-in-allows.https.html index 8af535208949..2ed233dc8856 100644 --- a/testing/web-platform/tests/mixed-content/optionally-blockable/no-opt-in/same-host-http/audio-tag/top-level/swap-scheme-redirect/no-opt-in-allows.https.html +++ b/testing/web-platform/tests/mixed-content/optionally-blockable/no-opt-in/same-host-http/audio-tag/top-level/swap-scheme-redirect/no-opt-in-allows.https.html @@ -1,10 +1,12 @@ - + Mixed-Content: Optionally-blockable content + + - - - - - - -

Optionally-blockable content

-

Test behavior of optionally-blockable content

-
opt_in_method: no-opt-in
-                                 origin: same-host-http
-                                 source_scheme: https
-                                 context_nesting: top-level
-                                 redirection: swap-scheme-redirect
-                                 subresource: audio-tag
-                                 expectation: allowed
- -

See specification - details for this test.

- -
+
diff --git a/testing/web-platform/tests/mixed-content/optionally-blockable/no-opt-in/same-host-http/img-tag/top-level/keep-scheme-redirect/no-opt-in-allows.https.html b/testing/web-platform/tests/mixed-content/optionally-blockable/no-opt-in/same-host-http/img-tag/top-level/keep-scheme-redirect/no-opt-in-allows.https.html index 355dc84511b6..aab662fc3ab3 100644 --- a/testing/web-platform/tests/mixed-content/optionally-blockable/no-opt-in/same-host-http/img-tag/top-level/keep-scheme-redirect/no-opt-in-allows.https.html +++ b/testing/web-platform/tests/mixed-content/optionally-blockable/no-opt-in/same-host-http/img-tag/top-level/keep-scheme-redirect/no-opt-in-allows.https.html @@ -1,10 +1,12 @@ - + Mixed-Content: Optionally-blockable content + + - - - - - - -

Optionally-blockable content

-

Test behavior of optionally-blockable content

-
opt_in_method: no-opt-in
-                                 origin: same-host-http
-                                 source_scheme: https
-                                 context_nesting: top-level
-                                 redirection: keep-scheme-redirect
-                                 subresource: img-tag
-                                 expectation: allowed
- -

See specification - details for this test.

- -
+
diff --git a/testing/web-platform/tests/mixed-content/optionally-blockable/no-opt-in/same-host-http/img-tag/top-level/no-redirect/no-opt-in-allows.https.html b/testing/web-platform/tests/mixed-content/optionally-blockable/no-opt-in/same-host-http/img-tag/top-level/no-redirect/no-opt-in-allows.https.html index 90e3843733f5..6f0a8fdedefb 100644 --- a/testing/web-platform/tests/mixed-content/optionally-blockable/no-opt-in/same-host-http/img-tag/top-level/no-redirect/no-opt-in-allows.https.html +++ b/testing/web-platform/tests/mixed-content/optionally-blockable/no-opt-in/same-host-http/img-tag/top-level/no-redirect/no-opt-in-allows.https.html @@ -1,10 +1,12 @@ - + Mixed-Content: Optionally-blockable content + + - - - - - - -

Optionally-blockable content

-

Test behavior of optionally-blockable content

-
opt_in_method: no-opt-in
-                                 origin: same-host-http
-                                 source_scheme: https
-                                 context_nesting: top-level
-                                 redirection: no-redirect
-                                 subresource: img-tag
-                                 expectation: allowed
- -

See specification - details for this test.

- -
+
diff --git a/testing/web-platform/tests/mixed-content/optionally-blockable/no-opt-in/same-host-http/img-tag/top-level/swap-scheme-redirect/no-opt-in-allows.https.html b/testing/web-platform/tests/mixed-content/optionally-blockable/no-opt-in/same-host-http/img-tag/top-level/swap-scheme-redirect/no-opt-in-allows.https.html index d8d2853b058f..f55cce437133 100644 --- a/testing/web-platform/tests/mixed-content/optionally-blockable/no-opt-in/same-host-http/img-tag/top-level/swap-scheme-redirect/no-opt-in-allows.https.html +++ b/testing/web-platform/tests/mixed-content/optionally-blockable/no-opt-in/same-host-http/img-tag/top-level/swap-scheme-redirect/no-opt-in-allows.https.html @@ -1,10 +1,12 @@ - + Mixed-Content: Optionally-blockable content + + - - - - - - -

Optionally-blockable content

-

Test behavior of optionally-blockable content

-
opt_in_method: no-opt-in
-                                 origin: same-host-http
-                                 source_scheme: https
-                                 context_nesting: top-level
-                                 redirection: swap-scheme-redirect
-                                 subresource: img-tag
-                                 expectation: allowed
- -

See specification - details for this test.

- -
+
diff --git a/testing/web-platform/tests/mixed-content/optionally-blockable/no-opt-in/same-host-http/link-prefetch-tag/top-level/keep-scheme-redirect/no-opt-in-allows.https.html b/testing/web-platform/tests/mixed-content/optionally-blockable/no-opt-in/same-host-http/link-prefetch-tag/top-level/keep-scheme-redirect/no-opt-in-allows.https.html index 30969a0623e7..26c765720405 100644 --- a/testing/web-platform/tests/mixed-content/optionally-blockable/no-opt-in/same-host-http/link-prefetch-tag/top-level/keep-scheme-redirect/no-opt-in-allows.https.html +++ b/testing/web-platform/tests/mixed-content/optionally-blockable/no-opt-in/same-host-http/link-prefetch-tag/top-level/keep-scheme-redirect/no-opt-in-allows.https.html @@ -1,10 +1,12 @@ - + Mixed-Content: Optionally-blockable content + + - - - - - - -

Optionally-blockable content

-

Test behavior of optionally-blockable content

-
opt_in_method: no-opt-in
-                                 origin: same-host-http
-                                 source_scheme: https
-                                 context_nesting: top-level
-                                 redirection: keep-scheme-redirect
-                                 subresource: link-prefetch-tag
-                                 expectation: allowed
- -

See specification - details for this test.

- -
+
diff --git a/testing/web-platform/tests/mixed-content/optionally-blockable/no-opt-in/same-host-http/link-prefetch-tag/top-level/no-redirect/no-opt-in-allows.https.html b/testing/web-platform/tests/mixed-content/optionally-blockable/no-opt-in/same-host-http/link-prefetch-tag/top-level/no-redirect/no-opt-in-allows.https.html index 6cf5133166c2..582f6c63a5d6 100644 --- a/testing/web-platform/tests/mixed-content/optionally-blockable/no-opt-in/same-host-http/link-prefetch-tag/top-level/no-redirect/no-opt-in-allows.https.html +++ b/testing/web-platform/tests/mixed-content/optionally-blockable/no-opt-in/same-host-http/link-prefetch-tag/top-level/no-redirect/no-opt-in-allows.https.html @@ -1,10 +1,12 @@ - + Mixed-Content: Optionally-blockable content + + - - - - - - -

Optionally-blockable content

-

Test behavior of optionally-blockable content

-
opt_in_method: no-opt-in
-                                 origin: same-host-http
-                                 source_scheme: https
-                                 context_nesting: top-level
-                                 redirection: no-redirect
-                                 subresource: link-prefetch-tag
-                                 expectation: allowed
- -

See specification - details for this test.

- -
+
diff --git a/testing/web-platform/tests/mixed-content/optionally-blockable/no-opt-in/same-host-http/link-prefetch-tag/top-level/swap-scheme-redirect/no-opt-in-allows.https.html b/testing/web-platform/tests/mixed-content/optionally-blockable/no-opt-in/same-host-http/link-prefetch-tag/top-level/swap-scheme-redirect/no-opt-in-allows.https.html index 8faeaa0e5123..a7feabccba16 100644 --- a/testing/web-platform/tests/mixed-content/optionally-blockable/no-opt-in/same-host-http/link-prefetch-tag/top-level/swap-scheme-redirect/no-opt-in-allows.https.html +++ b/testing/web-platform/tests/mixed-content/optionally-blockable/no-opt-in/same-host-http/link-prefetch-tag/top-level/swap-scheme-redirect/no-opt-in-allows.https.html @@ -1,10 +1,12 @@ - + Mixed-Content: Optionally-blockable content + + - - - - - - -

Optionally-blockable content

-

Test behavior of optionally-blockable content

-
opt_in_method: no-opt-in
-                                 origin: same-host-http
-                                 source_scheme: https
-                                 context_nesting: top-level
-                                 redirection: swap-scheme-redirect
-                                 subresource: link-prefetch-tag
-                                 expectation: allowed
- -

See specification - details for this test.

- -
+
diff --git a/testing/web-platform/tests/mixed-content/optionally-blockable/no-opt-in/same-host-http/video-tag/top-level/keep-scheme-redirect/no-opt-in-allows.https.html b/testing/web-platform/tests/mixed-content/optionally-blockable/no-opt-in/same-host-http/video-tag/top-level/keep-scheme-redirect/no-opt-in-allows.https.html index 139a87d30136..68bfc2b84a81 100644 --- a/testing/web-platform/tests/mixed-content/optionally-blockable/no-opt-in/same-host-http/video-tag/top-level/keep-scheme-redirect/no-opt-in-allows.https.html +++ b/testing/web-platform/tests/mixed-content/optionally-blockable/no-opt-in/same-host-http/video-tag/top-level/keep-scheme-redirect/no-opt-in-allows.https.html @@ -1,10 +1,12 @@ - + Mixed-Content: Optionally-blockable content + + - - - - - - -

Optionally-blockable content

-

Test behavior of optionally-blockable content

-
opt_in_method: no-opt-in
-                                 origin: same-host-http
-                                 source_scheme: https
-                                 context_nesting: top-level
-                                 redirection: keep-scheme-redirect
-                                 subresource: video-tag
-                                 expectation: allowed
- -

See specification - details for this test.

- -
+
diff --git a/testing/web-platform/tests/mixed-content/optionally-blockable/no-opt-in/same-host-http/video-tag/top-level/no-redirect/no-opt-in-allows.https.html b/testing/web-platform/tests/mixed-content/optionally-blockable/no-opt-in/same-host-http/video-tag/top-level/no-redirect/no-opt-in-allows.https.html index 847d2a7000b3..2e5eff5a74ef 100644 --- a/testing/web-platform/tests/mixed-content/optionally-blockable/no-opt-in/same-host-http/video-tag/top-level/no-redirect/no-opt-in-allows.https.html +++ b/testing/web-platform/tests/mixed-content/optionally-blockable/no-opt-in/same-host-http/video-tag/top-level/no-redirect/no-opt-in-allows.https.html @@ -1,10 +1,12 @@ - + Mixed-Content: Optionally-blockable content + + - - - - - - -

Optionally-blockable content

-

Test behavior of optionally-blockable content

-
opt_in_method: no-opt-in
-                                 origin: same-host-http
-                                 source_scheme: https
-                                 context_nesting: top-level
-                                 redirection: no-redirect
-                                 subresource: video-tag
-                                 expectation: allowed
- -

See specification - details for this test.

- -
+
diff --git a/testing/web-platform/tests/mixed-content/optionally-blockable/no-opt-in/same-host-http/video-tag/top-level/swap-scheme-redirect/no-opt-in-allows.https.html b/testing/web-platform/tests/mixed-content/optionally-blockable/no-opt-in/same-host-http/video-tag/top-level/swap-scheme-redirect/no-opt-in-allows.https.html index 3deb905f7608..8c5bd7b08061 100644 --- a/testing/web-platform/tests/mixed-content/optionally-blockable/no-opt-in/same-host-http/video-tag/top-level/swap-scheme-redirect/no-opt-in-allows.https.html +++ b/testing/web-platform/tests/mixed-content/optionally-blockable/no-opt-in/same-host-http/video-tag/top-level/swap-scheme-redirect/no-opt-in-allows.https.html @@ -1,10 +1,12 @@ - + Mixed-Content: Optionally-blockable content + + - - - - - - -

Optionally-blockable content

-

Test behavior of optionally-blockable content

-
opt_in_method: no-opt-in
-                                 origin: same-host-http
-                                 source_scheme: https
-                                 context_nesting: top-level
-                                 redirection: swap-scheme-redirect
-                                 subresource: video-tag
-                                 expectation: allowed
- -

See specification - details for this test.

- -
+
diff --git a/testing/web-platform/tests/notifications/Notification-permission.html b/testing/web-platform/tests/notifications/Notification-permission.html deleted file mode 100644 index d6501b5b5c32..000000000000 --- a/testing/web-platform/tests/notifications/Notification-permission.html +++ /dev/null @@ -1,17 +0,0 @@ - - -Web Notifications Test: Notification - permission (basic) - - - - - - -
- - - diff --git a/testing/web-platform/tests/notifications/Notification-requestPermission-denied-manual.html b/testing/web-platform/tests/notifications/Notification-requestPermission-denied-manual.html deleted file mode 100644 index 583e80e69204..000000000000 --- a/testing/web-platform/tests/notifications/Notification-requestPermission-denied-manual.html +++ /dev/null @@ -1,22 +0,0 @@ - - -Web Notifications Test: Notification - requestPermission (deny) - - - - - - - -

Test Step:

-

1. When ask the user whether showing notifications, make sure choose deny.

-
- - - diff --git a/testing/web-platform/tests/notifications/Notification-requestPermission-granted-manual.html b/testing/web-platform/tests/notifications/Notification-requestPermission-granted-manual.html deleted file mode 100644 index 4cf29d2731ff..000000000000 --- a/testing/web-platform/tests/notifications/Notification-requestPermission-granted-manual.html +++ /dev/null @@ -1,22 +0,0 @@ - - -Web Notifications Test: Notification - requestPermission (allow) - - - - - - - -

Test Step:

-

1. When ask the user whether showing notifications, make sure choose allow.

-
- - - diff --git a/testing/web-platform/tests/notifications/README.md b/testing/web-platform/tests/notifications/README.md deleted file mode 100644 index 821255358f10..000000000000 --- a/testing/web-platform/tests/notifications/README.md +++ /dev/null @@ -1,5 +0,0 @@ -Web Notifications test suite. - -Latest Editor's Draft: http://dvcs.w3.org/hg/notifications/raw-file/tip/Overview.html - -Latest Technical Report: http://www.w3.org/TR/notifications/ diff --git a/testing/web-platform/tests/notifications/body-basic-manual.html b/testing/web-platform/tests/notifications/body-basic-manual.html new file mode 100644 index 000000000000..a479917aeef9 --- /dev/null +++ b/testing/web-platform/tests/notifications/body-basic-manual.html @@ -0,0 +1,28 @@ + + +Notification.body (basic) + + + + + +
+ diff --git a/testing/web-platform/tests/notifications/body-empty-manual.html b/testing/web-platform/tests/notifications/body-empty-manual.html new file mode 100644 index 000000000000..a94f08e1c5db --- /dev/null +++ b/testing/web-platform/tests/notifications/body-empty-manual.html @@ -0,0 +1,31 @@ + + +Notification.body (empty string) + + + + + +
+ diff --git a/testing/web-platform/tests/notifications/common.js b/testing/web-platform/tests/notifications/common.js new file mode 100644 index 000000000000..ecfa0e3c2d94 --- /dev/null +++ b/testing/web-platform/tests/notifications/common.js @@ -0,0 +1,48 @@ +function createPassFail(condition, test, cleanup, cleanupParam) { + var div = document.querySelector("#passfail") + var para = document.createElement("p") + var pass = document.createElement("button") + var fail = document.createElement("button") + var style = "font-family: monospace" + para.innerHTML = condition + + ', press the PASS button;' + + ' otherwise press the FAIL button.', + pass.innerHTML = "PASS" + fail.innerHTML = "FAIL" + pass.setAttribute("style", style) + fail.setAttribute("style", style) + pass.addEventListener("click", function () { + clearPassFail() + cleanup(cleanupParam) + test.done() + }, false) + fail.addEventListener("click", function () { + clearPassFail() + cleanup(cleanupParam) + test.force_timeout() + test.set_status(test.FAIL) + test.done() + }, false) + document.body.appendChild(div) + div.appendChild(para) + div.appendChild(pass) + div.appendChild(fail) +} +function clearPassFail() { + document.querySelector("#passfail").innerHTML = "" +} +function closeNotifications(notifications) { + for (var i=0; i < notifications.length; i++) { + notifications[i].close() + } +} +function hasNotificationPermission() { + Notification.requestPermission() + if (Notification.permission != "granted") { + alert("TEST NOT RUN. Change your browser settings so that" + + " notifications for this origin are allowed, and then re-run" + + " this test.") + return false + } + return true +} diff --git a/testing/web-platform/tests/notifications/constructor-basic.html b/testing/web-platform/tests/notifications/constructor-basic.html new file mode 100644 index 000000000000..a36a8ce30470 --- /dev/null +++ b/testing/web-platform/tests/notifications/constructor-basic.html @@ -0,0 +1,21 @@ + + +Notification constructor (basic) + + + + + diff --git a/testing/web-platform/tests/notifications/constructor-invalid.html b/testing/web-platform/tests/notifications/constructor-invalid.html new file mode 100644 index 000000000000..88df165e169c --- /dev/null +++ b/testing/web-platform/tests/notifications/constructor-invalid.html @@ -0,0 +1,19 @@ + + +Notification constructor (invalid) + + + + + diff --git a/testing/web-platform/tests/notifications/event-onclick-manual.html b/testing/web-platform/tests/notifications/event-onclick-manual.html index 5d06caea5f23..0d48d06ae8dc 100644 --- a/testing/web-platform/tests/notifications/event-onclick-manual.html +++ b/testing/web-platform/tests/notifications/event-onclick-manual.html @@ -1,28 +1,25 @@ -Web Notifications Test: notification - onclick (basic) +Notification.onclick (basic) - - - -
- - - + + diff --git a/testing/web-platform/tests/notifications/event-onclose.html b/testing/web-platform/tests/notifications/event-onclose.html index 27414dc4fe8d..aee3213698e7 100644 --- a/testing/web-platform/tests/notifications/event-onclose.html +++ b/testing/web-platform/tests/notifications/event-onclose.html @@ -1,31 +1,26 @@ -Web Notifications Test: notification - onclose (basic) +Notification.onclose (basic) - - - -
- - - + diff --git a/testing/web-platform/tests/notifications/event-onerror-default-manual.html b/testing/web-platform/tests/notifications/event-onerror-default-manual.html index 3e521801d4b4..4a50de736621 100644 --- a/testing/web-platform/tests/notifications/event-onerror-default-manual.html +++ b/testing/web-platform/tests/notifications/event-onerror-default-manual.html @@ -1,27 +1,27 @@ -Web Notifications Test: notification - onerror (basic) +Notification.onerror (permission=default) - - - -
- - - + diff --git a/testing/web-platform/tests/notifications/event-onerror-denied-manual.html b/testing/web-platform/tests/notifications/event-onerror-denied-manual.html index 049bd3fe7791..b90fb38cc108 100644 --- a/testing/web-platform/tests/notifications/event-onerror-denied-manual.html +++ b/testing/web-platform/tests/notifications/event-onerror-denied-manual.html @@ -1,37 +1,26 @@ -Web Notifications Test: notification - onerror (basic) +Notification.onerror (permission=denied) - - - -
-
- - - + diff --git a/testing/web-platform/tests/notifications/event-onshow.html b/testing/web-platform/tests/notifications/event-onshow.html index 8e3c7637ee13..7cc2be9de5ba 100644 --- a/testing/web-platform/tests/notifications/event-onshow.html +++ b/testing/web-platform/tests/notifications/event-onshow.html @@ -1,29 +1,25 @@ -Web Notifications Test: notification - onshow (basic) +Notification.onshow (basic) - - - -
- - - + diff --git a/testing/web-platform/tests/notifications/icon-basic-manual.html b/testing/web-platform/tests/notifications/icon-basic-manual.html new file mode 100644 index 000000000000..32e8e0bbbd8c --- /dev/null +++ b/testing/web-platform/tests/notifications/icon-basic-manual.html @@ -0,0 +1,28 @@ + + +Notification.icon (basic) + + + + + +
+ diff --git a/testing/web-platform/tests/notifications/icon-empty-manual.html b/testing/web-platform/tests/notifications/icon-empty-manual.html new file mode 100644 index 000000000000..a4b288fa5976 --- /dev/null +++ b/testing/web-platform/tests/notifications/icon-empty-manual.html @@ -0,0 +1,27 @@ + + +Notification.icon (empty string) + + + + + +
+ diff --git a/testing/web-platform/tests/notifications/instance.html b/testing/web-platform/tests/notifications/instance.html index 2451b10c6a10..c0ebe7e6998e 100644 --- a/testing/web-platform/tests/notifications/instance.html +++ b/testing/web-platform/tests/notifications/instance.html @@ -1,52 +1,63 @@ -Basic Notification instance tests +Notification instance basic tests diff --git a/testing/web-platform/tests/notifications/interfaces.html b/testing/web-platform/tests/notifications/interfaces.html index 71232e712496..5930086f5987 100644 --- a/testing/web-platform/tests/notifications/interfaces.html +++ b/testing/web-platform/tests/notifications/interfaces.html @@ -1,6 +1,6 @@ -Web Notifications IDL tests +Notification interface IDL tests
@@ -74,7 +74,7 @@ var idlArray = new IdlArray(); } }); idlArray.add_objects({ - Notification: ['new Notification("foo")'], + Notification: ['new Notification("Running idlharness.")'], }); idlArray.test(); diff --git a/testing/web-platform/tests/notifications/notification-lang.html b/testing/web-platform/tests/notifications/lang.html similarity index 69% rename from testing/web-platform/tests/notifications/notification-lang.html rename to testing/web-platform/tests/notifications/lang.html index d36fc14e3876..be1795c8c9e2 100644 --- a/testing/web-platform/tests/notifications/notification-lang.html +++ b/testing/web-platform/tests/notifications/lang.html @@ -1,15 +1,10 @@ -Web Notifications Test: notification.lang +Notification.lang - - - -
- - +for (var i=0; i diff --git a/testing/web-platform/tests/notifications/notification-body-basic-manual.html b/testing/web-platform/tests/notifications/notification-body-basic-manual.html deleted file mode 100644 index 378ad4e3f1ff..000000000000 --- a/testing/web-platform/tests/notifications/notification-body-basic-manual.html +++ /dev/null @@ -1,17 +0,0 @@ - - -Web Notifications Test: notification - body (basic) - - - - - - -

Test passes if a notification popups and the notification's body content is "Room 101".

- - - diff --git a/testing/web-platform/tests/notifications/notification-body-empty-manual.html b/testing/web-platform/tests/notifications/notification-body-empty-manual.html deleted file mode 100644 index 76be5eba6c52..000000000000 --- a/testing/web-platform/tests/notifications/notification-body-empty-manual.html +++ /dev/null @@ -1,17 +0,0 @@ - - -Web Notifications Test: notification - body (empty string) - - - - - - -

Test passes if a notification popups and the notification have no body content.

- - - diff --git a/testing/web-platform/tests/notifications/notification-close-manual.html b/testing/web-platform/tests/notifications/notification-close-manual.html deleted file mode 100644 index 7b58e26090c4..000000000000 --- a/testing/web-platform/tests/notifications/notification-close-manual.html +++ /dev/null @@ -1,21 +0,0 @@ - - -Web Notifications Test: notification - close (basic) - - - - - - -

Test passes if a notification popups and it disappears after a while(about 3 seconds).

- - - diff --git a/testing/web-platform/tests/notifications/notification-constructor-basic.html b/testing/web-platform/tests/notifications/notification-constructor-basic.html deleted file mode 100644 index 7ed12b31d05e..000000000000 --- a/testing/web-platform/tests/notifications/notification-constructor-basic.html +++ /dev/null @@ -1,20 +0,0 @@ - - -Web Notifications Test: notification - constructor (basic) - - - - - - -
- - - diff --git a/testing/web-platform/tests/notifications/notification-constructor-invalid.html b/testing/web-platform/tests/notifications/notification-constructor-invalid.html deleted file mode 100644 index d065e975e34b..000000000000 --- a/testing/web-platform/tests/notifications/notification-constructor-invalid.html +++ /dev/null @@ -1,19 +0,0 @@ - - -Web Notifications Test: notification - constructor (invalid) - - - - - - -
- - - diff --git a/testing/web-platform/tests/notifications/notification-dir-auto-manual.html b/testing/web-platform/tests/notifications/notification-dir-auto-manual.html deleted file mode 100644 index 358aa619e7ac..000000000000 --- a/testing/web-platform/tests/notifications/notification-dir-auto-manual.html +++ /dev/null @@ -1,18 +0,0 @@ - - -Web Notifications Test: notification - dir (dir attribute set to "auto") - - - - - - -

Test passes if a notification popups and the notification's direction is the left edge.

- - - diff --git a/testing/web-platform/tests/notifications/notification-dir-ltr-manual.html b/testing/web-platform/tests/notifications/notification-dir-ltr-manual.html deleted file mode 100644 index d8b74511f20f..000000000000 --- a/testing/web-platform/tests/notifications/notification-dir-ltr-manual.html +++ /dev/null @@ -1,18 +0,0 @@ - - -Web Notifications Test: notification - dir (dir attribute set to "ltr") - - - - - - -

Test passes if a notification popups and the notification's direction is the left edge.

- - - diff --git a/testing/web-platform/tests/notifications/notification-dir-rtl-manual.html b/testing/web-platform/tests/notifications/notification-dir-rtl-manual.html deleted file mode 100644 index 544773c9991a..000000000000 --- a/testing/web-platform/tests/notifications/notification-dir-rtl-manual.html +++ /dev/null @@ -1,18 +0,0 @@ - - -Web Notifications Test: notification - dir (dir attribute set to "rtl") - - - - - - -

Test passes if a notification popups and the notification's direction is the right edge.

- - - diff --git a/testing/web-platform/tests/notifications/notification-icon-basic-manual.html b/testing/web-platform/tests/notifications/notification-icon-basic-manual.html deleted file mode 100644 index 1d3a95147b11..000000000000 --- a/testing/web-platform/tests/notifications/notification-icon-basic-manual.html +++ /dev/null @@ -1,19 +0,0 @@ - - -Web Notifications Test: notification - icon (basic) - - - - - - -

Make sure connect to network.

-

Test passes if a notificaiton popups with a cat pictrue.

- - - diff --git a/testing/web-platform/tests/notifications/notification-icon-empty-manual.html b/testing/web-platform/tests/notifications/notification-icon-empty-manual.html deleted file mode 100644 index b153ed7f35cb..000000000000 --- a/testing/web-platform/tests/notifications/notification-icon-empty-manual.html +++ /dev/null @@ -1,18 +0,0 @@ - - -Web Notifications Test: notification - icon (invalid) - - - - - - -

Test passes if a notificaiton popups and notification's icon content show nothing.

- - - diff --git a/testing/web-platform/tests/notifications/notification-tag-different-manual.html b/testing/web-platform/tests/notifications/notification-tag-different-manual.html deleted file mode 100644 index ee94e8b3edeb..000000000000 --- a/testing/web-platform/tests/notifications/notification-tag-different-manual.html +++ /dev/null @@ -1,23 +0,0 @@ - - -Web Notifications Test: notification - tag (with different tag) - - - - - - -

Test passes if two notifications popups and the notification's body are different.

- - - diff --git a/testing/web-platform/tests/notifications/notification-tag-same-manual.html b/testing/web-platform/tests/notifications/notification-tag-same-manual.html deleted file mode 100644 index 5099e68c2a07..000000000000 --- a/testing/web-platform/tests/notifications/notification-tag-same-manual.html +++ /dev/null @@ -1,23 +0,0 @@ - - -Web Notifications Test: notification - tag (with same tag) - - - - - - -

Test passes if only one notification popups and the notification's body is "Room 202".

- - - diff --git a/testing/web-platform/tests/notifications/permission.html b/testing/web-platform/tests/notifications/permission.html new file mode 100644 index 000000000000..d8b201e42efe --- /dev/null +++ b/testing/web-platform/tests/notifications/permission.html @@ -0,0 +1,14 @@ + + +Notification.permission (basic) + + + + + diff --git a/testing/web-platform/tests/notifications/requestPermission-denied-manual.html b/testing/web-platform/tests/notifications/requestPermission-denied-manual.html new file mode 100644 index 000000000000..a7ec052dba7b --- /dev/null +++ b/testing/web-platform/tests/notifications/requestPermission-denied-manual.html @@ -0,0 +1,22 @@ + + +Notification.requestPermission (permission=denied) + + + + + diff --git a/testing/web-platform/tests/notifications/requestPermission-granted-manual.html b/testing/web-platform/tests/notifications/requestPermission-granted-manual.html new file mode 100644 index 000000000000..970f4e3cbc8e --- /dev/null +++ b/testing/web-platform/tests/notifications/requestPermission-granted-manual.html @@ -0,0 +1,18 @@ + + +Notification.requestPermission (permission=granted) + + + + + + diff --git a/testing/web-platform/tests/notifications/tag-different-manual.html b/testing/web-platform/tests/notifications/tag-different-manual.html new file mode 100644 index 000000000000..e463e9767019 --- /dev/null +++ b/testing/web-platform/tests/notifications/tag-different-manual.html @@ -0,0 +1,37 @@ + + +Notification.tag (two tags with different values) + + + + + +
+ diff --git a/testing/web-platform/tests/notifications/tag-same-manual.html b/testing/web-platform/tests/notifications/tag-same-manual.html new file mode 100644 index 000000000000..53ebfd35ce56 --- /dev/null +++ b/testing/web-platform/tests/notifications/tag-same-manual.html @@ -0,0 +1,37 @@ + + +Notification.tag (two tags with same value) + + + + + +
+ diff --git a/testing/web-platform/tests/referrer-policy/generic/common.js b/testing/web-platform/tests/referrer-policy/generic/common.js index f9c3ad9d19bc..571aef1f79ed 100644 --- a/testing/web-platform/tests/referrer-policy/generic/common.js +++ b/testing/web-platform/tests/referrer-policy/generic/common.js @@ -85,8 +85,6 @@ function wrapResult(url, server_data) { referrer: server_data.headers.referer, headers: server_data.headers } - - return result; } function queryIframe(url, callback) { diff --git a/testing/web-platform/tests/resources/docs/api.md b/testing/web-platform/tests/resources/docs/api.md index 6f25ad2a1fc8dbf1a3862d80234d2ccb218349fe..f3540c80e24a081eac623dc92ea03f4d074ef72c 100644 GIT binary patch delta 1167 zcmZ8hO=}cE5G5DE@e&Zv76vg1>$(KNkKjc?$$jspcBW>wNl*9CUA#?ewDz8oA>)tRGC zoCLO{YoQc{d`o(#R!gmk)RXS~ivnMD)FY zgzKutOLWha);tX2W@Hq^sPn#|A#gnc417IB(+_q_RTeQgtU6L3HN9Yv%5DcqiWap{BOsxsh92EtNIk{=>Il`r> zVvx`qRXDY4n~jH2uHn$oc@$kvEY7J-u2$n+hKnlPfPqwff@G8Xf_jzV^N#oJi?>xp z_-x>w(mUdK_3i$H_nB`IyiAiFD>D=WiCgG*tHG0_(+NZ8cUoNiy!UuKExDUFAai*1 zWkx59#UfWPF-T+DR)RQ~y%N0?#O$AuFy{Z95tG6PI#iaS3^?-zxN(iZL)^R(fW9$j z?2}b9ScAe6!rJ#k(vl89G-7#sN|S>~eSXR-zmXDv+X3kg3_6_9Wy$umSX>Qd!Eo^s z)AbS4APpJAj&|27|FA2rFXpt&i`W;|Fx%#UT5}zvz>5@ziy)^+vtfmSV&$0nQ=m$^((emrCoZi JKRtc%>JRqSpgI5m delta 21 dcmeA>#Q1Fo;|2=>MuyE60>Yx3pJ-~C0{~f62R;A* diff --git a/testing/web-platform/tests/resources/testharness.js b/testing/web-platform/tests/resources/testharness.js index 9ad4f9aa5c1a..f4c66aae6219 100644 --- a/testing/web-platform/tests/resources/testharness.js +++ b/testing/web-platform/tests/resources/testharness.js @@ -658,6 +658,14 @@ policies and contribution forms [3]. object.addEventListener(event, callback, false); } + function step_timeout(f, t) { + var outer_this = this; + var args = Array.prototype.slice.call(arguments, 2); + return setTimeout(function() { + f.apply(outer_this, args); + }, t * tests.timeout_multiplier); + } + expose(test, 'test'); expose(async_test, 'async_test'); expose(promise_test, 'promise_test'); @@ -666,6 +674,7 @@ policies and contribution forms [3]. expose(setup, 'setup'); expose(done, 'done'); expose(on_event, 'on_event'); + expose(step_timeout, 'step_timeout'); /* * Return a string truncated to the given length, with ... added at the end @@ -1422,6 +1431,14 @@ policies and contribution forms [3]. }); }; + Test.prototype.step_timeout = function(f, timeout) { + var test_this = this; + var args = Array.prototype.slice.call(arguments, 2); + return setTimeout(this.step_func(function() { + return f.apply(test_this, args); + }, timeout * tests.timeout_multiplier)); + } + Test.prototype.add_cleanup = function(callback) { this.cleanup_callbacks.push(callback); }; diff --git a/testing/web-platform/tests/selectors-api/tests/submissions/Opera/ParentNode-query-queryAll.html b/testing/web-platform/tests/selectors-api/tests/submissions/Opera/ParentNode-query-queryAll.html index f27e4e66f0ce..95237a6fd975 100644 --- a/testing/web-platform/tests/selectors-api/tests/submissions/Opera/ParentNode-query-queryAll.html +++ b/testing/web-platform/tests/selectors-api/tests/submissions/Opera/ParentNode-query-queryAll.html @@ -12,16 +12,14 @@
This test requires JavaScript.
- - - - - -
- - - diff --git a/testing/web-platform/tests/shadow-dom/elements-and-dom-objects/shadowroot-object/shadowroot-methods/test-003.html b/testing/web-platform/tests/shadow-dom/elements-and-dom-objects/shadowroot-object/shadowroot-methods/test-003.html deleted file mode 100644 index bd8ce05be779..000000000000 --- a/testing/web-platform/tests/shadow-dom/elements-and-dom-objects/shadowroot-object/shadowroot-methods/test-003.html +++ /dev/null @@ -1,154 +0,0 @@ - - - - -Shadow DOM Test: A_10_01_02_03 - - - - - - - - - -
- - - diff --git a/testing/web-platform/tests/shadow-dom/elements-and-dom-objects/shadowroot-object/shadowroot-methods/test-004.html b/testing/web-platform/tests/shadow-dom/elements-and-dom-objects/shadowroot-object/shadowroot-methods/test-004.html index 53f4a2ab3284..bbc26bf733b6 100644 --- a/testing/web-platform/tests/shadow-dom/elements-and-dom-objects/shadowroot-object/shadowroot-methods/test-004.html +++ b/testing/web-platform/tests/shadow-dom/elements-and-dom-objects/shadowroot-object/shadowroot-methods/test-004.html @@ -37,7 +37,7 @@ test(unit(function (ctx) { range.setStart(span.firstChild, 0); range.setEnd(span.firstChild, 3); - var selection = window.getSelection(); + var selection = s.getSelection(); selection.removeAllRanges(); selection.addRange(range); diff --git a/testing/web-platform/tests/shadow-dom/elements-and-dom-objects/shadowroot-object/shadowroot-methods/test-005.html b/testing/web-platform/tests/shadow-dom/elements-and-dom-objects/shadowroot-object/shadowroot-methods/test-005.html deleted file mode 100644 index 8ce777f5e33b..000000000000 --- a/testing/web-platform/tests/shadow-dom/elements-and-dom-objects/shadowroot-object/shadowroot-methods/test-005.html +++ /dev/null @@ -1,80 +0,0 @@ - - - - -Shadow DOM Test: A_10_01_02_05 - - - - - - - - - -
- - - diff --git a/testing/web-platform/tests/shadow-dom/elements-and-dom-objects/shadowroot-object/shadowroot-methods/test-006.html b/testing/web-platform/tests/shadow-dom/elements-and-dom-objects/shadowroot-object/shadowroot-methods/test-006.html index 30b63067354c..354c7a0e3c9d 100644 --- a/testing/web-platform/tests/shadow-dom/elements-and-dom-objects/shadowroot-object/shadowroot-methods/test-006.html +++ b/testing/web-platform/tests/shadow-dom/elements-and-dom-objects/shadowroot-object/shadowroot-methods/test-006.html @@ -24,7 +24,7 @@ policies and contribution forms [3]. diff --git a/testing/web-platform/tests/shadow-dom/html-elements-and-their-shadow-trees/test-004.html b/testing/web-platform/tests/shadow-dom/html-elements-and-their-shadow-trees/test-004.html index 579f9616a065..200ade6b1b85 100644 --- a/testing/web-platform/tests/shadow-dom/html-elements-and-their-shadow-trees/test-004.html +++ b/testing/web-platform/tests/shadow-dom/html-elements-and-their-shadow-trees/test-004.html @@ -43,33 +43,6 @@ test(unit(function (ctx) { assert_equals(d.querySelector('#flbk').offsetTop, 0, 'Fallback content shouldn\'t be rendered'); }), 'A_09_00_04_T01'); - - - -//test summary:first-of-type -test(unit(function (ctx) { - - var d = newRenderedHTMLDocument(ctx); - - // create element - var el = d.createElement('details'); - el.setAttribute('open', 'open'); - d.body.appendChild(el); - - el.innerHTML = '' + - '' + - 'This is a node that should be distributed' + - '' + - 'Unlucky content'; - - var s = el.createShadowRoot(); - s.innerHTML = ''; - - assert_true(d.querySelector('#shadow').offsetTop > 0, 'details should allow insertion point' + - 'with summary:first-of-type matching criteria'); - assert_equals(d.querySelector('#flbk').offsetTop, 0, 'Fallback content shouldn\'t be rendered'); - -}), 'A_09_00_04_T02'); diff --git a/testing/web-platform/tests/shadow-dom/shadow-trees/content-pseudo-element/test-001.html b/testing/web-platform/tests/shadow-dom/shadow-trees/content-pseudo-element/test-001.html index ffafc7795e57..dfb96741aa73 100644 --- a/testing/web-platform/tests/shadow-dom/shadow-trees/content-pseudo-element/test-001.html +++ b/testing/web-platform/tests/shadow-dom/shadow-trees/content-pseudo-element/test-001.html @@ -36,7 +36,7 @@ A_04_04_01_T1.step(function () { //make shadow tree var ul = d.querySelector('ul.stories'); - var s = createSR(ul); + var s = ul.createShadowRoot(); var subdiv1 = d.createElement('div'); subdiv1.innerHTML = '
'; s.appendChild(subdiv1); diff --git a/testing/web-platform/tests/shadow-dom/shadow-trees/content-pseudo-element/test-002.html b/testing/web-platform/tests/shadow-dom/shadow-trees/content-pseudo-element/test-002.html index d583cfed4d63..e81d92bf4f66 100644 --- a/testing/web-platform/tests/shadow-dom/shadow-trees/content-pseudo-element/test-002.html +++ b/testing/web-platform/tests/shadow-dom/shadow-trees/content-pseudo-element/test-002.html @@ -35,7 +35,7 @@ A_04_04_01_T2.step(function () { //make shadow tree var ul = d.querySelector('ul.stories'); - var s = createSR(ul); + var s = ul.createShadowRoot(); var subdiv1 = d.createElement('div'); subdiv1.innerHTML = '
'; s.appendChild(subdiv1); diff --git a/testing/web-platform/tests/shadow-dom/shadow-trees/hosting-multiple-shadow-trees-002-ref.html b/testing/web-platform/tests/shadow-dom/shadow-trees/hosting-multiple-shadow-trees-002-ref.html deleted file mode 100644 index 6cc4b52ec6a8..000000000000 --- a/testing/web-platform/tests/shadow-dom/shadow-trees/hosting-multiple-shadow-trees-002-ref.html +++ /dev/null @@ -1,15 +0,0 @@ - - - - - Shadow DOM - The older tree is inserted into shadow, and the original branch is inserted into content. - - - -
-

Younger tree's node

-

Older tree's node

-

Original tree's node

-
- - diff --git a/testing/web-platform/tests/shadow-dom/shadow-trees/hosting-multiple-shadow-trees-002.html b/testing/web-platform/tests/shadow-dom/shadow-trees/hosting-multiple-shadow-trees-002.html deleted file mode 100644 index 4d589b505503..000000000000 --- a/testing/web-platform/tests/shadow-dom/shadow-trees/hosting-multiple-shadow-trees-002.html +++ /dev/null @@ -1,23 +0,0 @@ - - - - - Shadow DOM Test - Tests shadow inserts older tree. - - - - - - - -
-

Original tree's node

-
- - - diff --git a/testing/web-platform/tests/shadow-dom/shadow-trees/hosting-multiple-shadow-trees-003-ref.html b/testing/web-platform/tests/shadow-dom/shadow-trees/hosting-multiple-shadow-trees-003-ref.html deleted file mode 100644 index 629821c2c750..000000000000 --- a/testing/web-platform/tests/shadow-dom/shadow-trees/hosting-multiple-shadow-trees-003-ref.html +++ /dev/null @@ -1,15 +0,0 @@ - - - - - Shadow DOM - The shadow should insert original tree's node if no older shadow tree exists. - - - -
-

Younger tree's node

-

Older tree's node

-

Original tree's node

-
- - diff --git a/testing/web-platform/tests/shadow-dom/shadow-trees/hosting-multiple-shadow-trees-003.html b/testing/web-platform/tests/shadow-dom/shadow-trees/hosting-multiple-shadow-trees-003.html deleted file mode 100644 index b9f237275f98..000000000000 --- a/testing/web-platform/tests/shadow-dom/shadow-trees/hosting-multiple-shadow-trees-003.html +++ /dev/null @@ -1,23 +0,0 @@ - - - - - Shadow DOM Test - Tests shadow should insert original tree's node if no older shadow tree exists. - - - - - - - -
-

Original tree's node

-
- - - diff --git a/testing/web-platform/tests/shadow-dom/shadow-trees/hosting-multiple-shadow-trees-004-ref.html b/testing/web-platform/tests/shadow-dom/shadow-trees/hosting-multiple-shadow-trees-004-ref.html deleted file mode 100644 index 29d5eff0e214..000000000000 --- a/testing/web-platform/tests/shadow-dom/shadow-trees/hosting-multiple-shadow-trees-004-ref.html +++ /dev/null @@ -1,14 +0,0 @@ - - - - - Shadow DOM - The only first shadow element is used. - - - -
-

1st shadow tree's node

-

2nd shadow tree's node

-
- - diff --git a/testing/web-platform/tests/shadow-dom/shadow-trees/hosting-multiple-shadow-trees-004.html b/testing/web-platform/tests/shadow-dom/shadow-trees/hosting-multiple-shadow-trees-004.html deleted file mode 100644 index 5dfffd13a9a4..000000000000 --- a/testing/web-platform/tests/shadow-dom/shadow-trees/hosting-multiple-shadow-trees-004.html +++ /dev/null @@ -1,23 +0,0 @@ - - - - - Shadow DOM Test - The only first shadow element is used. - - - - - - - -
-

Original tree's node

-
- - - diff --git a/testing/web-platform/tests/shadow-dom/shadow-trees/hosting-multiple-shadow-trees-005-ref.html b/testing/web-platform/tests/shadow-dom/shadow-trees/hosting-multiple-shadow-trees-005-ref.html deleted file mode 100644 index 6d7b13af7068..000000000000 --- a/testing/web-platform/tests/shadow-dom/shadow-trees/hosting-multiple-shadow-trees-005-ref.html +++ /dev/null @@ -1,14 +0,0 @@ - - - - - Shadow DOM - Older shadow tree is not used - - - -
-

2nd shadow tree's node

-

Original tree's node

-
- - diff --git a/testing/web-platform/tests/shadow-dom/shadow-trees/hosting-multiple-shadow-trees-005.html b/testing/web-platform/tests/shadow-dom/shadow-trees/hosting-multiple-shadow-trees-005.html deleted file mode 100644 index 82d54d0cb878..000000000000 --- a/testing/web-platform/tests/shadow-dom/shadow-trees/hosting-multiple-shadow-trees-005.html +++ /dev/null @@ -1,23 +0,0 @@ - - - - - Shadow DOM Test - The older shadow tree is not used. - - - - - - - -
-

Original tree's node

-
- - - diff --git a/testing/web-platform/tests/shadow-dom/shadow-trees/hosting-multiple-shadow-trees-006-ref.html b/testing/web-platform/tests/shadow-dom/shadow-trees/hosting-multiple-shadow-trees-006-ref.html deleted file mode 100644 index ea90ce8ad35f..000000000000 --- a/testing/web-platform/tests/shadow-dom/shadow-trees/hosting-multiple-shadow-trees-006-ref.html +++ /dev/null @@ -1,15 +0,0 @@ - - - - - Shadow DOM - Content and shadow elements are both inserted - - - -
-

2nd shadow tree's node

-

Original tree's node

-

1st shadow tree's node

-
- - diff --git a/testing/web-platform/tests/shadow-dom/shadow-trees/hosting-multiple-shadow-trees-006.html b/testing/web-platform/tests/shadow-dom/shadow-trees/hosting-multiple-shadow-trees-006.html deleted file mode 100644 index a352be28790f..000000000000 --- a/testing/web-platform/tests/shadow-dom/shadow-trees/hosting-multiple-shadow-trees-006.html +++ /dev/null @@ -1,23 +0,0 @@ - - - - - Shadow DOM Test - Content and shadow elements are both inserted. - - - - - - - -
-

Original tree's node

-
- - - diff --git a/testing/web-platform/tests/shadow-dom/shadow-trees/hosting-multiple-shadow-trees/test-001.html b/testing/web-platform/tests/shadow-dom/shadow-trees/hosting-multiple-shadow-trees/test-001.html deleted file mode 100644 index a62bcf32ed63..000000000000 --- a/testing/web-platform/tests/shadow-dom/shadow-trees/hosting-multiple-shadow-trees/test-001.html +++ /dev/null @@ -1,128 +0,0 @@ - - - - -Shadow DOM Test: A_04_05_01 - - - - - - - - - -
- - - diff --git a/testing/web-platform/tests/shadow-dom/shadow-trees/hosting-multiple-shadow-trees/test-002.html b/testing/web-platform/tests/shadow-dom/shadow-trees/hosting-multiple-shadow-trees/test-002.html deleted file mode 100644 index a9e967878c22..000000000000 --- a/testing/web-platform/tests/shadow-dom/shadow-trees/hosting-multiple-shadow-trees/test-002.html +++ /dev/null @@ -1,86 +0,0 @@ - - - - -Shadow DOM Test: A_04_05_02 - - - - - - - - - -
- - - diff --git a/testing/web-platform/tests/shadow-dom/shadow-trees/hosting-multiple-shadow-trees/test-003.html b/testing/web-platform/tests/shadow-dom/shadow-trees/hosting-multiple-shadow-trees/test-003.html deleted file mode 100644 index 13dbe3f4e964..000000000000 --- a/testing/web-platform/tests/shadow-dom/shadow-trees/hosting-multiple-shadow-trees/test-003.html +++ /dev/null @@ -1,88 +0,0 @@ - - - - -Shadow DOM Test: A_04_05_03 - - - - - - - - - -
- - - diff --git a/testing/web-platform/tests/shadow-dom/shadow-trees/satisfying-matching-criteria/test-006.html b/testing/web-platform/tests/shadow-dom/shadow-trees/satisfying-matching-criteria/test-006.html deleted file mode 100644 index b6731d5d8676..000000000000 --- a/testing/web-platform/tests/shadow-dom/shadow-trees/satisfying-matching-criteria/test-006.html +++ /dev/null @@ -1,58 +0,0 @@ - - - - -Shadow DOM Test: A_04_03_06_01 - - - - - - - - - -
- - - diff --git a/testing/web-platform/tests/shadow-dom/shadow-trees/satisfying-matching-criteria/test-007.html b/testing/web-platform/tests/shadow-dom/shadow-trees/satisfying-matching-criteria/test-007.html deleted file mode 100644 index f1cf07f17944..000000000000 --- a/testing/web-platform/tests/shadow-dom/shadow-trees/satisfying-matching-criteria/test-007.html +++ /dev/null @@ -1,59 +0,0 @@ - - - - -Shadow DOM Test: A_04_03_06_03 - - - - - - - - - -
- - - diff --git a/testing/web-platform/tests/shadow-dom/shadow-trees/satisfying-matching-criteria/test-008.html b/testing/web-platform/tests/shadow-dom/shadow-trees/satisfying-matching-criteria/test-008.html deleted file mode 100644 index f90e04b3c40c..000000000000 --- a/testing/web-platform/tests/shadow-dom/shadow-trees/satisfying-matching-criteria/test-008.html +++ /dev/null @@ -1,59 +0,0 @@ - - - - -Shadow DOM Test: A_04_03_06_04 - - - - - - - - - -
- - - diff --git a/testing/web-platform/tests/shadow-dom/shadow-trees/satisfying-matching-criteria/test-009.html b/testing/web-platform/tests/shadow-dom/shadow-trees/satisfying-matching-criteria/test-009.html deleted file mode 100644 index 1dc5b81625d4..000000000000 --- a/testing/web-platform/tests/shadow-dom/shadow-trees/satisfying-matching-criteria/test-009.html +++ /dev/null @@ -1,59 +0,0 @@ - - - - -Shadow DOM Test: A_04_03_06_05 - - - - - - - - - -
- - - diff --git a/testing/web-platform/tests/shadow-dom/shadow-trees/satisfying-matching-criteria/test-010.html b/testing/web-platform/tests/shadow-dom/shadow-trees/satisfying-matching-criteria/test-010.html deleted file mode 100644 index 9ad8a6c09095..000000000000 --- a/testing/web-platform/tests/shadow-dom/shadow-trees/satisfying-matching-criteria/test-010.html +++ /dev/null @@ -1,59 +0,0 @@ - - - - -Shadow DOM Test: A_04_03_06_06 - - - - - - - - - -
- - - diff --git a/testing/web-platform/tests/shadow-dom/shadow-trees/satisfying-matching-criteria/test-011.html b/testing/web-platform/tests/shadow-dom/shadow-trees/satisfying-matching-criteria/test-011.html deleted file mode 100644 index 4def9a0c6480..000000000000 --- a/testing/web-platform/tests/shadow-dom/shadow-trees/satisfying-matching-criteria/test-011.html +++ /dev/null @@ -1,61 +0,0 @@ - - - - -Shadow DOM Test: A_04_03_06_07 - - - - - - - - - -
- - - diff --git a/testing/web-platform/tests/shadow-dom/shadow-trees/satisfying-matching-criteria/test-012.html b/testing/web-platform/tests/shadow-dom/shadow-trees/satisfying-matching-criteria/test-012.html deleted file mode 100644 index a7dd85cd9df1..000000000000 --- a/testing/web-platform/tests/shadow-dom/shadow-trees/satisfying-matching-criteria/test-012.html +++ /dev/null @@ -1,67 +0,0 @@ - - - - -Shadow DOM Test: A_04_03_06_08 - - - - - - - - - -
- - - diff --git a/testing/web-platform/tests/shadow-dom/shadow-trees/satisfying-matching-criteria/test-013.html b/testing/web-platform/tests/shadow-dom/shadow-trees/satisfying-matching-criteria/test-013.html deleted file mode 100644 index 31e4f310a69a..000000000000 --- a/testing/web-platform/tests/shadow-dom/shadow-trees/satisfying-matching-criteria/test-013.html +++ /dev/null @@ -1,67 +0,0 @@ - - - - -Shadow DOM Test: A_04_03_06_09 - - - - - - - - - -
- - - diff --git a/testing/web-platform/tests/shadow-dom/shadow-trees/satisfying-matching-criteria/test-014.html b/testing/web-platform/tests/shadow-dom/shadow-trees/satisfying-matching-criteria/test-014.html deleted file mode 100644 index 3f0eaad05bc0..000000000000 --- a/testing/web-platform/tests/shadow-dom/shadow-trees/satisfying-matching-criteria/test-014.html +++ /dev/null @@ -1,67 +0,0 @@ - - - - -Shadow DOM Test: A_04_03_06_10 - - - - - - - - - -
- - - diff --git a/testing/web-platform/tests/shadow-dom/shadow-trees/satisfying-matching-criteria/test-015.html b/testing/web-platform/tests/shadow-dom/shadow-trees/satisfying-matching-criteria/test-015.html deleted file mode 100644 index a074086f88eb..000000000000 --- a/testing/web-platform/tests/shadow-dom/shadow-trees/satisfying-matching-criteria/test-015.html +++ /dev/null @@ -1,67 +0,0 @@ - - - - -Shadow DOM Test: A_04_03_06_11 - - - - - - - - - -
- - - diff --git a/testing/web-platform/tests/shadow-dom/shadow-trees/satisfying-matching-criteria/test-016.html b/testing/web-platform/tests/shadow-dom/shadow-trees/satisfying-matching-criteria/test-016.html deleted file mode 100644 index 919c32626241..000000000000 --- a/testing/web-platform/tests/shadow-dom/shadow-trees/satisfying-matching-criteria/test-016.html +++ /dev/null @@ -1,67 +0,0 @@ - - - - -Shadow DOM Test: A_04_03_06_12 - - - - - - - - - -
- - - diff --git a/testing/web-platform/tests/shadow-dom/shadow-trees/satisfying-matching-criteria/test-017.html b/testing/web-platform/tests/shadow-dom/shadow-trees/satisfying-matching-criteria/test-017.html deleted file mode 100644 index 711c8c65add0..000000000000 --- a/testing/web-platform/tests/shadow-dom/shadow-trees/satisfying-matching-criteria/test-017.html +++ /dev/null @@ -1,67 +0,0 @@ - - - - -Shadow DOM Test: A_04_03_06_13 - - - - - - - - - -
- - - diff --git a/testing/web-platform/tests/shadow-dom/shadow-trees/satisfying-matching-criteria/test-018.html b/testing/web-platform/tests/shadow-dom/shadow-trees/satisfying-matching-criteria/test-018.html deleted file mode 100644 index 93f991fd45ea..000000000000 --- a/testing/web-platform/tests/shadow-dom/shadow-trees/satisfying-matching-criteria/test-018.html +++ /dev/null @@ -1,67 +0,0 @@ - - - - -Shadow DOM Test: A_04_03_06_14 - - - - - - - - - -
- - - diff --git a/testing/web-platform/tests/shadow-dom/shadow-trees/satisfying-matching-criteria/test-019.html b/testing/web-platform/tests/shadow-dom/shadow-trees/satisfying-matching-criteria/test-019.html deleted file mode 100644 index 8b7a07f50196..000000000000 --- a/testing/web-platform/tests/shadow-dom/shadow-trees/satisfying-matching-criteria/test-019.html +++ /dev/null @@ -1,67 +0,0 @@ - - - - -Shadow DOM Test: A_04_03_06_15 - - - - - - - - - -
- - - diff --git a/testing/web-platform/tests/shadow-dom/shadow-trees/satisfying-matching-criteria/test-020.html b/testing/web-platform/tests/shadow-dom/shadow-trees/satisfying-matching-criteria/test-020.html deleted file mode 100644 index 15ad4e620e39..000000000000 --- a/testing/web-platform/tests/shadow-dom/shadow-trees/satisfying-matching-criteria/test-020.html +++ /dev/null @@ -1,79 +0,0 @@ - - - - -Shadow DOM Test: A_04_03_06_16 - - - - - - - - - -
- - - diff --git a/testing/web-platform/tests/shadow-dom/shadow-trees/text-decoration-001.html b/testing/web-platform/tests/shadow-dom/shadow-trees/text-decoration-001.html index f22c3a3854e0..47d5efda0e61 100644 --- a/testing/web-platform/tests/shadow-dom/shadow-trees/text-decoration-001.html +++ b/testing/web-platform/tests/shadow-dom/shadow-trees/text-decoration-001.html @@ -13,7 +13,7 @@ - - - - - -
- - - diff --git a/testing/web-platform/tests/subresource-integrity/alternate.css b/testing/web-platform/tests/subresource-integrity/alternate.css new file mode 100644 index 000000000000..0ea6d22ec772 --- /dev/null +++ b/testing/web-platform/tests/subresource-integrity/alternate.css @@ -0,0 +1 @@ +.testdiv{ background-color: red } diff --git a/testing/web-platform/tests/subresource-integrity/subresource-integrity.html b/testing/web-platform/tests/subresource-integrity/subresource-integrity.html index e1dab10814ac..6bb6b4cf852d 100644 --- a/testing/web-platform/tests/subresource-integrity/subresource-integrity.html +++ b/testing/web-platform/tests/subresource-integrity/subresource-integrity.html @@ -3,6 +3,7 @@ Subresource Integrity +
@@ -68,12 +69,12 @@ // of executing them one at a time, the style tests are implemented as a // queue that builds up a list of tests, and then executes them one at a // time. - var SRIStyleTest = function(queue, pass, name, href, integrityValue, crossoriginValue) { + var SRIStyleTest = function(queue, pass, name, attrs, customCallback, altPassValue) { this.pass = pass; this.name = "Style: " + name; - this.href = href; - this.integrityValue = integrityValue; - this.crossoriginValue = crossoriginValue; + this.customCallback = customCallback || function () {}; + this.attrs = attrs || {}; + this.passValue = altPassValue || "rgb(255, 255, 0)"; this.test = async_test(this.name); @@ -82,6 +83,7 @@ } SRIStyleTest.prototype.execute = function() { + var that = this; var container = document.getElementById("container"); while (container.hasChildNodes()) { container.removeChild(container.firstChild); @@ -92,17 +94,18 @@ var div = document.createElement("div"); div.className = "testdiv"; var e = document.createElement("link"); - e.rel = "stylesheet"; - e.href = this.href; - e.setAttribute("integrity", this.integrityValue); - if(this.crossoriginValue) { - e.setAttribute("crossorigin", this.crossoriginValue); + this.attrs.rel = this.attrs.rel || "stylesheet"; + for (var key in this.attrs) { + if (this.attrs.hasOwnProperty(key)) { + e.setAttribute(key, this.attrs[key]); + } } + if(this.pass) { e.addEventListener("load", function() { test.step(function() { var background = window.getComputedStyle(div, null).getPropertyValue("background-color"); - assert_equals(background, "rgb(255, 255, 0)"); + assert_equals(background, that.passValue); test.done(); }); }); @@ -123,6 +126,7 @@ } container.appendChild(div); container.appendChild(e); + this.customCallback(e, container); }; var style_tests = []; @@ -281,157 +285,256 @@ style_tests, true, "Same-origin with correct sha256 hash", - "style.css", - "sha256-CzHgdJ7wOccM8L89n4bhcJMz3F-SPLT7YZk7gyCWUV4=" + { + href: "style.css", + integrity: "sha256-CzHgdJ7wOccM8L89n4bhcJMz3F-SPLT7YZk7gyCWUV4=" + } ); new SRIStyleTest( style_tests, true, "Same-origin with correct sha384 hash", - "style.css", - "sha384-wDAWxH4tOWBwAwHfBn9B7XuNmFxHTMeigAMwn0iVQ0zq3FtmYMLxihcGnU64CwcX" + { + href: "style.css", + integrity: "sha384-wDAWxH4tOWBwAwHfBn9B7XuNmFxHTMeigAMwn0iVQ0zq3FtmYMLxihcGnU64CwcX" + } ); new SRIStyleTest( style_tests, true, "Same-origin with correct sha512 hash", - "style.css", - "sha512-9wXDjd6Wq3H6nPAhI9zOvG7mJkUr03MTxaO+8ztTKnfJif42laL93Be/IF6YYZHHF4esitVYxiwpY2HSZX4l6w==" + { + href: "style.css", + integrity: "sha512-9wXDjd6Wq3H6nPAhI9zOvG7mJkUr03MTxaO+8ztTKnfJif42laL93Be/IF6YYZHHF4esitVYxiwpY2HSZX4l6w==" + } ); new SRIStyleTest( style_tests, true, "Same-origin with empty integrity", - "style.css", - "" + { + href: "style.css", + integrity: "" + } ); new SRIStyleTest( style_tests, false, "Same-origin with incorrect hash.", - "style.css", - "sha256-deadbeefdeadbeefdeadbeefdeadbeefdeadbeefdead" + { + href: "style.css", + integrity: "sha256-deadbeefdeadbeefdeadbeefdeadbeefdeadbeefdead" + } ); new SRIStyleTest( style_tests, true, "Same-origin with multiple sha256 hashes, including correct.", - "style.css", - "sha256-CzHgdJ7wOccM8L89n4bhcJMz3F-SPLT7YZk7gyCWUV4= sha256-deadbeefdeadbeefdeadbeefdeadbeefdeadbeefdead" + { + href: "style.css", + integrity: "sha256-CzHgdJ7wOccM8L89n4bhcJMz3F-SPLT7YZk7gyCWUV4= sha256-deadbeefdeadbeefdeadbeefdeadbeefdeadbeefdead" + } ); new SRIStyleTest( style_tests, true, "Same-origin with multiple sha256 hashes, including unknown algorithm.", - "style.css", - "sha256-CzHgdJ7wOccM8L89n4bhcJMz3F-SPLT7YZk7gyCWUV4= foo666-deadbeefdeadbeefdeadbeefdeadbeefdeadbeefdead" + { + href: "style.css", + integrity: "sha256-CzHgdJ7wOccM8L89n4bhcJMz3F-SPLT7YZk7gyCWUV4= foo666-deadbeefdeadbeefdeadbeefdeadbeefdeadbeefdead" + } ); new SRIStyleTest( style_tests, true, "Same-origin with sha256 mismatch, sha512 match", - "style.css", - "sha512-9wXDjd6Wq3H6nPAhI9zOvG7mJkUr03MTxaO+8ztTKnfJif42laL93Be/IF6YYZHHF4esitVYxiwpY2HSZX4l6w== sha256-deadbeefdeadbeefdeadbeefdeadbeefdeadbeefdead" + { + href: "style.css", + integrity: "sha512-9wXDjd6Wq3H6nPAhI9zOvG7mJkUr03MTxaO+8ztTKnfJif42laL93Be/IF6YYZHHF4esitVYxiwpY2HSZX4l6w== sha256-deadbeefdeadbeefdeadbeefdeadbeefdeadbeefdead" + } ); new SRIStyleTest( style_tests, false, "Same-origin with sha256 match, sha512 mismatch", - "style.css", - "sha512-deadbeef9wXDjd6Wq3H6nPAhI9zOvG7mJkUr03MTxaO+8ztTKnfJif42laL93Be/IF6YYZHHF4esitVYxiwpY2== sha256-CzHgdJ7wOccM8L89n4bhcJMz3F-SPLT7YZk7gyCWUV4=" + { + href: "style.css", + integrity: "sha512-deadbeef9wXDjd6Wq3H6nPAhI9zOvG7mJkUr03MTxaO+8ztTKnfJif42laL93Be/IF6YYZHHF4esitVYxiwpY2== sha256-CzHgdJ7wOccM8L89n4bhcJMz3F-SPLT7YZk7gyCWUV4=" + } ); new SRIStyleTest( style_tests, true, " with correct hash, ACAO: *", - xorigin_anon_style, - "sha256-CzHgdJ7wOccM8L89n4bhcJMz3F+SPLT7YZk7gyCWUV4=", - "anonymous" + { + href: xorigin_anon_style, + integrity: "sha256-CzHgdJ7wOccM8L89n4bhcJMz3F+SPLT7YZk7gyCWUV4=", + crossorigin: "anonymous" + } ); new SRIStyleTest( style_tests, false, " with incorrect hash, ACAO: *", - xorigin_anon_style, - "sha256-deadbeefCzHgdJ7wOccM8L89n4bhcJMz3F+SPLT7YZk=", - "anonymous" + { + href: xorigin_anon_style, + integrity: "sha256-deadbeefCzHgdJ7wOccM8L89n4bhcJMz3F+SPLT7YZk=", + crossorigin: "anonymous" + } ); new SRIStyleTest( style_tests, true, " with correct hash, CORS-eligible", - xorigin_creds_style, - "sha256-CzHgdJ7wOccM8L89n4bhcJMz3F+SPLT7YZk7gyCWUV4=", - "use-credentials" + { + href: xorigin_creds_style, + integrity: "sha256-CzHgdJ7wOccM8L89n4bhcJMz3F+SPLT7YZk7gyCWUV4=", + crossorigin: "use-credentials" + } ); new SRIStyleTest( style_tests, false, " with incorrect hash CORS-eligible", - xorigin_creds_style, - "sha256-deadbeefCzHgdJ7wOccM8L89n4bhcJMz3F+SPLT7YZk=", - "use-credentials" + { + href: xorigin_creds_style, + integrity: "sha256-deadbeefCzHgdJ7wOccM8L89n4bhcJMz3F+SPLT7YZk=", + crossorigin: "use-credentials" + } ); new SRIStyleTest( style_tests, false, " with CORS-ineligible resource", - xorigin_ineligible_style, - "sha256-CzHgdJ7wOccM8L89n4bhcJMz3F+SPLT7YZk7gyCWUV4=", - "anonymous" + { + href: xorigin_ineligible_style, + integrity: "sha256-CzHgdJ7wOccM8L89n4bhcJMz3F+SPLT7YZk7gyCWUV4=", + crossorigin: "anonymous" + } ); new SRIStyleTest( style_tests, true, "Cross-origin, not CORS request, with correct hash", - xorigin_anon_style, - "sha256-CzHgdJ7wOccM8L89n4bhcJMz3F+SPLT7YZk7gyCWUV4=" + { + href: xorigin_anon_style, + integrity: "sha256-CzHgdJ7wOccM8L89n4bhcJMz3F+SPLT7YZk7gyCWUV4=" + } ); new SRIStyleTest( style_tests, true, "Cross-origin, not CORS request, with hash masmatch", - xorigin_anon_style, - "sha256-deadbeefCzHgdJ7wOccM8L89n4bhcJMz3F+SPLT7YZk=" + { + href: xorigin_anon_style, + integrity: "sha256-deadbeefCzHgdJ7wOccM8L89n4bhcJMz3F+SPLT7YZk=" + } ); new SRIStyleTest( style_tests, true, "Cross-origin, empty integrity", - xorigin_anon_style, - "" + { + href: xorigin_anon_style, + integrity: "" + } ); new SRIStyleTest( style_tests, true, "Same-origin with correct hash, options.", - "style.css", - "sha256-CzHgdJ7wOccM8L89n4bhcJMz3F+SPLT7YZk7gyCWUV4=?foo=bar?spam=eggs" + { + href: "style.css", + integrity: "sha256-CzHgdJ7wOccM8L89n4bhcJMz3F+SPLT7YZk7gyCWUV4=?foo=bar?spam=eggs" + } ); new SRIStyleTest( style_tests, true, "Same-origin with unknown algorithm only.", - "style.css", - "foo666-CzHgdJ7wOccM8L89n4bhcJMz3F+SPLT7YZk7gyCWUV4=?foo=bar?spam=eggs" + { + href: "style.css", + integrity: "foo666-CzHgdJ7wOccM8L89n4bhcJMz3F+SPLT7YZk7gyCWUV4=?foo=bar?spam=eggs" + } + ); + + new SRIStyleTest( + style_tests, + true, + "Same-origin with correct sha256 hash, rel='stylesheet license'", + { + href: "style.css", + integrity: "sha256-CzHgdJ7wOccM8L89n4bhcJMz3F-SPLT7YZk7gyCWUV4=", + rel: "stylesheet license" + } + ); + + new SRIStyleTest( + style_tests, + true, + "Same-origin with correct sha256 hash, rel='license stylesheet'", + { + href: "style.css", + integrity: "sha256-CzHgdJ7wOccM8L89n4bhcJMz3F-SPLT7YZk7gyCWUV4=", + rel: "license stylesheet" + } + ); + + new SRIStyleTest( + style_tests, + true, + "Same-origin with correct sha256 and sha512 hash, rel='alternate stylesheet' enabled", + { + href: "alternate.css", + title: "alt", + type: "text/css", + class: "alternate", + disabled: "disabled", + rel: "alternate stylesheet", + integrity: "sha256-phbz83bWhnLig+d2VPKrRrTRyhqoDRo1ruGqZLZ0= sha512-8OYEB7ktnzcb6h+kB9CUIuc8qvKIyLpygRJdQSEEycRy74dUsB+Yu9rSjpOPjRUblle8WWX9Gn7v39LK2Oceig==", + }, + function (link, container) { + var alternate = document.querySelector('link.alternate'); + alternate.disabled = false; + }, + "rgb(255, 0, 0)" + ); + + new SRIStyleTest( + style_tests, + false, + "Same-origin with incorrect sha256 and sha512 hash, rel='alternate stylesheet' enabled", + { + href: "alternate.css", + title: "alt", + type: "text/css", + class: "alternate", + disabled: "disabled", + rel: "alternate stylesheet", + integrity: "sha256-fail83bWhnLig+d2VPKrRrTRyhqoDRo1ruGqZLZ0= sha512-failB7ktnzcb6h+kB9CUIuc8qvKIyLpygRJdQSEEycRy74dUsB+Yu9rSjpOPjRUblle8WWX9Gn7v39LK2Oceig==", + }, + function (link, container) { + var alternate = document.querySelector('link.alternate'); + alternate.disabled = false; + } ); style_tests.execute(); diff --git a/testing/web-platform/tests/websockets/interfaces/WebSocket/url/resolve.html b/testing/web-platform/tests/websockets/interfaces/WebSocket/url/resolve.html new file mode 100644 index 000000000000..7708b69c8b6e --- /dev/null +++ b/testing/web-platform/tests/websockets/interfaces/WebSocket/url/resolve.html @@ -0,0 +1,12 @@ + +WebSocket#url: resolving + + + +
+ From 01984ab540e079f55238e0380df038bf31e9ece4 Mon Sep 17 00:00:00 2001 From: James Graham Date: Fri, 24 Jul 2015 19:14:55 +0100 Subject: [PATCH 066/136] Bug 1187720 - Update web-platform-tests expected data to revision 4bc69f287365a67585d470300a2ef109689cf465, a=testonly --- .../FileAPI/blob/Blob-constructor.html.ini | 3 - .../meta/FileAPI/idlharness.worker.js.ini | 176 ++++++++++++++++++ .../nodes/Node-lookupNamespaceURI.html.ini | 41 ++++ .../web-platform/meta/hr-time/basic.html.ini | 1 - .../min-width-not-important.html.ini} | 2 +- .../allowed.https.html.ini | 1 + .../no-redirect/allowed.https.html.ini | 2 + .../no-redirect/allowed.https.html.ini | 6 - .../allowed.https.html.ini | 3 +- .../no-redirect/allowed.https.html.ini | 3 +- .../no-redirect/allowed.https.html.ini | 3 +- .../allowed.https.html.ini | 3 +- .../no-redirect/allowed.https.html.ini | 3 +- .../no-redirect/opt-in-blocks.https.html.ini | 3 +- .../opt-in-blocks.https.html.ini | 3 +- .../opt-in-blocks.https.html.ini | 3 +- .../no-redirect/opt-in-blocks.https.html.ini | 3 +- .../opt-in-blocks.https.html.ini | 3 +- .../no-redirect/opt-in-blocks.https.html.ini | 9 + .../no-redirect/opt-in-blocks.https.html.ini | 3 +- .../opt-in-blocks.https.html.ini | 3 +- .../opt-in-blocks.https.html.ini | 3 +- .../no-redirect/opt-in-blocks.https.html.ini | 3 +- .../opt-in-blocks.https.html.ini | 3 +- .../no-redirect/opt-in-blocks.https.html.ini | 9 + .../no-opt-in-blocks.https.html.ini | 2 +- .../no-opt-in-blocks.https.html.ini | 3 +- .../no-opt-in-blocks.https.html.ini | 3 +- .../no-opt-in-blocks.https.html.ini | 3 +- .../no-opt-in-blocks.https.html.ini | 3 +- .../no-opt-in-blocks.https.html.ini | 9 + .../no-opt-in-blocks.https.html.ini | 4 +- .../no-opt-in-blocks.https.html.ini | 3 +- .../no-opt-in-blocks.https.html.ini | 3 +- .../no-opt-in-blocks.https.html.ini | 3 +- .../no-opt-in-blocks.https.html.ini | 3 +- .../no-opt-in-blocks.https.html.ini | 9 + .../opt-in-blocks.https.html.ini | 3 +- .../no-redirect/opt-in-blocks.https.html.ini | 3 +- .../opt-in-blocks.https.html.ini | 3 +- .../opt-in-blocks.https.html.ini | 3 +- .../no-redirect/opt-in-blocks.https.html.ini | 3 +- .../opt-in-blocks.https.html.ini | 3 +- .../no-redirect/opt-in-blocks.https.html.ini | 3 +- .../no-redirect/opt-in-blocks.https.html.ini | 3 +- .../no-opt-in-allows.https.html.ini | 3 +- .../no-opt-in-allows.https.html.ini | 3 +- .../no-opt-in-allows.https.html.ini | 3 +- .../no-opt-in-allows.https.html.ini | 3 +- .../no-opt-in-allows.https.html.ini | 3 +- .../no-opt-in-allows.https.html.ini | 3 +- .../notifications/constructor-basic.html.ini | 6 + .../constructor-invalid.html.ini | 6 + .../meta/notifications/event-onclose.html.ini | 3 + .../meta/notifications/event-onshow.html.ini | 3 + .../meta/notifications/instance.html.ini | 6 + .../meta/notifications/lang.html.ini | 114 ++++++++++++ .../notifications/notification-lang.html.ini | 6 - .../Opera/script_scheduling/111.html.ini | 6 - .../shadowroot-methods}/test-006.html.ini | 2 +- ...hosting-multiple-shadow-trees-002.html.ini | 3 - ...hosting-multiple-shadow-trees-003.html.ini | 3 - .../test-001.html.ini | 5 - .../test-002.html.ini | 5 - .../test-003.html.ini | 5 - .../test-007.html.ini | 5 - .../test-008.html.ini | 5 - .../test-009.html.ini | 5 - .../test-010.html.ini | 5 - .../test-011.html.ini | 5 - .../test-012.html.ini | 5 - .../test-013.html.ini | 5 - .../test-014.html.ini | 5 - .../test-015.html.ini | 5 - .../test-016.html.ini | 5 - .../test-017.html.ini | 5 - .../test-018.html.ini | 5 - .../test-019.html.ini | 5 - .../test-020.html.ini | 5 - .../meta/shadow-dom/styles/test-002.html.ini | 5 - .../subresource-integrity.html.ini | 3 + .../service-worker/fetch-csp.https.html.ini | 6 +- ...ch-event-async-respond-with.https.html.ini | 9 +- ...pond-with-stops-propagation.https.html.ini | 9 +- .../fetch-frame-resource.https.html.ini | 10 +- .../fetch-request-xhr.https.html.ini | 6 +- .../fetch-response-xhr.https.html.ini | 6 +- .../invalid-blobtype.https.html.ini | 6 +- .../invalid-header.https.html.ini | 6 +- .../service-worker/referer.https.html.ini | 6 +- 90 files changed, 493 insertions(+), 207 deletions(-) create mode 100644 testing/web-platform/meta/FileAPI/idlharness.worker.js.ini create mode 100644 testing/web-platform/meta/dom/nodes/Node-lookupNamespaceURI.html.ini rename testing/web-platform/meta/{shadow-dom/shadow-trees/text-decoration-001.html.ini => html/rendering/non-replaced-elements/the-fieldset-element-0/min-width-not-important.html.ini} (51%) delete mode 100644 testing/web-platform/meta/mixed-content/allowed/http-csp/same-host-https/form-tag/top-level/no-redirect/allowed.https.html.ini create mode 100644 testing/web-platform/meta/mixed-content/blockable/http-csp/cross-origin-http/picture-tag/top-level/no-redirect/opt-in-blocks.https.html.ini create mode 100644 testing/web-platform/meta/mixed-content/blockable/http-csp/same-host-http/picture-tag/top-level/no-redirect/opt-in-blocks.https.html.ini create mode 100644 testing/web-platform/meta/mixed-content/blockable/no-opt-in/cross-origin-http/picture-tag/top-level/no-redirect/no-opt-in-blocks.https.html.ini create mode 100644 testing/web-platform/meta/mixed-content/blockable/no-opt-in/same-host-http/picture-tag/top-level/no-redirect/no-opt-in-blocks.https.html.ini create mode 100644 testing/web-platform/meta/notifications/constructor-basic.html.ini create mode 100644 testing/web-platform/meta/notifications/constructor-invalid.html.ini create mode 100644 testing/web-platform/meta/notifications/instance.html.ini create mode 100644 testing/web-platform/meta/notifications/lang.html.ini delete mode 100644 testing/web-platform/meta/notifications/notification-lang.html.ini delete mode 100644 testing/web-platform/meta/old-tests/submission/Opera/script_scheduling/111.html.ini rename testing/web-platform/meta/shadow-dom/{shadow-trees/satisfying-matching-criteria => elements-and-dom-objects/shadowroot-object/shadowroot-methods}/test-006.html.ini (69%) delete mode 100644 testing/web-platform/meta/shadow-dom/shadow-trees/hosting-multiple-shadow-trees-002.html.ini delete mode 100644 testing/web-platform/meta/shadow-dom/shadow-trees/hosting-multiple-shadow-trees-003.html.ini delete mode 100644 testing/web-platform/meta/shadow-dom/shadow-trees/hosting-multiple-shadow-trees/test-001.html.ini delete mode 100644 testing/web-platform/meta/shadow-dom/shadow-trees/hosting-multiple-shadow-trees/test-002.html.ini delete mode 100644 testing/web-platform/meta/shadow-dom/shadow-trees/hosting-multiple-shadow-trees/test-003.html.ini delete mode 100644 testing/web-platform/meta/shadow-dom/shadow-trees/satisfying-matching-criteria/test-007.html.ini delete mode 100644 testing/web-platform/meta/shadow-dom/shadow-trees/satisfying-matching-criteria/test-008.html.ini delete mode 100644 testing/web-platform/meta/shadow-dom/shadow-trees/satisfying-matching-criteria/test-009.html.ini delete mode 100644 testing/web-platform/meta/shadow-dom/shadow-trees/satisfying-matching-criteria/test-010.html.ini delete mode 100644 testing/web-platform/meta/shadow-dom/shadow-trees/satisfying-matching-criteria/test-011.html.ini delete mode 100644 testing/web-platform/meta/shadow-dom/shadow-trees/satisfying-matching-criteria/test-012.html.ini delete mode 100644 testing/web-platform/meta/shadow-dom/shadow-trees/satisfying-matching-criteria/test-013.html.ini delete mode 100644 testing/web-platform/meta/shadow-dom/shadow-trees/satisfying-matching-criteria/test-014.html.ini delete mode 100644 testing/web-platform/meta/shadow-dom/shadow-trees/satisfying-matching-criteria/test-015.html.ini delete mode 100644 testing/web-platform/meta/shadow-dom/shadow-trees/satisfying-matching-criteria/test-016.html.ini delete mode 100644 testing/web-platform/meta/shadow-dom/shadow-trees/satisfying-matching-criteria/test-017.html.ini delete mode 100644 testing/web-platform/meta/shadow-dom/shadow-trees/satisfying-matching-criteria/test-018.html.ini delete mode 100644 testing/web-platform/meta/shadow-dom/shadow-trees/satisfying-matching-criteria/test-019.html.ini delete mode 100644 testing/web-platform/meta/shadow-dom/shadow-trees/satisfying-matching-criteria/test-020.html.ini delete mode 100644 testing/web-platform/meta/shadow-dom/styles/test-002.html.ini diff --git a/testing/web-platform/meta/FileAPI/blob/Blob-constructor.html.ini b/testing/web-platform/meta/FileAPI/blob/Blob-constructor.html.ini index b7ba48eb7eaa..6b3e04b1e7aa 100644 --- a/testing/web-platform/meta/FileAPI/blob/Blob-constructor.html.ini +++ b/testing/web-platform/meta/FileAPI/blob/Blob-constructor.html.ini @@ -1,8 +1,5 @@ [Blob-constructor.html] type: testharness - [no-argument Blob constructor without 'new'] - expected: FAIL - [A plain object should be treated as a sequence for the blobParts argument.] expected: FAIL diff --git a/testing/web-platform/meta/FileAPI/idlharness.worker.js.ini b/testing/web-platform/meta/FileAPI/idlharness.worker.js.ini new file mode 100644 index 000000000000..1519b7d55402 --- /dev/null +++ b/testing/web-platform/meta/FileAPI/idlharness.worker.js.ini @@ -0,0 +1,176 @@ +[idlharness.worker] + type: testharness + [URL interface: operation createFor(Blob)] + expected: FAIL + + [Blob interface: attribute isClosed] + expected: FAIL + + [Blob interface: operation close()] + expected: FAIL + + [Blob interface: new Blob(["TEST"\]) must inherit property "isClosed" with the proper type (2)] + expected: FAIL + + [Blob interface: new Blob(["TEST"\]) must inherit property "close" with the proper type (4)] + expected: FAIL + + [File interface object length] + expected: FAIL + + [Blob interface: new File(["myFileBits"\], "myFileName") must inherit property "isClosed" with the proper type (2)] + expected: FAIL + + [Blob interface: new File(["myFileBits"\], "myFileName") must inherit property "close" with the proper type (4)] + expected: FAIL + + [FileList interface: existence and properties of interface object] + expected: FAIL + + [FileList interface object length] + expected: FAIL + + [FileList interface: existence and properties of interface prototype object] + expected: FAIL + + [FileList interface: existence and properties of interface prototype object's "constructor" property] + expected: FAIL + + [FileList interface: operation item(unsigned long)] + expected: FAIL + + [FileList interface: attribute length] + expected: FAIL + + [FileReader interface: existence and properties of interface object] + expected: FAIL + + [FileReader interface object length] + expected: FAIL + + [FileReader interface: existence and properties of interface prototype object] + expected: FAIL + + [FileReader interface: existence and properties of interface prototype object's "constructor" property] + expected: FAIL + + [FileReader interface: operation readAsArrayBuffer(Blob)] + expected: FAIL + + [FileReader interface: operation readAsText(Blob,DOMString)] + expected: FAIL + + [FileReader interface: operation readAsDataURL(Blob)] + expected: FAIL + + [FileReader interface: operation abort()] + expected: FAIL + + [FileReader interface: constant EMPTY on interface object] + expected: FAIL + + [FileReader interface: constant EMPTY on interface prototype object] + expected: FAIL + + [FileReader interface: constant LOADING on interface object] + expected: FAIL + + [FileReader interface: constant LOADING on interface prototype object] + expected: FAIL + + [FileReader interface: constant DONE on interface object] + expected: FAIL + + [FileReader interface: constant DONE on interface prototype object] + expected: FAIL + + [FileReader interface: attribute readyState] + expected: FAIL + + [FileReader interface: attribute result] + expected: FAIL + + [FileReader interface: attribute error] + expected: FAIL + + [FileReader interface: attribute onloadstart] + expected: FAIL + + [FileReader interface: attribute onprogress] + expected: FAIL + + [FileReader interface: attribute onload] + expected: FAIL + + [FileReader interface: attribute onabort] + expected: FAIL + + [FileReader interface: attribute onerror] + expected: FAIL + + [FileReader interface: attribute onloadend] + expected: FAIL + + [FileReader must be primary interface of new FileReader()] + expected: FAIL + + [Stringification of new FileReader()] + expected: FAIL + + [FileReader interface: new FileReader() must inherit property "readAsArrayBuffer" with the proper type (0)] + expected: FAIL + + [FileReader interface: calling readAsArrayBuffer(Blob) on new FileReader() with too few arguments must throw TypeError] + expected: FAIL + + [FileReader interface: new FileReader() must inherit property "readAsText" with the proper type (1)] + expected: FAIL + + [FileReader interface: calling readAsText(Blob,DOMString) on new FileReader() with too few arguments must throw TypeError] + expected: FAIL + + [FileReader interface: new FileReader() must inherit property "readAsDataURL" with the proper type (2)] + expected: FAIL + + [FileReader interface: calling readAsDataURL(Blob) on new FileReader() with too few arguments must throw TypeError] + expected: FAIL + + [FileReader interface: new FileReader() must inherit property "abort" with the proper type (3)] + expected: FAIL + + [FileReader interface: new FileReader() must inherit property "EMPTY" with the proper type (4)] + expected: FAIL + + [FileReader interface: new FileReader() must inherit property "LOADING" with the proper type (5)] + expected: FAIL + + [FileReader interface: new FileReader() must inherit property "DONE" with the proper type (6)] + expected: FAIL + + [FileReader interface: new FileReader() must inherit property "readyState" with the proper type (7)] + expected: FAIL + + [FileReader interface: new FileReader() must inherit property "result" with the proper type (8)] + expected: FAIL + + [FileReader interface: new FileReader() must inherit property "error" with the proper type (9)] + expected: FAIL + + [FileReader interface: new FileReader() must inherit property "onloadstart" with the proper type (10)] + expected: FAIL + + [FileReader interface: new FileReader() must inherit property "onprogress" with the proper type (11)] + expected: FAIL + + [FileReader interface: new FileReader() must inherit property "onload" with the proper type (12)] + expected: FAIL + + [FileReader interface: new FileReader() must inherit property "onabort" with the proper type (13)] + expected: FAIL + + [FileReader interface: new FileReader() must inherit property "onerror" with the proper type (14)] + expected: FAIL + + [FileReader interface: new FileReader() must inherit property "onloadend" with the proper type (15)] + expected: FAIL + diff --git a/testing/web-platform/meta/dom/nodes/Node-lookupNamespaceURI.html.ini b/testing/web-platform/meta/dom/nodes/Node-lookupNamespaceURI.html.ini new file mode 100644 index 000000000000..750fe3e09d97 --- /dev/null +++ b/testing/web-platform/meta/dom/nodes/Node-lookupNamespaceURI.html.ini @@ -0,0 +1,41 @@ +[Node-lookupNamespaceURI.html] + type: testharness + [Element should not have XMLNS namespace] + expected: FAIL + + [Element has namespace URI matching prefix] + expected: FAIL + + [Element does not has namespace with xlmns prefix] + expected: FAIL + + [Comment should inherit namespace URI matching prefix] + expected: FAIL + + [Child element should inherit baz namespace] + expected: FAIL + + [Child element should have null namespace] + expected: FAIL + + [Child element should not have XMLNS namespace] + expected: FAIL + + [Child element has namespace URI matching prefix] + expected: FAIL + + [baz namespace is default for child] + expected: FAIL + + [childNamespace is default for child] + expected: FAIL + + [Document should have xhtml namespace] + expected: FAIL + + [For document, baz namespace is not default] + expected: FAIL + + [For document, xhtml namespace is default] + expected: FAIL + diff --git a/testing/web-platform/meta/hr-time/basic.html.ini b/testing/web-platform/meta/hr-time/basic.html.ini index d8aac34fe3d8..2b73f1638ced 100644 --- a/testing/web-platform/meta/hr-time/basic.html.ini +++ b/testing/web-platform/meta/hr-time/basic.html.ini @@ -4,4 +4,3 @@ disabled: if os == "win": inaccurate clock on Windows - diff --git a/testing/web-platform/meta/shadow-dom/shadow-trees/text-decoration-001.html.ini b/testing/web-platform/meta/html/rendering/non-replaced-elements/the-fieldset-element-0/min-width-not-important.html.ini similarity index 51% rename from testing/web-platform/meta/shadow-dom/shadow-trees/text-decoration-001.html.ini rename to testing/web-platform/meta/html/rendering/non-replaced-elements/the-fieldset-element-0/min-width-not-important.html.ini index 3be2dc1fbb1f..1e690f30beda 100644 --- a/testing/web-platform/meta/shadow-dom/shadow-trees/text-decoration-001.html.ini +++ b/testing/web-platform/meta/html/rendering/non-replaced-elements/the-fieldset-element-0/min-width-not-important.html.ini @@ -1,3 +1,3 @@ -[text-decoration-001.html] +[min-width-not-important.html] type: reftest expected: FAIL diff --git a/testing/web-platform/meta/mixed-content/allowed/http-csp/same-host-https/audio-tag/top-level/keep-scheme-redirect/allowed.https.html.ini b/testing/web-platform/meta/mixed-content/allowed/http-csp/same-host-https/audio-tag/top-level/keep-scheme-redirect/allowed.https.html.ini index 1dfdae7ec0ae..f27219258a5e 100644 --- a/testing/web-platform/meta/mixed-content/allowed/http-csp/same-host-https/audio-tag/top-level/keep-scheme-redirect/allowed.https.html.ini +++ b/testing/web-platform/meta/mixed-content/allowed/http-csp/same-host-https/audio-tag/top-level/keep-scheme-redirect/allowed.https.html.ini @@ -2,6 +2,7 @@ type: testharness expected: if not debug and (os == "mac") and (version == "OS X 10.8") and (processor == "x86_64") and (bits == 64): ERROR + if debug and (os == "mac") and (version == "OS X 10.8") and (processor == "x86_64") and (bits == 64): ERROR [opt_in_method: http-csp\n origin: same-host-https\n source_scheme: https\n context_nesting: top-level\n redirection: keep-scheme-redirect\n subresource: audio-tag\n expectation: allowed] expected: if not debug and (os == "linux") and (version == "Ubuntu 12.04") and (processor == "x86") and (bits == 32): PASS diff --git a/testing/web-platform/meta/mixed-content/allowed/http-csp/same-host-https/audio-tag/top-level/no-redirect/allowed.https.html.ini b/testing/web-platform/meta/mixed-content/allowed/http-csp/same-host-https/audio-tag/top-level/no-redirect/allowed.https.html.ini index 5a08712e3b70..8f43360c9c67 100644 --- a/testing/web-platform/meta/mixed-content/allowed/http-csp/same-host-https/audio-tag/top-level/no-redirect/allowed.https.html.ini +++ b/testing/web-platform/meta/mixed-content/allowed/http-csp/same-host-https/audio-tag/top-level/no-redirect/allowed.https.html.ini @@ -1,5 +1,7 @@ [allowed.https.html] type: testharness + expected: + if not debug and (os == "mac") and (version == "OS X 10.8") and (processor == "x86_64") and (bits == 64): ERROR [opt_in_method: http-csp\n origin: same-host-https\n source_scheme: https\n context_nesting: top-level\n redirection: no-redirect\n subresource: audio-tag\n expectation: allowed] expected: if not debug and (os == "linux") and (version == "Ubuntu 12.04") and (processor == "x86") and (bits == 32): PASS diff --git a/testing/web-platform/meta/mixed-content/allowed/http-csp/same-host-https/form-tag/top-level/no-redirect/allowed.https.html.ini b/testing/web-platform/meta/mixed-content/allowed/http-csp/same-host-https/form-tag/top-level/no-redirect/allowed.https.html.ini deleted file mode 100644 index e9f49f042f06..000000000000 --- a/testing/web-platform/meta/mixed-content/allowed/http-csp/same-host-https/form-tag/top-level/no-redirect/allowed.https.html.ini +++ /dev/null @@ -1,6 +0,0 @@ -[allowed.https.html] - type: testharness - [opt_in_method: http-csp\n origin: same-host-https\n source_scheme: https\n context_nesting: top-level\n redirection: no-redirect\n subresource: form-tag\n expectation: allowed] - expected: - if debug and (os == "win") and (version == "6.2.9200") and (processor == "x86_64") and (bits == 64): FAIL - diff --git a/testing/web-platform/meta/mixed-content/allowed/http-csp/same-host-https/link-prefetch-tag/top-level/keep-scheme-redirect/allowed.https.html.ini b/testing/web-platform/meta/mixed-content/allowed/http-csp/same-host-https/link-prefetch-tag/top-level/keep-scheme-redirect/allowed.https.html.ini index f47a315f391c..abc68ca7ff1b 100644 --- a/testing/web-platform/meta/mixed-content/allowed/http-csp/same-host-https/link-prefetch-tag/top-level/keep-scheme-redirect/allowed.https.html.ini +++ b/testing/web-platform/meta/mixed-content/allowed/http-csp/same-host-https/link-prefetch-tag/top-level/keep-scheme-redirect/allowed.https.html.ini @@ -1,5 +1,6 @@ [allowed.https.html] type: testharness + expected: TIMEOUT [opt_in_method: http-csp\n origin: same-host-https\n source_scheme: https\n context_nesting: top-level\n redirection: keep-scheme-redirect\n subresource: link-prefetch-tag\n expectation: allowed] - expected: FAIL + expected: NOTRUN diff --git a/testing/web-platform/meta/mixed-content/allowed/http-csp/same-host-https/link-prefetch-tag/top-level/no-redirect/allowed.https.html.ini b/testing/web-platform/meta/mixed-content/allowed/http-csp/same-host-https/link-prefetch-tag/top-level/no-redirect/allowed.https.html.ini index 8d87d8dae975..cd9c1398da26 100644 --- a/testing/web-platform/meta/mixed-content/allowed/http-csp/same-host-https/link-prefetch-tag/top-level/no-redirect/allowed.https.html.ini +++ b/testing/web-platform/meta/mixed-content/allowed/http-csp/same-host-https/link-prefetch-tag/top-level/no-redirect/allowed.https.html.ini @@ -1,5 +1,6 @@ [allowed.https.html] type: testharness + expected: TIMEOUT [opt_in_method: http-csp\n origin: same-host-https\n source_scheme: https\n context_nesting: top-level\n redirection: no-redirect\n subresource: link-prefetch-tag\n expectation: allowed] - expected: FAIL + expected: NOTRUN diff --git a/testing/web-platform/meta/mixed-content/allowed/meta-csp/same-host-https/link-prefetch-tag/top-level/no-redirect/allowed.https.html.ini b/testing/web-platform/meta/mixed-content/allowed/meta-csp/same-host-https/link-prefetch-tag/top-level/no-redirect/allowed.https.html.ini index a1e1be9a67b9..9d7b944a9699 100644 --- a/testing/web-platform/meta/mixed-content/allowed/meta-csp/same-host-https/link-prefetch-tag/top-level/no-redirect/allowed.https.html.ini +++ b/testing/web-platform/meta/mixed-content/allowed/meta-csp/same-host-https/link-prefetch-tag/top-level/no-redirect/allowed.https.html.ini @@ -1,5 +1,6 @@ [allowed.https.html] type: testharness + expected: TIMEOUT [opt_in_method: meta-csp\n origin: same-host-https\n source_scheme: https\n context_nesting: top-level\n redirection: no-redirect\n subresource: link-prefetch-tag\n expectation: allowed] - expected: FAIL + expected: NOTRUN diff --git a/testing/web-platform/meta/mixed-content/allowed/no-opt-in/same-host-https/link-prefetch-tag/top-level/keep-scheme-redirect/allowed.https.html.ini b/testing/web-platform/meta/mixed-content/allowed/no-opt-in/same-host-https/link-prefetch-tag/top-level/keep-scheme-redirect/allowed.https.html.ini index 141ae59c95cb..f0087ab36b42 100644 --- a/testing/web-platform/meta/mixed-content/allowed/no-opt-in/same-host-https/link-prefetch-tag/top-level/keep-scheme-redirect/allowed.https.html.ini +++ b/testing/web-platform/meta/mixed-content/allowed/no-opt-in/same-host-https/link-prefetch-tag/top-level/keep-scheme-redirect/allowed.https.html.ini @@ -1,5 +1,6 @@ [allowed.https.html] type: testharness + expected: TIMEOUT [opt_in_method: no-opt-in\n origin: same-host-https\n source_scheme: https\n context_nesting: top-level\n redirection: keep-scheme-redirect\n subresource: link-prefetch-tag\n expectation: allowed] - expected: FAIL + expected: NOTRUN diff --git a/testing/web-platform/meta/mixed-content/allowed/no-opt-in/same-host-https/link-prefetch-tag/top-level/no-redirect/allowed.https.html.ini b/testing/web-platform/meta/mixed-content/allowed/no-opt-in/same-host-https/link-prefetch-tag/top-level/no-redirect/allowed.https.html.ini index f7cc21a7f43b..c455279290f6 100644 --- a/testing/web-platform/meta/mixed-content/allowed/no-opt-in/same-host-https/link-prefetch-tag/top-level/no-redirect/allowed.https.html.ini +++ b/testing/web-platform/meta/mixed-content/allowed/no-opt-in/same-host-https/link-prefetch-tag/top-level/no-redirect/allowed.https.html.ini @@ -1,5 +1,6 @@ [allowed.https.html] type: testharness + expected: TIMEOUT [opt_in_method: no-opt-in\n origin: same-host-https\n source_scheme: https\n context_nesting: top-level\n redirection: no-redirect\n subresource: link-prefetch-tag\n expectation: allowed] - expected: FAIL + expected: NOTRUN diff --git a/testing/web-platform/meta/mixed-content/blockable/http-csp/cross-origin-http/link-css-tag/top-level/no-redirect/opt-in-blocks.https.html.ini b/testing/web-platform/meta/mixed-content/blockable/http-csp/cross-origin-http/link-css-tag/top-level/no-redirect/opt-in-blocks.https.html.ini index 2352caf72d02..8e10ee484705 100644 --- a/testing/web-platform/meta/mixed-content/blockable/http-csp/cross-origin-http/link-css-tag/top-level/no-redirect/opt-in-blocks.https.html.ini +++ b/testing/web-platform/meta/mixed-content/blockable/http-csp/cross-origin-http/link-css-tag/top-level/no-redirect/opt-in-blocks.https.html.ini @@ -14,6 +14,7 @@ if debug and (os == "win") and (version == "6.1.7601") and (processor == "x86") and (bits == 32): TIMEOUT if not debug and (os == "win") and (version == "5.1.2600") and (processor == "x86") and (bits == 32): TIMEOUT if not debug and (os == "win") and (version == "6.1.7601") and (processor == "x86") and (bits == 32): TIMEOUT + if debug and (os == "linux") and (version == "Ubuntu 12.04") and (processor == "x86") and (bits == 32): TIMEOUT [opt_in_method: http-csp\n origin: cross-origin-http\n source_scheme: https\n context_nesting: top-level\n redirection: no-redirect\n subresource: link-css-tag\n expectation: blocked] - expected: FAIL + expected: NOTRUN diff --git a/testing/web-platform/meta/mixed-content/blockable/http-csp/cross-origin-http/link-css-tag/top-level/swap-scheme-redirect/opt-in-blocks.https.html.ini b/testing/web-platform/meta/mixed-content/blockable/http-csp/cross-origin-http/link-css-tag/top-level/swap-scheme-redirect/opt-in-blocks.https.html.ini index f9b9e3c5ec13..729452bb53c2 100644 --- a/testing/web-platform/meta/mixed-content/blockable/http-csp/cross-origin-http/link-css-tag/top-level/swap-scheme-redirect/opt-in-blocks.https.html.ini +++ b/testing/web-platform/meta/mixed-content/blockable/http-csp/cross-origin-http/link-css-tag/top-level/swap-scheme-redirect/opt-in-blocks.https.html.ini @@ -1,5 +1,6 @@ [opt-in-blocks.https.html] type: testharness + expected: TIMEOUT [opt_in_method: http-csp\n origin: cross-origin-http\n source_scheme: https\n context_nesting: top-level\n redirection: swap-scheme-redirect\n subresource: link-css-tag\n expectation: blocked] - expected: FAIL + expected: NOTRUN diff --git a/testing/web-platform/meta/mixed-content/blockable/http-csp/cross-origin-http/object-tag/top-level/keep-scheme-redirect/opt-in-blocks.https.html.ini b/testing/web-platform/meta/mixed-content/blockable/http-csp/cross-origin-http/object-tag/top-level/keep-scheme-redirect/opt-in-blocks.https.html.ini index 545a790a1e12..3f201fedc464 100644 --- a/testing/web-platform/meta/mixed-content/blockable/http-csp/cross-origin-http/object-tag/top-level/keep-scheme-redirect/opt-in-blocks.https.html.ini +++ b/testing/web-platform/meta/mixed-content/blockable/http-csp/cross-origin-http/object-tag/top-level/keep-scheme-redirect/opt-in-blocks.https.html.ini @@ -1,5 +1,6 @@ [opt-in-blocks.https.html] type: testharness + expected: TIMEOUT [opt_in_method: http-csp\n origin: cross-origin-http\n source_scheme: https\n context_nesting: top-level\n redirection: keep-scheme-redirect\n subresource: object-tag\n expectation: blocked] - expected: FAIL + expected: NOTRUN diff --git a/testing/web-platform/meta/mixed-content/blockable/http-csp/cross-origin-http/object-tag/top-level/no-redirect/opt-in-blocks.https.html.ini b/testing/web-platform/meta/mixed-content/blockable/http-csp/cross-origin-http/object-tag/top-level/no-redirect/opt-in-blocks.https.html.ini index ccc18194f0bb..bc0bf321647e 100644 --- a/testing/web-platform/meta/mixed-content/blockable/http-csp/cross-origin-http/object-tag/top-level/no-redirect/opt-in-blocks.https.html.ini +++ b/testing/web-platform/meta/mixed-content/blockable/http-csp/cross-origin-http/object-tag/top-level/no-redirect/opt-in-blocks.https.html.ini @@ -1,5 +1,6 @@ [opt-in-blocks.https.html] type: testharness + expected: TIMEOUT [opt_in_method: http-csp\n origin: cross-origin-http\n source_scheme: https\n context_nesting: top-level\n redirection: no-redirect\n subresource: object-tag\n expectation: blocked] - expected: FAIL + expected: NOTRUN diff --git a/testing/web-platform/meta/mixed-content/blockable/http-csp/cross-origin-http/object-tag/top-level/swap-scheme-redirect/opt-in-blocks.https.html.ini b/testing/web-platform/meta/mixed-content/blockable/http-csp/cross-origin-http/object-tag/top-level/swap-scheme-redirect/opt-in-blocks.https.html.ini index bd5170cc15f7..fe9e215697b0 100644 --- a/testing/web-platform/meta/mixed-content/blockable/http-csp/cross-origin-http/object-tag/top-level/swap-scheme-redirect/opt-in-blocks.https.html.ini +++ b/testing/web-platform/meta/mixed-content/blockable/http-csp/cross-origin-http/object-tag/top-level/swap-scheme-redirect/opt-in-blocks.https.html.ini @@ -1,5 +1,6 @@ [opt-in-blocks.https.html] type: testharness + expected: TIMEOUT [opt_in_method: http-csp\n origin: cross-origin-http\n source_scheme: https\n context_nesting: top-level\n redirection: swap-scheme-redirect\n subresource: object-tag\n expectation: blocked] - expected: FAIL + expected: NOTRUN diff --git a/testing/web-platform/meta/mixed-content/blockable/http-csp/cross-origin-http/picture-tag/top-level/no-redirect/opt-in-blocks.https.html.ini b/testing/web-platform/meta/mixed-content/blockable/http-csp/cross-origin-http/picture-tag/top-level/no-redirect/opt-in-blocks.https.html.ini new file mode 100644 index 000000000000..882f7b6a35b0 --- /dev/null +++ b/testing/web-platform/meta/mixed-content/blockable/http-csp/cross-origin-http/picture-tag/top-level/no-redirect/opt-in-blocks.https.html.ini @@ -0,0 +1,9 @@ +[opt-in-blocks.https.html] + type: testharness + [opt_in_method: http-csp\n origin: cross-origin-http\n source_scheme: https\n context_nesting: top-level\n redirection: no-redirect\n subresource: picture-tag\n expectation: blocked] + expected: + if debug and (os == "linux") and (version == "Ubuntu 12.04") and (processor == "x86_64") and (bits == 64): FAIL + if debug and (os == "linux") and (version == "Ubuntu 12.04") and (processor == "x86") and (bits == 32): FAIL + if debug and (os == "mac") and (version == "OS X 10.8") and (processor == "x86_64") and (bits == 64): FAIL + if debug and (os == "mac") and (version == "OS X 10.10.2") and (processor == "x86_64") and (bits == 64): FAIL + diff --git a/testing/web-platform/meta/mixed-content/blockable/http-csp/same-host-http/link-css-tag/top-level/no-redirect/opt-in-blocks.https.html.ini b/testing/web-platform/meta/mixed-content/blockable/http-csp/same-host-http/link-css-tag/top-level/no-redirect/opt-in-blocks.https.html.ini index a9cec1710d4e..baa593babf96 100644 --- a/testing/web-platform/meta/mixed-content/blockable/http-csp/same-host-http/link-css-tag/top-level/no-redirect/opt-in-blocks.https.html.ini +++ b/testing/web-platform/meta/mixed-content/blockable/http-csp/same-host-http/link-css-tag/top-level/no-redirect/opt-in-blocks.https.html.ini @@ -14,6 +14,7 @@ if debug and (os == "win") and (version == "6.1.7601") and (processor == "x86") and (bits == 32): TIMEOUT if not debug and (os == "win") and (version == "5.1.2600") and (processor == "x86") and (bits == 32): TIMEOUT if not debug and (os == "win") and (version == "6.1.7601") and (processor == "x86") and (bits == 32): TIMEOUT + if debug and (os == "linux") and (version == "Ubuntu 12.04") and (processor == "x86") and (bits == 32): TIMEOUT [opt_in_method: http-csp\n origin: same-host-http\n source_scheme: https\n context_nesting: top-level\n redirection: no-redirect\n subresource: link-css-tag\n expectation: blocked] - expected: FAIL + expected: NOTRUN diff --git a/testing/web-platform/meta/mixed-content/blockable/http-csp/same-host-http/link-css-tag/top-level/swap-scheme-redirect/opt-in-blocks.https.html.ini b/testing/web-platform/meta/mixed-content/blockable/http-csp/same-host-http/link-css-tag/top-level/swap-scheme-redirect/opt-in-blocks.https.html.ini index d35b59ea5565..e259c6af4927 100644 --- a/testing/web-platform/meta/mixed-content/blockable/http-csp/same-host-http/link-css-tag/top-level/swap-scheme-redirect/opt-in-blocks.https.html.ini +++ b/testing/web-platform/meta/mixed-content/blockable/http-csp/same-host-http/link-css-tag/top-level/swap-scheme-redirect/opt-in-blocks.https.html.ini @@ -1,5 +1,6 @@ [opt-in-blocks.https.html] type: testharness + expected: TIMEOUT [opt_in_method: http-csp\n origin: same-host-http\n source_scheme: https\n context_nesting: top-level\n redirection: swap-scheme-redirect\n subresource: link-css-tag\n expectation: blocked] - expected: FAIL + expected: NOTRUN diff --git a/testing/web-platform/meta/mixed-content/blockable/http-csp/same-host-http/object-tag/top-level/keep-scheme-redirect/opt-in-blocks.https.html.ini b/testing/web-platform/meta/mixed-content/blockable/http-csp/same-host-http/object-tag/top-level/keep-scheme-redirect/opt-in-blocks.https.html.ini index bf55c23a15bd..39f15e827cb2 100644 --- a/testing/web-platform/meta/mixed-content/blockable/http-csp/same-host-http/object-tag/top-level/keep-scheme-redirect/opt-in-blocks.https.html.ini +++ b/testing/web-platform/meta/mixed-content/blockable/http-csp/same-host-http/object-tag/top-level/keep-scheme-redirect/opt-in-blocks.https.html.ini @@ -1,5 +1,6 @@ [opt-in-blocks.https.html] type: testharness + expected: TIMEOUT [opt_in_method: http-csp\n origin: same-host-http\n source_scheme: https\n context_nesting: top-level\n redirection: keep-scheme-redirect\n subresource: object-tag\n expectation: blocked] - expected: FAIL + expected: NOTRUN diff --git a/testing/web-platform/meta/mixed-content/blockable/http-csp/same-host-http/object-tag/top-level/no-redirect/opt-in-blocks.https.html.ini b/testing/web-platform/meta/mixed-content/blockable/http-csp/same-host-http/object-tag/top-level/no-redirect/opt-in-blocks.https.html.ini index 839f66ae6f10..2308a9c462eb 100644 --- a/testing/web-platform/meta/mixed-content/blockable/http-csp/same-host-http/object-tag/top-level/no-redirect/opt-in-blocks.https.html.ini +++ b/testing/web-platform/meta/mixed-content/blockable/http-csp/same-host-http/object-tag/top-level/no-redirect/opt-in-blocks.https.html.ini @@ -1,5 +1,6 @@ [opt-in-blocks.https.html] type: testharness + expected: TIMEOUT [opt_in_method: http-csp\n origin: same-host-http\n source_scheme: https\n context_nesting: top-level\n redirection: no-redirect\n subresource: object-tag\n expectation: blocked] - expected: FAIL + expected: NOTRUN diff --git a/testing/web-platform/meta/mixed-content/blockable/http-csp/same-host-http/object-tag/top-level/swap-scheme-redirect/opt-in-blocks.https.html.ini b/testing/web-platform/meta/mixed-content/blockable/http-csp/same-host-http/object-tag/top-level/swap-scheme-redirect/opt-in-blocks.https.html.ini index 165b44606f30..98d481c1e122 100644 --- a/testing/web-platform/meta/mixed-content/blockable/http-csp/same-host-http/object-tag/top-level/swap-scheme-redirect/opt-in-blocks.https.html.ini +++ b/testing/web-platform/meta/mixed-content/blockable/http-csp/same-host-http/object-tag/top-level/swap-scheme-redirect/opt-in-blocks.https.html.ini @@ -1,5 +1,6 @@ [opt-in-blocks.https.html] type: testharness + expected: TIMEOUT [opt_in_method: http-csp\n origin: same-host-http\n source_scheme: https\n context_nesting: top-level\n redirection: swap-scheme-redirect\n subresource: object-tag\n expectation: blocked] - expected: FAIL + expected: NOTRUN diff --git a/testing/web-platform/meta/mixed-content/blockable/http-csp/same-host-http/picture-tag/top-level/no-redirect/opt-in-blocks.https.html.ini b/testing/web-platform/meta/mixed-content/blockable/http-csp/same-host-http/picture-tag/top-level/no-redirect/opt-in-blocks.https.html.ini new file mode 100644 index 000000000000..90f167ed3cc4 --- /dev/null +++ b/testing/web-platform/meta/mixed-content/blockable/http-csp/same-host-http/picture-tag/top-level/no-redirect/opt-in-blocks.https.html.ini @@ -0,0 +1,9 @@ +[opt-in-blocks.https.html] + type: testharness + [opt_in_method: http-csp\n origin: same-host-http\n source_scheme: https\n context_nesting: top-level\n redirection: no-redirect\n subresource: picture-tag\n expectation: blocked] + expected: + if debug and (os == "linux") and (version == "Ubuntu 12.04") and (processor == "x86_64") and (bits == 64): FAIL + if debug and (os == "linux") and (version == "Ubuntu 12.04") and (processor == "x86") and (bits == 32): FAIL + if debug and (os == "mac") and (version == "OS X 10.8") and (processor == "x86_64") and (bits == 64): FAIL + if debug and (os == "mac") and (version == "OS X 10.10.2") and (processor == "x86_64") and (bits == 64): FAIL + diff --git a/testing/web-platform/meta/mixed-content/blockable/no-opt-in/cross-origin-http/link-css-tag/top-level/no-redirect/no-opt-in-blocks.https.html.ini b/testing/web-platform/meta/mixed-content/blockable/no-opt-in/cross-origin-http/link-css-tag/top-level/no-redirect/no-opt-in-blocks.https.html.ini index 2f2407fa90ca..5460d841ba4c 100644 --- a/testing/web-platform/meta/mixed-content/blockable/no-opt-in/cross-origin-http/link-css-tag/top-level/no-redirect/no-opt-in-blocks.https.html.ini +++ b/testing/web-platform/meta/mixed-content/blockable/no-opt-in/cross-origin-http/link-css-tag/top-level/no-redirect/no-opt-in-blocks.https.html.ini @@ -2,5 +2,5 @@ type: testharness expected: TIMEOUT [opt_in_method: no-opt-in\n origin: cross-origin-http\n source_scheme: https\n context_nesting: top-level\n redirection: no-redirect\n subresource: link-css-tag\n expectation: blocked] - expected: FAIL + expected: NOTRUN diff --git a/testing/web-platform/meta/mixed-content/blockable/no-opt-in/cross-origin-http/link-css-tag/top-level/swap-scheme-redirect/no-opt-in-blocks.https.html.ini b/testing/web-platform/meta/mixed-content/blockable/no-opt-in/cross-origin-http/link-css-tag/top-level/swap-scheme-redirect/no-opt-in-blocks.https.html.ini index a722bde69eef..1c1412a58268 100644 --- a/testing/web-platform/meta/mixed-content/blockable/no-opt-in/cross-origin-http/link-css-tag/top-level/swap-scheme-redirect/no-opt-in-blocks.https.html.ini +++ b/testing/web-platform/meta/mixed-content/blockable/no-opt-in/cross-origin-http/link-css-tag/top-level/swap-scheme-redirect/no-opt-in-blocks.https.html.ini @@ -1,5 +1,6 @@ [no-opt-in-blocks.https.html] type: testharness + expected: TIMEOUT [opt_in_method: no-opt-in\n origin: cross-origin-http\n source_scheme: https\n context_nesting: top-level\n redirection: swap-scheme-redirect\n subresource: link-css-tag\n expectation: blocked] - expected: FAIL + expected: NOTRUN diff --git a/testing/web-platform/meta/mixed-content/blockable/no-opt-in/cross-origin-http/object-tag/top-level/keep-scheme-redirect/no-opt-in-blocks.https.html.ini b/testing/web-platform/meta/mixed-content/blockable/no-opt-in/cross-origin-http/object-tag/top-level/keep-scheme-redirect/no-opt-in-blocks.https.html.ini index bc4a0a6320cd..967f56a1ea9f 100644 --- a/testing/web-platform/meta/mixed-content/blockable/no-opt-in/cross-origin-http/object-tag/top-level/keep-scheme-redirect/no-opt-in-blocks.https.html.ini +++ b/testing/web-platform/meta/mixed-content/blockable/no-opt-in/cross-origin-http/object-tag/top-level/keep-scheme-redirect/no-opt-in-blocks.https.html.ini @@ -1,5 +1,6 @@ [no-opt-in-blocks.https.html] type: testharness + expected: TIMEOUT [opt_in_method: no-opt-in\n origin: cross-origin-http\n source_scheme: https\n context_nesting: top-level\n redirection: keep-scheme-redirect\n subresource: object-tag\n expectation: blocked] - expected: FAIL + expected: NOTRUN diff --git a/testing/web-platform/meta/mixed-content/blockable/no-opt-in/cross-origin-http/object-tag/top-level/no-redirect/no-opt-in-blocks.https.html.ini b/testing/web-platform/meta/mixed-content/blockable/no-opt-in/cross-origin-http/object-tag/top-level/no-redirect/no-opt-in-blocks.https.html.ini index 106ee7a41443..a03c5eae80f8 100644 --- a/testing/web-platform/meta/mixed-content/blockable/no-opt-in/cross-origin-http/object-tag/top-level/no-redirect/no-opt-in-blocks.https.html.ini +++ b/testing/web-platform/meta/mixed-content/blockable/no-opt-in/cross-origin-http/object-tag/top-level/no-redirect/no-opt-in-blocks.https.html.ini @@ -1,5 +1,6 @@ [no-opt-in-blocks.https.html] type: testharness + expected: TIMEOUT [opt_in_method: no-opt-in\n origin: cross-origin-http\n source_scheme: https\n context_nesting: top-level\n redirection: no-redirect\n subresource: object-tag\n expectation: blocked] - expected: FAIL + expected: NOTRUN diff --git a/testing/web-platform/meta/mixed-content/blockable/no-opt-in/cross-origin-http/object-tag/top-level/swap-scheme-redirect/no-opt-in-blocks.https.html.ini b/testing/web-platform/meta/mixed-content/blockable/no-opt-in/cross-origin-http/object-tag/top-level/swap-scheme-redirect/no-opt-in-blocks.https.html.ini index 1edcdd158d6b..e825055fd118 100644 --- a/testing/web-platform/meta/mixed-content/blockable/no-opt-in/cross-origin-http/object-tag/top-level/swap-scheme-redirect/no-opt-in-blocks.https.html.ini +++ b/testing/web-platform/meta/mixed-content/blockable/no-opt-in/cross-origin-http/object-tag/top-level/swap-scheme-redirect/no-opt-in-blocks.https.html.ini @@ -1,5 +1,6 @@ [no-opt-in-blocks.https.html] type: testharness + expected: TIMEOUT [opt_in_method: no-opt-in\n origin: cross-origin-http\n source_scheme: https\n context_nesting: top-level\n redirection: swap-scheme-redirect\n subresource: object-tag\n expectation: blocked] - expected: FAIL + expected: NOTRUN diff --git a/testing/web-platform/meta/mixed-content/blockable/no-opt-in/cross-origin-http/picture-tag/top-level/no-redirect/no-opt-in-blocks.https.html.ini b/testing/web-platform/meta/mixed-content/blockable/no-opt-in/cross-origin-http/picture-tag/top-level/no-redirect/no-opt-in-blocks.https.html.ini new file mode 100644 index 000000000000..b593f9810bb1 --- /dev/null +++ b/testing/web-platform/meta/mixed-content/blockable/no-opt-in/cross-origin-http/picture-tag/top-level/no-redirect/no-opt-in-blocks.https.html.ini @@ -0,0 +1,9 @@ +[no-opt-in-blocks.https.html] + type: testharness + [opt_in_method: no-opt-in\n origin: cross-origin-http\n source_scheme: https\n context_nesting: top-level\n redirection: no-redirect\n subresource: picture-tag\n expectation: blocked] + expected: + if debug and (os == "linux") and (version == "Ubuntu 12.04") and (processor == "x86_64") and (bits == 64): FAIL + if debug and (os == "linux") and (version == "Ubuntu 12.04") and (processor == "x86") and (bits == 32): FAIL + if debug and (os == "mac") and (version == "OS X 10.8") and (processor == "x86_64") and (bits == 64): FAIL + if debug and (os == "mac") and (version == "OS X 10.10.2") and (processor == "x86_64") and (bits == 64): FAIL + diff --git a/testing/web-platform/meta/mixed-content/blockable/no-opt-in/same-host-http/link-css-tag/top-level/no-redirect/no-opt-in-blocks.https.html.ini b/testing/web-platform/meta/mixed-content/blockable/no-opt-in/same-host-http/link-css-tag/top-level/no-redirect/no-opt-in-blocks.https.html.ini index 0f3f843587a8..05923c82c8d2 100644 --- a/testing/web-platform/meta/mixed-content/blockable/no-opt-in/same-host-http/link-css-tag/top-level/no-redirect/no-opt-in-blocks.https.html.ini +++ b/testing/web-platform/meta/mixed-content/blockable/no-opt-in/same-host-http/link-css-tag/top-level/no-redirect/no-opt-in-blocks.https.html.ini @@ -13,6 +13,8 @@ if debug and (os == "win") and (version == "6.1.7601") and (processor == "x86") and (bits == 32): TIMEOUT if not debug and (os == "win") and (version == "5.1.2600") and (processor == "x86") and (bits == 32): TIMEOUT if not debug and (os == "win") and (version == "6.1.7601") and (processor == "x86") and (bits == 32): TIMEOUT + if debug and (os == "linux") and (version == "Ubuntu 12.04") and (processor == "x86") and (bits == 32): TIMEOUT + if debug and (os == "linux") and (version == "Ubuntu 12.04") and (processor == "x86_64") and (bits == 64): TIMEOUT [opt_in_method: no-opt-in\n origin: same-host-http\n source_scheme: https\n context_nesting: top-level\n redirection: no-redirect\n subresource: link-css-tag\n expectation: blocked] - expected: FAIL + expected: NOTRUN diff --git a/testing/web-platform/meta/mixed-content/blockable/no-opt-in/same-host-http/link-css-tag/top-level/swap-scheme-redirect/no-opt-in-blocks.https.html.ini b/testing/web-platform/meta/mixed-content/blockable/no-opt-in/same-host-http/link-css-tag/top-level/swap-scheme-redirect/no-opt-in-blocks.https.html.ini index ef5ff3c30129..4f0c96eff5ec 100644 --- a/testing/web-platform/meta/mixed-content/blockable/no-opt-in/same-host-http/link-css-tag/top-level/swap-scheme-redirect/no-opt-in-blocks.https.html.ini +++ b/testing/web-platform/meta/mixed-content/blockable/no-opt-in/same-host-http/link-css-tag/top-level/swap-scheme-redirect/no-opt-in-blocks.https.html.ini @@ -1,5 +1,6 @@ [no-opt-in-blocks.https.html] type: testharness + expected: TIMEOUT [opt_in_method: no-opt-in\n origin: same-host-http\n source_scheme: https\n context_nesting: top-level\n redirection: swap-scheme-redirect\n subresource: link-css-tag\n expectation: blocked] - expected: FAIL + expected: NOTRUN diff --git a/testing/web-platform/meta/mixed-content/blockable/no-opt-in/same-host-http/object-tag/top-level/keep-scheme-redirect/no-opt-in-blocks.https.html.ini b/testing/web-platform/meta/mixed-content/blockable/no-opt-in/same-host-http/object-tag/top-level/keep-scheme-redirect/no-opt-in-blocks.https.html.ini index 68d74d2b56c8..ec987780fe97 100644 --- a/testing/web-platform/meta/mixed-content/blockable/no-opt-in/same-host-http/object-tag/top-level/keep-scheme-redirect/no-opt-in-blocks.https.html.ini +++ b/testing/web-platform/meta/mixed-content/blockable/no-opt-in/same-host-http/object-tag/top-level/keep-scheme-redirect/no-opt-in-blocks.https.html.ini @@ -1,5 +1,6 @@ [no-opt-in-blocks.https.html] type: testharness + expected: TIMEOUT [opt_in_method: no-opt-in\n origin: same-host-http\n source_scheme: https\n context_nesting: top-level\n redirection: keep-scheme-redirect\n subresource: object-tag\n expectation: blocked] - expected: FAIL + expected: NOTRUN diff --git a/testing/web-platform/meta/mixed-content/blockable/no-opt-in/same-host-http/object-tag/top-level/no-redirect/no-opt-in-blocks.https.html.ini b/testing/web-platform/meta/mixed-content/blockable/no-opt-in/same-host-http/object-tag/top-level/no-redirect/no-opt-in-blocks.https.html.ini index 2b6fa63b5b4f..2daf4ccefd03 100644 --- a/testing/web-platform/meta/mixed-content/blockable/no-opt-in/same-host-http/object-tag/top-level/no-redirect/no-opt-in-blocks.https.html.ini +++ b/testing/web-platform/meta/mixed-content/blockable/no-opt-in/same-host-http/object-tag/top-level/no-redirect/no-opt-in-blocks.https.html.ini @@ -1,5 +1,6 @@ [no-opt-in-blocks.https.html] type: testharness + expected: TIMEOUT [opt_in_method: no-opt-in\n origin: same-host-http\n source_scheme: https\n context_nesting: top-level\n redirection: no-redirect\n subresource: object-tag\n expectation: blocked] - expected: FAIL + expected: NOTRUN diff --git a/testing/web-platform/meta/mixed-content/blockable/no-opt-in/same-host-http/object-tag/top-level/swap-scheme-redirect/no-opt-in-blocks.https.html.ini b/testing/web-platform/meta/mixed-content/blockable/no-opt-in/same-host-http/object-tag/top-level/swap-scheme-redirect/no-opt-in-blocks.https.html.ini index 5611cc12062f..ae1eb277b02e 100644 --- a/testing/web-platform/meta/mixed-content/blockable/no-opt-in/same-host-http/object-tag/top-level/swap-scheme-redirect/no-opt-in-blocks.https.html.ini +++ b/testing/web-platform/meta/mixed-content/blockable/no-opt-in/same-host-http/object-tag/top-level/swap-scheme-redirect/no-opt-in-blocks.https.html.ini @@ -1,5 +1,6 @@ [no-opt-in-blocks.https.html] type: testharness + expected: TIMEOUT [opt_in_method: no-opt-in\n origin: same-host-http\n source_scheme: https\n context_nesting: top-level\n redirection: swap-scheme-redirect\n subresource: object-tag\n expectation: blocked] - expected: FAIL + expected: NOTRUN diff --git a/testing/web-platform/meta/mixed-content/blockable/no-opt-in/same-host-http/picture-tag/top-level/no-redirect/no-opt-in-blocks.https.html.ini b/testing/web-platform/meta/mixed-content/blockable/no-opt-in/same-host-http/picture-tag/top-level/no-redirect/no-opt-in-blocks.https.html.ini new file mode 100644 index 000000000000..c1810619da37 --- /dev/null +++ b/testing/web-platform/meta/mixed-content/blockable/no-opt-in/same-host-http/picture-tag/top-level/no-redirect/no-opt-in-blocks.https.html.ini @@ -0,0 +1,9 @@ +[no-opt-in-blocks.https.html] + type: testharness + [opt_in_method: no-opt-in\n origin: same-host-http\n source_scheme: https\n context_nesting: top-level\n redirection: no-redirect\n subresource: picture-tag\n expectation: blocked] + expected: + if debug and (os == "linux") and (version == "Ubuntu 12.04") and (processor == "x86_64") and (bits == 64): FAIL + if debug and (os == "linux") and (version == "Ubuntu 12.04") and (processor == "x86") and (bits == 32): FAIL + if debug and (os == "mac") and (version == "OS X 10.8") and (processor == "x86_64") and (bits == 64): FAIL + if debug and (os == "mac") and (version == "OS X 10.10.2") and (processor == "x86_64") and (bits == 64): FAIL + diff --git a/testing/web-platform/meta/mixed-content/optionally-blockable/http-csp/cross-origin-http/link-prefetch-tag/top-level/keep-scheme-redirect/opt-in-blocks.https.html.ini b/testing/web-platform/meta/mixed-content/optionally-blockable/http-csp/cross-origin-http/link-prefetch-tag/top-level/keep-scheme-redirect/opt-in-blocks.https.html.ini index 6e4ccd3d544b..0524d01dbc2f 100644 --- a/testing/web-platform/meta/mixed-content/optionally-blockable/http-csp/cross-origin-http/link-prefetch-tag/top-level/keep-scheme-redirect/opt-in-blocks.https.html.ini +++ b/testing/web-platform/meta/mixed-content/optionally-blockable/http-csp/cross-origin-http/link-prefetch-tag/top-level/keep-scheme-redirect/opt-in-blocks.https.html.ini @@ -1,5 +1,6 @@ [opt-in-blocks.https.html] type: testharness + expected: TIMEOUT [opt_in_method: http-csp\n origin: cross-origin-http\n source_scheme: https\n context_nesting: top-level\n redirection: keep-scheme-redirect\n subresource: link-prefetch-tag\n expectation: blocked] - expected: FAIL + expected: NOTRUN diff --git a/testing/web-platform/meta/mixed-content/optionally-blockable/http-csp/cross-origin-http/link-prefetch-tag/top-level/no-redirect/opt-in-blocks.https.html.ini b/testing/web-platform/meta/mixed-content/optionally-blockable/http-csp/cross-origin-http/link-prefetch-tag/top-level/no-redirect/opt-in-blocks.https.html.ini index 3db9b075fcbf..bd8dd44c17e6 100644 --- a/testing/web-platform/meta/mixed-content/optionally-blockable/http-csp/cross-origin-http/link-prefetch-tag/top-level/no-redirect/opt-in-blocks.https.html.ini +++ b/testing/web-platform/meta/mixed-content/optionally-blockable/http-csp/cross-origin-http/link-prefetch-tag/top-level/no-redirect/opt-in-blocks.https.html.ini @@ -1,5 +1,6 @@ [opt-in-blocks.https.html] type: testharness + expected: TIMEOUT [opt_in_method: http-csp\n origin: cross-origin-http\n source_scheme: https\n context_nesting: top-level\n redirection: no-redirect\n subresource: link-prefetch-tag\n expectation: blocked] - expected: FAIL + expected: NOTRUN diff --git a/testing/web-platform/meta/mixed-content/optionally-blockable/http-csp/cross-origin-http/link-prefetch-tag/top-level/swap-scheme-redirect/opt-in-blocks.https.html.ini b/testing/web-platform/meta/mixed-content/optionally-blockable/http-csp/cross-origin-http/link-prefetch-tag/top-level/swap-scheme-redirect/opt-in-blocks.https.html.ini index 22724cc68eb6..e5e615ad9fd2 100644 --- a/testing/web-platform/meta/mixed-content/optionally-blockable/http-csp/cross-origin-http/link-prefetch-tag/top-level/swap-scheme-redirect/opt-in-blocks.https.html.ini +++ b/testing/web-platform/meta/mixed-content/optionally-blockable/http-csp/cross-origin-http/link-prefetch-tag/top-level/swap-scheme-redirect/opt-in-blocks.https.html.ini @@ -1,5 +1,6 @@ [opt-in-blocks.https.html] type: testharness + expected: TIMEOUT [opt_in_method: http-csp\n origin: cross-origin-http\n source_scheme: https\n context_nesting: top-level\n redirection: swap-scheme-redirect\n subresource: link-prefetch-tag\n expectation: blocked] - expected: FAIL + expected: NOTRUN diff --git a/testing/web-platform/meta/mixed-content/optionally-blockable/http-csp/same-host-http/link-prefetch-tag/top-level/keep-scheme-redirect/opt-in-blocks.https.html.ini b/testing/web-platform/meta/mixed-content/optionally-blockable/http-csp/same-host-http/link-prefetch-tag/top-level/keep-scheme-redirect/opt-in-blocks.https.html.ini index 6c72606cde8b..076f1419ed4c 100644 --- a/testing/web-platform/meta/mixed-content/optionally-blockable/http-csp/same-host-http/link-prefetch-tag/top-level/keep-scheme-redirect/opt-in-blocks.https.html.ini +++ b/testing/web-platform/meta/mixed-content/optionally-blockable/http-csp/same-host-http/link-prefetch-tag/top-level/keep-scheme-redirect/opt-in-blocks.https.html.ini @@ -1,5 +1,6 @@ [opt-in-blocks.https.html] type: testharness + expected: TIMEOUT [opt_in_method: http-csp\n origin: same-host-http\n source_scheme: https\n context_nesting: top-level\n redirection: keep-scheme-redirect\n subresource: link-prefetch-tag\n expectation: blocked] - expected: FAIL + expected: NOTRUN diff --git a/testing/web-platform/meta/mixed-content/optionally-blockable/http-csp/same-host-http/link-prefetch-tag/top-level/no-redirect/opt-in-blocks.https.html.ini b/testing/web-platform/meta/mixed-content/optionally-blockable/http-csp/same-host-http/link-prefetch-tag/top-level/no-redirect/opt-in-blocks.https.html.ini index 0747448661bd..43e02911df9c 100644 --- a/testing/web-platform/meta/mixed-content/optionally-blockable/http-csp/same-host-http/link-prefetch-tag/top-level/no-redirect/opt-in-blocks.https.html.ini +++ b/testing/web-platform/meta/mixed-content/optionally-blockable/http-csp/same-host-http/link-prefetch-tag/top-level/no-redirect/opt-in-blocks.https.html.ini @@ -1,5 +1,6 @@ [opt-in-blocks.https.html] type: testharness + expected: TIMEOUT [opt_in_method: http-csp\n origin: same-host-http\n source_scheme: https\n context_nesting: top-level\n redirection: no-redirect\n subresource: link-prefetch-tag\n expectation: blocked] - expected: FAIL + expected: NOTRUN diff --git a/testing/web-platform/meta/mixed-content/optionally-blockable/http-csp/same-host-http/link-prefetch-tag/top-level/swap-scheme-redirect/opt-in-blocks.https.html.ini b/testing/web-platform/meta/mixed-content/optionally-blockable/http-csp/same-host-http/link-prefetch-tag/top-level/swap-scheme-redirect/opt-in-blocks.https.html.ini index 2ebe8cc8001e..1f3900c5d917 100644 --- a/testing/web-platform/meta/mixed-content/optionally-blockable/http-csp/same-host-http/link-prefetch-tag/top-level/swap-scheme-redirect/opt-in-blocks.https.html.ini +++ b/testing/web-platform/meta/mixed-content/optionally-blockable/http-csp/same-host-http/link-prefetch-tag/top-level/swap-scheme-redirect/opt-in-blocks.https.html.ini @@ -1,5 +1,6 @@ [opt-in-blocks.https.html] type: testharness + expected: TIMEOUT [opt_in_method: http-csp\n origin: same-host-http\n source_scheme: https\n context_nesting: top-level\n redirection: swap-scheme-redirect\n subresource: link-prefetch-tag\n expectation: blocked] - expected: FAIL + expected: NOTRUN diff --git a/testing/web-platform/meta/mixed-content/optionally-blockable/meta-csp/cross-origin-http/link-prefetch-tag/top-level/no-redirect/opt-in-blocks.https.html.ini b/testing/web-platform/meta/mixed-content/optionally-blockable/meta-csp/cross-origin-http/link-prefetch-tag/top-level/no-redirect/opt-in-blocks.https.html.ini index 4599c2986d7f..f2dd41a27745 100644 --- a/testing/web-platform/meta/mixed-content/optionally-blockable/meta-csp/cross-origin-http/link-prefetch-tag/top-level/no-redirect/opt-in-blocks.https.html.ini +++ b/testing/web-platform/meta/mixed-content/optionally-blockable/meta-csp/cross-origin-http/link-prefetch-tag/top-level/no-redirect/opt-in-blocks.https.html.ini @@ -1,5 +1,6 @@ [opt-in-blocks.https.html] type: testharness + expected: TIMEOUT [opt_in_method: meta-csp\n origin: cross-origin-http\n source_scheme: https\n context_nesting: top-level\n redirection: no-redirect\n subresource: link-prefetch-tag\n expectation: blocked] - expected: FAIL + expected: NOTRUN diff --git a/testing/web-platform/meta/mixed-content/optionally-blockable/meta-csp/same-host-http/link-prefetch-tag/top-level/no-redirect/opt-in-blocks.https.html.ini b/testing/web-platform/meta/mixed-content/optionally-blockable/meta-csp/same-host-http/link-prefetch-tag/top-level/no-redirect/opt-in-blocks.https.html.ini index 133d1b94f3a6..1236d0d2ee11 100644 --- a/testing/web-platform/meta/mixed-content/optionally-blockable/meta-csp/same-host-http/link-prefetch-tag/top-level/no-redirect/opt-in-blocks.https.html.ini +++ b/testing/web-platform/meta/mixed-content/optionally-blockable/meta-csp/same-host-http/link-prefetch-tag/top-level/no-redirect/opt-in-blocks.https.html.ini @@ -1,5 +1,6 @@ [opt-in-blocks.https.html] type: testharness + expected: TIMEOUT [opt_in_method: meta-csp\n origin: same-host-http\n source_scheme: https\n context_nesting: top-level\n redirection: no-redirect\n subresource: link-prefetch-tag\n expectation: blocked] - expected: FAIL + expected: NOTRUN diff --git a/testing/web-platform/meta/mixed-content/optionally-blockable/no-opt-in/cross-origin-http/link-prefetch-tag/top-level/keep-scheme-redirect/no-opt-in-allows.https.html.ini b/testing/web-platform/meta/mixed-content/optionally-blockable/no-opt-in/cross-origin-http/link-prefetch-tag/top-level/keep-scheme-redirect/no-opt-in-allows.https.html.ini index 6c7f9bdae96e..743f5d670ed7 100644 --- a/testing/web-platform/meta/mixed-content/optionally-blockable/no-opt-in/cross-origin-http/link-prefetch-tag/top-level/keep-scheme-redirect/no-opt-in-allows.https.html.ini +++ b/testing/web-platform/meta/mixed-content/optionally-blockable/no-opt-in/cross-origin-http/link-prefetch-tag/top-level/keep-scheme-redirect/no-opt-in-allows.https.html.ini @@ -1,5 +1,6 @@ [no-opt-in-allows.https.html] type: testharness + expected: TIMEOUT [opt_in_method: no-opt-in\n origin: cross-origin-http\n source_scheme: https\n context_nesting: top-level\n redirection: keep-scheme-redirect\n subresource: link-prefetch-tag\n expectation: allowed] - expected: FAIL + expected: NOTRUN diff --git a/testing/web-platform/meta/mixed-content/optionally-blockable/no-opt-in/cross-origin-http/link-prefetch-tag/top-level/no-redirect/no-opt-in-allows.https.html.ini b/testing/web-platform/meta/mixed-content/optionally-blockable/no-opt-in/cross-origin-http/link-prefetch-tag/top-level/no-redirect/no-opt-in-allows.https.html.ini index cd36fda79099..fa1abb817877 100644 --- a/testing/web-platform/meta/mixed-content/optionally-blockable/no-opt-in/cross-origin-http/link-prefetch-tag/top-level/no-redirect/no-opt-in-allows.https.html.ini +++ b/testing/web-platform/meta/mixed-content/optionally-blockable/no-opt-in/cross-origin-http/link-prefetch-tag/top-level/no-redirect/no-opt-in-allows.https.html.ini @@ -1,5 +1,6 @@ [no-opt-in-allows.https.html] type: testharness + expected: TIMEOUT [opt_in_method: no-opt-in\n origin: cross-origin-http\n source_scheme: https\n context_nesting: top-level\n redirection: no-redirect\n subresource: link-prefetch-tag\n expectation: allowed] - expected: FAIL + expected: NOTRUN diff --git a/testing/web-platform/meta/mixed-content/optionally-blockable/no-opt-in/cross-origin-http/link-prefetch-tag/top-level/swap-scheme-redirect/no-opt-in-allows.https.html.ini b/testing/web-platform/meta/mixed-content/optionally-blockable/no-opt-in/cross-origin-http/link-prefetch-tag/top-level/swap-scheme-redirect/no-opt-in-allows.https.html.ini index 7635cf60ae71..9149669c88d0 100644 --- a/testing/web-platform/meta/mixed-content/optionally-blockable/no-opt-in/cross-origin-http/link-prefetch-tag/top-level/swap-scheme-redirect/no-opt-in-allows.https.html.ini +++ b/testing/web-platform/meta/mixed-content/optionally-blockable/no-opt-in/cross-origin-http/link-prefetch-tag/top-level/swap-scheme-redirect/no-opt-in-allows.https.html.ini @@ -1,5 +1,6 @@ [no-opt-in-allows.https.html] type: testharness + expected: TIMEOUT [opt_in_method: no-opt-in\n origin: cross-origin-http\n source_scheme: https\n context_nesting: top-level\n redirection: swap-scheme-redirect\n subresource: link-prefetch-tag\n expectation: allowed] - expected: FAIL + expected: NOTRUN diff --git a/testing/web-platform/meta/mixed-content/optionally-blockable/no-opt-in/same-host-http/link-prefetch-tag/top-level/keep-scheme-redirect/no-opt-in-allows.https.html.ini b/testing/web-platform/meta/mixed-content/optionally-blockable/no-opt-in/same-host-http/link-prefetch-tag/top-level/keep-scheme-redirect/no-opt-in-allows.https.html.ini index 985fea2a7a5f..44a96d0e7e8a 100644 --- a/testing/web-platform/meta/mixed-content/optionally-blockable/no-opt-in/same-host-http/link-prefetch-tag/top-level/keep-scheme-redirect/no-opt-in-allows.https.html.ini +++ b/testing/web-platform/meta/mixed-content/optionally-blockable/no-opt-in/same-host-http/link-prefetch-tag/top-level/keep-scheme-redirect/no-opt-in-allows.https.html.ini @@ -1,5 +1,6 @@ [no-opt-in-allows.https.html] type: testharness + expected: TIMEOUT [opt_in_method: no-opt-in\n origin: same-host-http\n source_scheme: https\n context_nesting: top-level\n redirection: keep-scheme-redirect\n subresource: link-prefetch-tag\n expectation: allowed] - expected: FAIL + expected: NOTRUN diff --git a/testing/web-platform/meta/mixed-content/optionally-blockable/no-opt-in/same-host-http/link-prefetch-tag/top-level/no-redirect/no-opt-in-allows.https.html.ini b/testing/web-platform/meta/mixed-content/optionally-blockable/no-opt-in/same-host-http/link-prefetch-tag/top-level/no-redirect/no-opt-in-allows.https.html.ini index 8db20a207c08..a4d274ad6368 100644 --- a/testing/web-platform/meta/mixed-content/optionally-blockable/no-opt-in/same-host-http/link-prefetch-tag/top-level/no-redirect/no-opt-in-allows.https.html.ini +++ b/testing/web-platform/meta/mixed-content/optionally-blockable/no-opt-in/same-host-http/link-prefetch-tag/top-level/no-redirect/no-opt-in-allows.https.html.ini @@ -1,5 +1,6 @@ [no-opt-in-allows.https.html] type: testharness + expected: TIMEOUT [opt_in_method: no-opt-in\n origin: same-host-http\n source_scheme: https\n context_nesting: top-level\n redirection: no-redirect\n subresource: link-prefetch-tag\n expectation: allowed] - expected: FAIL + expected: NOTRUN diff --git a/testing/web-platform/meta/mixed-content/optionally-blockable/no-opt-in/same-host-http/link-prefetch-tag/top-level/swap-scheme-redirect/no-opt-in-allows.https.html.ini b/testing/web-platform/meta/mixed-content/optionally-blockable/no-opt-in/same-host-http/link-prefetch-tag/top-level/swap-scheme-redirect/no-opt-in-allows.https.html.ini index 689dad3e2027..e2798ea00a73 100644 --- a/testing/web-platform/meta/mixed-content/optionally-blockable/no-opt-in/same-host-http/link-prefetch-tag/top-level/swap-scheme-redirect/no-opt-in-allows.https.html.ini +++ b/testing/web-platform/meta/mixed-content/optionally-blockable/no-opt-in/same-host-http/link-prefetch-tag/top-level/swap-scheme-redirect/no-opt-in-allows.https.html.ini @@ -1,5 +1,6 @@ [no-opt-in-allows.https.html] type: testharness + expected: TIMEOUT [opt_in_method: no-opt-in\n origin: same-host-http\n source_scheme: https\n context_nesting: top-level\n redirection: swap-scheme-redirect\n subresource: link-prefetch-tag\n expectation: allowed] - expected: FAIL + expected: NOTRUN diff --git a/testing/web-platform/meta/notifications/constructor-basic.html.ini b/testing/web-platform/meta/notifications/constructor-basic.html.ini new file mode 100644 index 000000000000..41dd43fd6b6c --- /dev/null +++ b/testing/web-platform/meta/notifications/constructor-basic.html.ini @@ -0,0 +1,6 @@ +[constructor-basic.html] + type: testharness + expected: TIMEOUT + [Called the notification constructor with one argument.] + expected: NOTRUN + diff --git a/testing/web-platform/meta/notifications/constructor-invalid.html.ini b/testing/web-platform/meta/notifications/constructor-invalid.html.ini new file mode 100644 index 000000000000..b992cc8bfb55 --- /dev/null +++ b/testing/web-platform/meta/notifications/constructor-invalid.html.ini @@ -0,0 +1,6 @@ +[constructor-invalid.html] + type: testharness + expected: TIMEOUT + [Called the notification constructor with no arguments.] + expected: NOTRUN + diff --git a/testing/web-platform/meta/notifications/event-onclose.html.ini b/testing/web-platform/meta/notifications/event-onclose.html.ini index b85789b6bca9..1f06e947a7d6 100644 --- a/testing/web-platform/meta/notifications/event-onclose.html.ini +++ b/testing/web-platform/meta/notifications/event-onclose.html.ini @@ -4,3 +4,6 @@ [the notification.onclose event can be invoked] expected: NOTRUN + [Checked test prerequisites.] + expected: NOTRUN + diff --git a/testing/web-platform/meta/notifications/event-onshow.html.ini b/testing/web-platform/meta/notifications/event-onshow.html.ini index 8de229d14d65..1d0e9500e0e2 100644 --- a/testing/web-platform/meta/notifications/event-onshow.html.ini +++ b/testing/web-platform/meta/notifications/event-onshow.html.ini @@ -4,3 +4,6 @@ [the notification.onshow event can be invoked] expected: NOTRUN + [Checked test prerequisites.] + expected: NOTRUN + diff --git a/testing/web-platform/meta/notifications/instance.html.ini b/testing/web-platform/meta/notifications/instance.html.ini new file mode 100644 index 000000000000..449807e98f59 --- /dev/null +++ b/testing/web-platform/meta/notifications/instance.html.ini @@ -0,0 +1,6 @@ +[instance.html] + type: testharness + expected: TIMEOUT + [Notification instance basic tests] + expected: NOTRUN + diff --git a/testing/web-platform/meta/notifications/lang.html.ini b/testing/web-platform/meta/notifications/lang.html.ini new file mode 100644 index 000000000000..4dac30701510 --- /dev/null +++ b/testing/web-platform/meta/notifications/lang.html.ini @@ -0,0 +1,114 @@ +[lang.html] + type: testharness + expected: TIMEOUT + [Roundtripping lang "". Expecting "".] + expected: NOTRUN + + [Roundtripping lang "en". Expecting "en".] + expected: NOTRUN + + [Roundtripping lang "en-US-x-hixie". Expecting "en-US-x-hixie".] + expected: NOTRUN + + [Roundtripping lang "de-DE". Expecting "de-DE".] + expected: NOTRUN + + [Roundtripping lang "de-de". Expecting "de-de".] + expected: NOTRUN + + [Roundtripping lang "de-De". Expecting "de-De".] + expected: NOTRUN + + [Roundtripping lang "de-dE". Expecting "de-dE".] + expected: NOTRUN + + [Roundtripping lang "de-DE-1996". Expecting "de-DE-1996".] + expected: NOTRUN + + [Roundtripping lang "de-Latn-DE". Expecting "de-Latn-DE".] + expected: NOTRUN + + [Roundtripping lang "de-Latf-DE". Expecting "de-Latf-DE".] + expected: NOTRUN + + [Roundtripping lang "de-Latn-DE-1996". Expecting "de-Latn-DE-1996".] + expected: NOTRUN + + [Roundtripping lang "de-CH". Expecting "de-CH".] + expected: NOTRUN + + [Roundtripping lang "it-CH". Expecting "it-CH".] + expected: NOTRUN + + [Roundtripping lang "fr-CH". Expecting "fr-CH".] + expected: NOTRUN + + [Roundtripping lang "rm-CH". Expecting "rm-CH".] + expected: NOTRUN + + [Roundtripping lang "es-CH". Expecting "es-CH".] + expected: NOTRUN + + [Roundtripping lang "Latn-de". Expecting "".] + expected: NOTRUN + + [Roundtripping lang "Latf-de". Expecting "".] + expected: NOTRUN + + [Roundtripping lang "tic-tac-tac-toe". Expecting "".] + expected: NOTRUN + + [Roundtripping lang "cocoa-1-bar". Expecting "".] + expected: NOTRUN + + [Roundtripping lang "cocoa-a-bar". Expecting "".] + expected: NOTRUN + + [Roundtripping lang "en-". Expecting "".] + expected: NOTRUN + + [Roundtripping lang "en--". Expecting "".] + expected: NOTRUN + + [Roundtripping lang "foo--bar". Expecting "".] + expected: NOTRUN + + [Roundtripping lang "id---Java". Expecting "".] + expected: NOTRUN + + [Roundtripping lang "fr-x". Expecting "".] + expected: NOTRUN + + [Roundtripping lang "fr-xenomorph". Expecting "".] + expected: NOTRUN + + [Roundtripping lang "fr-x-xenomorph". Expecting "".] + expected: NOTRUN + + [Roundtripping lang "a". Expecting "".] + expected: NOTRUN + + [Roundtripping lang "a-fr-lang". Expecting "".] + expected: NOTRUN + + [Roundtripping lang "b-fr-lang". Expecting "".] + expected: NOTRUN + + [Roundtripping lang "es1-KK-aa-bb-cc-dd". Expecting "".] + expected: NOTRUN + + [Roundtripping lang "es2-KL-aa-bb-cc-dd". Expecting "".] + expected: NOTRUN + + [Roundtripping lang "es3-KM-aa-bb-cc-dd". Expecting "".] + expected: NOTRUN + + [Roundtripping lang "fooÉ". Expecting "".] + expected: NOTRUN + + [Roundtripping lang "foöÉ-bÁr". Expecting "".] + expected: NOTRUN + + [Roundtripping lang "foöÉbÁr". Expecting "".] + expected: NOTRUN + diff --git a/testing/web-platform/meta/notifications/notification-lang.html.ini b/testing/web-platform/meta/notifications/notification-lang.html.ini deleted file mode 100644 index 18a5f79de0d5..000000000000 --- a/testing/web-platform/meta/notifications/notification-lang.html.ini +++ /dev/null @@ -1,6 +0,0 @@ -[notification-lang.html] - type: testharness - expected: TIMEOUT - [We have permission to use the notifications API.] - expected: NOTRUN - diff --git a/testing/web-platform/meta/old-tests/submission/Opera/script_scheduling/111.html.ini b/testing/web-platform/meta/old-tests/submission/Opera/script_scheduling/111.html.ini deleted file mode 100644 index 422030c6d6ea..000000000000 --- a/testing/web-platform/meta/old-tests/submission/Opera/script_scheduling/111.html.ini +++ /dev/null @@ -1,6 +0,0 @@ -[111.html] - type: testharness - [ scheduler: removing async attribute at runtime] - expected: - if debug and (os == "linux") and (version == "Ubuntu 12.04") and (processor == "x86") and (bits == 32): FAIL - diff --git a/testing/web-platform/meta/shadow-dom/shadow-trees/satisfying-matching-criteria/test-006.html.ini b/testing/web-platform/meta/shadow-dom/elements-and-dom-objects/shadowroot-object/shadowroot-methods/test-006.html.ini similarity index 69% rename from testing/web-platform/meta/shadow-dom/shadow-trees/satisfying-matching-criteria/test-006.html.ini rename to testing/web-platform/meta/shadow-dom/elements-and-dom-objects/shadowroot-object/shadowroot-methods/test-006.html.ini index 9e49197bd3b4..73bb2806ba3f 100644 --- a/testing/web-platform/meta/shadow-dom/shadow-trees/satisfying-matching-criteria/test-006.html.ini +++ b/testing/web-platform/meta/shadow-dom/elements-and-dom-objects/shadowroot-object/shadowroot-methods/test-006.html.ini @@ -1,5 +1,5 @@ [test-006.html] type: testharness - [A_04_03_06_01_T01] + [A_10_01_02_06_01_T02] expected: FAIL diff --git a/testing/web-platform/meta/shadow-dom/shadow-trees/hosting-multiple-shadow-trees-002.html.ini b/testing/web-platform/meta/shadow-dom/shadow-trees/hosting-multiple-shadow-trees-002.html.ini deleted file mode 100644 index b4f998322287..000000000000 --- a/testing/web-platform/meta/shadow-dom/shadow-trees/hosting-multiple-shadow-trees-002.html.ini +++ /dev/null @@ -1,3 +0,0 @@ -[hosting-multiple-shadow-trees-002.html] - type: reftest - expected: FAIL diff --git a/testing/web-platform/meta/shadow-dom/shadow-trees/hosting-multiple-shadow-trees-003.html.ini b/testing/web-platform/meta/shadow-dom/shadow-trees/hosting-multiple-shadow-trees-003.html.ini deleted file mode 100644 index fddb64def132..000000000000 --- a/testing/web-platform/meta/shadow-dom/shadow-trees/hosting-multiple-shadow-trees-003.html.ini +++ /dev/null @@ -1,3 +0,0 @@ -[hosting-multiple-shadow-trees-003.html] - type: reftest - expected: FAIL diff --git a/testing/web-platform/meta/shadow-dom/shadow-trees/hosting-multiple-shadow-trees/test-001.html.ini b/testing/web-platform/meta/shadow-dom/shadow-trees/hosting-multiple-shadow-trees/test-001.html.ini deleted file mode 100644 index b9612655f401..000000000000 --- a/testing/web-platform/meta/shadow-dom/shadow-trees/hosting-multiple-shadow-trees/test-001.html.ini +++ /dev/null @@ -1,5 +0,0 @@ -[test-001.html] - type: testharness - [A_04_05_01_T02] - expected: FAIL - diff --git a/testing/web-platform/meta/shadow-dom/shadow-trees/hosting-multiple-shadow-trees/test-002.html.ini b/testing/web-platform/meta/shadow-dom/shadow-trees/hosting-multiple-shadow-trees/test-002.html.ini deleted file mode 100644 index ae07b8e0d5a3..000000000000 --- a/testing/web-platform/meta/shadow-dom/shadow-trees/hosting-multiple-shadow-trees/test-002.html.ini +++ /dev/null @@ -1,5 +0,0 @@ -[test-002.html] - type: testharness - [A_04_05_02_T01] - expected: FAIL - diff --git a/testing/web-platform/meta/shadow-dom/shadow-trees/hosting-multiple-shadow-trees/test-003.html.ini b/testing/web-platform/meta/shadow-dom/shadow-trees/hosting-multiple-shadow-trees/test-003.html.ini deleted file mode 100644 index b8990b6cca59..000000000000 --- a/testing/web-platform/meta/shadow-dom/shadow-trees/hosting-multiple-shadow-trees/test-003.html.ini +++ /dev/null @@ -1,5 +0,0 @@ -[test-003.html] - type: testharness - [A_04_05_03_T01] - expected: FAIL - diff --git a/testing/web-platform/meta/shadow-dom/shadow-trees/satisfying-matching-criteria/test-007.html.ini b/testing/web-platform/meta/shadow-dom/shadow-trees/satisfying-matching-criteria/test-007.html.ini deleted file mode 100644 index de88904a67ff..000000000000 --- a/testing/web-platform/meta/shadow-dom/shadow-trees/satisfying-matching-criteria/test-007.html.ini +++ /dev/null @@ -1,5 +0,0 @@ -[test-007.html] - type: testharness - [A_04_03_06_03_T01] - expected: FAIL - diff --git a/testing/web-platform/meta/shadow-dom/shadow-trees/satisfying-matching-criteria/test-008.html.ini b/testing/web-platform/meta/shadow-dom/shadow-trees/satisfying-matching-criteria/test-008.html.ini deleted file mode 100644 index 141a213cff46..000000000000 --- a/testing/web-platform/meta/shadow-dom/shadow-trees/satisfying-matching-criteria/test-008.html.ini +++ /dev/null @@ -1,5 +0,0 @@ -[test-008.html] - type: testharness - [A_04_03_06_04_T01] - expected: FAIL - diff --git a/testing/web-platform/meta/shadow-dom/shadow-trees/satisfying-matching-criteria/test-009.html.ini b/testing/web-platform/meta/shadow-dom/shadow-trees/satisfying-matching-criteria/test-009.html.ini deleted file mode 100644 index a33137526f7c..000000000000 --- a/testing/web-platform/meta/shadow-dom/shadow-trees/satisfying-matching-criteria/test-009.html.ini +++ /dev/null @@ -1,5 +0,0 @@ -[test-009.html] - type: testharness - [A_04_03_06_05_T01] - expected: FAIL - diff --git a/testing/web-platform/meta/shadow-dom/shadow-trees/satisfying-matching-criteria/test-010.html.ini b/testing/web-platform/meta/shadow-dom/shadow-trees/satisfying-matching-criteria/test-010.html.ini deleted file mode 100644 index 0fff512eec95..000000000000 --- a/testing/web-platform/meta/shadow-dom/shadow-trees/satisfying-matching-criteria/test-010.html.ini +++ /dev/null @@ -1,5 +0,0 @@ -[test-010.html] - type: testharness - [A_04_03_06_06_T01] - expected: FAIL - diff --git a/testing/web-platform/meta/shadow-dom/shadow-trees/satisfying-matching-criteria/test-011.html.ini b/testing/web-platform/meta/shadow-dom/shadow-trees/satisfying-matching-criteria/test-011.html.ini deleted file mode 100644 index 8cd693d0eba6..000000000000 --- a/testing/web-platform/meta/shadow-dom/shadow-trees/satisfying-matching-criteria/test-011.html.ini +++ /dev/null @@ -1,5 +0,0 @@ -[test-011.html] - type: testharness - [A_04_03_06_07_T01] - expected: FAIL - diff --git a/testing/web-platform/meta/shadow-dom/shadow-trees/satisfying-matching-criteria/test-012.html.ini b/testing/web-platform/meta/shadow-dom/shadow-trees/satisfying-matching-criteria/test-012.html.ini deleted file mode 100644 index eba3e572bcbd..000000000000 --- a/testing/web-platform/meta/shadow-dom/shadow-trees/satisfying-matching-criteria/test-012.html.ini +++ /dev/null @@ -1,5 +0,0 @@ -[test-012.html] - type: testharness - [A_04_03_06_08_T01] - expected: FAIL - diff --git a/testing/web-platform/meta/shadow-dom/shadow-trees/satisfying-matching-criteria/test-013.html.ini b/testing/web-platform/meta/shadow-dom/shadow-trees/satisfying-matching-criteria/test-013.html.ini deleted file mode 100644 index ca84eba8b13b..000000000000 --- a/testing/web-platform/meta/shadow-dom/shadow-trees/satisfying-matching-criteria/test-013.html.ini +++ /dev/null @@ -1,5 +0,0 @@ -[test-013.html] - type: testharness - [A_04_03_06_09_T01] - expected: FAIL - diff --git a/testing/web-platform/meta/shadow-dom/shadow-trees/satisfying-matching-criteria/test-014.html.ini b/testing/web-platform/meta/shadow-dom/shadow-trees/satisfying-matching-criteria/test-014.html.ini deleted file mode 100644 index 0961ecbccfc7..000000000000 --- a/testing/web-platform/meta/shadow-dom/shadow-trees/satisfying-matching-criteria/test-014.html.ini +++ /dev/null @@ -1,5 +0,0 @@ -[test-014.html] - type: testharness - [A_04_03_06_10_T01] - expected: FAIL - diff --git a/testing/web-platform/meta/shadow-dom/shadow-trees/satisfying-matching-criteria/test-015.html.ini b/testing/web-platform/meta/shadow-dom/shadow-trees/satisfying-matching-criteria/test-015.html.ini deleted file mode 100644 index 86fce6d79400..000000000000 --- a/testing/web-platform/meta/shadow-dom/shadow-trees/satisfying-matching-criteria/test-015.html.ini +++ /dev/null @@ -1,5 +0,0 @@ -[test-015.html] - type: testharness - [A_04_03_06_11_T01] - expected: FAIL - diff --git a/testing/web-platform/meta/shadow-dom/shadow-trees/satisfying-matching-criteria/test-016.html.ini b/testing/web-platform/meta/shadow-dom/shadow-trees/satisfying-matching-criteria/test-016.html.ini deleted file mode 100644 index 2b08e9b1ffa4..000000000000 --- a/testing/web-platform/meta/shadow-dom/shadow-trees/satisfying-matching-criteria/test-016.html.ini +++ /dev/null @@ -1,5 +0,0 @@ -[test-016.html] - type: testharness - [A_04_03_06_12_T01] - expected: FAIL - diff --git a/testing/web-platform/meta/shadow-dom/shadow-trees/satisfying-matching-criteria/test-017.html.ini b/testing/web-platform/meta/shadow-dom/shadow-trees/satisfying-matching-criteria/test-017.html.ini deleted file mode 100644 index 86d3742dae11..000000000000 --- a/testing/web-platform/meta/shadow-dom/shadow-trees/satisfying-matching-criteria/test-017.html.ini +++ /dev/null @@ -1,5 +0,0 @@ -[test-017.html] - type: testharness - [A_04_03_06_13_T01] - expected: FAIL - diff --git a/testing/web-platform/meta/shadow-dom/shadow-trees/satisfying-matching-criteria/test-018.html.ini b/testing/web-platform/meta/shadow-dom/shadow-trees/satisfying-matching-criteria/test-018.html.ini deleted file mode 100644 index 7efd15043288..000000000000 --- a/testing/web-platform/meta/shadow-dom/shadow-trees/satisfying-matching-criteria/test-018.html.ini +++ /dev/null @@ -1,5 +0,0 @@ -[test-018.html] - type: testharness - [A_04_03_06_14_T01] - expected: FAIL - diff --git a/testing/web-platform/meta/shadow-dom/shadow-trees/satisfying-matching-criteria/test-019.html.ini b/testing/web-platform/meta/shadow-dom/shadow-trees/satisfying-matching-criteria/test-019.html.ini deleted file mode 100644 index 3230782b4776..000000000000 --- a/testing/web-platform/meta/shadow-dom/shadow-trees/satisfying-matching-criteria/test-019.html.ini +++ /dev/null @@ -1,5 +0,0 @@ -[test-019.html] - type: testharness - [A_04_03_06_15_T01] - expected: FAIL - diff --git a/testing/web-platform/meta/shadow-dom/shadow-trees/satisfying-matching-criteria/test-020.html.ini b/testing/web-platform/meta/shadow-dom/shadow-trees/satisfying-matching-criteria/test-020.html.ini deleted file mode 100644 index 4e0289ff34fc..000000000000 --- a/testing/web-platform/meta/shadow-dom/shadow-trees/satisfying-matching-criteria/test-020.html.ini +++ /dev/null @@ -1,5 +0,0 @@ -[test-020.html] - type: testharness - [A_04_03_06_16_T01] - expected: FAIL - diff --git a/testing/web-platform/meta/shadow-dom/styles/test-002.html.ini b/testing/web-platform/meta/shadow-dom/styles/test-002.html.ini deleted file mode 100644 index 04c9d2e7d953..000000000000 --- a/testing/web-platform/meta/shadow-dom/styles/test-002.html.ini +++ /dev/null @@ -1,5 +0,0 @@ -[test-002.html] - type: testharness - [A_06_00_02_T03] - expected: FAIL - diff --git a/testing/web-platform/meta/subresource-integrity/subresource-integrity.html.ini b/testing/web-platform/meta/subresource-integrity/subresource-integrity.html.ini index ff2def85bfaa..d77cc9ae1d29 100644 --- a/testing/web-platform/meta/subresource-integrity/subresource-integrity.html.ini +++ b/testing/web-platform/meta/subresource-integrity/subresource-integrity.html.ini @@ -72,3 +72,6 @@ [Style: with CORS-ineligible resource] expected: FAIL + [Style: Same-origin with incorrect sha256 and sha512 hash, rel='alternate stylesheet' enabled] + expected: FAIL + diff --git a/testing/web-platform/mozilla/meta/service-workers/service-worker/fetch-csp.https.html.ini b/testing/web-platform/mozilla/meta/service-workers/service-worker/fetch-csp.https.html.ini index e3ef8760643c..239d8f645adf 100644 --- a/testing/web-platform/mozilla/meta/service-workers/service-worker/fetch-csp.https.html.ini +++ b/testing/web-platform/mozilla/meta/service-workers/service-worker/fetch-csp.https.html.ini @@ -1,10 +1,6 @@ [fetch-csp.https.html] type: testharness - expected: - if debug and (os == "win") and (version == "6.1.7601") and (processor == "x86") and (bits == 32): CRASH - if debug and (os == "win") and (version == "5.1.2600") and (processor == "x86") and (bits == 32): CRASH - if debug and (os == "win") and (version == "6.2.9200") and (processor == "x86_64") and (bits == 64): CRASH - TIMEOUT + expected: TIMEOUT [Verify CSP control of fetch() in a Service Worker] expected: TIMEOUT diff --git a/testing/web-platform/mozilla/meta/service-workers/service-worker/fetch-event-async-respond-with.https.html.ini b/testing/web-platform/mozilla/meta/service-workers/service-worker/fetch-event-async-respond-with.https.html.ini index 2aa94eef2a04..f44bb2122def 100644 --- a/testing/web-platform/mozilla/meta/service-workers/service-worker/fetch-event-async-respond-with.https.html.ini +++ b/testing/web-platform/mozilla/meta/service-workers/service-worker/fetch-event-async-respond-with.https.html.ini @@ -1,10 +1,3 @@ [fetch-event-async-respond-with.https.html] type: testharness - expected: - if not debug and (os == "win") and (version == "6.2.9200") and (processor == "x86_64") and (bits == 64): CRASH - if not debug and (os == "win") and (version == "5.1.2600") and (processor == "x86") and (bits == 32): CRASH - if not debug and (os == "win") and (version == "6.1.7601") and (processor == "x86") and (bits == 32): CRASH - if debug and (os == "win") and (version == "6.1.7601") and (processor == "x86") and (bits == 32): CRASH - if debug and (os == "win") and (version == "5.1.2600") and (processor == "x86") and (bits == 32): CRASH - if debug and (os == "win") and (version == "6.2.9200") and (processor == "x86_64") and (bits == 64): CRASH - CRASH + expected: CRASH diff --git a/testing/web-platform/mozilla/meta/service-workers/service-worker/fetch-event-respond-with-stops-propagation.https.html.ini b/testing/web-platform/mozilla/meta/service-workers/service-worker/fetch-event-respond-with-stops-propagation.https.html.ini index b5dab92fec6e..9bd19343af14 100644 --- a/testing/web-platform/mozilla/meta/service-workers/service-worker/fetch-event-respond-with-stops-propagation.https.html.ini +++ b/testing/web-platform/mozilla/meta/service-workers/service-worker/fetch-event-respond-with-stops-propagation.https.html.ini @@ -1,10 +1,3 @@ [fetch-event-respond-with-stops-propagation.https.html] type: testharness - expected: - if not debug and (os == "win") and (version == "6.2.9200") and (processor == "x86_64") and (bits == 64): CRASH - if not debug and (os == "win") and (version == "5.1.2600") and (processor == "x86") and (bits == 32): CRASH - if not debug and (os == "win") and (version == "6.1.7601") and (processor == "x86") and (bits == 32): CRASH - if debug and (os == "win") and (version == "6.1.7601") and (processor == "x86") and (bits == 32): CRASH - if debug and (os == "win") and (version == "5.1.2600") and (processor == "x86") and (bits == 32): CRASH - if debug and (os == "win") and (version == "6.2.9200") and (processor == "x86_64") and (bits == 64): CRASH - CRASH + expected: CRASH diff --git a/testing/web-platform/mozilla/meta/service-workers/service-worker/fetch-frame-resource.https.html.ini b/testing/web-platform/mozilla/meta/service-workers/service-worker/fetch-frame-resource.https.html.ini index adf61de7d105..2f5e254be44b 100644 --- a/testing/web-platform/mozilla/meta/service-workers/service-worker/fetch-frame-resource.https.html.ini +++ b/testing/web-platform/mozilla/meta/service-workers/service-worker/fetch-frame-resource.https.html.ini @@ -11,12 +11,18 @@ expected: FAIL [Opaque type response could not be loaded in the iframe.] - expected: FAIL + expected: + if debug and (os == "linux") and (version == "Ubuntu 12.04") and (processor == "x86") and (bits == 32): PASS + if debug and (os == "linux") and (version == "Ubuntu 12.04") and (processor == "x86_64") and (bits == 64): PASS + FAIL [CORS type response could not be loaded in the new window.] bug: https://bugzilla.mozilla.org/show_bug.cgi?id=1183162 - expected: FAIL + expected: + if debug and (os == "linux") and (version == "Ubuntu 12.04") and (processor == "x86") and (bits == 32): PASS + FAIL [Opaque type response could not be loaded in the new window.] bug: https://bugzilla.mozilla.org/show_bug.cgi?id=1183162 expected: FAIL + diff --git a/testing/web-platform/mozilla/meta/service-workers/service-worker/fetch-request-xhr.https.html.ini b/testing/web-platform/mozilla/meta/service-workers/service-worker/fetch-request-xhr.https.html.ini index ea93b4494c49..3130ed98d023 100644 --- a/testing/web-platform/mozilla/meta/service-workers/service-worker/fetch-request-xhr.https.html.ini +++ b/testing/web-platform/mozilla/meta/service-workers/service-worker/fetch-request-xhr.https.html.ini @@ -1,10 +1,6 @@ [fetch-request-xhr.https.html] type: testharness - expected: - if debug and (os == "win") and (version == "6.1.7601") and (processor == "x86") and (bits == 32): CRASH - if debug and (os == "win") and (version == "5.1.2600") and (processor == "x86") and (bits == 32): CRASH - if debug and (os == "win") and (version == "6.2.9200") and (processor == "x86_64") and (bits == 64): CRASH - TIMEOUT + expected: TIMEOUT [Verify the body of FetchEvent using XMLHttpRequest] expected: TIMEOUT diff --git a/testing/web-platform/mozilla/meta/service-workers/service-worker/fetch-response-xhr.https.html.ini b/testing/web-platform/mozilla/meta/service-workers/service-worker/fetch-response-xhr.https.html.ini index b5ba0a46a74a..b7aaca6b8d72 100644 --- a/testing/web-platform/mozilla/meta/service-workers/service-worker/fetch-response-xhr.https.html.ini +++ b/testing/web-platform/mozilla/meta/service-workers/service-worker/fetch-response-xhr.https.html.ini @@ -1,10 +1,6 @@ [fetch-response-xhr.https.html] type: testharness - expected: - if debug and (os == "win") and (version == "6.1.7601") and (processor == "x86") and (bits == 32): CRASH - if debug and (os == "win") and (version == "5.1.2600") and (processor == "x86") and (bits == 32): CRASH - if debug and (os == "win") and (version == "6.2.9200") and (processor == "x86_64") and (bits == 64): CRASH - TIMEOUT + expected: TIMEOUT [Verify the response of FetchEvent using XMLHttpRequest] expected: TIMEOUT diff --git a/testing/web-platform/mozilla/meta/service-workers/service-worker/invalid-blobtype.https.html.ini b/testing/web-platform/mozilla/meta/service-workers/service-worker/invalid-blobtype.https.html.ini index f72053f27112..3e59bb055690 100644 --- a/testing/web-platform/mozilla/meta/service-workers/service-worker/invalid-blobtype.https.html.ini +++ b/testing/web-platform/mozilla/meta/service-workers/service-worker/invalid-blobtype.https.html.ini @@ -1,10 +1,6 @@ [invalid-blobtype.https.html] type: testharness - expected: - if debug and (os == "win") and (version == "6.1.7601") and (processor == "x86") and (bits == 32): CRASH - if debug and (os == "win") and (version == "5.1.2600") and (processor == "x86") and (bits == 32): CRASH - if debug and (os == "win") and (version == "6.2.9200") and (processor == "x86_64") and (bits == 64): CRASH - TIMEOUT + expected: TIMEOUT [Verify the response of FetchEvent using XMLHttpRequest] expected: TIMEOUT diff --git a/testing/web-platform/mozilla/meta/service-workers/service-worker/invalid-header.https.html.ini b/testing/web-platform/mozilla/meta/service-workers/service-worker/invalid-header.https.html.ini index 69a938735efe..bab4781d8678 100644 --- a/testing/web-platform/mozilla/meta/service-workers/service-worker/invalid-header.https.html.ini +++ b/testing/web-platform/mozilla/meta/service-workers/service-worker/invalid-header.https.html.ini @@ -1,10 +1,6 @@ [invalid-header.https.html] type: testharness - expected: - if debug and (os == "win") and (version == "6.1.7601") and (processor == "x86") and (bits == 32): CRASH - if debug and (os == "win") and (version == "5.1.2600") and (processor == "x86") and (bits == 32): CRASH - if debug and (os == "win") and (version == "6.2.9200") and (processor == "x86_64") and (bits == 64): CRASH - TIMEOUT + expected: TIMEOUT [Verify the response of FetchEvent using XMLHttpRequest] expected: TIMEOUT diff --git a/testing/web-platform/mozilla/meta/service-workers/service-worker/referer.https.html.ini b/testing/web-platform/mozilla/meta/service-workers/service-worker/referer.https.html.ini index 234b86e6b0e4..7f314a55a4e0 100644 --- a/testing/web-platform/mozilla/meta/service-workers/service-worker/referer.https.html.ini +++ b/testing/web-platform/mozilla/meta/service-workers/service-worker/referer.https.html.ini @@ -1,10 +1,6 @@ [referer.https.html] type: testharness - expected: - if debug and (os == "win") and (version == "6.1.7601") and (processor == "x86") and (bits == 32): CRASH - if debug and (os == "win") and (version == "5.1.2600") and (processor == "x86") and (bits == 32): CRASH - if debug and (os == "win") and (version == "6.2.9200") and (processor == "x86_64") and (bits == 64): CRASH - TIMEOUT + expected: TIMEOUT [Verify the referer] expected: TIMEOUT From 72abf7c0ec7788000e6b336c0751dedefe894f09 Mon Sep 17 00:00:00 2001 From: James Graham Date: Sun, 26 Jul 2015 18:48:05 +0100 Subject: [PATCH 067/136] Bug 1187722 - Disable unstable service-worker test in debug linux, a=testonly --- .../fetch-frame-resource.https.html.ini | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/testing/web-platform/mozilla/meta/service-workers/service-worker/fetch-frame-resource.https.html.ini b/testing/web-platform/mozilla/meta/service-workers/service-worker/fetch-frame-resource.https.html.ini index 2f5e254be44b..79791c274a06 100644 --- a/testing/web-platform/mozilla/meta/service-workers/service-worker/fetch-frame-resource.https.html.ini +++ b/testing/web-platform/mozilla/meta/service-workers/service-worker/fetch-frame-resource.https.html.ini @@ -1,6 +1,9 @@ [fetch-frame-resource.https.html] type: testharness expected: TIMEOUT + disabled: + if debug and (os == "linux"): https://bugzilla.mozilla.org/show_bug.cgi?id=1187722 + [Basic type response could be loaded in the iframe.] expected: TIMEOUT @@ -11,16 +14,11 @@ expected: FAIL [Opaque type response could not be loaded in the iframe.] - expected: - if debug and (os == "linux") and (version == "Ubuntu 12.04") and (processor == "x86") and (bits == 32): PASS - if debug and (os == "linux") and (version == "Ubuntu 12.04") and (processor == "x86_64") and (bits == 64): PASS - FAIL + expected: FAIL [CORS type response could not be loaded in the new window.] bug: https://bugzilla.mozilla.org/show_bug.cgi?id=1183162 - expected: - if debug and (os == "linux") and (version == "Ubuntu 12.04") and (processor == "x86") and (bits == 32): PASS - FAIL + expected: FAIL [Opaque type response could not be loaded in the new window.] bug: https://bugzilla.mozilla.org/show_bug.cgi?id=1183162 From 95bead466835d19b4ecfc1492191628aedde2b44 Mon Sep 17 00:00:00 2001 From: Andrew McCreight Date: Sun, 26 Jul 2015 14:26:23 -0700 Subject: [PATCH 068/136] Bug 1187410 - Use GetNameShared() in XPCNativeInterface::NewInstance() to avoid a leak. r=mrbkap GetName() returns a new string, but that string is never freed. This patch avoids the leak by not copying the string. This is okay because the scope of intfNameChars is within the scope of aInfo. --- js/xpconnect/src/XPCWrappedNativeInfo.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/js/xpconnect/src/XPCWrappedNativeInfo.cpp b/js/xpconnect/src/XPCWrappedNativeInfo.cpp index 48816435fae8..ee8aeb60efe4 100644 --- a/js/xpconnect/src/XPCWrappedNativeInfo.cpp +++ b/js/xpconnect/src/XPCWrappedNativeInfo.cpp @@ -239,8 +239,8 @@ XPCNativeInterface::NewInstance(nsIInterfaceInfo* aInfo) if (mainProcessScriptableOnly && !XRE_IsParentProcess()) { nsCOMPtr console(do_GetService(NS_CONSOLESERVICE_CONTRACTID)); if (console) { - char* intfNameChars; - aInfo->GetName(&intfNameChars); + const char* intfNameChars; + aInfo->GetNameShared(&intfNameChars); nsPrintfCString errorMsg("Use of %s in content process is deprecated.", intfNameChars); nsAutoString filename; From 9fd9265409a9f0f4ba1bee72d667cbdbe69824ab Mon Sep 17 00:00:00 2001 From: Mike Hommey Date: Sun, 26 Jul 2015 11:55:21 +0900 Subject: [PATCH 069/136] Bug 1187662 - Add the -v option to valgrind when running valgrind-test. r=njn This will add more verbosity, with the intent of having the triggered suppressions be displayed in the form: "--23983-- used_suppression: 3 Bug 794372 /builds/slave/try-l64-valgrind-0000000000000/src/build/valgrind/cross-architecture.sup:90 suppressed: 20,736 bytes in 648 blocks" --- build/valgrind/mach_commands.py | 1 + 1 file changed, 1 insertion(+) diff --git a/build/valgrind/mach_commands.py b/build/valgrind/mach_commands.py index fb9e1f7db6c0..b9038a2d8ef2 100644 --- a/build/valgrind/mach_commands.py +++ b/build/valgrind/mach_commands.py @@ -109,6 +109,7 @@ class MachCommands(MachCommandBase): '--show-possibly-lost=no', '--track-origins=yes', '--trace-children=yes', + '-v', # Enable verbosity to get the list of used suppressions ] for s in suppressions: From b45368f4716c2cb4d5a9dc2cb99c98f3a7fd6a33 Mon Sep 17 00:00:00 2001 From: Masayuki Nakano Date: Mon, 27 Jul 2015 08:23:04 +0900 Subject: [PATCH 070/136] Bug 1186017 part.1 Rename nsGtkIMModule to mozilla::widget::IMContextWrapper r=m_kato+kerlt --HG-- rename : widget/gtk/nsGtkIMModule.cpp => widget/gtk/IMContextWrapper.cpp rename : widget/gtk/nsGtkIMModule.h => widget/gtk/IMContextWrapper.h --- ...nsGtkIMModule.cpp => IMContextWrapper.cpp} | 674 ++++++++++-------- .../{nsGtkIMModule.h => IMContextWrapper.h} | 95 +-- widget/gtk/moz.build | 4 +- widget/gtk/nsGtkKeyUtils.cpp | 1 + widget/gtk/nsWindow.cpp | 54 +- widget/gtk/nsWindow.h | 6 +- 6 files changed, 463 insertions(+), 371 deletions(-) rename widget/gtk/{nsGtkIMModule.cpp => IMContextWrapper.cpp} (71%) rename widget/gtk/{nsGtkIMModule.h => IMContextWrapper.h} (84%) diff --git a/widget/gtk/nsGtkIMModule.cpp b/widget/gtk/IMContextWrapper.cpp similarity index 71% rename from widget/gtk/nsGtkIMModule.cpp rename to widget/gtk/IMContextWrapper.cpp index ae4a20c3c393..0fcaf10c791a 100644 --- a/widget/gtk/nsGtkIMModule.cpp +++ b/widget/gtk/IMContextWrapper.cpp @@ -7,7 +7,7 @@ #include "mozilla/Logging.h" #include "prtime.h" -#include "nsGtkIMModule.h" +#include "IMContextWrapper.h" #include "nsWindow.h" #include "mozilla/AutoRestore.h" #include "mozilla/Likely.h" @@ -16,8 +16,8 @@ #include "mozilla/TextEvents.h" #include "WritingModes.h" -using namespace mozilla; -using namespace mozilla::widget; +namespace mozilla { +namespace widget { PRLogModuleInfo* gGtkIMLog = nullptr; @@ -97,13 +97,13 @@ public: const static bool kUseSimpleContextDefault = MOZ_WIDGET_GTK == 2; /****************************************************************************** - * nsGtkIMModule + * IMContextWrapper ******************************************************************************/ -nsGtkIMModule* nsGtkIMModule::sLastFocusedModule = nullptr; -bool nsGtkIMModule::sUseSimpleContext; +IMContextWrapper* IMContextWrapper::sLastFocusedContext = nullptr; +bool IMContextWrapper::sUseSimpleContext; -nsGtkIMModule::nsGtkIMModule(nsWindow* aOwnerWindow) +IMContextWrapper::IMContextWrapper(nsWindow* aOwnerWindow) : mOwnerWindow(aOwnerWindow) , mLastFocusedWindow(nullptr) , mContext(nullptr) @@ -133,10 +133,10 @@ nsGtkIMModule::nsGtkIMModule(nsWindow* aOwnerWindow) } void -nsGtkIMModule::Init() +IMContextWrapper::Init() { MOZ_LOG(gGtkIMLog, LogLevel::Info, - ("GtkIMModule(%p): Init, mOwnerWindow=%p", + ("GTKIM: %p Init(), mOwnerWindow=%p", this, mOwnerWindow)); MozContainer* container = mOwnerWindow->GetMozContainer(); @@ -150,45 +150,39 @@ nsGtkIMModule::Init() mContext = gtk_im_multicontext_new(); gtk_im_context_set_client_window(mContext, gdkWindow); g_signal_connect(mContext, "preedit_changed", - G_CALLBACK(nsGtkIMModule::OnChangeCompositionCallback), - this); + G_CALLBACK(IMContextWrapper::OnChangeCompositionCallback), this); g_signal_connect(mContext, "retrieve_surrounding", - G_CALLBACK(nsGtkIMModule::OnRetrieveSurroundingCallback), - this); + G_CALLBACK(IMContextWrapper::OnRetrieveSurroundingCallback), this); g_signal_connect(mContext, "delete_surrounding", - G_CALLBACK(nsGtkIMModule::OnDeleteSurroundingCallback), - this); + G_CALLBACK(IMContextWrapper::OnDeleteSurroundingCallback), this); g_signal_connect(mContext, "commit", - G_CALLBACK(nsGtkIMModule::OnCommitCompositionCallback), - this); + G_CALLBACK(IMContextWrapper::OnCommitCompositionCallback), this); g_signal_connect(mContext, "preedit_start", - G_CALLBACK(nsGtkIMModule::OnStartCompositionCallback), - this); + G_CALLBACK(IMContextWrapper::OnStartCompositionCallback), this); g_signal_connect(mContext, "preedit_end", - G_CALLBACK(nsGtkIMModule::OnEndCompositionCallback), - this); + G_CALLBACK(IMContextWrapper::OnEndCompositionCallback), this); // Simple context if (sUseSimpleContext) { mSimpleContext = gtk_im_context_simple_new(); gtk_im_context_set_client_window(mSimpleContext, gdkWindow); g_signal_connect(mSimpleContext, "preedit_changed", - G_CALLBACK(&nsGtkIMModule::OnChangeCompositionCallback), + G_CALLBACK(&IMContextWrapper::OnChangeCompositionCallback), this); g_signal_connect(mSimpleContext, "retrieve_surrounding", - G_CALLBACK(&nsGtkIMModule::OnRetrieveSurroundingCallback), + G_CALLBACK(&IMContextWrapper::OnRetrieveSurroundingCallback), this); g_signal_connect(mSimpleContext, "delete_surrounding", - G_CALLBACK(&nsGtkIMModule::OnDeleteSurroundingCallback), + G_CALLBACK(&IMContextWrapper::OnDeleteSurroundingCallback), this); g_signal_connect(mSimpleContext, "commit", - G_CALLBACK(&nsGtkIMModule::OnCommitCompositionCallback), + G_CALLBACK(&IMContextWrapper::OnCommitCompositionCallback), this); g_signal_connect(mSimpleContext, "preedit_start", - G_CALLBACK(nsGtkIMModule::OnStartCompositionCallback), + G_CALLBACK(IMContextWrapper::OnStartCompositionCallback), this); g_signal_connect(mSimpleContext, "preedit_end", - G_CALLBACK(nsGtkIMModule::OnEndCompositionCallback), + G_CALLBACK(IMContextWrapper::OnEndCompositionCallback), this); } @@ -197,21 +191,22 @@ nsGtkIMModule::Init() gtk_im_context_set_client_window(mDummyContext, gdkWindow); } -nsGtkIMModule::~nsGtkIMModule() +IMContextWrapper::~IMContextWrapper() { - if (this == sLastFocusedModule) { - sLastFocusedModule = nullptr; + if (this == sLastFocusedContext) { + sLastFocusedContext = nullptr; } MOZ_LOG(gGtkIMLog, LogLevel::Info, - ("GtkIMModule(%p) was gone", this)); + ("GTKIM: %p ~IMContextWrapper()", this)); } void -nsGtkIMModule::OnDestroyWindow(nsWindow* aWindow) +IMContextWrapper::OnDestroyWindow(nsWindow* aWindow) { MOZ_LOG(gGtkIMLog, LogLevel::Info, - ("GtkIMModule(%p): OnDestroyWindow, aWindow=%p, mLastFocusedWindow=%p, mOwnerWindow=%p, mLastFocusedModule=%p", - this, aWindow, mLastFocusedWindow, mOwnerWindow, sLastFocusedModule)); + ("GTKIM: %p OnDestroyWindow(aWindow=%p), mLastFocusedWindow=%p, " + "mOwnerWindow=%p, mLastFocusedModule=%p", + this, aWindow, mLastFocusedWindow, mOwnerWindow, sLastFocusedContext)); NS_PRECONDITION(aWindow, "aWindow must not be null"); @@ -227,8 +222,8 @@ nsGtkIMModule::OnDestroyWindow(nsWindow* aWindow) return; } - if (sLastFocusedModule == this) { - sLastFocusedModule = nullptr; + if (sLastFocusedContext == this) { + sLastFocusedContext = nullptr; } /** @@ -269,8 +264,9 @@ nsGtkIMModule::OnDestroyWindow(nsWindow* aWindow) mLastFocusedWindow = nullptr; mInputContext.mIMEState.mEnabled = IMEState::DISABLED; - MOZ_LOG(gGtkIMLog, LogLevel::Info, - (" SUCCEEDED, Completely destroyed")); + MOZ_LOG(gGtkIMLog, LogLevel::Debug, + ("GTKIM: %p OnDestroyWindow(), succeeded, Completely destroyed", + this)); } // Work around gtk bug http://bugzilla.gnome.org/show_bug.cgi?id=483223: @@ -292,7 +288,7 @@ nsGtkIMModule::OnDestroyWindow(nsWindow* aWindow) // handlers (where possible). void -nsGtkIMModule::PrepareToDestroyContext(GtkIMContext *aContext) +IMContextWrapper::PrepareToDestroyContext(GtkIMContext* aContext) { #if (MOZ_WIDGET_GTK == 2) GtkIMMulticontext *multicontext = GTK_IM_MULTICONTEXT(aContext); @@ -316,28 +312,28 @@ nsGtkIMModule::PrepareToDestroyContext(GtkIMContext *aContext) } void -nsGtkIMModule::OnFocusWindow(nsWindow* aWindow) +IMContextWrapper::OnFocusWindow(nsWindow* aWindow) { if (MOZ_UNLIKELY(IsDestroyed())) { return; } MOZ_LOG(gGtkIMLog, LogLevel::Info, - ("GtkIMModule(%p): OnFocusWindow, aWindow=%p, mLastFocusedWindow=%p", + ("GTKIM: %p OnFocusWindow(aWindow=%p), mLastFocusedWindow=%p", this, aWindow, mLastFocusedWindow)); mLastFocusedWindow = aWindow; Focus(); } void -nsGtkIMModule::OnBlurWindow(nsWindow* aWindow) +IMContextWrapper::OnBlurWindow(nsWindow* aWindow) { if (MOZ_UNLIKELY(IsDestroyed())) { return; } MOZ_LOG(gGtkIMLog, LogLevel::Info, - ("GtkIMModule(%p): OnBlurWindow, aWindow=%p, mLastFocusedWindow=%p, " + ("GTKIM: %p OnBlurWindow(aWindow=%p), mLastFocusedWindow=%p, " "mIsIMFocused=%s", this, aWindow, mLastFocusedWindow, GetBoolName(mIsIMFocused))); @@ -349,8 +345,9 @@ nsGtkIMModule::OnBlurWindow(nsWindow* aWindow) } bool -nsGtkIMModule::OnKeyEvent(nsWindow* aCaller, GdkEventKey* aEvent, - bool aKeyDownEventWasSent /* = false */) +IMContextWrapper::OnKeyEvent(nsWindow* aCaller, + GdkEventKey* aEvent, + bool aKeyDownEventWasSent /* = false */) { NS_PRECONDITION(aEvent, "aEvent must be non-null"); @@ -360,7 +357,7 @@ nsGtkIMModule::OnKeyEvent(nsWindow* aCaller, GdkEventKey* aEvent, } MOZ_LOG(gGtkIMLog, LogLevel::Info, - ("GtkIMModule(%p): OnKeyEvent, aCaller=%p, aKeyDownEventWasSent=%s, " + ("GTKIM: %p OnKeyEvent(aCaller=%p, aKeyDownEventWasSent=%s), " "mCompositionState=%s, current context=%p, active context=%p, " "aEvent(%p): { type=%s, keyval=%s, unicode=0x%X }", this, aCaller, GetBoolName(aKeyDownEventWasSent), @@ -369,9 +366,10 @@ nsGtkIMModule::OnKeyEvent(nsWindow* aCaller, GdkEventKey* aEvent, gdk_keyval_to_unicode(aEvent->keyval))); if (aCaller != mLastFocusedWindow) { - MOZ_LOG(gGtkIMLog, LogLevel::Info, - (" FAILED, the caller isn't focused window, mLastFocusedWindow=%p", - mLastFocusedWindow)); + MOZ_LOG(gGtkIMLog, LogLevel::Error, + ("GTKIM: %p OnKeyEvent(), FAILED, the caller isn't focused " + "window, mLastFocusedWindow=%p", + this, mLastFocusedWindow)); return false; } @@ -379,8 +377,9 @@ nsGtkIMModule::OnKeyEvent(nsWindow* aCaller, GdkEventKey* aEvent, // current context since the user expects so. GtkIMContext* currentContext = GetCurrentContext(); if (MOZ_UNLIKELY(!currentContext)) { - MOZ_LOG(gGtkIMLog, LogLevel::Info, - (" FAILED, there are no context")); + MOZ_LOG(gGtkIMLog, LogLevel::Error, + ("GTKIM: %p OnKeyEvent(), FAILED, there are no context", + this)); return false; } @@ -427,20 +426,20 @@ nsGtkIMModule::OnKeyEvent(nsWindow* aCaller, GdkEventKey* aEvent, } } - MOZ_LOG(gGtkIMLog, LogLevel::Info, - (" filterThisEvent=%s (isFiltered=%s, mFilterKeyEvent=%s), " - "mCompositionState=%s", - GetBoolName(filterThisEvent), GetBoolName(isFiltered), + MOZ_LOG(gGtkIMLog, LogLevel::Debug, + ("GTKIM: %p OnKeyEvent(), succeeded, filterThisEvent=%s " + "(isFiltered=%s, mFilterKeyEvent=%s), mCompositionState=%s", + this, GetBoolName(filterThisEvent), GetBoolName(isFiltered), GetBoolName(mFilterKeyEvent), GetCompositionStateName())); return filterThisEvent; } void -nsGtkIMModule::OnFocusChangeInGecko(bool aFocus) +IMContextWrapper::OnFocusChangeInGecko(bool aFocus) { MOZ_LOG(gGtkIMLog, LogLevel::Info, - ("GtkIMModule(%p): OnFocusChangeInGecko, aFocus=%s, " + ("GTKIM: %p OnFocusChangeInGecko(aFocus=%s), " "mCompositionState=%s, mIsIMFocused=%s", this, GetBoolName(aFocus), GetCompositionStateName(), GetBoolName(mIsIMFocused))); @@ -451,20 +450,21 @@ nsGtkIMModule::OnFocusChangeInGecko(bool aFocus) } void -nsGtkIMModule::ResetIME() +IMContextWrapper::ResetIME() { MOZ_LOG(gGtkIMLog, LogLevel::Info, - ("GtkIMModule(%p): ResetIME, mCompositionState=%s, mIsIMFocused=%s", + ("GTKIM: %p ResetIME(), mCompositionState=%s, mIsIMFocused=%s", this, GetCompositionStateName(), GetBoolName(mIsIMFocused))); GtkIMContext* activeContext = GetActiveContext(); if (MOZ_UNLIKELY(!activeContext)) { - MOZ_LOG(gGtkIMLog, LogLevel::Info, - (" FAILED, there are no context")); + MOZ_LOG(gGtkIMLog, LogLevel::Error, + ("GTKIM: %p ResetIME(), FAILED, there are no context", + this)); return; } - nsRefPtr kungFuDeathGrip(this); + nsRefPtr kungFuDeathGrip(this); nsRefPtr lastFocusedWindow(mLastFocusedWindow); gtk_im_context_reset(activeContext); @@ -480,8 +480,8 @@ nsGtkIMModule::ResetIME() nsAutoString compositionString; GetCompositionString(activeContext, compositionString); - MOZ_LOG(gGtkIMLog, LogLevel::Info, - ("GtkIMModule(%p): ResetIME() called gtk_im_context_reset(), " + MOZ_LOG(gGtkIMLog, LogLevel::Debug, + ("GTKIM: %p ResetIME() called gtk_im_context_reset(), " "activeContext=%p, mCompositionState=%s, compositionString=%s, " "mIsIMFocused=%s", this, activeContext, GetCompositionStateName(), @@ -500,21 +500,22 @@ nsGtkIMModule::ResetIME() } nsresult -nsGtkIMModule::EndIMEComposition(nsWindow* aCaller) +IMContextWrapper::EndIMEComposition(nsWindow* aCaller) { if (MOZ_UNLIKELY(IsDestroyed())) { return NS_OK; } MOZ_LOG(gGtkIMLog, LogLevel::Info, - ("GtkIMModule(%p): EndIMEComposition, aCaller=%p, " + ("GTKIM: %p EndIMEComposition(aCaller=%p), " "mCompositionState=%s", this, aCaller, GetCompositionStateName())); if (aCaller != mLastFocusedWindow) { - MOZ_LOG(gGtkIMLog, LogLevel::Info, - (" WARNING: the caller isn't focused window, mLastFocusedWindow=%p", - mLastFocusedWindow)); + MOZ_LOG(gGtkIMLog, LogLevel::Error, + ("GTKIM: %p EndIMEComposition(), FAILED, the caller isn't " + "focused window, mLastFocusedWindow=%p", + this, mLastFocusedWindow)); return NS_OK; } @@ -536,7 +537,7 @@ nsGtkIMModule::EndIMEComposition(nsWindow* aCaller) } void -nsGtkIMModule::OnLayoutChange() +IMContextWrapper::OnLayoutChange() { if (MOZ_UNLIKELY(IsDestroyed())) { return; @@ -553,7 +554,7 @@ nsGtkIMModule::OnLayoutChange() } void -nsGtkIMModule::OnUpdateComposition() +IMContextWrapper::OnUpdateComposition() { if (MOZ_UNLIKELY(IsDestroyed())) { return; @@ -575,37 +576,43 @@ nsGtkIMModule::OnUpdateComposition() } void -nsGtkIMModule::SetInputContext(nsWindow* aCaller, - const InputContext* aContext, - const InputContextAction* aAction) +IMContextWrapper::SetInputContext(nsWindow* aCaller, + const InputContext* aContext, + const InputContextAction* aAction) { if (MOZ_UNLIKELY(IsDestroyed())) { return; } MOZ_LOG(gGtkIMLog, LogLevel::Info, - ("GtkIMModule(%p): SetInputContext, aCaller=%p, aState=%s mHTMLInputType=%s", + ("GTKIM: %p SetInputContext(aCaller=%p, aContext={ mIMEState={ " + "mEnabled=%s }, mHTMLInputType=%s })", this, aCaller, GetEnabledStateName(aContext->mIMEState.mEnabled), NS_ConvertUTF16toUTF8(aContext->mHTMLInputType).get())); if (aCaller != mLastFocusedWindow) { - MOZ_LOG(gGtkIMLog, LogLevel::Info, - (" FAILED, the caller isn't focused window, mLastFocusedWindow=%p", - mLastFocusedWindow)); + MOZ_LOG(gGtkIMLog, LogLevel::Error, + ("GTKIM: %p SetInputContext(), FAILED, " + "the caller isn't focused window, mLastFocusedWindow=%p", + this, mLastFocusedWindow)); return; } if (!mContext) { - MOZ_LOG(gGtkIMLog, LogLevel::Info, - (" FAILED, there are no context")); + MOZ_LOG(gGtkIMLog, LogLevel::Error, + ("GTKIM: %p SetInputContext(), FAILED, " + "there are no context", + this)); return; } - if (sLastFocusedModule != this) { + if (sLastFocusedContext != this) { mInputContext = *aContext; - MOZ_LOG(gGtkIMLog, LogLevel::Info, - (" SUCCEEDED, but we're not active")); + MOZ_LOG(gGtkIMLog, LogLevel::Debug, + ("GTKIM: %p SetInputContext(), succeeded, " + "but we're not active", + this)); return; } @@ -676,14 +683,14 @@ nsGtkIMModule::SetInputContext(nsWindow* aCaller, } InputContext -nsGtkIMModule::GetInputContext() +IMContextWrapper::GetInputContext() { mInputContext.mIMEState.mOpen = IMEState::OPEN_STATE_NOT_SUPPORTED; return mInputContext; } GtkIMContext* -nsGtkIMModule::GetCurrentContext() const +IMContextWrapper::GetCurrentContext() const { if (IsEnabled()) { return mContext; @@ -695,7 +702,7 @@ nsGtkIMModule::GetCurrentContext() const } bool -nsGtkIMModule::IsValidContext(GtkIMContext* aContext) const +IMContextWrapper::IsValidContext(GtkIMContext* aContext) const { if (!aContext) { return false; @@ -706,7 +713,7 @@ nsGtkIMModule::IsValidContext(GtkIMContext* aContext) const } bool -nsGtkIMModule::IsEnabled() const +IMContextWrapper::IsEnabled() const { return mInputContext.mIMEState.mEnabled == IMEState::ENABLED || mInputContext.mIMEState.mEnabled == IMEState::PLUGIN || @@ -715,30 +722,31 @@ nsGtkIMModule::IsEnabled() const } void -nsGtkIMModule::Focus() +IMContextWrapper::Focus() { MOZ_LOG(gGtkIMLog, LogLevel::Info, - ("GtkIMModule(%p): Focus, sLastFocusedModule=%p", - this, sLastFocusedModule)); + ("GTKIM: %p Focus(), sLastFocusedContext=%p", + this, sLastFocusedContext)); if (mIsIMFocused) { - NS_ASSERTION(sLastFocusedModule == this, + NS_ASSERTION(sLastFocusedContext == this, "We're not active, but the IM was focused?"); return; } GtkIMContext* currentContext = GetCurrentContext(); if (!currentContext) { - MOZ_LOG(gGtkIMLog, LogLevel::Info, - (" FAILED, there are no context")); + MOZ_LOG(gGtkIMLog, LogLevel::Error, + ("GTKIM: %p Focus(), FAILED, there are no context", + this)); return; } - if (sLastFocusedModule && sLastFocusedModule != this) { - sLastFocusedModule->Blur(); + if (sLastFocusedContext && sLastFocusedContext != this) { + sLastFocusedContext->Blur(); } - sLastFocusedModule = this; + sLastFocusedContext = this; gtk_im_context_focus_in(currentContext); mIsIMFocused = true; @@ -752,10 +760,10 @@ nsGtkIMModule::Focus() } void -nsGtkIMModule::Blur() +IMContextWrapper::Blur() { MOZ_LOG(gGtkIMLog, LogLevel::Info, - ("GtkIMModule(%p): Blur, mIsIMFocused=%s", + ("GTKIM: %p Blur(), mIsIMFocused=%s", this, GetBoolName(mIsIMFocused))); if (!mIsIMFocused) { @@ -764,8 +772,9 @@ nsGtkIMModule::Blur() GtkIMContext* currentContext = GetCurrentContext(); if (!currentContext) { - MOZ_LOG(gGtkIMLog, LogLevel::Info, - (" FAILED, there are no context")); + MOZ_LOG(gGtkIMLog, LogLevel::Error, + ("GTKIM: %p Blur(), FAILED, there are no context", + this)); return; } @@ -774,8 +783,8 @@ nsGtkIMModule::Blur() } void -nsGtkIMModule::OnSelectionChange(nsWindow* aCaller, - const IMENotification& aIMENotification) +IMContextWrapper::OnSelectionChange(nsWindow* aCaller, + const IMENotification& aIMENotification) { mSelection.Assign(aIMENotification); @@ -787,7 +796,7 @@ nsGtkIMModule::OnSelectionChange(nsWindow* aCaller, aIMENotification.mSelectionChangeData; MOZ_LOG(gGtkIMLog, LogLevel::Info, - ("GtkIMModule(%p): OnSelectionChange(aCaller=0x%p, aIMENotification={ " + ("GTKIM: %p OnSelectionChange(aCaller=0x%p, aIMENotification={ " "mSelectionChangeData={ mOffset=%u, Length()=%u, mReversed=%s, " "mWritingMode=%s, mCausedByComposition=%s, mCausedBySelectionEvent=%s " "} }), mCompositionState=%s, mIsDeletingSurrounding=%s", @@ -800,10 +809,10 @@ nsGtkIMModule::OnSelectionChange(nsWindow* aCaller, GetCompositionStateName(), GetBoolName(mIsDeletingSurrounding))); if (aCaller != mLastFocusedWindow) { - MOZ_LOG(gGtkIMLog, LogLevel::Info, - (" WARNING: the caller isn't focused window, " - "mLastFocusedWindow=%p", - mLastFocusedWindow)); + MOZ_LOG(gGtkIMLog, LogLevel::Error, + ("GTKIM: %p OnSelectionChange(), FAILED, " + "the caller isn't focused window, mLastFocusedWindow=%p", + this, mLastFocusedWindow)); return; } @@ -819,16 +828,19 @@ nsGtkIMModule::OnSelectionChange(nsWindow* aCaller, // we should ignore selection change notification. if (mCompositionState == eCompositionState_CompositionStartDispatched) { if (NS_WARN_IF(!mSelection.IsValid())) { - MOZ_LOG(gGtkIMLog, LogLevel::Info, - (" ERROR: new offset is too large, cannot keep composing")); + MOZ_LOG(gGtkIMLog, LogLevel::Error, + ("GTKIM: %p OnSelectionChange(), FAILED, " + "new offset is too large, cannot keep composing", + this)); } else { // Modify the selection start offset with new offset. mCompositionStart = mSelection.mOffset; // XXX We should modify mSelectedString? But how? - MOZ_LOG(gGtkIMLog, LogLevel::Info, - (" NOTE: mCompositionStart is updated to %u, " - "the selection change doesn't cause resetting IM context", - mCompositionStart)); + MOZ_LOG(gGtkIMLog, LogLevel::Debug, + ("GTKIM: %p OnSelectionChange(), ignored, mCompositionStart " + "is updated to %u, the selection change doesn't cause " + "resetting IM context", + this, mCompositionStart)); // And don't reset the IM context. return; } @@ -852,24 +864,26 @@ nsGtkIMModule::OnSelectionChange(nsWindow* aCaller, /* static */ void -nsGtkIMModule::OnStartCompositionCallback(GtkIMContext *aContext, - nsGtkIMModule* aModule) +IMContextWrapper::OnStartCompositionCallback(GtkIMContext* aContext, + IMContextWrapper* aModule) { aModule->OnStartCompositionNative(aContext); } void -nsGtkIMModule::OnStartCompositionNative(GtkIMContext *aContext) +IMContextWrapper::OnStartCompositionNative(GtkIMContext* aContext) { MOZ_LOG(gGtkIMLog, LogLevel::Info, - ("GtkIMModule(%p): OnStartCompositionNative, aContext=%p, " + ("GTKIM: %p OnStartCompositionNative(aContext=%p), " "current context=%p", this, aContext, GetCurrentContext())); // See bug 472635, we should do nothing if IM context doesn't match. if (GetCurrentContext() != aContext) { - MOZ_LOG(gGtkIMLog, LogLevel::Info, - (" FAILED, given context doesn't match")); + MOZ_LOG(gGtkIMLog, LogLevel::Error, + ("GTKIM: %p OnStartCompositionNative(), FAILED, " + "given context doesn't match", + this)); return; } @@ -884,25 +898,27 @@ nsGtkIMModule::OnStartCompositionNative(GtkIMContext *aContext) /* static */ void -nsGtkIMModule::OnEndCompositionCallback(GtkIMContext *aContext, - nsGtkIMModule* aModule) +IMContextWrapper::OnEndCompositionCallback(GtkIMContext* aContext, + IMContextWrapper* aModule) { aModule->OnEndCompositionNative(aContext); } void -nsGtkIMModule::OnEndCompositionNative(GtkIMContext *aContext) +IMContextWrapper::OnEndCompositionNative(GtkIMContext* aContext) { MOZ_LOG(gGtkIMLog, LogLevel::Info, - ("GtkIMModule(%p): OnEndCompositionNative, aContext=%p", + ("GTKIM: %p OnEndCompositionNative(aContext=%p)", this, aContext)); // See bug 472635, we should do nothing if IM context doesn't match. // Note that if this is called after focus move, the context may different // from any our owning context. if (!IsValidContext(aContext)) { - MOZ_LOG(gGtkIMLog, LogLevel::Info, - (" FAILED, given context doesn't match with any context")); + MOZ_LOG(gGtkIMLog, LogLevel::Error, + ("GTKIM: %p OnEndCompositionNative(), FAILED, " + "given context doesn't match with any context", + this)); return; } @@ -920,25 +936,27 @@ nsGtkIMModule::OnEndCompositionNative(GtkIMContext *aContext) /* static */ void -nsGtkIMModule::OnChangeCompositionCallback(GtkIMContext *aContext, - nsGtkIMModule* aModule) +IMContextWrapper::OnChangeCompositionCallback(GtkIMContext* aContext, + IMContextWrapper* aModule) { aModule->OnChangeCompositionNative(aContext); } void -nsGtkIMModule::OnChangeCompositionNative(GtkIMContext *aContext) +IMContextWrapper::OnChangeCompositionNative(GtkIMContext* aContext) { MOZ_LOG(gGtkIMLog, LogLevel::Info, - ("GtkIMModule(%p): OnChangeCompositionNative, aContext=%p", + ("GTKIM: %p OnChangeCompositionNative(aContext=%p)", this, aContext)); // See bug 472635, we should do nothing if IM context doesn't match. // Note that if this is called after focus move, the context may different // from any our owning context. if (!IsValidContext(aContext)) { - MOZ_LOG(gGtkIMLog, LogLevel::Info, - (" FAILED, given context doesn't match with any context")); + MOZ_LOG(gGtkIMLog, LogLevel::Error, + ("GTKIM: %p OnChangeCompositionNative(), FAILED, " + "given context doesn't match with any context", + this)); return; } @@ -955,24 +973,26 @@ nsGtkIMModule::OnChangeCompositionNative(GtkIMContext *aContext) /* static */ gboolean -nsGtkIMModule::OnRetrieveSurroundingCallback(GtkIMContext *aContext, - nsGtkIMModule *aModule) +IMContextWrapper::OnRetrieveSurroundingCallback(GtkIMContext* aContext, + IMContextWrapper* aModule) { return aModule->OnRetrieveSurroundingNative(aContext); } gboolean -nsGtkIMModule::OnRetrieveSurroundingNative(GtkIMContext *aContext) +IMContextWrapper::OnRetrieveSurroundingNative(GtkIMContext* aContext) { MOZ_LOG(gGtkIMLog, LogLevel::Info, - ("GtkIMModule(%p): OnRetrieveSurroundingNative, aContext=%p, " + ("GTKIM: %p OnRetrieveSurroundingNative(aContext=%p), " "current context=%p", this, aContext, GetCurrentContext())); // See bug 472635, we should do nothing if IM context doesn't match. if (GetCurrentContext() != aContext) { - MOZ_LOG(gGtkIMLog, LogLevel::Info, - (" FAILED, given context doesn't match")); + MOZ_LOG(gGtkIMLog, LogLevel::Error, + ("GTKIM: %p OnRetrieveSurroundingNative(), FAILED, " + "given context doesn't match", + this)); return FALSE; } @@ -992,28 +1012,30 @@ nsGtkIMModule::OnRetrieveSurroundingNative(GtkIMContext *aContext) /* static */ gboolean -nsGtkIMModule::OnDeleteSurroundingCallback(GtkIMContext *aContext, - gint aOffset, - gint aNChars, - nsGtkIMModule *aModule) +IMContextWrapper::OnDeleteSurroundingCallback(GtkIMContext* aContext, + gint aOffset, + gint aNChars, + IMContextWrapper* aModule) { return aModule->OnDeleteSurroundingNative(aContext, aOffset, aNChars); } gboolean -nsGtkIMModule::OnDeleteSurroundingNative(GtkIMContext *aContext, - gint aOffset, - gint aNChars) +IMContextWrapper::OnDeleteSurroundingNative(GtkIMContext* aContext, + gint aOffset, + gint aNChars) { MOZ_LOG(gGtkIMLog, LogLevel::Info, - ("GtkIMModule(%p): OnDeleteSurroundingNative, aContext=%p, " - "current context=%p", + ("GTKIM: %p OnDeleteSurroundingNative(aContext=%p, aOffset=%ld, " + "aNChar=%ld), current context=%p", this, aContext, GetCurrentContext())); // See bug 472635, we should do nothing if IM context doesn't match. if (GetCurrentContext() != aContext) { - MOZ_LOG(gGtkIMLog, LogLevel::Info, - (" FAILED, given context doesn't match")); + MOZ_LOG(gGtkIMLog, LogLevel::Error, + ("GTKIM: %p OnDeleteSurroundingNative(), FAILED, " + "given context doesn't match", + this)); return FALSE; } @@ -1024,29 +1046,31 @@ nsGtkIMModule::OnDeleteSurroundingNative(GtkIMContext *aContext, } // failed - MOZ_LOG(gGtkIMLog, LogLevel::Info, - (" FAILED, cannot delete text")); + MOZ_LOG(gGtkIMLog, LogLevel::Error, + ("GTKIM: %p OnDeleteSurroundingNative(), FAILED, " + "cannot delete text", + this)); return FALSE; } /* static */ void -nsGtkIMModule::OnCommitCompositionCallback(GtkIMContext *aContext, - const gchar *aString, - nsGtkIMModule* aModule) +IMContextWrapper::OnCommitCompositionCallback(GtkIMContext* aContext, + const gchar* aString, + IMContextWrapper* aModule) { aModule->OnCommitCompositionNative(aContext, aString); } void -nsGtkIMModule::OnCommitCompositionNative(GtkIMContext *aContext, - const gchar *aUTF8Char) +IMContextWrapper::OnCommitCompositionNative(GtkIMContext* aContext, + const gchar* aUTF8Char) { const gchar emptyStr = 0; const gchar *commitString = aUTF8Char ? aUTF8Char : &emptyStr; MOZ_LOG(gGtkIMLog, LogLevel::Info, - ("GtkIMModule(%p): OnCommitCompositionNative, aContext=%p, " + ("GTKIM: %p OnCommitCompositionNative(aContext=%p), " "current context=%p, active context=%p, commitString=\"%s\", " "mProcessingKeyEvent=%p, IsComposingOn(aContext)=%s", this, aContext, GetCurrentContext(), GetActiveContext(), commitString, @@ -1054,8 +1078,10 @@ nsGtkIMModule::OnCommitCompositionNative(GtkIMContext *aContext, // See bug 472635, we should do nothing if IM context doesn't match. if (!IsValidContext(aContext)) { - MOZ_LOG(gGtkIMLog, LogLevel::Info, - (" FAILED, given context doesn't match")); + MOZ_LOG(gGtkIMLog, LogLevel::Error, + ("GTKIM: %p OnCommitCompositionNative(), FAILED, " + "given context doesn't match", + this)); return; } @@ -1085,7 +1111,8 @@ nsGtkIMModule::OnCommitCompositionNative(GtkIMContext *aContext, if (!strcmp(commitString, keyval_utf8)) { MOZ_LOG(gGtkIMLog, LogLevel::Info, - ("GtkIMModule(%p): OnCommitCompositionNative, we'll send normal key event", + ("GTKIM: %p OnCommitCompositionNative(), " + "we'll send normal key event", this)); mFilterKeyEvent = false; return; @@ -1098,8 +1125,8 @@ nsGtkIMModule::OnCommitCompositionNative(GtkIMContext *aContext, } void -nsGtkIMModule::GetCompositionString(GtkIMContext* aContext, - nsAString& aCompositionString) +IMContextWrapper::GetCompositionString(GtkIMContext* aContext, + nsAString& aCompositionString) { gchar *preedit_string; gint cursor_pos; @@ -1113,35 +1140,42 @@ nsGtkIMModule::GetCompositionString(GtkIMContext* aContext, } MOZ_LOG(gGtkIMLog, LogLevel::Info, - ("GtkIMModule(%p): GetCompositionString, result=\"%s\"", - this, preedit_string)); + ("GTKIM: %p GetCompositionString(aContext=%p), " + "aCompositionString=\"%s\"", + this, aContext, preedit_string)); pango_attr_list_unref(feedback_list); g_free(preedit_string); } bool -nsGtkIMModule::DispatchCompositionStart(GtkIMContext* aContext) +IMContextWrapper::DispatchCompositionStart(GtkIMContext* aContext) { MOZ_LOG(gGtkIMLog, LogLevel::Info, - ("GtkIMModule(%p): DispatchCompositionStart, aContext=%p", + ("GTKIM: %p DispatchCompositionStart(aContext=%p)", this, aContext)); if (IsComposing()) { - MOZ_LOG(gGtkIMLog, LogLevel::Info, - (" WARNING, we're already in composition")); + MOZ_LOG(gGtkIMLog, LogLevel::Error, + ("GTKIM: %p DispatchCompositionStart(), FAILED, " + "we're already in composition", + this)); return true; } if (!mLastFocusedWindow) { - MOZ_LOG(gGtkIMLog, LogLevel::Info, - (" FAILED, there are no focused window in this module")); + MOZ_LOG(gGtkIMLog, LogLevel::Error, + ("GTKIM: %p DispatchCompositionStart(), FAILED, " + "there are no focused window in this module", + this)); return false; } if (NS_WARN_IF(!EnsureToCacheSelection())) { - MOZ_LOG(gGtkIMLog, LogLevel::Info, - (" FAILED, cannot query the selection offset")); + MOZ_LOG(gGtkIMLog, LogLevel::Error, + ("GTKIM: %p DispatchCompositionStart(), FAILED, " + "cannot query the selection offset", + this)); return false; } @@ -1160,18 +1194,23 @@ nsGtkIMModule::DispatchCompositionStart(GtkIMContext* aContext) bool isCancelled; mLastFocusedWindow->DispatchKeyDownEvent(mProcessingKeyEvent, &isCancelled); - MOZ_LOG(gGtkIMLog, LogLevel::Info, - (" keydown event is dispatched")); + MOZ_LOG(gGtkIMLog, LogLevel::Debug, + ("GTKIM: %p DispatchCompositionStart(), FAILED, keydown event " + "is dispatched", + this)); if (static_cast(kungFuDeathGrip.get())->IsDestroyed() || kungFuDeathGrip != mLastFocusedWindow) { - MOZ_LOG(gGtkIMLog, LogLevel::Info, - (" NOTE, the focused widget was destroyed/changed by keydown event")); + MOZ_LOG(gGtkIMLog, LogLevel::Error, + ("GTKIM: %p DispatchCompositionStart(), FAILED, the focused " + "widget was destroyed/changed by keydown event", + this)); return false; } } - MOZ_LOG(gGtkIMLog, LogLevel::Info, - (" mCompositionStart=%u", mCompositionStart)); + MOZ_LOG(gGtkIMLog, LogLevel::Debug, + ("GTKIM: %p DispatchCompositionStart(), FAILED, mCompositionStart=%u", + this, mCompositionStart)); mCompositionState = eCompositionState_CompositionStartDispatched; WidgetCompositionEvent compEvent(true, NS_COMPOSITION_START, mLastFocusedWindow); @@ -1181,8 +1220,10 @@ nsGtkIMModule::DispatchCompositionStart(GtkIMContext* aContext) mLastFocusedWindow->DispatchEvent(&compEvent, status); if (static_cast(kungFuDeathGrip.get())->IsDestroyed() || kungFuDeathGrip != mLastFocusedWindow) { - MOZ_LOG(gGtkIMLog, LogLevel::Info, - (" NOTE, the focused widget was destroyed/changed by compositionstart event")); + MOZ_LOG(gGtkIMLog, LogLevel::Error, + ("GTKIM: %p DispatchCompositionStart(), FAILED, the focused " + "widget was destroyed/changed by compositionstart event", + this)); return false; } @@ -1190,23 +1231,27 @@ nsGtkIMModule::DispatchCompositionStart(GtkIMContext* aContext) } bool -nsGtkIMModule::DispatchCompositionChangeEvent( - GtkIMContext* aContext, - const nsAString& aCompositionString) +IMContextWrapper::DispatchCompositionChangeEvent( + GtkIMContext* aContext, + const nsAString& aCompositionString) { MOZ_LOG(gGtkIMLog, LogLevel::Info, - ("GtkIMModule(%p): DispatchCompositionChangeEvent, aContext=%p", + ("GTKIM: %p DispatchCompositionChangeEvent(aContext=%p)", this, aContext)); if (!mLastFocusedWindow) { - MOZ_LOG(gGtkIMLog, LogLevel::Info, - (" FAILED, there are no focused window in this module")); + MOZ_LOG(gGtkIMLog, LogLevel::Error, + ("GTKIM: %p DispatchCompositionChangeEvent(), FAILED, " + "there are no focused window in this module", + this)); return false; } if (!IsComposing()) { - MOZ_LOG(gGtkIMLog, LogLevel::Info, - (" The composition wasn't started, force starting...")); + MOZ_LOG(gGtkIMLog, LogLevel::Debug, + ("GTKIM: %p DispatchCompositionChangeEvent(), the composition " + "wasn't started, force starting...", + this)); nsCOMPtr kungFuDeathGrip = mLastFocusedWindow; if (!DispatchCompositionStart(aContext)) { return false; @@ -1254,40 +1299,47 @@ nsGtkIMModule::DispatchCompositionChangeEvent( mLastFocusedWindow->DispatchEvent(&compositionChangeEvent, status); if (lastFocusedWindow->IsDestroyed() || lastFocusedWindow != mLastFocusedWindow) { - MOZ_LOG(gGtkIMLog, LogLevel::Info, - (" NOTE, the focused widget was destroyed/changed by " - "compositionchange event")); + MOZ_LOG(gGtkIMLog, LogLevel::Error, + ("GTKIM: %p DispatchCompositionChangeEvent(), FAILED, the " + "focused widget was destroyed/changed by " + "compositionchange event", + this)); return false; } return true; } bool -nsGtkIMModule::DispatchCompositionCommitEvent( - GtkIMContext* aContext, - const nsAString* aCommitString) +IMContextWrapper::DispatchCompositionCommitEvent( + GtkIMContext* aContext, + const nsAString* aCommitString) { MOZ_LOG(gGtkIMLog, LogLevel::Info, - ("GtkIMModule(%p): DispatchCompositionCommitEvent, aContext=%p, " - "aCommitString=%p, (\"%s\")", + ("GTKIM: %p DispatchCompositionCommitEvent(aContext=%p, " + "aCommitString=%p, (\"%s\"))", this, aContext, aCommitString, aCommitString ? NS_ConvertUTF16toUTF8(*aCommitString).get() : "")); if (!mLastFocusedWindow) { - MOZ_LOG(gGtkIMLog, LogLevel::Info, - (" FAILED, there are no focused window in this module")); + MOZ_LOG(gGtkIMLog, LogLevel::Error, + ("GTKIM: %p DispatchCompositionCommitEvent(), FAILED, " + "there are no focused window in this module", + this)); return false; } if (!IsComposing()) { if (!aCommitString || aCommitString->IsEmpty()) { - MOZ_LOG(gGtkIMLog, LogLevel::Info, - (" FAILED, there is no composition and empty commit " - "string")); + MOZ_LOG(gGtkIMLog, LogLevel::Error, + ("GTKIM: %p DispatchCompositionCommitEvent(), FAILED, " + "there is no composition and empty commit string", + this)); return true; } - MOZ_LOG(gGtkIMLog, LogLevel::Info, - (" The composition wasn't started, force starting...")); + MOZ_LOG(gGtkIMLog, LogLevel::Debug, + ("GTKIM: %p DispatchCompositionCommitEvent(), " + "the composition wasn't started, force starting...", + this)); nsCOMPtr kungFuDeathGrip(mLastFocusedWindow); if (!DispatchCompositionStart(aContext)) { return false; @@ -1315,9 +1367,11 @@ nsGtkIMModule::DispatchCompositionCommitEvent( if (lastFocusedWindow->IsDestroyed() || lastFocusedWindow != mLastFocusedWindow) { - MOZ_LOG(gGtkIMLog, LogLevel::Info, - (" NOTE, the focused widget was destroyed/changed by " - "compositioncommit event")); + MOZ_LOG(gGtkIMLog, LogLevel::Error, + ("GTKIM: %p DispatchCompositionCommitEvent(), FAILED, " + "the focused widget was destroyed/changed by " + "compositioncommit event", + this)); return false; } @@ -1325,12 +1379,12 @@ nsGtkIMModule::DispatchCompositionCommitEvent( } already_AddRefed -nsGtkIMModule::CreateTextRangeArray(GtkIMContext* aContext, - const nsAString& aLastDispatchedData) +IMContextWrapper::CreateTextRangeArray(GtkIMContext* aContext, + const nsAString& aLastDispatchedData) { MOZ_LOG(gGtkIMLog, LogLevel::Info, - ("GtkIMModule(%p): CreateTextRangeArray, aContext=%p, " - "aLastDispatchedData=\"%s\" (length=%u)", + ("GTKIM: %p CreateTextRangeArray(aContext=%p, " + "aLastDispatchedData=\"%s\" (Length()=%u))", this, aContext, NS_ConvertUTF16toUTF8(aLastDispatchedData).get(), aLastDispatchedData.Length())); @@ -1342,8 +1396,10 @@ nsGtkIMModule::CreateTextRangeArray(GtkIMContext* aContext, gtk_im_context_get_preedit_string(aContext, &preedit_string, &feedback_list, &cursor_pos); if (!preedit_string || !*preedit_string) { - MOZ_LOG(gGtkIMLog, LogLevel::Info, - (" preedit_string is null")); + MOZ_LOG(gGtkIMLog, LogLevel::Error, + ("GTKIM: %p CreateTextRangeArray(), FAILED, due to " + "preedit_string is null", + this)); pango_attr_list_unref(feedback_list); g_free(preedit_string); return textRangeArray.forget(); @@ -1352,8 +1408,10 @@ nsGtkIMModule::CreateTextRangeArray(GtkIMContext* aContext, PangoAttrIterator* iter; iter = pango_attr_list_get_iterator(feedback_list); if (!iter) { - MOZ_LOG(gGtkIMLog, LogLevel::Info, - (" FAILED, iterator couldn't be allocated")); + MOZ_LOG(gGtkIMLog, LogLevel::Error, + ("GTKIM: %p CreateTextRangeArray(), FAILED, iterator couldn't " + "be allocated", + this)); pango_attr_list_unref(feedback_list); g_free(preedit_string); return textRangeArray.forget(); @@ -1424,9 +1482,10 @@ nsGtkIMModule::CreateTextRangeArray(GtkIMContext* aContext, textRangeArray->AppendElement(range); - MOZ_LOG(gGtkIMLog, LogLevel::Info, - (" mStartOffset=%u, mEndOffset=%u, mRangeType=%s", - range.mStartOffset, range.mEndOffset, + MOZ_LOG(gGtkIMLog, LogLevel::Debug, + ("GTKIM: %p CreateTextRangeArray(), mStartOffset=%u, " + "mEndOffset=%u, mRangeType=%s", + this, range.mStartOffset, range.mEndOffset, GetRangeTypeName(range.mRangeType))); } while (pango_attr_iterator_next(iter)); @@ -1442,9 +1501,10 @@ nsGtkIMModule::CreateTextRangeArray(GtkIMContext* aContext, range.mRangeType = NS_TEXTRANGE_CARETPOSITION; textRangeArray->AppendElement(range); - MOZ_LOG(gGtkIMLog, LogLevel::Info, - (" mStartOffset=%u, mEndOffset=%u, mRangeType=%s", - range.mStartOffset, range.mEndOffset, + MOZ_LOG(gGtkIMLog, LogLevel::Debug, + ("GTKIM: %p CreateTextRangeArray(), mStartOffset=%u, mEndOffset=%u, " + "mRangeType=%s", + this, range.mStartOffset, range.mEndOffset, GetRangeTypeName(range.mRangeType))); pango_attr_iterator_destroy(iter); @@ -1455,10 +1515,10 @@ nsGtkIMModule::CreateTextRangeArray(GtkIMContext* aContext, } void -nsGtkIMModule::SetCursorPosition(GtkIMContext* aContext) +IMContextWrapper::SetCursorPosition(GtkIMContext* aContext) { MOZ_LOG(gGtkIMLog, LogLevel::Info, - ("GtkIMModule(%p): SetCursorPosition, aContext=%p, " + ("GTKIM: %p SetCursorPosition(aContext=%p), " "mCompositionTargetRange={ mOffset=%u, mLength=%u }" "mSelection={ mOffset=%u, mLength=%u, mWritingMode=%s }", this, aContext, mCompositionTargetRange.mOffset, @@ -1469,23 +1529,27 @@ nsGtkIMModule::SetCursorPosition(GtkIMContext* aContext) bool useCaret = false; if (!mCompositionTargetRange.IsValid()) { if (!mSelection.IsValid()) { - MOZ_LOG(gGtkIMLog, LogLevel::Info, - (" FAILED, mCompositionTargetRange and mSelection are " - "invalid")); + MOZ_LOG(gGtkIMLog, LogLevel::Error, + ("GTKIM: %p SetCursorPosition(), FAILED, " + "mCompositionTargetRange and mSelection are invalid", + this)); return; } useCaret = true; } if (!mLastFocusedWindow) { - MOZ_LOG(gGtkIMLog, LogLevel::Info, - (" FAILED, there are no focused window")); + MOZ_LOG(gGtkIMLog, LogLevel::Error, + ("GTKIM: %p SetCursorPosition(), FAILED, due to no focused " + "window", + this)); return; } if (MOZ_UNLIKELY(!aContext)) { - MOZ_LOG(gGtkIMLog, LogLevel::Info, - (" FAILED, there are no context")); + MOZ_LOG(gGtkIMLog, LogLevel::Error, + ("GTKIM: %p SetCursorPosition(), FAILED, due to no context", + this)); return; } @@ -1511,9 +1575,9 @@ nsGtkIMModule::SetCursorPosition(GtkIMContext* aContext) nsEventStatus status; mLastFocusedWindow->DispatchEvent(&charRect, status); if (!charRect.mSucceeded) { - MOZ_LOG(gGtkIMLog, LogLevel::Info, - (" FAILED, %s was failed", - useCaret ? "NS_QUERY_CARET_RECT" : "NS_QUERY_TEXT_RECT")); + MOZ_LOG(gGtkIMLog, LogLevel::Error, + ("GTKIM: %p SetCursorPosition(), FAILED, %s was failed", + this, useCaret ? "NS_QUERY_CARET_RECT" : "NS_QUERY_TEXT_RECT")); return; } @@ -1539,15 +1603,18 @@ nsGtkIMModule::SetCursorPosition(GtkIMContext* aContext) } nsresult -nsGtkIMModule::GetCurrentParagraph(nsAString& aText, uint32_t& aCursorPos) +IMContextWrapper::GetCurrentParagraph(nsAString& aText, + uint32_t& aCursorPos) { MOZ_LOG(gGtkIMLog, LogLevel::Info, - ("GtkIMModule(%p): GetCurrentParagraph, mCompositionState=%s", + ("GTKIM: %p GetCurrentParagraph(), mCompositionState=%s", this, GetCompositionStateName())); if (!mLastFocusedWindow) { - MOZ_LOG(gGtkIMLog, LogLevel::Info, - (" FAILED, there are no focused window in this module")); + MOZ_LOG(gGtkIMLog, LogLevel::Error, + ("GTKIM: %p GetCurrentParagraph(), FAILED, there are no " + "focused window in this module", + this)); return NS_ERROR_NULL_POINTER; } @@ -1561,8 +1628,10 @@ nsGtkIMModule::GetCurrentParagraph(nsAString& aText, uint32_t& aCursorPos) if (!EditorHasCompositionString()) { // Query cursor position & selection if (NS_WARN_IF(!EnsureToCacheSelection())) { - MOZ_LOG(gGtkIMLog, LogLevel::Info, - (" FAILED, due to no valid selection information")); + MOZ_LOG(gGtkIMLog, LogLevel::Error, + ("GTKIM: %p GetCurrentParagraph(), FAILED, due to no " + "valid selection information", + this)); return NS_ERROR_FAILURE; } @@ -1570,17 +1639,19 @@ nsGtkIMModule::GetCurrentParagraph(nsAString& aText, uint32_t& aCursorPos) selLength = mSelection.mLength; } - MOZ_LOG(gGtkIMLog, LogLevel::Info, - (" selOffset=%u, selLength=%u", - selOffset, selLength)); + MOZ_LOG(gGtkIMLog, LogLevel::Debug, + ("GTKIM: %p GetCurrentParagraph(), selOffset=%u, selLength=%u", + this, selOffset, selLength)); // XXX nsString::Find and nsString::RFind take int32_t for offset, so, // we cannot support this request when the current offset is larger // than INT32_MAX. if (selOffset > INT32_MAX || selLength > INT32_MAX || selOffset + selLength > INT32_MAX) { - MOZ_LOG(gGtkIMLog, LogLevel::Info, - (" FAILED, The selection is out of range")); + MOZ_LOG(gGtkIMLog, LogLevel::Error, + ("GTKIM: %p GetCurrentParagraph(), FAILED, The selection is " + "out of range", + this)); return NS_ERROR_FAILURE; } @@ -1594,9 +1665,10 @@ nsGtkIMModule::GetCurrentParagraph(nsAString& aText, uint32_t& aCursorPos) nsAutoString textContent(queryTextContentEvent.mReply.mString); if (selOffset + selLength > textContent.Length()) { - MOZ_LOG(gGtkIMLog, LogLevel::Info, - (" FAILED, The selection is invalid, textContent.Length()=%u", - textContent.Length())); + MOZ_LOG(gGtkIMLog, LogLevel::Error, + ("GTKIM: %p GetCurrentParagraph(), FAILED, The selection is " + "invalid, textContent.Length()=%u", + this, textContent.Length())); return NS_ERROR_FAILURE; } @@ -1619,33 +1691,37 @@ nsGtkIMModule::GetCurrentParagraph(nsAString& aText, uint32_t& aCursorPos) aText = nsDependentSubstring(textContent, parStart, parEnd - parStart); aCursorPos = selOffset - uint32_t(parStart); - MOZ_LOG(gGtkIMLog, LogLevel::Info, - (" aText=%s, aText.Length()=%u, aCursorPos=%u", - NS_ConvertUTF16toUTF8(aText).get(), + MOZ_LOG(gGtkIMLog, LogLevel::Debug, + ("GTKIM: %p GetCurrentParagraph(), succeeded, aText=%s, " + "aText.Length()=%u, aCursorPos=%u", + this, NS_ConvertUTF16toUTF8(aText).get(), aText.Length(), aCursorPos)); return NS_OK; } nsresult -nsGtkIMModule::DeleteText(GtkIMContext* aContext, - int32_t aOffset, - uint32_t aNChars) +IMContextWrapper::DeleteText(GtkIMContext* aContext, + int32_t aOffset, + uint32_t aNChars) { MOZ_LOG(gGtkIMLog, LogLevel::Info, - ("GtkIMModule(%p): DeleteText, aContext=%p, aOffset=%d, aNChars=%d, " + ("GTKIM: %p DeleteText(aContext=%p, aOffset=%d, aNChars=%d), " "mCompositionState=%s", this, aContext, aOffset, aNChars, GetCompositionStateName())); if (!mLastFocusedWindow) { - MOZ_LOG(gGtkIMLog, LogLevel::Info, - (" FAILED, there are no focused window in this module")); + MOZ_LOG(gGtkIMLog, LogLevel::Error, + ("GTKIM: %p DeleteText(), FAILED, there are no focused window " + "in this module", + this)); return NS_ERROR_NULL_POINTER; } if (!aNChars) { - MOZ_LOG(gGtkIMLog, LogLevel::Info, - (" FAILED, aNChars must not be zero")); + MOZ_LOG(gGtkIMLog, LogLevel::Error, + ("GTKIM: %p DeleteText(), FAILED, aNChars must not be zero", + this)); return NS_ERROR_INVALID_ARG; } @@ -1660,14 +1736,17 @@ nsGtkIMModule::DeleteText(GtkIMContext* aContext, if (wasComposing) { selOffset = mCompositionStart; if (!DispatchCompositionCommitEvent(aContext, &mSelectedString)) { - MOZ_LOG(gGtkIMLog, LogLevel::Info, - (" FAILED, quitting from DeletText")); + MOZ_LOG(gGtkIMLog, LogLevel::Error, + ("GTKIM: %p DeleteText(), FAILED, quitting from DeletText", + this)); return NS_ERROR_FAILURE; } } else { if (NS_WARN_IF(!EnsureToCacheSelection())) { - MOZ_LOG(gGtkIMLog, LogLevel::Info, - (" FAILED, due to no valid selection information")); + MOZ_LOG(gGtkIMLog, LogLevel::Error, + ("GTKIM: %p DeleteText(), FAILED, due to no valid selection " + "information", + this)); return NS_ERROR_FAILURE; } selOffset = mSelection.mOffset; @@ -1681,8 +1760,9 @@ nsGtkIMModule::DeleteText(GtkIMContext* aContext, mLastFocusedWindow->DispatchEvent(&queryTextContentEvent, status); NS_ENSURE_TRUE(queryTextContentEvent.mSucceeded, NS_ERROR_FAILURE); if (queryTextContentEvent.mReply.mString.IsEmpty()) { - MOZ_LOG(gGtkIMLog, LogLevel::Info, - (" FAILED, there is no contents")); + MOZ_LOG(gGtkIMLog, LogLevel::Error, + ("GTKIM: %p DeleteText(), FAILED, there is no contents", + this)); return NS_ERROR_FAILURE; } @@ -1692,10 +1772,10 @@ nsGtkIMModule::DeleteText(GtkIMContext* aContext, glong offsetInUTF8Characters = g_utf8_strlen(utf8Str.get(), utf8Str.Length()) + aOffset; if (offsetInUTF8Characters < 0) { - MOZ_LOG(gGtkIMLog, LogLevel::Info, - (" FAILED, aOffset is too small for current cursor pos " - "(computed offset: %d)", - offsetInUTF8Characters)); + MOZ_LOG(gGtkIMLog, LogLevel::Error, + ("GTKIM: %p DeleteText(), FAILED, aOffset is too small for " + "current cursor pos (computed offset: %d)", + this, offsetInUTF8Characters)); return NS_ERROR_FAILURE; } @@ -1707,10 +1787,10 @@ nsGtkIMModule::DeleteText(GtkIMContext* aContext, glong endInUTF8Characters = offsetInUTF8Characters + aNChars; if (countOfCharactersInUTF8 < endInUTF8Characters) { - MOZ_LOG(gGtkIMLog, LogLevel::Info, - (" FAILED, aNChars is too large for current contents " - "(content length: %d, computed end offset: %d)", - countOfCharactersInUTF8, endInUTF8Characters)); + MOZ_LOG(gGtkIMLog, LogLevel::Error, + ("GTKIM: %p DeleteText(), FAILED, aNChars is too large for " + "current contents (content length: %d, computed end offset: %d)", + this, countOfCharactersInUTF8, endInUTF8Characters)); return NS_ERROR_FAILURE; } @@ -1741,9 +1821,10 @@ nsGtkIMModule::DeleteText(GtkIMContext* aContext, if (!selectionEvent.mSucceeded || lastFocusedWindow != mLastFocusedWindow || lastFocusedWindow->Destroyed()) { - MOZ_LOG(gGtkIMLog, LogLevel::Info, - (" FAILED, setting selection caused focus change " - "or window destroyed")); + MOZ_LOG(gGtkIMLog, LogLevel::Error, + ("GTKIM: %p DeleteText(), FAILED, setting selection caused " + "focus change or window destroyed", + this)); return NS_ERROR_FAILURE; } @@ -1756,9 +1837,10 @@ nsGtkIMModule::DeleteText(GtkIMContext* aContext, if (!contentCommandEvent.mSucceeded || lastFocusedWindow != mLastFocusedWindow || lastFocusedWindow->Destroyed()) { - MOZ_LOG(gGtkIMLog, LogLevel::Info, - (" FAILED, deleting the selection caused focus change " - "or window destroyed")); + MOZ_LOG(gGtkIMLog, LogLevel::Error, + ("GTKIM: %p DeleteText(), FAILED, deleting the selection caused " + "focus change or window destroyed", + this)); return NS_ERROR_FAILURE; } @@ -1768,8 +1850,9 @@ nsGtkIMModule::DeleteText(GtkIMContext* aContext, // Restore the composition at new caret position. if (!DispatchCompositionStart(aContext)) { - MOZ_LOG(gGtkIMLog, LogLevel::Info, - (" FAILED, resterting composition start")); + MOZ_LOG(gGtkIMLog, LogLevel::Error, + ("GTKIM: %p DeleteText(), FAILED, resterting composition start", + this)); return NS_ERROR_FAILURE; } @@ -1780,8 +1863,9 @@ nsGtkIMModule::DeleteText(GtkIMContext* aContext, nsAutoString compositionString; GetCompositionString(aContext, compositionString); if (!DispatchCompositionChangeEvent(aContext, compositionString)) { - MOZ_LOG(gGtkIMLog, LogLevel::Info, - (" FAILED, restoring composition string")); + MOZ_LOG(gGtkIMLog, LogLevel::Error, + ("GTKIM: %p DeleteText(), FAILED, restoring composition string", + this)); return NS_ERROR_FAILURE; } @@ -1789,13 +1873,13 @@ nsGtkIMModule::DeleteText(GtkIMContext* aContext, } void -nsGtkIMModule::InitEvent(WidgetGUIEvent& aEvent) +IMContextWrapper::InitEvent(WidgetGUIEvent& aEvent) { aEvent.time = PR_Now() / 1000; } bool -nsGtkIMModule::EnsureToCacheSelection(nsAString* aSelectedString) +IMContextWrapper::EnsureToCacheSelection(nsAString* aSelectedString) { if (aSelectedString) { aSelectedString->Truncate(); @@ -1808,8 +1892,9 @@ nsGtkIMModule::EnsureToCacheSelection(nsAString* aSelectedString) if (NS_WARN_IF(!mLastFocusedWindow)) { MOZ_LOG(gGtkIMLog, LogLevel::Error, - ("GtkIMModule(%p): EnsureToCacheSelection(), FAILED, due to " - "no focused window", this)); + ("GTKIM: %p EnsureToCacheSelection(), FAILED, due to " + "no focused window", + this)); return false; } @@ -1820,16 +1905,18 @@ nsGtkIMModule::EnsureToCacheSelection(nsAString* aSelectedString) mLastFocusedWindow->DispatchEvent(&selection, status); if (NS_WARN_IF(!selection.mSucceeded)) { MOZ_LOG(gGtkIMLog, LogLevel::Error, - ("GtkIMModule(%p): EnsureToCacheSelection(), FAILED, due to " - "failure of query selection event", this)); + ("GTKIM: %p EnsureToCacheSelection(), FAILED, due to " + "failure of query selection event", + this)); return false; } mSelection.Assign(selection); if (!mSelection.IsValid()) { MOZ_LOG(gGtkIMLog, LogLevel::Error, - ("GtkIMModule(%p): EnsureToCacheSelection(), FAILED, due to " - "failure of query selection event (invalid result)", this)); + ("GTKIM: %p EnsureToCacheSelection(), FAILED, due to " + "failure of query selection event (invalid result)", + this)); return false; } @@ -1838,7 +1925,7 @@ nsGtkIMModule::EnsureToCacheSelection(nsAString* aSelectedString) } MOZ_LOG(gGtkIMLog, LogLevel::Debug, - ("GtkIMModule(%p): EnsureToCacheSelection(), Succeeded, mSelection=" + ("GTKIM: %p EnsureToCacheSelection(), Succeeded, mSelection=" "{ mOffset=%u, mLength=%u, mWritingMode=%s }", this, mSelection.mOffset, mSelection.mLength, GetWritingModeName(mSelection.mWritingMode).get())); @@ -1846,11 +1933,11 @@ nsGtkIMModule::EnsureToCacheSelection(nsAString* aSelectedString) } /****************************************************************************** - * nsGtkIMModule::Selection + * IMContextWrapper::Selection ******************************************************************************/ void -nsGtkIMModule::Selection::Assign(const IMENotification& aIMENotification) +IMContextWrapper::Selection::Assign(const IMENotification& aIMENotification) { MOZ_ASSERT(aIMENotification.mMessage == NOTIFY_IME_OF_SELECTION_CHANGE); mOffset = aIMENotification.mSelectionChangeData.mOffset; @@ -1859,7 +1946,7 @@ nsGtkIMModule::Selection::Assign(const IMENotification& aIMENotification) } void -nsGtkIMModule::Selection::Assign(const WidgetQueryContentEvent& aEvent) +IMContextWrapper::Selection::Assign(const WidgetQueryContentEvent& aEvent) { MOZ_ASSERT(aEvent.message == NS_QUERY_SELECTED_TEXT); MOZ_ASSERT(aEvent.mSucceeded); @@ -1867,3 +1954,6 @@ nsGtkIMModule::Selection::Assign(const WidgetQueryContentEvent& aEvent) mLength = aEvent.mReply.mString.Length(); mWritingMode = aEvent.GetWritingMode(); } + +} // namespace widget +} // namespace mozilla diff --git a/widget/gtk/nsGtkIMModule.h b/widget/gtk/IMContextWrapper.h similarity index 84% rename from widget/gtk/nsGtkIMModule.h rename to widget/gtk/IMContextWrapper.h index 4740b80a0517..ba2db599571e 100644 --- a/widget/gtk/nsGtkIMModule.h +++ b/widget/gtk/IMContextWrapper.h @@ -5,8 +5,8 @@ * 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/. */ -#ifndef __nsGtkIMModule_h__ -#define __nsGtkIMModule_h__ +#ifndef IMContextWrapper_h_ +#define IMContextWrapper_h_ #include #include @@ -22,20 +22,18 @@ class nsWindow; -class nsGtkIMModule -{ -protected: - typedef mozilla::widget::IMENotification IMENotification; - typedef mozilla::widget::InputContext InputContext; - typedef mozilla::widget::InputContextAction InputContextAction; +namespace mozilla { +namespace widget { +class IMContextWrapper final +{ public: // aOwnerWindow is a pointer of the owner window. When aOwnerWindow is // destroyed, the related IME contexts are released (i.e., IME cannot be // used with the instance after that). - explicit nsGtkIMModule(nsWindow* aOwnerWindow); + explicit IMContextWrapper(nsWindow* aOwnerWindow); - NS_INLINE_DECL_REFCOUNTING(nsGtkIMModule) + NS_INLINE_DECL_REFCOUNTING(IMContextWrapper) // "Enabled" means the users can use all IMEs. // I.e., the focus is in the normal editors. @@ -72,7 +70,7 @@ public: void OnLayoutChange(); protected: - ~nsGtkIMModule(); + ~IMContextWrapper(); // Owner of an instance of this class. This should be top level window. // The owner window must release the contexts when it's destroyed because @@ -205,7 +203,7 @@ protected: { uint32_t mOffset; uint32_t mLength; - mozilla::WritingMode mWritingMode; + WritingMode mWritingMode; Selection() : mOffset(UINT32_MAX) @@ -217,11 +215,11 @@ protected: { mOffset = UINT32_MAX; mLength = UINT32_MAX; - mWritingMode = mozilla::WritingMode(); + mWritingMode = WritingMode(); } void Assign(const IMENotification& aIMENotification); - void Assign(const mozilla::WidgetQueryContentEvent& aSelectedTextEvent); + void Assign(const WidgetQueryContentEvent& aSelectedTextEvent); bool IsValid() const { return mOffset != UINT32_MAX; } bool Collapsed() const { return !mLength; } @@ -230,8 +228,8 @@ protected: if (NS_WARN_IF(!IsValid())) { return UINT32_MAX; } - mozilla::CheckedInt endOffset = - mozilla::CheckedInt(mOffset) + mLength; + CheckedInt endOffset = + CheckedInt(mOffset) + mLength; if (NS_WARN_IF(!endOffset.isValid())) { return UINT32_MAX; } @@ -264,10 +262,10 @@ protected: // before key down bool mSetCursorPositionOnKeyEvent; - // sLastFocusedModule is a pointer to the last focused instance of this - // class. When a instance is destroyed and sLastFocusedModule refers it, + // sLastFocusedContext is a pointer to the last focused instance of this + // class. When a instance is destroyed and sLastFocusedContext refers it, // this is cleared. So, this refers valid pointer always. - static nsGtkIMModule* sLastFocusedModule; + static IMContextWrapper* sLastFocusedContext; // sUseSimpleContext indeicates if password editors and editors with // |ime-mode: disabled;| should use GtkIMContextSimple. @@ -276,32 +274,32 @@ protected: // Callback methods for native IME events. These methods should call // the related instance methods simply. - static gboolean OnRetrieveSurroundingCallback(GtkIMContext *aContext, - nsGtkIMModule *aModule); - static gboolean OnDeleteSurroundingCallback(GtkIMContext *aContext, - gint aOffset, - gint aNChars, - nsGtkIMModule *aModule); - static void OnCommitCompositionCallback(GtkIMContext *aContext, - const gchar *aString, - nsGtkIMModule* aModule); - static void OnChangeCompositionCallback(GtkIMContext *aContext, - nsGtkIMModule* aModule); - static void OnStartCompositionCallback(GtkIMContext *aContext, - nsGtkIMModule* aModule); - static void OnEndCompositionCallback(GtkIMContext *aContext, - nsGtkIMModule* aModule); + static gboolean OnRetrieveSurroundingCallback(GtkIMContext* aContext, + IMContextWrapper* aModule); + static gboolean OnDeleteSurroundingCallback(GtkIMContext* aContext, + gint aOffset, + gint aNChars, + IMContextWrapper* aModule); + static void OnCommitCompositionCallback(GtkIMContext* aContext, + const gchar* aString, + IMContextWrapper* aModule); + static void OnChangeCompositionCallback(GtkIMContext* aContext, + IMContextWrapper* aModule); + static void OnStartCompositionCallback(GtkIMContext* aContext, + IMContextWrapper* aModule); + static void OnEndCompositionCallback(GtkIMContext* aContext, + IMContextWrapper* aModule); // The instance methods for the native IME events. - gboolean OnRetrieveSurroundingNative(GtkIMContext *aContext); - gboolean OnDeleteSurroundingNative(GtkIMContext *aContext, - gint aOffset, - gint aNChars); - void OnCommitCompositionNative(GtkIMContext *aContext, - const gchar *aString); - void OnChangeCompositionNative(GtkIMContext *aContext); - void OnStartCompositionNative(GtkIMContext *aContext); - void OnEndCompositionNative(GtkIMContext *aContext); + gboolean OnRetrieveSurroundingNative(GtkIMContext* aContext); + gboolean OnDeleteSurroundingNative(GtkIMContext* aContext, + gint aOffset, + gint aNChars); + void OnCommitCompositionNative(GtkIMContext* aContext, + const gchar* aString); + void OnChangeCompositionNative(GtkIMContext* aContext); + void OnStartCompositionNative(GtkIMContext* aContext); + void OnEndCompositionNative(GtkIMContext* aContext); /** * GetCurrentContext() returns current IM context which is chosen with the @@ -349,7 +347,7 @@ protected: * of current composition. This should be * mDispatchedCompositionString. */ - already_AddRefed + already_AddRefed CreateTextRangeArray(GtkIMContext* aContext, const nsAString& aLastDispatchedData); @@ -379,10 +377,10 @@ protected: uint32_t aNChars); // Initializes the GUI event. - void InitEvent(mozilla::WidgetGUIEvent& aEvent); + void InitEvent(WidgetGUIEvent& aEvent); // Called before destroying the context to work around some platform bugs. - void PrepareToDestroyContext(GtkIMContext *aContext); + void PrepareToDestroyContext(GtkIMContext* aContext); /** * WARNING: @@ -430,4 +428,7 @@ protected: const nsAString* aCommitString = nullptr); }; -#endif // __nsGtkIMModule_h__ +} // namespace widget +} // namespace mozilla + +#endif // #ifndef IMContextWrapper_h_ diff --git a/widget/gtk/moz.build b/widget/gtk/moz.build index 0861f92ced47..daca5e3de9bc 100644 --- a/widget/gtk/moz.build +++ b/widget/gtk/moz.build @@ -20,8 +20,6 @@ UNIFIED_SOURCES += [ 'nsBidiKeyboard.cpp', 'nsColorPicker.cpp', 'nsFilePicker.cpp', - 'nsGtkIMModule.cpp', - 'nsGtkKeyUtils.cpp', 'nsImageToPixbuf.cpp', 'nsLookAndFeel.cpp', 'nsNativeThemeGTK.cpp', @@ -35,6 +33,8 @@ UNIFIED_SOURCES += [ ] SOURCES += [ + 'IMContextWrapper.cpp', # methods for logging conflict with other files + 'nsGtkKeyUtils.cpp', # methods for logging conflict with other files 'nsWindow.cpp', # conflicts with X11 headers ] diff --git a/widget/gtk/nsGtkKeyUtils.cpp b/widget/gtk/nsGtkKeyUtils.cpp index 85cca5e77ad4..cbbd1972dbd8 100644 --- a/widget/gtk/nsGtkKeyUtils.cpp +++ b/widget/gtk/nsGtkKeyUtils.cpp @@ -19,6 +19,7 @@ #include #include "WidgetUtils.h" #include "keysym2ucs.h" +#include "nsGtkUtils.h" #include "nsIBidiKeyboard.h" #include "nsServiceManagerUtils.h" diff --git a/widget/gtk/nsWindow.cpp b/widget/gtk/nsWindow.cpp index 15ffdafc0b96..d6288b00d183 100644 --- a/widget/gtk/nsWindow.cpp +++ b/widget/gtk/nsWindow.cpp @@ -632,8 +632,8 @@ nsWindow::Destroy(void) NativeShow(false); - if (mIMModule) { - mIMModule->OnDestroyWindow(this); + if (mIMContext) { + mIMContext->OnDestroyWindow(this); } // make sure that we remove ourself as the focus window @@ -1367,8 +1367,8 @@ nsWindow::SetFocus(bool aRaise) // Set this window to be the focused child window gFocusWindow = this; - if (mIMModule) { - mIMModule->OnFocusWindow(this); + if (mIMContext) { + mIMContext->OnFocusWindow(this); } LOGFOCUS((" widget now has focus in SetFocus() [%p]\n", @@ -2793,8 +2793,8 @@ nsWindow::OnContainerFocusOutEvent(GdkEventFocus *aEvent) if (gFocusWindow) { nsRefPtr kungFuDeathGrip = gFocusWindow; - if (gFocusWindow->mIMModule) { - gFocusWindow->mIMModule->OnBlurWindow(gFocusWindow); + if (gFocusWindow->mIMContext) { + gFocusWindow->mIMContext->OnBlurWindow(gFocusWindow); } gFocusWindow = nullptr; } @@ -2857,9 +2857,9 @@ nsWindow::OnKeyPressEvent(GdkEventKey *aEvent) // if we are in the middle of composing text, XIM gets to see it // before mozilla does. bool IMEWasEnabled = false; - if (mIMModule) { - IMEWasEnabled = mIMModule->IsEnabled(); - if (mIMModule->OnKeyEvent(this, aEvent)) { + if (mIMContext) { + IMEWasEnabled = mIMContext->IsEnabled(); + if (mIMContext->OnKeyEvent(this, aEvent)) { return TRUE; } } @@ -2888,10 +2888,10 @@ nsWindow::OnKeyPressEvent(GdkEventKey *aEvent) // If a keydown event handler causes to enable IME, i.e., it moves // focus from IME unusable content to IME usable editor, we should // send the native key event to IME for the first input on the editor. - if (!IMEWasEnabled && mIMModule && mIMModule->IsEnabled()) { + if (!IMEWasEnabled && mIMContext && mIMContext->IsEnabled()) { // Notice our keydown event was already dispatched. This prevents // unnecessary DOM keydown event in the editor. - if (mIMModule->OnKeyEvent(this, aEvent, true)) { + if (mIMContext->OnKeyEvent(this, aEvent, true)) { return TRUE; } } @@ -2989,7 +2989,7 @@ nsWindow::OnKeyReleaseEvent(GdkEventKey *aEvent) { LOGFOCUS(("OnKeyReleaseEvent [%p]\n", (void *)this)); - if (mIMModule && mIMModule->OnKeyEvent(this, aEvent)) { + if (mIMContext && mIMContext->OnKeyEvent(this, aEvent)) { return TRUE; } @@ -3660,12 +3660,12 @@ nsWindow::Create(nsIWidget *aParent, // We create input contexts for all containers, except for // toplevel popup windows if (mWindowType != eWindowType_popup) { - mIMModule = new nsGtkIMModule(this); + mIMContext = new IMContextWrapper(this); } - } else if (!mIMModule) { + } else if (!mIMContext) { nsWindow *container = GetContainerWindow(); if (container) { - mIMModule = container->mIMModule; + mIMContext = container->mIMContext; } } @@ -5970,27 +5970,27 @@ nsChildWindow::~nsChildWindow() nsresult nsWindow::NotifyIMEInternal(const IMENotification& aIMENotification) { - if (MOZ_UNLIKELY(!mIMModule)) { + if (MOZ_UNLIKELY(!mIMContext)) { return NS_ERROR_NOT_AVAILABLE; } switch (aIMENotification.mMessage) { case REQUEST_TO_COMMIT_COMPOSITION: case REQUEST_TO_CANCEL_COMPOSITION: - return mIMModule->EndIMEComposition(this); + return mIMContext->EndIMEComposition(this); case NOTIFY_IME_OF_FOCUS: - mIMModule->OnFocusChangeInGecko(true); + mIMContext->OnFocusChangeInGecko(true); return NS_OK; case NOTIFY_IME_OF_BLUR: - mIMModule->OnFocusChangeInGecko(false); + mIMContext->OnFocusChangeInGecko(false); return NS_OK; case NOTIFY_IME_OF_POSITION_CHANGE: - mIMModule->OnLayoutChange(); + mIMContext->OnLayoutChange(); return NS_OK; case NOTIFY_IME_OF_COMPOSITION_UPDATE: - mIMModule->OnUpdateComposition(); + mIMContext->OnUpdateComposition(); return NS_OK; case NOTIFY_IME_OF_SELECTION_CHANGE: - mIMModule->OnSelectionChange(this, aIMENotification); + mIMContext->OnSelectionChange(this, aIMENotification); return NS_OK; default: return NS_ERROR_NOT_IMPLEMENTED; @@ -6001,17 +6001,17 @@ NS_IMETHODIMP_(void) nsWindow::SetInputContext(const InputContext& aContext, const InputContextAction& aAction) { - if (!mIMModule) { + if (!mIMContext) { return; } - mIMModule->SetInputContext(this, &aContext, &aAction); + mIMContext->SetInputContext(this, &aContext, &aAction); } NS_IMETHODIMP_(InputContext) nsWindow::GetInputContext() { InputContext context; - if (!mIMModule) { + if (!mIMContext) { context.mIMEState.mEnabled = IMEState::DISABLED; context.mIMEState.mOpen = IMEState::OPEN_STATE_NOT_SUPPORTED; // If IME context isn't available on this widget, we should set |this| @@ -6019,8 +6019,8 @@ nsWindow::GetInputContext() // context per process. context.mNativeIMEContext = this; } else { - context = mIMModule->GetInputContext(); - context.mNativeIMEContext = mIMModule; + context = mIMContext->GetInputContext(); + context.mNativeIMEContext = mIMContext; } return context; } diff --git a/widget/gtk/nsWindow.h b/widget/gtk/nsWindow.h index 59656e40c647..af3f7373a40c 100644 --- a/widget/gtk/nsWindow.h +++ b/widget/gtk/nsWindow.h @@ -31,7 +31,7 @@ #endif #include "mozilla/EventForwards.h" -#include "nsGtkIMModule.h" +#include "IMContextWrapper.h" #undef LOG #ifdef MOZ_LOGGING @@ -478,7 +478,7 @@ private: virtual int32_t RoundsWidgetCoordinatesTo() override; /** - * |mIMModule| takes all IME related stuff. + * |mIMContext| takes all IME related stuff. * * This is owned by the top-level nsWindow or the topmost child * nsWindow embedded in a non-Gecko widget. @@ -490,7 +490,7 @@ private: * level window is released, the children still have a valid pointer, * however, IME doesn't work at that time. */ - nsRefPtr mIMModule; + nsRefPtr mIMContext; // HiDPI scale conversion gint GdkScaleFactor(); From b38c1b7f777a25d30413551eed0d5ae1ad062147 Mon Sep 17 00:00:00 2001 From: Masayuki Nakano Date: Mon, 27 Jul 2015 08:23:04 +0900 Subject: [PATCH 071/136] Bug 1186017 part.2 Rename GetBoolName() in IMContextWrapper.cpp to ToChar() r=kerlt --- widget/gtk/IMContextWrapper.cpp | 34 ++++++++++++++++----------------- widget/gtk/moz.build | 4 ++-- 2 files changed, 19 insertions(+), 19 deletions(-) diff --git a/widget/gtk/IMContextWrapper.cpp b/widget/gtk/IMContextWrapper.cpp index 0fcaf10c791a..2ca34da0f2c1 100644 --- a/widget/gtk/IMContextWrapper.cpp +++ b/widget/gtk/IMContextWrapper.cpp @@ -21,10 +21,10 @@ namespace widget { PRLogModuleInfo* gGtkIMLog = nullptr; -static const char* -GetBoolName(bool aBool) +static inline const char* +ToChar(bool aBool) { - return aBool ? "true" : "false"; + return aBool ? "true" : "false"; } static const char* @@ -335,7 +335,7 @@ IMContextWrapper::OnBlurWindow(nsWindow* aWindow) MOZ_LOG(gGtkIMLog, LogLevel::Info, ("GTKIM: %p OnBlurWindow(aWindow=%p), mLastFocusedWindow=%p, " "mIsIMFocused=%s", - this, aWindow, mLastFocusedWindow, GetBoolName(mIsIMFocused))); + this, aWindow, mLastFocusedWindow, ToChar(mIsIMFocused))); if (!mIsIMFocused || mLastFocusedWindow != aWindow) { return; @@ -360,7 +360,7 @@ IMContextWrapper::OnKeyEvent(nsWindow* aCaller, ("GTKIM: %p OnKeyEvent(aCaller=%p, aKeyDownEventWasSent=%s), " "mCompositionState=%s, current context=%p, active context=%p, " "aEvent(%p): { type=%s, keyval=%s, unicode=0x%X }", - this, aCaller, GetBoolName(aKeyDownEventWasSent), + this, aCaller, ToChar(aKeyDownEventWasSent), GetCompositionStateName(), GetCurrentContext(), GetActiveContext(), aEvent, GetEventType(aEvent), gdk_keyval_name(aEvent->keyval), gdk_keyval_to_unicode(aEvent->keyval))); @@ -429,8 +429,8 @@ IMContextWrapper::OnKeyEvent(nsWindow* aCaller, MOZ_LOG(gGtkIMLog, LogLevel::Debug, ("GTKIM: %p OnKeyEvent(), succeeded, filterThisEvent=%s " "(isFiltered=%s, mFilterKeyEvent=%s), mCompositionState=%s", - this, GetBoolName(filterThisEvent), GetBoolName(isFiltered), - GetBoolName(mFilterKeyEvent), GetCompositionStateName())); + this, ToChar(filterThisEvent), ToChar(isFiltered), + ToChar(mFilterKeyEvent), GetCompositionStateName())); return filterThisEvent; } @@ -441,8 +441,8 @@ IMContextWrapper::OnFocusChangeInGecko(bool aFocus) MOZ_LOG(gGtkIMLog, LogLevel::Info, ("GTKIM: %p OnFocusChangeInGecko(aFocus=%s), " "mCompositionState=%s, mIsIMFocused=%s", - this, GetBoolName(aFocus), GetCompositionStateName(), - GetBoolName(mIsIMFocused))); + this, ToChar(aFocus), GetCompositionStateName(), + ToChar(mIsIMFocused))); // We shouldn't carry over the removed string to another editor. mSelectedString.Truncate(); @@ -454,7 +454,7 @@ IMContextWrapper::ResetIME() { MOZ_LOG(gGtkIMLog, LogLevel::Info, ("GTKIM: %p ResetIME(), mCompositionState=%s, mIsIMFocused=%s", - this, GetCompositionStateName(), GetBoolName(mIsIMFocused))); + this, GetCompositionStateName(), ToChar(mIsIMFocused))); GtkIMContext* activeContext = GetActiveContext(); if (MOZ_UNLIKELY(!activeContext)) { @@ -486,7 +486,7 @@ IMContextWrapper::ResetIME() "mIsIMFocused=%s", this, activeContext, GetCompositionStateName(), NS_ConvertUTF16toUTF8(compositionString).get(), - GetBoolName(mIsIMFocused))); + ToChar(mIsIMFocused))); // XXX IIIMF (ATOK X3 which is one of the Language Engine of it is still // used in Japan!) sends only "preedit_changed" signal with empty @@ -764,7 +764,7 @@ IMContextWrapper::Blur() { MOZ_LOG(gGtkIMLog, LogLevel::Info, ("GTKIM: %p Blur(), mIsIMFocused=%s", - this, GetBoolName(mIsIMFocused))); + this, ToChar(mIsIMFocused))); if (!mIsIMFocused) { return; @@ -802,11 +802,11 @@ IMContextWrapper::OnSelectionChange(nsWindow* aCaller, "} }), mCompositionState=%s, mIsDeletingSurrounding=%s", this, aCaller, selectionChangeData.mOffset, selectionChangeData.Length(), - GetBoolName(selectionChangeData.mReversed), + ToChar(selectionChangeData.mReversed), GetWritingModeName(selectionChangeData.GetWritingMode()).get(), - GetBoolName(selectionChangeData.mCausedByComposition), - GetBoolName(selectionChangeData.mCausedBySelectionEvent), - GetCompositionStateName(), GetBoolName(mIsDeletingSurrounding))); + ToChar(selectionChangeData.mCausedByComposition), + ToChar(selectionChangeData.mCausedBySelectionEvent), + GetCompositionStateName(), ToChar(mIsDeletingSurrounding))); if (aCaller != mLastFocusedWindow) { MOZ_LOG(gGtkIMLog, LogLevel::Error, @@ -1074,7 +1074,7 @@ IMContextWrapper::OnCommitCompositionNative(GtkIMContext* aContext, "current context=%p, active context=%p, commitString=\"%s\", " "mProcessingKeyEvent=%p, IsComposingOn(aContext)=%s", this, aContext, GetCurrentContext(), GetActiveContext(), commitString, - mProcessingKeyEvent, GetBoolName(IsComposingOn(aContext)))); + mProcessingKeyEvent, ToChar(IsComposingOn(aContext)))); // See bug 472635, we should do nothing if IM context doesn't match. if (!IsValidContext(aContext)) { diff --git a/widget/gtk/moz.build b/widget/gtk/moz.build index daca5e3de9bc..320478ab775f 100644 --- a/widget/gtk/moz.build +++ b/widget/gtk/moz.build @@ -14,12 +14,14 @@ EXPORTS += [ ] UNIFIED_SOURCES += [ + 'IMContextWrapper.cpp', 'mozcontainer.c', 'NativeKeyBindings.cpp', 'nsAppShell.cpp', 'nsBidiKeyboard.cpp', 'nsColorPicker.cpp', 'nsFilePicker.cpp', + 'nsGtkKeyUtils.cpp', 'nsImageToPixbuf.cpp', 'nsLookAndFeel.cpp', 'nsNativeThemeGTK.cpp', @@ -33,8 +35,6 @@ UNIFIED_SOURCES += [ ] SOURCES += [ - 'IMContextWrapper.cpp', # methods for logging conflict with other files - 'nsGtkKeyUtils.cpp', # methods for logging conflict with other files 'nsWindow.cpp', # conflicts with X11 headers ] From 2fa9d4ad30c2b5c83131f25f7b5b0f7c9215e23c Mon Sep 17 00:00:00 2001 From: Chris Pearce Date: Mon, 27 Jul 2015 11:52:16 +1200 Subject: [PATCH 072/136] Bug 1187163 - Ensure we send Reset/Drain complete notifications no matter what happens in GMP{Audio,Video}Decoder. r=gerald --- dom/media/gmp/GMPAudioDecoderParent.cpp | 55 +++++++++++++++++++++++++ dom/media/gmp/GMPAudioDecoderParent.h | 4 ++ dom/media/gmp/GMPVideoDecoderParent.cpp | 55 +++++++++++++++++++++++++ dom/media/gmp/GMPVideoDecoderParent.h | 4 ++ 4 files changed, 118 insertions(+) diff --git a/dom/media/gmp/GMPAudioDecoderParent.cpp b/dom/media/gmp/GMPAudioDecoderParent.cpp index 2b801b454339..72facefc3fbf 100644 --- a/dom/media/gmp/GMPAudioDecoderParent.cpp +++ b/dom/media/gmp/GMPAudioDecoderParent.cpp @@ -28,6 +28,8 @@ GMPAudioDecoderParent::GMPAudioDecoderParent(GMPContentParent* aPlugin) : mIsOpen(false) , mShuttingDown(false) , mActorDestroyed(false) + , mIsAwaitingResetComplete(false) + , mIsAwaitingDrainComplete(false) , mPlugin(aPlugin) , mCallback(nullptr) { @@ -109,6 +111,8 @@ GMPAudioDecoderParent::Reset() return NS_ERROR_FAILURE; } + mIsAwaitingResetComplete = true; + // Async IPC, we don't have access to a return value. return NS_OK; } @@ -127,6 +131,8 @@ GMPAudioDecoderParent::Drain() return NS_ERROR_FAILURE; } + mIsAwaitingDrainComplete = true; + // Async IPC, we don't have access to a return value. return NS_OK; } @@ -138,6 +144,11 @@ GMPAudioDecoderParent::Close() LOGD(("%s: %p", __FUNCTION__, this)); MOZ_ASSERT(!mPlugin || mPlugin->GMPThread() == NS_GetCurrentThread()); + // Ensure if we've received a Close while waiting for a ResetComplete + // or DrainComplete notification, we'll unblock the caller before processing + // the close. This seems unlikely to happen, but better to be careful. + UnblockResetAndDrain(); + // Consumer is done with us; we can shut down. No more callbacks should // be made to mCallback. Note: do this before Shutdown()! mCallback = nullptr; @@ -163,6 +174,11 @@ GMPAudioDecoderParent::Shutdown() } mShuttingDown = true; + // Ensure if we've received a shutdown while waiting for a ResetComplete + // or DrainComplete notification, we'll unblock the caller before processing + // the shutdown. + UnblockResetAndDrain(); + // Notify client we're gone! Won't occur after Close() if (mCallback) { mCallback->Terminated(); @@ -183,6 +199,12 @@ GMPAudioDecoderParent::ActorDestroy(ActorDestroyReason aWhy) { mIsOpen = false; mActorDestroyed = true; + + // Ensure if we've received a destroy while waiting for a ResetComplete + // or DrainComplete notification, we'll unblock the caller before processing + // the error. + UnblockResetAndDrain(); + if (mCallback) { // May call Close() (and Shutdown()) immediately or with a delay mCallback->Terminated(); @@ -230,6 +252,11 @@ GMPAudioDecoderParent::RecvDrainComplete() return false; } + if (!mIsAwaitingDrainComplete) { + return true; + } + mIsAwaitingDrainComplete = false; + // Ignore any return code. It is OK for this to fail without killing the process. mCallback->DrainComplete(); @@ -243,6 +270,11 @@ GMPAudioDecoderParent::RecvResetComplete() return false; } + if (!mIsAwaitingResetComplete) { + return true; + } + mIsAwaitingResetComplete = false; + // Ignore any return code. It is OK for this to fail without killing the process. mCallback->ResetComplete(); @@ -256,6 +288,11 @@ GMPAudioDecoderParent::RecvError(const GMPErr& aError) return false; } + // Ensure if we've received an error while waiting for a ResetComplete + // or DrainComplete notification, we'll unblock the caller before processing + // the error. + UnblockResetAndDrain(); + // Ignore any return code. It is OK for this to fail without killing the process. mCallback->Error(aError); @@ -281,5 +318,23 @@ GMPAudioDecoderParent::Recv__delete__() return true; } +void +GMPAudioDecoderParent::UnblockResetAndDrain() +{ + if (!mCallback) { + MOZ_ASSERT(!mIsAwaitingResetComplete); + MOZ_ASSERT(!mIsAwaitingDrainComplete); + return; + } + if (mIsAwaitingResetComplete) { + mIsAwaitingResetComplete = false; + mCallback->ResetComplete(); + } + if (mIsAwaitingDrainComplete) { + mIsAwaitingDrainComplete = false; + mCallback->DrainComplete(); + } +} + } // namespace gmp } // namespace mozilla diff --git a/dom/media/gmp/GMPAudioDecoderParent.h b/dom/media/gmp/GMPAudioDecoderParent.h index 8379f6f89feb..cb19021f5d71 100644 --- a/dom/media/gmp/GMPAudioDecoderParent.h +++ b/dom/media/gmp/GMPAudioDecoderParent.h @@ -53,9 +53,13 @@ private: virtual bool RecvShutdown() override; virtual bool Recv__delete__() override; + void UnblockResetAndDrain(); + bool mIsOpen; bool mShuttingDown; bool mActorDestroyed; + bool mIsAwaitingResetComplete; + bool mIsAwaitingDrainComplete; nsRefPtr mPlugin; GMPAudioDecoderCallbackProxy* mCallback; }; diff --git a/dom/media/gmp/GMPVideoDecoderParent.cpp b/dom/media/gmp/GMPVideoDecoderParent.cpp index 8491a67d15db..68e633f8701a 100644 --- a/dom/media/gmp/GMPVideoDecoderParent.cpp +++ b/dom/media/gmp/GMPVideoDecoderParent.cpp @@ -43,6 +43,8 @@ GMPVideoDecoderParent::GMPVideoDecoderParent(GMPContentParent* aPlugin) , mIsOpen(false) , mShuttingDown(false) , mActorDestroyed(false) + , mIsAwaitingResetComplete(false) + , mIsAwaitingDrainComplete(false) , mPlugin(aPlugin) , mCallback(nullptr) , mVideoHost(this) @@ -67,6 +69,12 @@ GMPVideoDecoderParent::Close() { LOGD(("%s: %p", __FUNCTION__, this)); MOZ_ASSERT(!mPlugin || mPlugin->GMPThread() == NS_GetCurrentThread()); + + // Ensure if we've received a Close while waiting for a ResetComplete + // or DrainComplete notification, we'll unblock the caller before processing + // the close. This seems unlikely to happen, but better to be careful. + UnblockResetAndDrain(); + // Consumer is done with us; we can shut down. No more callbacks should // be made to mCallback. Note: do this before Shutdown()! mCallback = nullptr; @@ -161,6 +169,8 @@ GMPVideoDecoderParent::Reset() return NS_ERROR_FAILURE; } + mIsAwaitingResetComplete = true; + // Async IPC, we don't have access to a return value. return NS_OK; } @@ -179,6 +189,8 @@ GMPVideoDecoderParent::Drain() return NS_ERROR_FAILURE; } + mIsAwaitingDrainComplete = true; + // Async IPC, we don't have access to a return value. return NS_OK; } @@ -207,6 +219,11 @@ GMPVideoDecoderParent::Shutdown() } mShuttingDown = true; + // Ensure if we've received a shutdown while waiting for a ResetComplete + // or DrainComplete notification, we'll unblock the caller before processing + // the shutdown. + UnblockResetAndDrain(); + // Notify client we're gone! Won't occur after Close() if (mCallback) { mCallback->Terminated(); @@ -229,6 +246,11 @@ GMPVideoDecoderParent::ActorDestroy(ActorDestroyReason aWhy) mActorDestroyed = true; mVideoHost.DoneWithAPI(); + // Ensure if we've received a destroy while waiting for a ResetComplete + // or DrainComplete notification, we'll unblock the caller before processing + // the error. + UnblockResetAndDrain(); + if (mCallback) { // May call Close() (and Shutdown()) immediately or with a delay mCallback->Terminated(); @@ -307,6 +329,11 @@ GMPVideoDecoderParent::RecvDrainComplete() return false; } + if (!mIsAwaitingDrainComplete) { + return true; + } + mIsAwaitingDrainComplete = false; + // Ignore any return code. It is OK for this to fail without killing the process. mCallback->DrainComplete(); @@ -320,6 +347,11 @@ GMPVideoDecoderParent::RecvResetComplete() return false; } + if (!mIsAwaitingResetComplete) { + return true; + } + mIsAwaitingResetComplete = false; + // Ignore any return code. It is OK for this to fail without killing the process. mCallback->ResetComplete(); @@ -333,6 +365,11 @@ GMPVideoDecoderParent::RecvError(const GMPErr& aError) return false; } + // Ensure if we've received an error while waiting for a ResetComplete + // or DrainComplete notification, we'll unblock the caller before processing + // the error. + UnblockResetAndDrain(); + // Ignore any return code. It is OK for this to fail without killing the process. mCallback->Error(aError); @@ -387,5 +424,23 @@ GMPVideoDecoderParent::Recv__delete__() return true; } +void +GMPVideoDecoderParent::UnblockResetAndDrain() +{ + if (!mCallback) { + MOZ_ASSERT(!mIsAwaitingResetComplete); + MOZ_ASSERT(!mIsAwaitingDrainComplete); + return; + } + if (mIsAwaitingResetComplete) { + mIsAwaitingResetComplete = false; + mCallback->ResetComplete(); + } + if (mIsAwaitingDrainComplete) { + mIsAwaitingDrainComplete = false; + mCallback->DrainComplete(); + } +} + } // namespace gmp } // namespace mozilla diff --git a/dom/media/gmp/GMPVideoDecoderParent.h b/dom/media/gmp/GMPVideoDecoderParent.h index 9b54403146f4..1f477ed4176a 100644 --- a/dom/media/gmp/GMPVideoDecoderParent.h +++ b/dom/media/gmp/GMPVideoDecoderParent.h @@ -79,9 +79,13 @@ private: Shmem* aMem) override; virtual bool Recv__delete__() override; + void UnblockResetAndDrain(); + bool mIsOpen; bool mShuttingDown; bool mActorDestroyed; + bool mIsAwaitingResetComplete; + bool mIsAwaitingDrainComplete; nsRefPtr mPlugin; GMPVideoDecoderCallbackProxy* mCallback; GMPVideoHostImpl mVideoHost; From e220da3249ffa73204e958856c7c464b2d6bb798 Mon Sep 17 00:00:00 2001 From: Chris Pearce Date: Mon, 27 Jul 2015 11:52:19 +1200 Subject: [PATCH 073/136] Bug 1187113 - Add more logging around EME promise rejects and method calls that often fail. r=edwin --- dom/base/Navigator.cpp | 46 ++++++++++++++++++- dom/html/HTMLMediaElement.cpp | 3 +- dom/media/eme/DetailedPromise.cpp | 30 ++++++------ dom/media/eme/DetailedPromise.h | 7 ++- dom/media/eme/EMEUtils.cpp | 15 ++++++ dom/media/eme/EMEUtils.h | 3 ++ dom/media/eme/MediaKeySession.cpp | 21 +++++---- dom/media/eme/MediaKeySession.h | 3 +- dom/media/eme/MediaKeySystemAccessManager.cpp | 16 +++++-- dom/media/eme/MediaKeys.cpp | 12 ++--- dom/media/eme/MediaKeys.h | 3 +- 11 files changed, 119 insertions(+), 40 deletions(-) diff --git a/dom/base/Navigator.cpp b/dom/base/Navigator.cpp index c5fc2e6a4b88..a35f86404237 100644 --- a/dom/base/Navigator.cpp +++ b/dom/base/Navigator.cpp @@ -2728,8 +2728,52 @@ Navigator::RequestMediaKeySystemAccess(const nsAString& aKeySystem, const Optional>& aOptions, ErrorResult& aRv) { + nsAutoCString logMsg; + logMsg.AppendPrintf("Navigator::RequestMediaKeySystemAccess(keySystem='%s' options=[", + NS_ConvertUTF16toUTF8(aKeySystem).get()); + if (aOptions.WasPassed()) { + const Sequence& options = aOptions.Value(); + for (size_t i = 0; i < options.Length(); i++) { + const MediaKeySystemOptions& op = options[i]; + if (i > 0) { + logMsg.AppendLiteral(","); + } + logMsg.AppendLiteral("{"); + logMsg.AppendPrintf("stateful='%s'", + MediaKeysRequirementValues::strings[(size_t)op.mStateful].value); + + logMsg.AppendPrintf(", uniqueIdentifier='%s'", + MediaKeysRequirementValues::strings[(size_t)op.mUniqueidentifier].value); + + if (!op.mAudioCapability.IsEmpty()) { + logMsg.AppendPrintf(", audioCapability='%s'", + NS_ConvertUTF16toUTF8(op.mAudioCapability).get()); + } + if (!op.mAudioType.IsEmpty()) { + logMsg.AppendPrintf(", audioType='%s'", + NS_ConvertUTF16toUTF8(op.mAudioType).get()); + } + if (!op.mInitDataType.IsEmpty()) { + logMsg.AppendPrintf(", initDataType='%s'", + NS_ConvertUTF16toUTF8(op.mInitDataType).get()); + } + if (!op.mVideoCapability.IsEmpty()) { + logMsg.AppendPrintf(", videoCapability='%s'", + NS_ConvertUTF16toUTF8(op.mVideoCapability).get()); + } + if (!op.mVideoType.IsEmpty()) { + logMsg.AppendPrintf(", videoType='%s'", + NS_ConvertUTF16toUTF8(op.mVideoType).get()); + } + logMsg.AppendLiteral("}"); + } + } + logMsg.AppendPrintf("])"); + EME_LOG(logMsg.get()); + nsCOMPtr go = do_QueryInterface(mWindow); - nsRefPtr promise = DetailedPromise::Create(go, aRv); + nsRefPtr promise = DetailedPromise::Create(go, aRv, + NS_LITERAL_CSTRING("navigator.requestMediaKeySystemAccess")); if (aRv.Failed()) { return nullptr; } diff --git a/dom/html/HTMLMediaElement.cpp b/dom/html/HTMLMediaElement.cpp index 493bbd26678a..432dba7573de 100644 --- a/dom/html/HTMLMediaElement.cpp +++ b/dom/html/HTMLMediaElement.cpp @@ -4561,7 +4561,8 @@ HTMLMediaElement::SetMediaKeys(mozilla::dom::MediaKeys* aMediaKeys, aRv.Throw(NS_ERROR_UNEXPECTED); return nullptr; } - nsRefPtr promise = DetailedPromise::Create(global, aRv); + nsRefPtr promise = DetailedPromise::Create(global, aRv, + NS_LITERAL_CSTRING("HTMLMediaElement.setMediaKeys")); if (aRv.Failed()) { return nullptr; } diff --git a/dom/media/eme/DetailedPromise.cpp b/dom/media/eme/DetailedPromise.cpp index 863a9634a302..3d72995a0217 100644 --- a/dom/media/eme/DetailedPromise.cpp +++ b/dom/media/eme/DetailedPromise.cpp @@ -6,12 +6,15 @@ #include "DetailedPromise.h" #include "mozilla/dom/DOMException.h" +#include "nsPrintfCString.h" namespace mozilla { namespace dom { -DetailedPromise::DetailedPromise(nsIGlobalObject* aGlobal) +DetailedPromise::DetailedPromise(nsIGlobalObject* aGlobal, + const nsACString& aName) : Promise(aGlobal) + , mName(aName) , mResponded(false) { } @@ -21,25 +24,16 @@ DetailedPromise::~DetailedPromise() MOZ_ASSERT(mResponded == IsPending()); } -static void -LogToConsole(const nsAString& aMsg) -{ - nsCOMPtr console( - do_GetService("@mozilla.org/consoleservice;1")); - if (!console) { - NS_WARNING("Failed to log message to console."); - return; - } - nsAutoString msg(aMsg); - console->LogStringMessage(msg.get()); -} - void DetailedPromise::MaybeReject(nsresult aArg, const nsACString& aReason) { + nsPrintfCString msg("%s promise rejected 0x%x '%s'", mName.get(), aArg, + PromiseFlatCString(aReason).get()); + EME_LOG(msg.get()); + mResponded = true; - LogToConsole(NS_ConvertUTF8toUTF16(aReason)); + LogToBrowserConsole(NS_ConvertUTF8toUTF16(msg)); nsRefPtr exception = DOMException::Create(aArg, aReason); @@ -53,9 +47,11 @@ DetailedPromise::MaybeReject(ErrorResult&, const nsACString& aReason) } /* static */ already_AddRefed -DetailedPromise::Create(nsIGlobalObject* aGlobal, ErrorResult& aRv) +DetailedPromise::Create(nsIGlobalObject* aGlobal, + ErrorResult& aRv, + const nsACString& aName) { - nsRefPtr promise = new DetailedPromise(aGlobal); + nsRefPtr promise = new DetailedPromise(aGlobal, aName); promise->CreateWrapper(aRv); return aRv.Failed() ? nullptr : promise.forget(); } diff --git a/dom/media/eme/DetailedPromise.h b/dom/media/eme/DetailedPromise.h index 922e95f58e74..0b919fa53c64 100644 --- a/dom/media/eme/DetailedPromise.h +++ b/dom/media/eme/DetailedPromise.h @@ -8,6 +8,7 @@ #define __DetailedPromise_h__ #include "mozilla/dom/Promise.h" +#include "EMEUtils.h" namespace mozilla { namespace dom { @@ -21,11 +22,12 @@ class DetailedPromise : public Promise { public: static already_AddRefed - Create(nsIGlobalObject* aGlobal, ErrorResult& aRv); + Create(nsIGlobalObject* aGlobal, ErrorResult& aRv, const nsACString& aName); template void MaybeResolve(const T& aArg) { + EME_LOG("%s promise resolved", mName.get()); mResponded = true; Promise::MaybeResolve(aArg); } @@ -37,9 +39,10 @@ public: void MaybeReject(ErrorResult&, const nsACString& aReason); private: - explicit DetailedPromise(nsIGlobalObject* aGlobal); + explicit DetailedPromise(nsIGlobalObject* aGlobal, const nsACString& aName); virtual ~DetailedPromise(); + nsCString mName; bool mResponded; }; diff --git a/dom/media/eme/EMEUtils.cpp b/dom/media/eme/EMEUtils.cpp index 6137862cdd79..443adbea8baa 100644 --- a/dom/media/eme/EMEUtils.cpp +++ b/dom/media/eme/EMEUtils.cpp @@ -5,6 +5,8 @@ * You can obtain one at http://mozilla.org/MPL/2.0/. */ #include "mozilla/EMEUtils.h" +#include "nsServiceManagerUtils.h" +#include "nsIConsoleService.h" namespace mozilla { @@ -109,4 +111,17 @@ ParseKeySystem(const nsAString& aInputKeySystem, return false; } +void +LogToBrowserConsole(const nsAString& aMsg) +{ + nsCOMPtr console( + do_GetService("@mozilla.org/consoleservice;1")); + if (!console) { + NS_WARNING("Failed to log message to console."); + return; + } + nsAutoString msg(aMsg); + console->LogStringMessage(msg.get()); +} + } // namespace mozilla diff --git a/dom/media/eme/EMEUtils.h b/dom/media/eme/EMEUtils.h index 44165b51215e..fef99cac7fe5 100644 --- a/dom/media/eme/EMEUtils.h +++ b/dom/media/eme/EMEUtils.h @@ -51,6 +51,9 @@ bool ParseKeySystem(const nsAString& aKeySystem, nsAString& aOutKeySystem, int32_t& aOutMinCDMVersion); +void +LogToBrowserConsole(const nsAString& aMsg); + } // namespace mozilla #endif // EME_LOG_H_ diff --git a/dom/media/eme/MediaKeySession.cpp b/dom/media/eme/MediaKeySession.cpp index 7b64ba18cb03..fb979757f495 100644 --- a/dom/media/eme/MediaKeySession.cpp +++ b/dom/media/eme/MediaKeySession.cpp @@ -60,7 +60,7 @@ MediaKeySession::MediaKeySession(JSContext* aCx, if (aRv.Failed()) { return; } - mClosed = MakePromise(aRv); + mClosed = MakePromise(aRv, NS_LITERAL_CSTRING("MediaKeys.createSession")); } void MediaKeySession::SetSessionId(const nsAString& aSessionId) @@ -169,7 +169,8 @@ MediaKeySession::GenerateRequest(const nsAString& aInitDataType, const ArrayBufferViewOrArrayBuffer& aInitData, ErrorResult& aRv) { - nsRefPtr promise(MakePromise(aRv)); + nsRefPtr promise(MakePromise(aRv, + NS_LITERAL_CSTRING("MediaKeySession.generateRequest"))); if (aRv.Failed()) { return nullptr; } @@ -226,7 +227,8 @@ MediaKeySession::GenerateRequest(const nsAString& aInitDataType, already_AddRefed MediaKeySession::Load(const nsAString& aSessionId, ErrorResult& aRv) { - nsRefPtr promise(MakePromise(aRv)); + nsRefPtr promise(MakePromise(aRv, + NS_LITERAL_CSTRING("MediaKeySession.load"))); if (aRv.Failed()) { return nullptr; } @@ -269,7 +271,8 @@ MediaKeySession::Load(const nsAString& aSessionId, ErrorResult& aRv) already_AddRefed MediaKeySession::Update(const ArrayBufferViewOrArrayBuffer& aResponse, ErrorResult& aRv) { - nsRefPtr promise(MakePromise(aRv)); + nsRefPtr promise(MakePromise(aRv, + NS_LITERAL_CSTRING("MediaKeySession.update"))); if (aRv.Failed()) { return nullptr; } @@ -320,7 +323,8 @@ MediaKeySession::Update(const ArrayBufferViewOrArrayBuffer& aResponse, ErrorResu already_AddRefed MediaKeySession::Close(ErrorResult& aRv) { - nsRefPtr promise(MakePromise(aRv)); + nsRefPtr promise(MakePromise(aRv, + NS_LITERAL_CSTRING("MediaKeySession.close"))); if (aRv.Failed()) { return nullptr; } @@ -362,7 +366,8 @@ MediaKeySession::IsClosed() const already_AddRefed MediaKeySession::Remove(ErrorResult& aRv) { - nsRefPtr promise(MakePromise(aRv)); + nsRefPtr promise(MakePromise(aRv, + NS_LITERAL_CSTRING("MediaKeySession.remove"))); if (aRv.Failed()) { return nullptr; } @@ -447,7 +452,7 @@ MediaKeySession::Token() const } already_AddRefed -MediaKeySession::MakePromise(ErrorResult& aRv) +MediaKeySession::MakePromise(ErrorResult& aRv, const nsACString& aName) { nsCOMPtr global = do_QueryInterface(GetParentObject()); if (!global) { @@ -455,7 +460,7 @@ MediaKeySession::MakePromise(ErrorResult& aRv) aRv.Throw(NS_ERROR_UNEXPECTED); return nullptr; } - return DetailedPromise::Create(global, aRv); + return DetailedPromise::Create(global, aRv, aName); } } // namespace dom diff --git a/dom/media/eme/MediaKeySession.h b/dom/media/eme/MediaKeySession.h index d48597ea88ee..2d3fd23c7f30 100644 --- a/dom/media/eme/MediaKeySession.h +++ b/dom/media/eme/MediaKeySession.h @@ -98,7 +98,8 @@ private: ~MediaKeySession(); void UpdateKeyStatusMap(); - already_AddRefed MakePromise(ErrorResult& aRv); + already_AddRefed MakePromise(ErrorResult& aRv, + const nsACString& aName); nsRefPtr mClosed; diff --git a/dom/media/eme/MediaKeySystemAccessManager.cpp b/dom/media/eme/MediaKeySystemAccessManager.cpp index 5212f92d9591..3b1a8d9e4389 100644 --- a/dom/media/eme/MediaKeySystemAccessManager.cpp +++ b/dom/media/eme/MediaKeySystemAccessManager.cpp @@ -13,6 +13,7 @@ #ifdef XP_WIN #include "mozilla/WindowsVersion.h" #endif +#include "nsPrintfCString.h" namespace mozilla { namespace dom { @@ -106,7 +107,17 @@ MediaKeySystemAccessManager::Request(DetailedPromise* aPromise, } nsAutoCString message; - MediaKeySystemStatus status = MediaKeySystemAccess::GetKeySystemStatus(keySystem, minCdmVersion, message); + MediaKeySystemStatus status = + MediaKeySystemAccess::GetKeySystemStatus(keySystem, minCdmVersion, message); + + nsPrintfCString msg("MediaKeySystemAccess::GetKeySystemStatus(%s, minVer=%d) " + "result=%s msg='%s'", + NS_ConvertUTF16toUTF8(keySystem).get(), + minCdmVersion, + MediaKeySystemStatusValues::strings[(size_t)status].value, + message.get()); + LogToBrowserConsole(NS_ConvertUTF8toUTF16(msg)); + if ((status == MediaKeySystemStatus::Cdm_not_installed || status == MediaKeySystemStatus::Cdm_insufficient_version) && keySystem.EqualsLiteral("com.adobe.primetime")) { @@ -139,8 +150,7 @@ MediaKeySystemAccessManager::Request(DetailedPromise* aPromise, // chrome, so we can show some UI to explain how the user can rectify // the situation. MediaKeySystemAccess::NotifyObservers(mWindow, keySystem, status); - aPromise->MaybeReject(NS_ERROR_DOM_NOT_SUPPORTED_ERR, - NS_LITERAL_CSTRING("The key system has been disabled by the user")); + aPromise->MaybeReject(NS_ERROR_DOM_NOT_SUPPORTED_ERR, message); return; } aPromise->MaybeReject(NS_ERROR_DOM_INVALID_STATE_ERR, diff --git a/dom/media/eme/MediaKeys.cpp b/dom/media/eme/MediaKeys.cpp index 40fcb6791a4a..83f3a843098c 100644 --- a/dom/media/eme/MediaKeys.cpp +++ b/dom/media/eme/MediaKeys.cpp @@ -147,8 +147,8 @@ MediaKeys::GetKeySystem(nsString& retval) const already_AddRefed MediaKeys::SetServerCertificate(const ArrayBufferViewOrArrayBuffer& aCert, ErrorResult& aRv) { - nsRefPtr - promise(MakePromise(aRv)); + nsRefPtr promise(MakePromise(aRv, + NS_LITERAL_CSTRING("MediaKeys.setServerCertificate"))); if (aRv.Failed()) { return nullptr; } @@ -172,7 +172,7 @@ MediaKeys::SetServerCertificate(const ArrayBufferViewOrArrayBuffer& aCert, Error } already_AddRefed -MediaKeys::MakePromise(ErrorResult& aRv) +MediaKeys::MakePromise(ErrorResult& aRv, const nsACString& aName) { nsCOMPtr global = do_QueryInterface(GetParentObject()); if (!global) { @@ -180,7 +180,7 @@ MediaKeys::MakePromise(ErrorResult& aRv) aRv.Throw(NS_ERROR_UNEXPECTED); return nullptr; } - return DetailedPromise::Create(global, aRv); + return DetailedPromise::Create(global, aRv, aName); } PromiseId @@ -295,8 +295,8 @@ MediaKeys::ResolvePromise(PromiseId aId) already_AddRefed MediaKeys::Init(ErrorResult& aRv) { - nsRefPtr - promise(MakePromise(aRv)); + nsRefPtr promise(MakePromise(aRv, + NS_LITERAL_CSTRING("MediaKeys::Init()"))); if (aRv.Failed()) { return nullptr; } diff --git a/dom/media/eme/MediaKeys.h b/dom/media/eme/MediaKeys.h index 74f937331b95..aa74ee4b168f 100644 --- a/dom/media/eme/MediaKeys.h +++ b/dom/media/eme/MediaKeys.h @@ -99,7 +99,8 @@ public: CDMProxy* GetCDMProxy() { return mProxy; } // Makes a new promise, or nullptr on failure. - already_AddRefed MakePromise(ErrorResult& aRv); + already_AddRefed MakePromise(ErrorResult& aRv, + const nsACString& aName); // Stores promise in mPromises, returning an ID that can be used to retrieve // it later. The ID is passed to the CDM, so that it can signal specific // promises to be resolved. From 49a82c55c83f63a548ca8e60a62ec9243149e709 Mon Sep 17 00:00:00 2001 From: Nicholas Nethercote Date: Thu, 23 Jul 2015 21:43:48 -0700 Subject: [PATCH 074/136] Bug 1187197 (part 1) - Move comments from PL_DHashTable* functions to the equivalent methods. r=froydnj. Because the PL_DHashTable* functions will go away eventually (bug 1121760). --HG-- extra : rebase_source : 6bd5aedf71c162102f4a7e06347c868d5dd78dbd --- xpcom/glue/pldhash.cpp | 2 +- xpcom/glue/pldhash.h | 129 +++++++++++++++++------------------------ 2 files changed, 54 insertions(+), 77 deletions(-) diff --git a/xpcom/glue/pldhash.cpp b/xpcom/glue/pldhash.cpp index 5fcd463153ee..59205867ea27 100644 --- a/xpcom/glue/pldhash.cpp +++ b/xpcom/glue/pldhash.cpp @@ -686,7 +686,7 @@ PLDHashTable::Remove(const void* aKey) : nullptr; if (entry) { /* Clear this entry and mark it as "removed". */ - PL_DHashTableRawRemove(this, entry); + RawRemove(entry); /* Shrink if alpha is <= .25 and the table isn't too small already. */ uint32_t capacity = Capacity(); diff --git a/xpcom/glue/pldhash.h b/xpcom/glue/pldhash.h index 42c237fd9509..087828aae81f 100644 --- a/xpcom/glue/pldhash.h +++ b/xpcom/glue/pldhash.h @@ -301,11 +301,43 @@ public: uint32_t EntryCount() const { return mEntryCount; } uint32_t Generation() const { return mGeneration; } + // To search for a |key| in |table|, call: + // + // entry = table.Search(key); + // + // If |entry| is non-null, |key| was found. If |entry| is null, key was not + // found. PLDHashEntryHdr* Search(const void* aKey); + + // To add an entry identified by |key| to table, call: + // + // entry = table.Add(key, mozilla::fallible); + // + // If |entry| is null upon return, then the table is severely overloaded and + // memory can't be allocated for entry storage. + // + // Otherwise, |aEntry->mKeyHash| has been set so that + // PLDHashTable::EntryIsFree(entry) is false, and it is up to the caller to + // initialize the key and value parts of the entry sub-type, if they have not + // been set already (i.e. if entry was not already in the table, and if the + // optional initEntry hook was not used). PLDHashEntryHdr* Add(const void* aKey, const mozilla::fallible_t&); + + // This is like the other Add() function, but infallible, and so never + // returns null. PLDHashEntryHdr* Add(const void* aKey); + + // To remove an entry identified by |key| from table, call: + // + // table.Remove(key); + // + // If |key|'s entry is found, it is cleared (via table->mOps->clearEntry). void Remove(const void* aKey); + // Remove an entry already accessed via Search() or Add(). + // + // NB: this is a "raw" or low-level method. It does not shrink the table if + // it is underloaded. Don't use it unless you know what you are doing. void RawRemove(PLDHashEntryHdr* aEntry); // This function is equivalent to @@ -322,15 +354,22 @@ public: // a new |aLength| argument. void ClearAndPrepareForLength(uint32_t aLength); + // Measure the size of the table's entry storage, and if + // |aSizeOfEntryExcludingThis| is non-nullptr, measure the size of things + // pointed to by entries. size_t SizeOfIncludingThis( PLDHashSizeOfEntryExcludingThisFun aSizeOfEntryExcludingThis, mozilla::MallocSizeOf aMallocSizeOf, void* aArg = nullptr) const; + // Like SizeOfExcludingThis(), but includes sizeof(*this). size_t SizeOfExcludingThis( PLDHashSizeOfEntryExcludingThisFun aSizeOfEntryExcludingThis, mozilla::MallocSizeOf aMallocSizeOf, void* aArg = nullptr) const; #ifdef DEBUG + // Mark a table as immutable for the remainder of its lifetime. This + // changes the implementation from asserting one set of invariants to + // asserting a different set. void MarkImmutable(); #endif @@ -483,17 +522,16 @@ typedef void (*PLDHashMoveEntry)(PLDHashTable* aTable, /* * Clear the entry and drop any strong references it holds. This callback is - * invoked by PL_DHashTableRemove(), but only if the given key is found in the - * table. + * invoked by Remove(), but only if the given key is found in the table. */ typedef void (*PLDHashClearEntry)(PLDHashTable* aTable, PLDHashEntryHdr* aEntry); /* * Initialize a new entry, apart from mKeyHash. This function is called when - * PL_DHashTableAdd finds no existing entry for the given key, and must add a - * new one. At that point, aEntry->mKeyHash is not set yet, to avoid claiming - * the last free entry in a severely overloaded table. + * Add() finds no existing entry for the given key, and must add a new one. At + * that point, |aEntry->mKeyHash| is not set yet, to avoid claiming the last + * free entry in a severely overloaded table. */ typedef void (*PLDHashInitEntry)(PLDHashEntryHdr* aEntry, const void* aKey); @@ -509,13 +547,13 @@ typedef void (*PLDHashInitEntry)(PLDHashEntryHdr* aEntry, const void* aKey); * clearEntry Run dtor on entry. * * Note the reason why initEntry is optional: the default hooks (stubs) clear - * entry storage: On successful PL_DHashTableAdd(tbl, key), the returned entry - * pointer addresses an entry struct whose mKeyHash member has been set - * non-zero, but all other entry members are still clear (null). - * PL_DHashTableAdd callers can test such members to see whether the entry was - * newly created by the PL_DHashTableAdd call that just succeeded. If - * placement new or similar initialization is required, define an initEntry - * hook. Of course, the clearEntry hook must zero or null appropriately. + * entry storage: On successful Add(tbl, key), the returned entry pointer + * addresses an entry struct whose mKeyHash member has been set non-zero, but + * all other entry members are still clear (null). Add() callers can test such + * members to see whether the entry was newly created by the Add() call that + * just succeeded. If placement new or similar initialization is required, + * define an |initEntry| hook. Of course, the |clearEntry| hook must zero or + * null appropriately. * * XXX assumes 0 is null for pointer types. */ @@ -567,96 +605,35 @@ void PL_DHashClearEntryStub(PLDHashTable* aTable, PLDHashEntryHdr* aEntry); */ const PLDHashTableOps* PL_DHashGetStubOps(void); -/* - * To search for a key in |table|, call: - * - * entry = PL_DHashTableSearch(table, key); - * - * If |entry| is non-null, |key| was found. If |entry| is null, key was not - * found. - */ +// The following function are deprecated. Use the equivalent class methods +// instead: PLDHashTable::Search() instead of PL_DHashTableSearch(), etc. + PLDHashEntryHdr* PL_DHASH_FASTCALL PL_DHashTableSearch(PLDHashTable* aTable, const void* aKey); -/* - * To add an entry identified by key to table, call: - * - * entry = PL_DHashTableAdd(table, key, mozilla::fallible); - * - * If entry is null upon return, then the table is severely overloaded and - * memory can't be allocated for entry storage. - * - * Otherwise, aEntry->mKeyHash has been set so that - * PLDHashTable::EntryIsFree(entry) is false, and it is up to the caller to - * initialize the key and value parts of the entry sub-type, if they have not - * been set already (i.e. if entry was not already in the table, and if the - * optional initEntry hook was not used). - */ PLDHashEntryHdr* PL_DHASH_FASTCALL PL_DHashTableAdd(PLDHashTable* aTable, const void* aKey, const mozilla::fallible_t&); -/* - * This is like the other PL_DHashTableAdd() function, but infallible, and so - * never returns null. - */ PLDHashEntryHdr* PL_DHASH_FASTCALL PL_DHashTableAdd(PLDHashTable* aTable, const void* aKey); -/* - * To remove an entry identified by key from table, call: - * - * PL_DHashTableRemove(table, key); - * - * If key's entry is found, it is cleared (via table->mOps->clearEntry). - */ void PL_DHASH_FASTCALL PL_DHashTableRemove(PLDHashTable* aTable, const void* aKey); -/* - * Remove an entry already accessed via PL_DHashTableSearch or PL_DHashTableAdd. - * - * NB: this is a "raw" or low-level routine, intended to be used only where - * the inefficiency of a full PL_DHashTableRemove (which rehashes in order - * to find the entry given its key) is not tolerable. This function does not - * shrink the table if it is underloaded. - */ void PL_DHashTableRawRemove(PLDHashTable* aTable, PLDHashEntryHdr* aEntry); -/** - * Measure the size of the table's entry storage, and if - * |aSizeOfEntryExcludingThis| is non-nullptr, measure the size of things - * pointed to by entries. Doesn't measure |mOps| because it's often shared - * between tables. - */ size_t PL_DHashTableSizeOfExcludingThis( const PLDHashTable* aTable, PLDHashSizeOfEntryExcludingThisFun aSizeOfEntryExcludingThis, mozilla::MallocSizeOf aMallocSizeOf, void* aArg = nullptr); -/** - * Like PL_DHashTableSizeOfExcludingThis, but includes sizeof(*this). - */ size_t PL_DHashTableSizeOfIncludingThis( const PLDHashTable* aTable, PLDHashSizeOfEntryExcludingThisFun aSizeOfEntryExcludingThis, mozilla::MallocSizeOf aMallocSizeOf, void* aArg = nullptr); #ifdef DEBUG -/** - * Mark a table as immutable for the remainder of its lifetime. This - * changes the implementation from ASSERTing one set of invariants to - * ASSERTing a different set. - * - * When a table is NOT marked as immutable, the table implementation - * asserts that the table is not mutated from its own callbacks. It - * assumes the caller protects the table from being accessed on multiple - * threads simultaneously. - * - * When the table is marked as immutable, the re-entry assertions will - * no longer trigger erroneously due to multi-threaded access. Instead, - * mutations will cause assertions. - */ void PL_DHashMarkTableImmutable(PLDHashTable* aTable); #endif From 42e338fc52ee28502b414586ae5afd1997ff6c98 Mon Sep 17 00:00:00 2001 From: Nicholas Nethercote Date: Thu, 23 Jul 2015 23:13:10 -0700 Subject: [PATCH 075/136] Bug 1187197 (part 2) - Put function return types on their own line. r=froydnj. --HG-- extra : rebase_source : 58e81c134c321faa28e6ab46ed4c6c583a846ab5 --- xpcom/glue/pldhash.h | 38 ++++++++++++++++++++++++-------------- 1 file changed, 24 insertions(+), 14 deletions(-) diff --git a/xpcom/glue/pldhash.h b/xpcom/glue/pldhash.h index 087828aae81f..6adc6eeabcb0 100644 --- a/xpcom/glue/pldhash.h +++ b/xpcom/glue/pldhash.h @@ -573,7 +573,8 @@ struct PLDHashTableOps * Default implementations for the above mOps. */ -PLDHashNumber PL_DHashStringKey(PLDHashTable* aTable, const void* aKey); +PLDHashNumber +PL_DHashStringKey(PLDHashTable* aTable, const void* aKey); /* A minimal entry is a subclass of PLDHashEntryHdr and has void key pointer. */ struct PLDHashEntryStub : public PLDHashEntryHdr @@ -581,29 +582,34 @@ struct PLDHashEntryStub : public PLDHashEntryHdr const void* key; }; -PLDHashNumber PL_DHashVoidPtrKeyStub(PLDHashTable* aTable, const void* aKey); +PLDHashNumber +PL_DHashVoidPtrKeyStub(PLDHashTable* aTable, const void* aKey); -bool PL_DHashMatchEntryStub(PLDHashTable* aTable, - const PLDHashEntryHdr* aEntry, - const void* aKey); +bool +PL_DHashMatchEntryStub(PLDHashTable* aTable, + const PLDHashEntryHdr* aEntry, + const void* aKey); -bool PL_DHashMatchStringKey(PLDHashTable* aTable, - const PLDHashEntryHdr* aEntry, - const void* aKey); +bool +PL_DHashMatchStringKey(PLDHashTable* aTable, + const PLDHashEntryHdr* aEntry, + const void* aKey); void PL_DHashMoveEntryStub(PLDHashTable* aTable, const PLDHashEntryHdr* aFrom, PLDHashEntryHdr* aTo); -void PL_DHashClearEntryStub(PLDHashTable* aTable, PLDHashEntryHdr* aEntry); +void +PL_DHashClearEntryStub(PLDHashTable* aTable, PLDHashEntryHdr* aEntry); /* * If you use PLDHashEntryStub or a subclass of it as your entry struct, and * if your entries move via memcpy and clear via memset(0), you can use these * stub operations. */ -const PLDHashTableOps* PL_DHashGetStubOps(void); +const PLDHashTableOps* +PL_DHashGetStubOps(void); // The following function are deprecated. Use the equivalent class methods // instead: PLDHashTable::Search() instead of PL_DHashTableSearch(), etc. @@ -621,20 +627,24 @@ PL_DHashTableAdd(PLDHashTable* aTable, const void* aKey); void PL_DHASH_FASTCALL PL_DHashTableRemove(PLDHashTable* aTable, const void* aKey); -void PL_DHashTableRawRemove(PLDHashTable* aTable, PLDHashEntryHdr* aEntry); +void +PL_DHashTableRawRemove(PLDHashTable* aTable, PLDHashEntryHdr* aEntry); -size_t PL_DHashTableSizeOfExcludingThis( +size_t +PL_DHashTableSizeOfExcludingThis( const PLDHashTable* aTable, PLDHashSizeOfEntryExcludingThisFun aSizeOfEntryExcludingThis, mozilla::MallocSizeOf aMallocSizeOf, void* aArg = nullptr); -size_t PL_DHashTableSizeOfIncludingThis( +size_t +PL_DHashTableSizeOfIncludingThis( const PLDHashTable* aTable, PLDHashSizeOfEntryExcludingThisFun aSizeOfEntryExcludingThis, mozilla::MallocSizeOf aMallocSizeOf, void* aArg = nullptr); #ifdef DEBUG -void PL_DHashMarkTableImmutable(PLDHashTable* aTable); +void +PL_DHashMarkTableImmutable(PLDHashTable* aTable); #endif #endif /* pldhash_h___ */ From 10da8efa1c66623d2e5e354735fd7682a96d0e0d Mon Sep 17 00:00:00 2001 From: Nicholas Nethercote Date: Thu, 23 Jul 2015 23:13:11 -0700 Subject: [PATCH 076/136] Bug 1187197 (part 3) - Convert pldhash.{cpp,h} to C++ style comments. r=froydnj. --HG-- extra : rebase_source : 4615862ad586e24050a6f5571b8d21689ba3fdf3 --- xpcom/glue/pldhash.cpp | 122 +++++++++++---------------- xpcom/glue/pldhash.h | 186 ++++++++++++++++++----------------------- 2 files changed, 132 insertions(+), 176 deletions(-) diff --git a/xpcom/glue/pldhash.cpp b/xpcom/glue/pldhash.cpp index 59205867ea27..e474e74ed490 100644 --- a/xpcom/glue/pldhash.cpp +++ b/xpcom/glue/pldhash.cpp @@ -4,9 +4,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/. */ -/* - * Double hashing implementation. - */ #include #include #include @@ -14,7 +11,6 @@ #include "pldhash.h" #include "mozilla/HashFunctions.h" #include "mozilla/MathAlgorithms.h" -#include "nsDebug.h" /* for PR_ASSERT */ #include "nsAlgorithm.h" #include "mozilla/Likely.h" #include "mozilla/MemoryReporting.h" @@ -95,7 +91,7 @@ PL_DHashMatchStringKey(PLDHashTable* aTable, { const PLDHashEntryStub* stub = (const PLDHashEntryStub*)aEntry; - /* XXX tolerate null keys on account of sloppy Mozilla callers. */ + // XXX tolerate null keys on account of sloppy Mozilla callers. return stub->key == aKey || (stub->key && aKey && strcmp((const char*)stub->key, (const char*)aKey) == 0); @@ -150,13 +146,11 @@ SizeOfEntryStore(uint32_t aCapacity, uint32_t aEntrySize, uint32_t* aNbytes) return uint64_t(*aNbytes) == nbytes64; // returns false on overflow } -/* - * Compute max and min load numbers (entry counts). We have a secondary max - * that allows us to overload a table reasonably if it cannot be grown further - * (i.e. if ChangeTable() fails). The table slows down drastically if the - * secondary max is too close to 1, but 0.96875 gives only a slight slowdown - * while allowing 1.3x more elements. - */ +// Compute max and min load numbers (entry counts). We have a secondary max +// that allows us to overload a table reasonably if it cannot be grown further +// (i.e. if ChangeTable() fails). The table slows down drastically if the +// secondary max is too close to 1, but 0.96875 gives only a slight slowdown +// while allowing 1.3x more elements. static inline uint32_t MaxLoad(uint32_t aCapacity) { @@ -288,14 +282,12 @@ PLDHashTable::Hash2(PLDHashNumber aHash, aSizeMaskOut = (PLDHashNumber(1) << sizeLog2) - 1; } -/* - * Reserve mKeyHash 0 for free entries and 1 for removed-entry sentinels. Note - * that a removed-entry sentinel need be stored only if the removed entry had - * a colliding entry added after it. Therefore we can use 1 as the collision - * flag in addition to the removed-entry sentinel value. Multiplicative hash - * uses the high order bits of mKeyHash, so this least-significant reservation - * should not hurt the hash function's effectiveness much. - */ +// Reserve mKeyHash 0 for free entries and 1 for removed-entry sentinels. Note +// that a removed-entry sentinel need be stored only if the removed entry had +// a colliding entry added after it. Therefore we can use 1 as the collision +// flag in addition to the removed-entry sentinel value. Multiplicative hash +// uses the high order bits of mKeyHash, so this least-significant reservation +// should not hurt the hash function's effectiveness much. /* static */ MOZ_ALWAYS_INLINE bool PLDHashTable::EntryIsFree(PLDHashEntryHdr* aEntry) @@ -324,14 +316,14 @@ PLDHashTable::MarkEntryRemoved(PLDHashEntryHdr* aEntry) aEntry->mKeyHash = 1; } -/* Match an entry's mKeyHash against an unstored one computed from a key. */ +// Match an entry's mKeyHash against an unstored one computed from a key. /* static */ bool PLDHashTable::MatchEntryKeyhash(PLDHashEntryHdr* aEntry, PLDHashNumber aKeyHash) { return (aEntry->mKeyHash & ~kCollisionFlag) == aKeyHash; } -/* Compute the address of the indexed entry in table. */ +// Compute the address of the indexed entry in table. PLDHashEntryHdr* PLDHashTable::AddressEntry(uint32_t aIndex) { @@ -348,7 +340,7 @@ PLDHashTable::~PLDHashTable() return; } - /* Clear any remaining live entries. */ + // Clear any remaining live entries. char* entryAddr = mEntryStore; char* entryLimit = entryAddr + Capacity() * mEntrySize; while (entryAddr < entryLimit) { @@ -359,7 +351,7 @@ PLDHashTable::~PLDHashTable() entryAddr += mEntrySize; } - /* Free entry storage last. */ + // Free entry storage last. free(mEntryStore); mEntryStore = nullptr; } @@ -394,31 +386,29 @@ PLDHashTable::SearchTable(const void* aKey, PLDHashNumber aKeyHash) NS_ASSERTION(!(aKeyHash & kCollisionFlag), "!(aKeyHash & kCollisionFlag)"); - /* Compute the primary hash address. */ + // Compute the primary hash address. PLDHashNumber hash1 = Hash1(aKeyHash); PLDHashEntryHdr* entry = AddressEntry(hash1); - /* Miss: return space for a new entry. */ + // Miss: return space for a new entry. if (EntryIsFree(entry)) { return (Reason == ForAdd) ? entry : nullptr; } - /* Hit: return entry. */ + // Hit: return entry. PLDHashMatchEntry matchEntry = mOps->matchEntry; if (MatchEntryKeyhash(entry, aKeyHash) && matchEntry(this, entry, aKey)) { return entry; } - /* Collision: double hash. */ + // Collision: double hash. PLDHashNumber hash2; uint32_t sizeMask; Hash2(aKeyHash, hash2, sizeMask); - /* - * Save the first removed entry pointer so Add() can recycle it. (Only used - * if Reason==ForAdd.) - */ + // Save the first removed entry pointer so Add() can recycle it. (Only used + // if Reason==ForAdd.) PLDHashEntryHdr* firstRemoved = nullptr; for (;;) { @@ -447,20 +437,17 @@ PLDHashTable::SearchTable(const void* aKey, PLDHashNumber aKeyHash) } } - /* NOTREACHED */ + // NOTREACHED return nullptr; } -/* - * This is a copy of SearchTable, used by ChangeTable, hardcoded to - * 1. assume |aIsAdd| is true, - * 2. assume that |aKey| will never match an existing entry, and - * 3. assume that no entries have been removed from the current table - * structure. - * Avoiding the need for |aKey| means we can avoid needing a way to map - * entries to keys, which means callers can use complex key types more - * easily. - */ +// This is a copy of SearchTable(), used by ChangeTable(), hardcoded to +// 1. assume |aIsAdd| is true, +// 2. assume that |aKey| will never match an existing entry, and +// 3. assume that no entries have been removed from the current table +// structure. +// Avoiding the need for |aKey| means we can avoid needing a way to map entries +// to keys, which means callers can use complex key types more easily. PLDHashEntryHdr* PL_DHASH_FASTCALL PLDHashTable::FindFreeEntry(PLDHashNumber aKeyHash) { @@ -468,16 +455,16 @@ PLDHashTable::FindFreeEntry(PLDHashNumber aKeyHash) NS_ASSERTION(!(aKeyHash & kCollisionFlag), "!(aKeyHash & kCollisionFlag)"); - /* Compute the primary hash address. */ + // Compute the primary hash address. PLDHashNumber hash1 = Hash1(aKeyHash); PLDHashEntryHdr* entry = AddressEntry(hash1); - /* Miss: return space for a new entry. */ + // Miss: return space for a new entry. if (EntryIsFree(entry)) { return entry; } - /* Collision: double hash. */ + // Collision: double hash. PLDHashNumber hash2; uint32_t sizeMask; Hash2(aKeyHash, hash2, sizeMask); @@ -496,7 +483,7 @@ PLDHashTable::FindFreeEntry(PLDHashNumber aKeyHash) } } - /* NOTREACHED */ + // NOTREACHED return nullptr; } @@ -505,7 +492,7 @@ PLDHashTable::ChangeTable(int32_t aDeltaLog2) { MOZ_ASSERT(mEntryStore); - /* Look, but don't touch, until we succeed in getting new entry store. */ + // Look, but don't touch, until we succeed in getting new entry store. int32_t oldLog2 = kHashBits - mHashShift; int32_t newLog2 = oldLog2 + aDeltaLog2; uint32_t newCapacity = 1u << newLog2; @@ -523,12 +510,12 @@ PLDHashTable::ChangeTable(int32_t aDeltaLog2) return false; } - /* We can't fail from here on, so update table parameters. */ + // We can't fail from here on, so update table parameters. mHashShift = kHashBits - newLog2; mRemovedCount = 0; mGeneration++; - /* Assign the new entry store to table. */ + // Assign the new entry store to table. memset(newEntryStore, 0, nbytes); char* oldEntryStore; char* oldEntryAddr; @@ -536,7 +523,7 @@ PLDHashTable::ChangeTable(int32_t aDeltaLog2) mEntryStore = newEntryStore; PLDHashMoveEntry moveEntry = mOps->moveEntry; - /* Copy only live entries, leaving removed ones behind. */ + // Copy only live entries, leaving removed ones behind. uint32_t oldCapacity = 1u << oldLog2; for (uint32_t i = 0; i < oldCapacity; ++i) { PLDHashEntryHdr* oldEntry = (PLDHashEntryHdr*)oldEntryAddr; @@ -562,7 +549,7 @@ PLDHashTable::ComputeKeyHash(const void* aKey) PLDHashNumber keyHash = mOps->hashKey(this, aKey); keyHash *= kGoldenRatio; - /* Avoid 0 and 1 hash codes, they indicate free and removed entries. */ + // Avoid 0 and 1 hash codes, they indicate free and removed entries. if (keyHash < 2) { keyHash -= 2; } @@ -605,14 +592,12 @@ PLDHashTable::Add(const void* aKey, const mozilla::fallible_t&) memset(mEntryStore, 0, nbytes); } - /* - * If alpha is >= .75, grow or compress the table. If aKey is already - * in the table, we may grow once more than necessary, but only if we - * are on the edge of being overloaded. - */ + // If alpha is >= .75, grow or compress the table. If aKey is already in the + // table, we may grow once more than necessary, but only if we are on the + // edge of being overloaded. uint32_t capacity = Capacity(); if (mEntryCount + mRemovedCount >= MaxLoad(capacity)) { - /* Compress if a quarter or more of all entries are removed. */ + // Compress if a quarter or more of all entries are removed. int deltaLog2; if (mRemovedCount >= capacity >> 2) { deltaLog2 = 0; @@ -620,25 +605,20 @@ PLDHashTable::Add(const void* aKey, const mozilla::fallible_t&) deltaLog2 = 1; } - /* - * Grow or compress the table. If ChangeTable() fails, allow - * overloading up to the secondary max. Once we hit the secondary - * max, return null. - */ + // Grow or compress the table. If ChangeTable() fails, allow overloading up + // to the secondary max. Once we hit the secondary max, return null. if (!ChangeTable(deltaLog2) && mEntryCount + mRemovedCount >= MaxLoadOnGrowthFailure(capacity)) { return nullptr; } } - /* - * Look for entry after possibly growing, so we don't have to add it, - * then skip it while growing the table and re-add it after. - */ + // Look for entry after possibly growing, so we don't have to add it, + // then skip it while growing the table and re-add it after. PLDHashNumber keyHash = ComputeKeyHash(aKey); PLDHashEntryHdr* entry = SearchTable(aKey, keyHash); if (!EntryIsLive(entry)) { - /* Initialize the entry, indicating that it's no longer free. */ + // Initialize the entry, indicating that it's no longer free. if (EntryIsRemoved(entry)) { mRemovedCount--; keyHash |= kCollisionFlag; @@ -685,10 +665,10 @@ PLDHashTable::Remove(const void* aKey) mEntryStore ? SearchTable(aKey, ComputeKeyHash(aKey)) : nullptr; if (entry) { - /* Clear this entry and mark it as "removed". */ + // Clear this entry and mark it as "removed". RawRemove(entry); - /* Shrink if alpha is <= .25 and the table isn't too small already. */ + // Shrink if alpha is <= .25 and the table isn't too small already. uint32_t capacity = Capacity(); if (capacity > kMinCapacity && mEntryCount <= MinLoad(capacity)) { @@ -734,7 +714,7 @@ PLDHashTable::RawRemove(PLDHashEntryHdr* aEntry) NS_ASSERTION(EntryIsLive(aEntry), "EntryIsLive(aEntry)"); - /* Load keyHash first in case clearEntry() goofs it. */ + // Load keyHash first in case clearEntry() goofs it. PLDHashNumber keyHash = aEntry->mKeyHash; mOps->clearEntry(this, aEntry); if (keyHash & kCollisionFlag) { diff --git a/xpcom/glue/pldhash.h b/xpcom/glue/pldhash.h index 6adc6eeabcb0..025f5b8e0b56 100644 --- a/xpcom/glue/pldhash.h +++ b/xpcom/glue/pldhash.h @@ -6,9 +6,7 @@ #ifndef pldhash_h___ #define pldhash_h___ -/* - * Double hashing, a la Knuth 6. - */ + #include "mozilla/Atomics.h" #include "mozilla/Attributes.h" // for MOZ_ALWAYS_INLINE #include "mozilla/fallible.h" @@ -30,24 +28,22 @@ typedef uint32_t PLDHashNumber; class PLDHashTable; struct PLDHashTableOps; -/* - * Table entry header structure. - * - * In order to allow in-line allocation of key and value, we do not declare - * either here. Instead, the API uses const void *key as a formal parameter. - * The key need not be stored in the entry; it may be part of the value, but - * need not be stored at all. - * - * Callback types are defined below and grouped into the PLDHashTableOps - * structure, for single static initialization per hash table sub-type. - * - * Each hash table sub-type should make its entry type a subclass of - * PLDHashEntryHdr. The mKeyHash member contains the result of multiplying the - * hash code returned from the hashKey callback (see below) by kGoldenRatio, - * then constraining the result to avoid the magic 0 and 1 values. The stored - * mKeyHash value is table size invariant, and it is maintained automatically - * -- users need never access it. - */ +// Table entry header structure. +// +// In order to allow in-line allocation of key and value, we do not declare +// either here. Instead, the API uses const void *key as a formal parameter. +// The key need not be stored in the entry; it may be part of the value, but +// need not be stored at all. +// +// Callback types are defined below and grouped into the PLDHashTableOps +// structure, for single static initialization per hash table sub-type. +// +// Each hash table sub-type should make its entry type a subclass of +// PLDHashEntryHdr. The mKeyHash member contains the result of multiplying the +// hash code returned from the hashKey callback (see below) by kGoldenRatio, +// then constraining the result to avoid the magic 0 and 1 values. The stored +// mKeyHash value is table size invariant, and it is maintained automatically +// -- users need never access it. struct PLDHashEntryHdr { private: @@ -206,31 +202,29 @@ private: }; #endif -/* - * A PLDHashTable may be allocated on the stack or within another structure or - * class. No entry storage is allocated until the first element is added. This - * means that empty hash tables are cheap, which is good because they are - * common. - * - * There used to be a long, math-heavy comment here about the merits of - * double hashing vs. chaining; it was removed in bug 1058335. In short, double - * hashing is more space-efficient unless the element size gets large (in which - * case you should keep using double hashing but switch to using pointer - * elements). Also, with double hashing, you can't safely hold an entry pointer - * and use it after an ADD or REMOVE operation, unless you sample - * aTable->mGeneration before adding or removing, and compare the sample after, - * dereferencing the entry pointer only if aTable->mGeneration has not changed. - */ +// A PLDHashTable may be allocated on the stack or within another structure or +// class. No entry storage is allocated until the first element is added. This +// means that empty hash tables are cheap, which is good because they are +// common. +// +// There used to be a long, math-heavy comment here about the merits of +// double hashing vs. chaining; it was removed in bug 1058335. In short, double +// hashing is more space-efficient unless the element size gets large (in which +// case you should keep using double hashing but switch to using pointer +// elements). Also, with double hashing, you can't safely hold an entry pointer +// and use it after an ADD or REMOVE operation, unless you sample +// aTable->mGeneration before adding or removing, and compare the sample after, +// dereferencing the entry pointer only if aTable->mGeneration has not changed. class PLDHashTable { private: - const PLDHashTableOps* const mOps; /* Virtual operations; see below. */ - int16_t mHashShift; /* multiplicative hash shift */ - const uint32_t mEntrySize; /* number of bytes in an entry */ - uint32_t mEntryCount; /* number of entries in table */ - uint32_t mRemovedCount; /* removed entry sentinels in table */ - uint32_t mGeneration; /* entry storage generation number */ - char* mEntryStore; /* entry storage; allocated lazily */ + const PLDHashTableOps* const mOps; // Virtual operations; see below. + int16_t mHashShift; // Multiplicative hash shift. + const uint32_t mEntrySize; // Number of bytes in an entry. + uint32_t mEntryCount; // Number of entries in table. + uint32_t mRemovedCount; // Removed entry sentinels in table. + uint32_t mGeneration; // Entry storage generation number. + char* mEntryStore; // Entry storage; allocated lazily. #ifdef DEBUG mutable Checker mChecker; @@ -287,11 +281,9 @@ public: // This should be used rarely. const PLDHashTableOps* const Ops() { return mOps; } - /* - * Size in entries (gross, not net of free and removed sentinels) for table. - * This can be zero if no elements have been added yet, in which case the - * entry storage will not have yet been allocated. - */ + // Size in entries (gross, not net of free and removed sentinels) for table. + // This can be zero if no elements have been added yet, in which case the + // entry storage will not have yet been allocated. uint32_t Capacity() const { return mEntryStore ? CapacityFromHashShift() : 0; @@ -495,88 +487,74 @@ private: PLDHashTable& operator=(const PLDHashTable& aOther) = delete; }; -/* - * Compute the hash code for a given key to be looked up, added, or removed - * from aTable. A hash code may have any PLDHashNumber value. - */ +// Compute the hash code for a given key to be looked up, added, or removed +// from aTable. A hash code may have any PLDHashNumber value. typedef PLDHashNumber (*PLDHashHashKey)(PLDHashTable* aTable, const void* aKey); -/* - * Compare the key identifying aEntry in aTable with the provided key parameter. - * Return true if keys match, false otherwise. - */ +// Compare the key identifying aEntry in aTable with the provided key parameter. +// Return true if keys match, false otherwise. typedef bool (*PLDHashMatchEntry)(PLDHashTable* aTable, const PLDHashEntryHdr* aEntry, const void* aKey); -/* - * Copy the data starting at aFrom to the new entry storage at aTo. Do not add - * reference counts for any strong references in the entry, however, as this - * is a "move" operation: the old entry storage at from will be freed without - * any reference-decrementing callback shortly. - */ +// Copy the data starting at aFrom to the new entry storage at aTo. Do not add +// reference counts for any strong references in the entry, however, as this +// is a "move" operation: the old entry storage at from will be freed without +// any reference-decrementing callback shortly. typedef void (*PLDHashMoveEntry)(PLDHashTable* aTable, const PLDHashEntryHdr* aFrom, PLDHashEntryHdr* aTo); -/* - * Clear the entry and drop any strong references it holds. This callback is - * invoked by Remove(), but only if the given key is found in the table. - */ +// Clear the entry and drop any strong references it holds. This callback is +// invoked by Remove(), but only if the given key is found in the table. typedef void (*PLDHashClearEntry)(PLDHashTable* aTable, PLDHashEntryHdr* aEntry); -/* - * Initialize a new entry, apart from mKeyHash. This function is called when - * Add() finds no existing entry for the given key, and must add a new one. At - * that point, |aEntry->mKeyHash| is not set yet, to avoid claiming the last - * free entry in a severely overloaded table. - */ +// Initialize a new entry, apart from mKeyHash. This function is called when +// Add() finds no existing entry for the given key, and must add a new one. At +// that point, |aEntry->mKeyHash| is not set yet, to avoid claiming the last +// free entry in a severely overloaded table. typedef void (*PLDHashInitEntry)(PLDHashEntryHdr* aEntry, const void* aKey); -/* - * Finally, the "vtable" structure for PLDHashTable. The first four hooks - * must be provided by implementations; they're called unconditionally by the - * generic pldhash.c code. Hooks after these may be null. - * - * Summary of allocation-related hook usage with C++ placement new emphasis: - * initEntry Call placement new using default key-based ctor. - * moveEntry Call placement new using copy ctor, run dtor on old - * entry storage. - * clearEntry Run dtor on entry. - * - * Note the reason why initEntry is optional: the default hooks (stubs) clear - * entry storage: On successful Add(tbl, key), the returned entry pointer - * addresses an entry struct whose mKeyHash member has been set non-zero, but - * all other entry members are still clear (null). Add() callers can test such - * members to see whether the entry was newly created by the Add() call that - * just succeeded. If placement new or similar initialization is required, - * define an |initEntry| hook. Of course, the |clearEntry| hook must zero or - * null appropriately. - * - * XXX assumes 0 is null for pointer types. - */ +// Finally, the "vtable" structure for PLDHashTable. The first four hooks +// must be provided by implementations; they're called unconditionally by the +// generic pldhash.c code. Hooks after these may be null. +// +// Summary of allocation-related hook usage with C++ placement new emphasis: +// initEntry Call placement new using default key-based ctor. +// moveEntry Call placement new using copy ctor, run dtor on old +// entry storage. +// clearEntry Run dtor on entry. +// +// Note the reason why initEntry is optional: the default hooks (stubs) clear +// entry storage: On successful Add(tbl, key), the returned entry pointer +// addresses an entry struct whose mKeyHash member has been set non-zero, but +// all other entry members are still clear (null). Add() callers can test such +// members to see whether the entry was newly created by the Add() call that +// just succeeded. If placement new or similar initialization is required, +// define an |initEntry| hook. Of course, the |clearEntry| hook must zero or +// null appropriately. +// +// XXX assumes 0 is null for pointer types. struct PLDHashTableOps { - /* Mandatory hooks. All implementations must provide these. */ + // Mandatory hooks. All implementations must provide these. PLDHashHashKey hashKey; PLDHashMatchEntry matchEntry; PLDHashMoveEntry moveEntry; PLDHashClearEntry clearEntry; - /* Optional hooks start here. If null, these are not called. */ + // Optional hooks start here. If null, these are not called. PLDHashInitEntry initEntry; }; -/* - * Default implementations for the above mOps. - */ +// Default implementations for the above mOps. PLDHashNumber PL_DHashStringKey(PLDHashTable* aTable, const void* aKey); -/* A minimal entry is a subclass of PLDHashEntryHdr and has void key pointer. */ +// A minimal entry is a subclass of PLDHashEntryHdr and has void key pointer. struct PLDHashEntryStub : public PLDHashEntryHdr { const void* key; @@ -603,11 +581,9 @@ PL_DHashMoveEntryStub(PLDHashTable* aTable, void PL_DHashClearEntryStub(PLDHashTable* aTable, PLDHashEntryHdr* aEntry); -/* - * If you use PLDHashEntryStub or a subclass of it as your entry struct, and - * if your entries move via memcpy and clear via memset(0), you can use these - * stub operations. - */ +// If you use PLDHashEntryStub or a subclass of it as your entry struct, and +// if your entries move via memcpy and clear via memset(0), you can use these +// stub operations. const PLDHashTableOps* PL_DHashGetStubOps(void); From 6758447d5da972ebfabd5ed9e5ac54ede8fa8b93 Mon Sep 17 00:00:00 2001 From: Kyle Huey Date: Sun, 26 Jul 2015 19:29:52 -0700 Subject: [PATCH 077/136] Bug 1186780: Replace EnumerateRead with new iterators in cycle collection code. r=mccr8 --- dom/events/DataContainerEvent.cpp | 16 ++--------- dom/events/DataContainerEvent.h | 3 -- dom/xbl/nsXBLDocumentInfo.cpp | 47 ++++++++----------------------- xpcom/glue/nsBaseHashtable.h | 35 ----------------------- xpcom/glue/nsInterfaceHashtable.h | 7 ++--- xpcom/glue/nsRefPtrHashtable.h | 7 ++--- 6 files changed, 20 insertions(+), 95 deletions(-) diff --git a/dom/events/DataContainerEvent.cpp b/dom/events/DataContainerEvent.cpp index 66d10be099f0..4878f467f336 100644 --- a/dom/events/DataContainerEvent.cpp +++ b/dom/events/DataContainerEvent.cpp @@ -28,11 +28,11 @@ DataContainerEvent::DataContainerEvent(EventTarget* aOwner, NS_IMPL_CYCLE_COLLECTION_CLASS(DataContainerEvent) NS_IMPL_CYCLE_COLLECTION_UNLINK_BEGIN_INHERITED(DataContainerEvent, Event) - tmp->mData.Clear(); + NS_IMPL_CYCLE_COLLECTION_UNLINK(mData) NS_IMPL_CYCLE_COLLECTION_UNLINK_END NS_IMPL_CYCLE_COLLECTION_TRAVERSE_BEGIN_INHERITED(DataContainerEvent, Event) - tmp->mData.EnumerateRead(TraverseEntry, &cb); + NS_IMPL_CYCLE_COLLECTION_TRAVERSE(mData) NS_IMPL_CYCLE_COLLECTION_TRAVERSE_END NS_IMPL_ADDREF_INHERITED(DataContainerEvent, Event) @@ -81,18 +81,6 @@ DataContainerEvent::SetData(JSContext* aCx, const nsAString& aKey, aRv = SetData(aKey, val); } -PLDHashOperator -DataContainerEvent::TraverseEntry(const nsAString& aKey, - nsIVariant* aDataItem, - void* aUserArg) -{ - nsCycleCollectionTraversalCallback *cb = - static_cast(aUserArg); - cb->NoteXPCOMChild(aDataItem); - - return PL_DHASH_NEXT; -} - } // namespace dom } // namespace mozilla diff --git a/dom/events/DataContainerEvent.h b/dom/events/DataContainerEvent.h index 51cbe2bcb4c5..15acfeb44b7d 100644 --- a/dom/events/DataContainerEvent.h +++ b/dom/events/DataContainerEvent.h @@ -51,9 +51,6 @@ protected: ~DataContainerEvent() {} private: - static PLDHashOperator - TraverseEntry(const nsAString& aKey, nsIVariant* aDataItem, void* aUserArg); - nsInterfaceHashtable mData; }; diff --git a/dom/xbl/nsXBLDocumentInfo.cpp b/dom/xbl/nsXBLDocumentInfo.cpp index 645b1f9ea17e..f9560350416e 100644 --- a/dom/xbl/nsXBLDocumentInfo.cpp +++ b/dom/xbl/nsXBLDocumentInfo.cpp @@ -39,42 +39,14 @@ using namespace mozilla::dom; static const char kXBLCachePrefix[] = "xblcache"; /* Implementation file */ - -static PLDHashOperator -TraverseProtos(const nsACString &aKey, nsXBLPrototypeBinding *aProto, void* aClosure) -{ - nsCycleCollectionTraversalCallback *cb = - static_cast(aClosure); - aProto->Traverse(*cb); - return PL_DHASH_NEXT; -} - -static PLDHashOperator -UnlinkProto(const nsACString &aKey, nsXBLPrototypeBinding *aProto, void* aClosure) -{ - aProto->Unlink(); - return PL_DHASH_NEXT; -} - -struct ProtoTracer -{ - const TraceCallbacks &mCallbacks; - void *mClosure; -}; - -static PLDHashOperator -TraceProtos(const nsACString &aKey, nsXBLPrototypeBinding *aProto, void* aClosure) -{ - ProtoTracer* closure = static_cast(aClosure); - aProto->Trace(closure->mCallbacks, closure->mClosure); - return PL_DHASH_NEXT; -} - NS_IMPL_CYCLE_COLLECTION_CLASS(nsXBLDocumentInfo) NS_IMPL_CYCLE_COLLECTION_UNLINK_BEGIN(nsXBLDocumentInfo) if (tmp->mBindingTable) { - tmp->mBindingTable->EnumerateRead(UnlinkProto, nullptr); + for (auto iter = tmp->mBindingTable->ConstIter(); + !iter.Done(); iter.Next()) { + iter.UserData()->Unlink(); + } } NS_IMPL_CYCLE_COLLECTION_UNLINK(mDocument) NS_IMPL_CYCLE_COLLECTION_UNLINK_END @@ -86,14 +58,19 @@ NS_IMPL_CYCLE_COLLECTION_TRAVERSE_BEGIN(nsXBLDocumentInfo) } NS_IMPL_CYCLE_COLLECTION_TRAVERSE(mDocument) if (tmp->mBindingTable) { - tmp->mBindingTable->EnumerateRead(TraverseProtos, &cb); + for (auto iter = tmp->mBindingTable->ConstIter(); + !iter.Done(); iter.Next()) { + iter.UserData()->Traverse(cb); + } } NS_IMPL_CYCLE_COLLECTION_TRAVERSE_SCRIPT_OBJECTS NS_IMPL_CYCLE_COLLECTION_TRAVERSE_END NS_IMPL_CYCLE_COLLECTION_TRACE_BEGIN(nsXBLDocumentInfo) if (tmp->mBindingTable) { - ProtoTracer closure = { aCallbacks, aClosure }; - tmp->mBindingTable->EnumerateRead(TraceProtos, &closure); + for (auto iter = tmp->mBindingTable->ConstIter(); + !iter.Done(); iter.Next()) { + iter.UserData()->Trace(aCallbacks, aClosure); + } } NS_IMPL_CYCLE_COLLECTION_TRACE_END diff --git a/xpcom/glue/nsBaseHashtable.h b/xpcom/glue/nsBaseHashtable.h index eef5b386b03e..50658f5d62ce 100644 --- a/xpcom/glue/nsBaseHashtable.h +++ b/xpcom/glue/nsBaseHashtable.h @@ -343,41 +343,6 @@ protected: void* aArg); }; -class nsCycleCollectionTraversalCallback; - -struct MOZ_STACK_CLASS nsBaseHashtableCCTraversalData -{ - nsBaseHashtableCCTraversalData(nsCycleCollectionTraversalCallback& aCallback, - const char* aName, - uint32_t aFlags) - : mCallback(aCallback) - , mName(aName) - , mFlags(aFlags) - { - } - - nsCycleCollectionTraversalCallback& mCallback; - const char* mName; - uint32_t mFlags; - -}; - -template -PLDHashOperator -ImplCycleCollectionTraverse_EnumFunc(K aKey, - T aData, - void* aUserData) -{ - nsBaseHashtableCCTraversalData* userData = - static_cast(aUserData); - - CycleCollectionNoteChild(userData->mCallback, - aData, - userData->mName, - userData->mFlags); - return PL_DHASH_NEXT; -} - // // nsBaseHashtableET definitions // diff --git a/xpcom/glue/nsInterfaceHashtable.h b/xpcom/glue/nsInterfaceHashtable.h index ee803bce67ad..14368af63764 100644 --- a/xpcom/glue/nsInterfaceHashtable.h +++ b/xpcom/glue/nsInterfaceHashtable.h @@ -69,10 +69,9 @@ ImplCycleCollectionTraverse(nsCycleCollectionTraversalCallback& aCallback, const char* aName, uint32_t aFlags = 0) { - nsBaseHashtableCCTraversalData userData(aCallback, aName, aFlags); - - aField.EnumerateRead(ImplCycleCollectionTraverse_EnumFunc, - &userData); + for (auto iter = aField.ConstIter(); !iter.Done(); iter.Next()) { + CycleCollectionNoteChild(aCallback, iter.UserData(), aName, aFlags); + } } // diff --git a/xpcom/glue/nsRefPtrHashtable.h b/xpcom/glue/nsRefPtrHashtable.h index be9777d90650..e49274ae53c1 100644 --- a/xpcom/glue/nsRefPtrHashtable.h +++ b/xpcom/glue/nsRefPtrHashtable.h @@ -84,10 +84,9 @@ ImplCycleCollectionTraverse(nsCycleCollectionTraversalCallback& aCallback, const char* aName, uint32_t aFlags = 0) { - nsBaseHashtableCCTraversalData userData(aCallback, aName, aFlags); - - aField.EnumerateRead(ImplCycleCollectionTraverse_EnumFunc, - &userData); + for (auto iter = aField.ConstIter(); !iter.Done(); iter.Next()) { + CycleCollectionNoteChild(aCallback, iter.UserData(), aName, aFlags); + } } // From c86c02163eb12ca029c49aa4f0f485dc7150cdde Mon Sep 17 00:00:00 2001 From: Kyle Huey Date: Sun, 26 Jul 2015 19:34:29 -0700 Subject: [PATCH 078/136] Bug 1186780: Replace EnumerateRead with new iterators in some DOM code. r=bkelly --- dom/base/nsDocument.cpp | 343 ++++++++++------------------- dom/base/nsDocument.h | 2 + dom/base/nsFrameMessageManager.cpp | 187 ++++++---------- dom/xbl/nsXBLDocumentInfo.cpp | 11 +- 4 files changed, 195 insertions(+), 348 deletions(-) diff --git a/dom/base/nsDocument.cpp b/dom/base/nsDocument.cpp index 10c1abc0825a..01e4ae1756c6 100644 --- a/dom/base/nsDocument.cpp +++ b/dom/base/nsDocument.cpp @@ -336,86 +336,55 @@ const nsIID nsIStyleRule::COMTypeInfo::kIID = NS_ISTYLE_RULE_II namespace mozilla { namespace dom { -static PLDHashOperator -CustomDefinitionsTraverse(CustomElementHashKey* aKey, - CustomElementDefinition* aDefinition, - void* aArg) -{ - nsCycleCollectionTraversalCallback* cb = - static_cast(aArg); - - nsAutoPtr& callbacks = aDefinition->mCallbacks; - - if (callbacks->mAttributeChangedCallback.WasPassed()) { - NS_CYCLE_COLLECTION_NOTE_EDGE_NAME(*cb, - "mCustomDefinitions->mCallbacks->mAttributeChangedCallback"); - cb->NoteXPCOMChild(aDefinition->mCallbacks->mAttributeChangedCallback.Value()); - } - - if (callbacks->mCreatedCallback.WasPassed()) { - NS_CYCLE_COLLECTION_NOTE_EDGE_NAME(*cb, - "mCustomDefinitions->mCallbacks->mCreatedCallback"); - cb->NoteXPCOMChild(aDefinition->mCallbacks->mCreatedCallback.Value()); - } - - if (callbacks->mAttachedCallback.WasPassed()) { - NS_CYCLE_COLLECTION_NOTE_EDGE_NAME(*cb, - "mCustomDefinitions->mCallbacks->mAttachedCallback"); - cb->NoteXPCOMChild(aDefinition->mCallbacks->mAttachedCallback.Value()); - } - - if (callbacks->mDetachedCallback.WasPassed()) { - NS_CYCLE_COLLECTION_NOTE_EDGE_NAME(*cb, - "mCustomDefinitions->mCallbacks->mDetachedCallback"); - cb->NoteXPCOMChild(aDefinition->mCallbacks->mDetachedCallback.Value()); - } - - return PL_DHASH_NEXT; -} - -static PLDHashOperator -CandidatesTraverse(CustomElementHashKey* aKey, - nsTArray>* aData, - void* aArg) -{ - nsCycleCollectionTraversalCallback *cb = - static_cast(aArg); - for (size_t i = 0; i < aData->Length(); ++i) { - NS_CYCLE_COLLECTION_NOTE_EDGE_NAME(*cb, "mCandidatesMap->Element"); - cb->NoteXPCOMChild(aData->ElementAt(i)); - } - return PL_DHASH_NEXT; -} - -struct CustomDefinitionTraceArgs -{ - const TraceCallbacks& callbacks; - void* closure; -}; - -static PLDHashOperator -CustomDefinitionTrace(CustomElementHashKey *aKey, - CustomElementDefinition *aData, - void *aArg) -{ - CustomDefinitionTraceArgs* traceArgs = static_cast(aArg); - MOZ_ASSERT(aData, "Definition must not be null"); - traceArgs->callbacks.Trace(&aData->mPrototype, "mCustomDefinitions prototype", - traceArgs->closure); - return PL_DHASH_NEXT; -} - NS_IMPL_CYCLE_COLLECTION_CLASS(Registry) NS_IMPL_CYCLE_COLLECTION_TRACE_BEGIN(Registry) - CustomDefinitionTraceArgs customDefinitionArgs = { aCallbacks, aClosure }; - tmp->mCustomDefinitions.EnumerateRead(CustomDefinitionTrace, - &customDefinitionArgs); + for (auto iter = tmp->mCustomDefinitions.ConstIter(); !iter.Done(); + iter.Next()) { + aCallbacks.Trace(&iter.UserData()->mPrototype, + "mCustomDefinitions prototype", + aClosure); + } NS_IMPL_CYCLE_COLLECTION_TRACE_END NS_IMPL_CYCLE_COLLECTION_TRAVERSE_BEGIN(Registry) - tmp->mCustomDefinitions.EnumerateRead(CustomDefinitionsTraverse, &cb); - tmp->mCandidatesMap.EnumerateRead(CandidatesTraverse, &cb); + for (auto iter = tmp->mCustomDefinitions.ConstIter(); !iter.Done(); + iter.Next()) { + CustomElementDefinition* definition = iter.UserData(); + auto callbacks = definition->mCallbacks; + + if (callbacks->mAttributeChangedCallback.WasPassed()) { + NS_CYCLE_COLLECTION_NOTE_EDGE_NAME(cb, + "mCustomDefinitions->mCallbacks->mAttributeChangedCallback"); + cb.NoteXPCOMChild(callbacks->mAttributeChangedCallback.Value()); + } + + if (callbacks->mCreatedCallback.WasPassed()) { + NS_CYCLE_COLLECTION_NOTE_EDGE_NAME(cb, + "mCustomDefinitions->mCallbacks->mCreatedCallback"); + cb.NoteXPCOMChild(callbacks->mCreatedCallback.Value()); + } + + if (callbacks->mAttachedCallback.WasPassed()) { + NS_CYCLE_COLLECTION_NOTE_EDGE_NAME(cb, + "mCustomDefinitions->mCallbacks->mAttachedCallback"); + cb.NoteXPCOMChild(callbacks->mAttachedCallback.Value()); + } + + if (callbacks->mDetachedCallback.WasPassed()) { + NS_CYCLE_COLLECTION_NOTE_EDGE_NAME(cb, + "mCustomDefinitions->mCallbacks->mDetachedCallback"); + cb.NoteXPCOMChild(callbacks->mDetachedCallback.Value()); + } + } + + for (auto iter = tmp->mCandidatesMap.ConstIter(); !iter.Done(); iter.Next()) { + auto data = iter.UserData(); + for (size_t i = 0; i < data->Length(); ++i) { + NS_CYCLE_COLLECTION_NOTE_EDGE_NAME(cb, "mCandidatesMap->Element"); + cb.NoteXPCOMChild(data->ElementAt(i)); + } + } NS_IMPL_CYCLE_COLLECTION_TRAVERSE_SCRIPT_OBJECTS NS_IMPL_CYCLE_COLLECTION_TRAVERSE_END @@ -942,99 +911,60 @@ nsExternalResourceMap::RequestResource(nsIURI* aURI, return nullptr; } -struct -nsExternalResourceEnumArgs -{ - nsIDocument::nsSubDocEnumFunc callback; - void *data; -}; - -static PLDHashOperator -ExternalResourceEnumerator(nsIURI* aKey, - nsExternalResourceMap::ExternalResource* aData, - void* aClosure) -{ - nsExternalResourceEnumArgs* args = - static_cast(aClosure); - bool next = - aData->mDocument ? args->callback(aData->mDocument, args->data) : true; - return next ? PL_DHASH_NEXT : PL_DHASH_STOP; -} - void nsExternalResourceMap::EnumerateResources(nsIDocument::nsSubDocEnumFunc aCallback, void* aData) { - nsExternalResourceEnumArgs args = { aCallback, aData }; - mMap.EnumerateRead(ExternalResourceEnumerator, &args); -} - -static PLDHashOperator -ExternalResourceTraverser(nsIURI* aKey, - nsExternalResourceMap::ExternalResource* aData, - void* aClosure) -{ - nsCycleCollectionTraversalCallback *cb = - static_cast(aClosure); - - NS_CYCLE_COLLECTION_NOTE_EDGE_NAME(*cb, - "mExternalResourceMap.mMap entry" - "->mDocument"); - cb->NoteXPCOMChild(aData->mDocument); - - NS_CYCLE_COLLECTION_NOTE_EDGE_NAME(*cb, - "mExternalResourceMap.mMap entry" - "->mViewer"); - cb->NoteXPCOMChild(aData->mViewer); - - NS_CYCLE_COLLECTION_NOTE_EDGE_NAME(*cb, - "mExternalResourceMap.mMap entry" - "->mLoadGroup"); - cb->NoteXPCOMChild(aData->mLoadGroup); - - return PL_DHASH_NEXT; + for (auto iter = mMap.ConstIter(); !iter.Done(); iter.Next()) { + auto data = iter.UserData(); + if (data->mDocument && !aCallback(data->mDocument, aData)) { + break; + } + } } void -nsExternalResourceMap::Traverse(nsCycleCollectionTraversalCallback* aCallback) const +nsExternalResourceMap::Traverse(nsCycleCollectionTraversalCallback* cb) const { // mPendingLoads will get cleared out as the requests complete, so // no need to worry about those here. - mMap.EnumerateRead(ExternalResourceTraverser, aCallback); -} + for (auto iter = mMap.ConstIter(); !iter.Done(); iter.Next()) { + auto data = iter.UserData(); + NS_CYCLE_COLLECTION_NOTE_EDGE_NAME(*cb, + "mExternalResourceMap.mMap entry" + "->mDocument"); + cb->NoteXPCOMChild(data->mDocument); -static PLDHashOperator -ExternalResourceHider(nsIURI* aKey, - nsExternalResourceMap::ExternalResource* aData, - void* aClosure) -{ - if (aData->mViewer) { - aData->mViewer->Hide(); + NS_CYCLE_COLLECTION_NOTE_EDGE_NAME(*cb, + "mExternalResourceMap.mMap entry" + "->mViewer"); + cb->NoteXPCOMChild(data->mViewer); + + NS_CYCLE_COLLECTION_NOTE_EDGE_NAME(*cb, + "mExternalResourceMap.mMap entry" + "->mLoadGroup"); + cb->NoteXPCOMChild(data->mLoadGroup); } - return PL_DHASH_NEXT; } void nsExternalResourceMap::HideViewers() { - mMap.EnumerateRead(ExternalResourceHider, nullptr); -} - -static PLDHashOperator -ExternalResourceShower(nsIURI* aKey, - nsExternalResourceMap::ExternalResource* aData, - void* aClosure) -{ - if (aData->mViewer) { - aData->mViewer->Show(); + for (auto iter = mMap.ConstIter(); !iter.Done(); iter.Next()) { + if (auto viewer = iter.UserData()->mViewer) { + viewer->Hide(); + } } - return PL_DHASH_NEXT; } void nsExternalResourceMap::ShowViewers() { - mMap.EnumerateRead(ExternalResourceShower, nullptr); + for (auto iter = mMap.ConstIter(); !iter.Done(); iter.Next()) { + if (auto viewer = iter.UserData()->mViewer) { + viewer->Show(); + } + } } void @@ -1603,15 +1533,6 @@ nsDocument::nsDocument(const char* aContentType) } } -static PLDHashOperator -ClearAllBoxObjects(nsIContent* aKey, nsPIBoxObject* aBoxObject, void* aUserArg) -{ - if (aBoxObject) { - aBoxObject->Clear(); - } - return PL_DHASH_NEXT; -} - nsIDocument::~nsIDocument() { MOZ_ASSERT(PR_CLIST_IS_EMPTY(&mDOMMediaQueryLists), @@ -1752,10 +1673,7 @@ nsDocument::~nsDocument() delete mHeaderData; - if (mBoxObjectTable) { - mBoxObjectTable->EnumerateRead(ClearAllBoxObjects, nullptr); - delete mBoxObjectTable; - } + MaybeClearBoxObjectTable(); mPendingTitleChangeEvent.Revoke(); @@ -1866,18 +1784,6 @@ RadioGroupsTraverser(const nsAString& aKey, nsRadioGroupStruct* aData, return PL_DHASH_NEXT; } -static PLDHashOperator -BoxObjectTraverser(nsIContent* key, nsPIBoxObject* boxObject, void* userArg) -{ - nsCycleCollectionTraversalCallback *cb = - static_cast(userArg); - - NS_CYCLE_COLLECTION_NOTE_EDGE_NAME(*cb, "mBoxObjectTable entry"); - cb->NoteXPCOMChild(boxObject); - - return PL_DHASH_NEXT; -} - static const char* kNSURIs[] = { "([none])", "(xmlns)", @@ -1959,7 +1865,11 @@ NS_IMPL_CYCLE_COLLECTION_TRAVERSE_BEGIN_INTERNAL(nsDocument) // The boxobject for an element will only exist as long as it's in the // document, so we'll traverse the table here instead of from the element. if (tmp->mBoxObjectTable) { - tmp->mBoxObjectTable->EnumerateRead(BoxObjectTraverser, &cb); + for (auto iter = tmp->mBoxObjectTable->ConstIter(); !iter.Done(); + iter.Next()) { + NS_CYCLE_COLLECTION_NOTE_EDGE_NAME(cb, "mBoxObjectTable entry"); + cb.NoteXPCOMChild(iter.UserData()); + } } NS_IMPL_CYCLE_COLLECTION_TRAVERSE(mChannel) @@ -2078,12 +1988,7 @@ NS_IMPL_CYCLE_COLLECTION_UNLINK_BEGIN(nsDocument) NS_IMPL_CYCLE_COLLECTION_UNLINK(mPreloadingImages) - - if (tmp->mBoxObjectTable) { - tmp->mBoxObjectTable->EnumerateRead(ClearAllBoxObjects, nullptr); - delete tmp->mBoxObjectTable; - tmp->mBoxObjectTable = nullptr; - } + tmp->MaybeClearBoxObjectTable(); if (tmp->mListenerManager) { tmp->mListenerManager->Disconnect(); @@ -3851,6 +3756,23 @@ nsDocument::MaybeRescheduleAnimationFrameNotifications() } } +void +nsDocument::MaybeClearBoxObjectTable() +{ + if (!mBoxObjectTable) { + return; + } + + for (auto iter = mBoxObjectTable->ConstIter(); !iter.Done(); iter.Next()) { + if (auto boxObject = iter.UserData()) { + boxObject->Clear(); + } + } + + delete mBoxObjectTable; + mBoxObjectTable = nullptr; +} + void nsIDocument::TakeFrameRequestCallbacks(FrameRequestCallbackList& aCallbacks) { @@ -3899,14 +3821,6 @@ nsIDocument::ShouldThrottleFrameRequests() return false; } -PLDHashOperator RequestDiscardEnumerator(imgIRequest* aKey, - uint32_t aData, - void* userArg) -{ - aKey->RequestDiscard(); - return PL_DHASH_NEXT; -} - void nsDocument::DeleteShell() { @@ -3921,7 +3835,9 @@ nsDocument::DeleteShell() // When our shell goes away, request that all our images be immediately // discarded, so we don't carry around decoded image data for a document we // no longer intend to paint. - mImageTracker.EnumerateRead(RequestDiscardEnumerator, nullptr); + for (auto iter = mImageTracker.ConstIter(); !iter.Done(); iter.Next()) { + iter.Key()->RequestDiscard(); + } // Now that we no longer have a shell, we need to forget about any FontFace // objects for @font-face rules that came from the style set. @@ -10629,24 +10545,6 @@ nsDocument::NotifyMediaFeatureValuesChanged() } } -PLDHashOperator LockEnumerator(imgIRequest* aKey, - uint32_t aData, - void* userArg) -{ - aKey->LockImage(); - aKey->RequestDecode(); - return PL_DHASH_NEXT; -} - -PLDHashOperator UnlockEnumerator(imgIRequest* aKey, - uint32_t aData, - void* userArg) -{ - aKey->UnlockImage(); - return PL_DHASH_NEXT; -} - - nsresult nsDocument::SetImageLockingState(bool aLocked) { @@ -10660,9 +10558,15 @@ nsDocument::SetImageLockingState(bool aLocked) return NS_OK; // Otherwise, iterate over our images and perform the appropriate action. - mImageTracker.EnumerateRead(aLocked ? LockEnumerator - : UnlockEnumerator, - nullptr); + for (auto iter = mImageTracker.ConstIter(); !iter.Done(); iter.Next()) { + imgIRequest* image = iter.Key(); + if (aLocked) { + image->LockImage(); + image->RequestDecode(); + } else { + image->UnlockImage(); + } + } // Update state. mLockingImages = aLocked; @@ -10670,22 +10574,6 @@ nsDocument::SetImageLockingState(bool aLocked) return NS_OK; } -PLDHashOperator IncrementAnimationEnumerator(imgIRequest* aKey, - uint32_t aData, - void* userArg) -{ - aKey->IncrementAnimationConsumers(); - return PL_DHASH_NEXT; -} - -PLDHashOperator DecrementAnimationEnumerator(imgIRequest* aKey, - uint32_t aData, - void* userArg) -{ - aKey->DecrementAnimationConsumers(); - return PL_DHASH_NEXT; -} - void nsDocument::SetImagesNeedAnimating(bool aAnimating) { @@ -10694,9 +10582,14 @@ nsDocument::SetImagesNeedAnimating(bool aAnimating) return; // Otherwise, iterate over our images and perform the appropriate action. - mImageTracker.EnumerateRead(aAnimating ? IncrementAnimationEnumerator - : DecrementAnimationEnumerator, - nullptr); + for (auto iter = mImageTracker.ConstIter(); !iter.Done(); iter.Next()) { + imgIRequest* image = iter.Key(); + if (aAnimating) { + image->IncrementAnimationConsumers(); + } else { + image->DecrementAnimationConsumers(); + } + } // Update state. mAnimatingImages = aAnimating; diff --git a/dom/base/nsDocument.h b/dom/base/nsDocument.h index 1e64d95be47b..38eaf716e85b 100644 --- a/dom/base/nsDocument.h +++ b/dom/base/nsDocument.h @@ -1737,6 +1737,8 @@ private: // requestAnimationFrame, if it's OK to do so. void MaybeRescheduleAnimationFrameNotifications(); + void MaybeClearBoxObjectTable(); + // These are not implemented and not supported. nsDocument(const nsDocument& aOther); nsDocument& operator=(const nsDocument& aOther); diff --git a/dom/base/nsFrameMessageManager.cpp b/dom/base/nsFrameMessageManager.cpp index 9d33b8d3ffeb..3444c4ffa3bb 100644 --- a/dom/base/nsFrameMessageManager.cpp +++ b/dom/base/nsFrameMessageManager.cpp @@ -120,26 +120,18 @@ nsFrameMessageManager::~nsFrameMessageManager() } } -static PLDHashOperator -CycleCollectorTraverseListeners(const nsAString& aKey, - nsAutoTObserverArray* aListeners, - void* aCb) -{ - nsCycleCollectionTraversalCallback* cb = - static_cast (aCb); - uint32_t count = aListeners->Length(); - for (uint32_t i = 0; i < count; ++i) { - NS_CYCLE_COLLECTION_NOTE_EDGE_NAME(*cb, "listeners[i] mStrongListener"); - cb->NoteXPCOMChild(aListeners->ElementAt(i).mStrongListener.get()); - } - return PL_DHASH_NEXT; -} - NS_IMPL_CYCLE_COLLECTION_CLASS(nsFrameMessageManager) NS_IMPL_CYCLE_COLLECTION_TRAVERSE_BEGIN(nsFrameMessageManager) - tmp->mListeners.EnumerateRead(CycleCollectorTraverseListeners, - static_cast(&cb)); + for (auto iter = tmp->mListeners.ConstIter(); !iter.Done(); iter.Next()) { + auto listeners = iter.UserData(); + const uint32_t count = listeners->Length(); + + for (uint32_t i = 0; i < count; ++i) { + NS_CYCLE_COLLECTION_NOTE_EDGE_NAME(cb, "listeners[i] mStrongListener"); + cb.NoteXPCOMChild(listeners->ElementAt(i).mStrongListener.get()); + } + } NS_IMPL_CYCLE_COLLECTION_TRAVERSE(mChildManagers) NS_IMPL_CYCLE_COLLECTION_TRAVERSE(mParentManager) NS_IMPL_CYCLE_COLLECTION_TRAVERSE_SCRIPT_OBJECTS @@ -415,35 +407,6 @@ nsFrameMessageManager::RemoveMessageListener(const nsAString& aMessage, return NS_OK; } -#ifdef DEBUG -typedef struct -{ - nsCOMPtr mCanonical; - nsWeakPtr mWeak; -} CanonicalCheckerParams; - -static PLDHashOperator -CanonicalChecker(const nsAString& aKey, - nsAutoTObserverArray* aListeners, - void* aParams) -{ - CanonicalCheckerParams* params = - static_cast (aParams); - - uint32_t count = aListeners->Length(); - for (uint32_t i = 0; i < count; i++) { - if (!aListeners->ElementAt(i).mWeakListener) { - continue; - } - nsCOMPtr otherCanonical = - do_QueryReferent(aListeners->ElementAt(i).mWeakListener); - MOZ_ASSERT((params->mCanonical == otherCanonical) == - (params->mWeak == aListeners->ElementAt(i).mWeakListener)); - } - return PL_DHASH_NEXT; -} -#endif - NS_IMETHODIMP nsFrameMessageManager::AddWeakMessageListener(const nsAString& aMessage, nsIMessageListener* aListener) @@ -452,15 +415,24 @@ nsFrameMessageManager::AddWeakMessageListener(const nsAString& aMessage, NS_ENSURE_TRUE(weak, NS_ERROR_NO_INTERFACE); #ifdef DEBUG - // It's technically possible that one object X could give two different - // nsIWeakReference*'s when you do_GetWeakReference(X). We really don't want - // this to happen; it will break e.g. RemoveWeakMessageListener. So let's - // check that we're not getting ourselves into that situation. - nsCOMPtr canonical = do_QueryInterface(aListener); - CanonicalCheckerParams params; - params.mCanonical = canonical; - params.mWeak = weak; - mListeners.EnumerateRead(CanonicalChecker, (void*)¶ms); + { + // It's technically possible that one object X could give two different + // nsIWeakReference*'s when you do_GetWeakReference(X). We really don't + // want this to happen; it will break e.g. RemoveWeakMessageListener. So + // let's check that we're not getting ourselves into that situation. + nsCOMPtr canonical = do_QueryInterface(aListener); + + for (auto iter = mListeners.ConstIter(); !iter.Done(); iter.Next()) { + auto listeners = iter.UserData(); + const uint32_t count = listeners->Length(); + for (uint32_t i = 0; i < count; i++) { + if (auto listener = listeners->ElementAt(i).mWeakListener) { + nsCOMPtr otherCanonical = do_QueryReferent(listener); + MOZ_ASSERT((canonical == otherCanonical) == (weak == listener)); + } + } + } + } #endif nsAutoTObserverArray* listeners = @@ -1472,55 +1444,45 @@ protected: NS_IMPL_ISUPPORTS(MessageManagerReporter, nsIMemoryReporter) -static PLDHashOperator -CollectMessageListenerData(const nsAString& aKey, - nsAutoTObserverArray* aListeners, - void* aData) -{ - MessageManagerReferentCount* referentCount = - static_cast(aData); - - uint32_t listenerCount = aListeners->Length(); - if (!listenerCount) { - return PL_DHASH_NEXT; - } - - nsString key(aKey); - uint32_t oldCount = 0; - referentCount->mMessageCounter.Get(key, &oldCount); - uint32_t currentCount = oldCount + listenerCount; - referentCount->mMessageCounter.Put(key, currentCount); - - // Keep track of messages that have a suspiciously large - // number of referents (symptom of leak). - if (currentCount == MessageManagerReporter::kSuspectReferentCount) { - referentCount->mSuspectMessages.AppendElement(key); - } - - for (uint32_t i = 0; i < listenerCount; ++i) { - const nsMessageListenerInfo& listenerInfo = - aListeners->ElementAt(i); - if (listenerInfo.mWeakListener) { - nsCOMPtr referent = - do_QueryReferent(listenerInfo.mWeakListener); - if (referent) { - referentCount->mWeakAlive++; - } else { - referentCount->mWeakDead++; - } - } else { - referentCount->mStrong++; - } - } - return PL_DHASH_NEXT; -} - void MessageManagerReporter::CountReferents(nsFrameMessageManager* aMessageManager, MessageManagerReferentCount* aReferentCount) { - aMessageManager->mListeners.EnumerateRead(CollectMessageListenerData, - aReferentCount); + for (auto iter = aMessageManager->mListeners.ConstIter(); + !iter.Done(); iter.Next()) { + auto listeners = iter.UserData(); + const uint32_t listenerCount = listeners->Length(); + if (!listenerCount) { + continue; + } + + nsString key(iter.Key()); + uint32_t oldCount = 0; + aReferentCount->mMessageCounter.Get(key, &oldCount); + uint32_t currentCount = oldCount + listenerCount; + aReferentCount->mMessageCounter.Put(key, currentCount); + + // Keep track of messages that have a suspiciously large + // number of referents (symptom of leak). + if (currentCount == MessageManagerReporter::kSuspectReferentCount) { + aReferentCount->mSuspectMessages.AppendElement(key); + } + + for (uint32_t i = 0; i < listenerCount; ++i) { + const nsMessageListenerInfo& listenerInfo = listeners->ElementAt(i); + if (listenerInfo.mWeakListener) { + nsCOMPtr referent = + do_QueryReferent(listenerInfo.mWeakListener); + if (referent) { + aReferentCount->mWeakAlive++; + } else { + aReferentCount->mWeakDead++; + } + } else { + aReferentCount->mStrong++; + } + } + } // Add referent count in child managers because the listeners // participate in messages dispatched from parent message manager. @@ -2167,24 +2129,19 @@ NS_NewChildProcessMessageManager(nsISyncMessageSender** aResult) } -static PLDHashOperator -CycleCollectorMarkListeners(const nsAString& aKey, - nsAutoTObserverArray* aListeners, - void* aData) -{ - uint32_t count = aListeners->Length(); - for (uint32_t i = 0; i < count; i++) { - if (aListeners->ElementAt(i).mStrongListener) { - xpc_TryUnmarkWrappedGrayObject(aListeners->ElementAt(i).mStrongListener); - } - } - return PL_DHASH_NEXT; -} - bool nsFrameMessageManager::MarkForCC() { - mListeners.EnumerateRead(CycleCollectorMarkListeners, nullptr); + for (auto iter = mListeners.ConstIter(); !iter.Done(); iter.Next()) { + auto listeners = iter.UserData(); + const uint32_t count = listeners->Length(); + + for (uint32_t i = 0; i < count; i++) { + if (auto listener = listeners->ElementAt(i).mStrongListener) { + xpc_TryUnmarkWrappedGrayObject(listener); + } + } + } if (mRefCnt.IsPurple()) { mRefCnt.RemovePurple(); diff --git a/dom/xbl/nsXBLDocumentInfo.cpp b/dom/xbl/nsXBLDocumentInfo.cpp index f9560350416e..daf9f544ab2d 100644 --- a/dom/xbl/nsXBLDocumentInfo.cpp +++ b/dom/xbl/nsXBLDocumentInfo.cpp @@ -316,18 +316,13 @@ nsXBLDocumentInfo::SetFirstPrototypeBinding(nsXBLPrototypeBinding* aBinding) mFirstBinding = aBinding; } -static PLDHashOperator -FlushScopedSkinSheets(const nsACString &aKey, nsXBLPrototypeBinding *aProto, void* aClosure) -{ - aProto->FlushSkinSheets(); - return PL_DHASH_NEXT; -} - void nsXBLDocumentInfo::FlushSkinStylesheets() { if (mBindingTable) { - mBindingTable->EnumerateRead(FlushScopedSkinSheets, nullptr); + for (auto iter = mBindingTable->ConstIter(); !iter.Done(); iter.Next()) { + iter.UserData()->FlushSkinSheets(); + } } } From 4b4ac7d1cb4a26be1c33688e650885ec629935a7 Mon Sep 17 00:00:00 2001 From: Makoto Kato Date: Mon, 27 Jul 2015 12:34:27 +0900 Subject: [PATCH 079/136] Bug 1187155 - Remove sphelper.h dependency to avoid ATL. r=jimm --- .../webspeech/synth/windows/SapiService.cpp | 28 +++++++++++++------ 1 file changed, 19 insertions(+), 9 deletions(-) diff --git a/dom/media/webspeech/synth/windows/SapiService.cpp b/dom/media/webspeech/synth/windows/SapiService.cpp index f8753427845b..15d4fc095dd4 100644 --- a/dom/media/webspeech/synth/windows/SapiService.cpp +++ b/dom/media/webspeech/synth/windows/SapiService.cpp @@ -13,8 +13,6 @@ #include "mozilla/dom/nsSpeechTask.h" #include "mozilla/Preferences.h" -#include - namespace mozilla { namespace dom { @@ -226,9 +224,19 @@ SapiService::RegisterVoices() return false; } + nsRefPtr category; + if (FAILED(CoCreateInstance(CLSID_SpObjectTokenCategory, nullptr, CLSCTX_ALL, + IID_ISpObjectTokenCategory, + getter_AddRefs(category)))) { + return false; + } + if (FAILED(category->SetId(SPCAT_VOICES, FALSE))) { + return false; + } + nsRefPtr voiceTokens; - if (FAILED(SpEnumTokens(SPCAT_VOICES, nullptr, nullptr, - getter_AddRefs(voiceTokens)))) { + if (FAILED(category->EnumTokens(nullptr, nullptr, + getter_AddRefs(voiceTokens)))) { return false; } @@ -238,11 +246,6 @@ SapiService::RegisterVoices() break; } - WCHAR* description = nullptr; - if (FAILED(SpGetDescription(voiceToken, &description))) { - continue; - } - nsRefPtr attributes; if (FAILED(voiceToken->OpenKey(L"Attributes", getter_AddRefs(attributes)))) { @@ -258,9 +261,15 @@ SapiService::RegisterVoices() // name. nsAutoString hexLcid; LCID lcid = wcstol(language, nullptr, 16); + CoTaskMemFree(language); nsAutoString locale; nsWin32Locale::GetXPLocale(lcid, locale); + WCHAR* description = nullptr; + if (FAILED(voiceToken->GetStringValue(nullptr, &description))) { + continue; + } + nsAutoString uri; uri.AssignLiteral("urn:moz-tts:sapi:"); uri.Append(description); @@ -269,6 +278,7 @@ SapiService::RegisterVoices() rv = registry->AddVoice(this, uri, nsDependentString(description), locale, true); + CoTaskMemFree(description); if (NS_FAILED(rv)) { continue; } From 76c380be232b5d1d1ca6d521e16491974ae583cd Mon Sep 17 00:00:00 2001 From: Jeremy Chen Date: Mon, 27 Jul 2015 11:56:04 +0800 Subject: [PATCH 080/136] Bug 1147329 - Handle in-process case for Cut/Copy/Paste feature. r=kanru --HG-- extra : commitid : H2bSIbLfEXs --- dom/browser-element/BrowserElementChild.js | 8 ++++++++ dom/browser-element/BrowserElementCopyPaste.js | 9 +++++++++ 2 files changed, 17 insertions(+) diff --git a/dom/browser-element/BrowserElementChild.js b/dom/browser-element/BrowserElementChild.js index 653c5de604c9..ea25ce968de3 100644 --- a/dom/browser-element/BrowserElementChild.js +++ b/dom/browser-element/BrowserElementChild.js @@ -41,7 +41,15 @@ if (!('BrowserElementIsPreloaded' in this)) { } catch (e) { } } + } + if(Services.appinfo.processType == Services.appinfo.PROCESS_TYPE_CONTENT) { + // general content apps + if (isTopBrowserElement(docShell)) { + Services.scriptloader.loadSubScript("chrome://global/content/BrowserElementCopyPaste.js"); + } + } else { + // rocketbar in system app and other in-process case (ex. B2G desktop client) Services.scriptloader.loadSubScript("chrome://global/content/BrowserElementCopyPaste.js"); } diff --git a/dom/browser-element/BrowserElementCopyPaste.js b/dom/browser-element/BrowserElementCopyPaste.js index bfe4f71bc2f8..ae5a8f091bf9 100644 --- a/dom/browser-element/BrowserElementCopyPaste.js +++ b/dom/browser-element/BrowserElementCopyPaste.js @@ -8,6 +8,8 @@ dump("###################################### BrowserElementCopyPaste.js loaded\n"); +let { classes: Cc, interfaces: Ci, results: Cr, utils: Cu } = Components; + let CopyPasteAssistent = { COMMAND_MAP: { 'cut': 'cmd_cut', @@ -81,6 +83,13 @@ let CopyPasteAssistent = { detail.rect.left += currentRect.left; detail.rect.right += currentRect.left; currentWindow = currentWindow.realFrameElement.ownerDocument.defaultView; + + let targetDocShell = currentWindow + .QueryInterface(Ci.nsIInterfaceRequestor) + .getInterface(Ci.nsIWebNavigation); + if(targetDocShell.isBrowserOrApp) { + break; + } } sendAsyncMsg('caretstatechanged', detail); From c106f27e4dace9b477a1ab06f0d108de56628ca9 Mon Sep 17 00:00:00 2001 From: Ting-Yu Lin Date: Mon, 27 Jul 2015 11:56:04 +0800 Subject: [PATCH 081/136] Bug 1172382 - Disable AccessibleCaret on some tests. r=roc All the tests disabled for AccessibleCaret had already being disabled for either TouchCaret or SelectionCarets. --HG-- extra : commitid : H2bSIbLfEXs --- dom/events/test/test_clickevent_on_input.html | 3 ++- editor/reftests/reftest.list | 4 ++-- layout/base/tests/test_bug558663.html | 3 ++- layout/base/tests/test_reftests_with_caret.html | 10 ++++++---- 4 files changed, 12 insertions(+), 8 deletions(-) diff --git a/dom/events/test/test_clickevent_on_input.html b/dom/events/test/test_clickevent_on_input.html index 86737329f93c..a426f8b1df24 100644 --- a/dom/events/test/test_clickevent_on_input.html +++ b/dom/events/test/test_clickevent_on_input.html @@ -52,7 +52,8 @@ function isEnabledMiddleClickPaste() function isEnabledTouchCaret() { try { - return SpecialPowers.getBoolPref("touchcaret.enabled"); + return SpecialPowers.getBoolPref("touchcaret.enabled") || + SpecialPowers.getBoolPref("layout.accessiblecaret.enabled"); } catch (e) { return false; } diff --git a/editor/reftests/reftest.list b/editor/reftests/reftest.list index 5b11dcd387a5..0e9c48140a5f 100644 --- a/editor/reftests/reftest.list +++ b/editor/reftests/reftest.list @@ -104,11 +104,11 @@ skip-if(Android||B2G||Mulet) needs-focus == 462758-grabbers-resizers.html 462758 == 388980-1.html 388980-1-ref.html needs-focus == spellcheck-superscript-1.html spellcheck-superscript-1-ref.html skip-if(B2G||Mulet) fails-if(Android) needs-focus != spellcheck-superscript-2.html spellcheck-superscript-2-ref.html # bug 783658 # Initial mulet triage: parity with B2G/B2G Desktop -needs-focus pref(selectioncaret.enabled,false) == 824080-1.html 824080-1-ref.html +needs-focus pref(selectioncaret.enabled,false) pref(layout.accessiblecaret.enabled,false) == 824080-1.html 824080-1-ref.html needs-focus pref(selectioncaret.enabled,false) == 824080-2.html 824080-2-ref.html needs-focus pref(selectioncaret.enabled,false) == 824080-3.html 824080-3-ref.html needs-focus != 824080-2.html 824080-3.html -needs-focus pref(selectioncaret.enabled,false) == 824080-4.html 824080-4-ref.html +needs-focus pref(selectioncaret.enabled,false) pref(layout.accessiblecaret.enabled,false) == 824080-4.html 824080-4-ref.html needs-focus pref(selectioncaret.enabled,false) == 824080-5.html 824080-5-ref.html needs-focus != 824080-4.html 824080-5.html needs-focus == 824080-6.html 824080-6-ref.html diff --git a/layout/base/tests/test_bug558663.html b/layout/base/tests/test_bug558663.html index 21543360f505..737d32d62845 100644 --- a/layout/base/tests/test_bug558663.html +++ b/layout/base/tests/test_bug558663.html @@ -28,7 +28,8 @@ SimpleTest.waitForExplicitFinish(); // Selection caret's pref is checked only when PresShell is initialized. To turn // off the pref, we test bug 558663 in an iframe. - SpecialPowers.pushPrefEnv({"set": [['selectioncaret.enabled', false]]}, function() { + SpecialPowers.pushPrefEnv({"set": [['selectioncaret.enabled', false], + ['layout.accessiblecaret.enabled', false]]}, function() { var iframe = document.createElement("iframe"); iframe.src = "bug558663.html"; document.getElementById('container').appendChild(iframe); diff --git a/layout/base/tests/test_reftests_with_caret.html b/layout/base/tests/test_reftests_with_caret.html index 452cd77ca289..cc617ba24465 100644 --- a/layout/base/tests/test_reftests_with_caret.html +++ b/layout/base/tests/test_reftests_with_caret.html @@ -109,8 +109,9 @@ var tests = [ // The following test cases are all involving with one sending // synthesizeKey(), the other without. They fail when the touch // or selection caret is enabled. Test them with these preferences off. - function() {SpecialPowers.pushPrefEnv({'set': [['touchcaret.enabled', false]]}, nextTest);} , - function() {SpecialPowers.pushPrefEnv({'set': [['selectioncaret.enabled', false]]}, nextTest);} , + function() {SpecialPowers.pushPrefEnv({'set': [['touchcaret.enabled', false], + ['selectioncaret.enabled', false], + ['layout.accessiblecaret.enabled', false]]}, nextTest);} , [ 'bug240933-1.html' , 'bug240933-1-ref.html' ] , [ 'bug240933-2.html' , 'bug240933-1-ref.html' ] , [ 'bug389321-1.html' , 'bug389321-1-ref.html' ] , @@ -156,8 +157,9 @@ var tests = [ [ 'bug1123067-2.html' , 'bug1123067-ref.html' ] , [ 'bug1123067-3.html' , 'bug1123067-ref.html' ] , [ 'bug1132768-1.html' , 'bug1132768-1-ref.html'] , - function() {SpecialPowers.pushPrefEnv({'clear': [['touchcaret.enabled']]}, nextTest);} , - function() {SpecialPowers.pushPrefEnv({'clear': [['selectioncaret.enabled']]}, nextTest);} , + function() {SpecialPowers.pushPrefEnv({'clear': [['touchcaret.enabled'], + ['selectioncaret.enabled'], + ['layout.accessiblecaret.enabled']]}, nextTest);} , ]; if (navigator.appVersion.indexOf("Android") == -1 && From 7004e4e2ab0f066639f59d65d3122b008f481d8f Mon Sep 17 00:00:00 2001 From: Ting-Yu Lin Date: Mon, 27 Jul 2015 11:56:05 +0800 Subject: [PATCH 082/136] Bug 1172382 - Enable AccessibleCaret on B2G. r=roc The new AccessibleCaret replaces TouchCaret and SelectionCarets. Disable them accordingly. --HG-- extra : commitid : H2bSIbLfEXs --- b2g/app/b2g.js | 11 +++++++---- modules/libpref/init/all.js | 4 ++-- 2 files changed, 9 insertions(+), 6 deletions(-) diff --git a/b2g/app/b2g.js b/b2g/app/b2g.js index 136aace65078..7e9afdd3980a 100644 --- a/b2g/app/b2g.js +++ b/b2g/app/b2g.js @@ -1100,11 +1100,14 @@ pref("dom.wakelock.enabled", true); // Enable webapps add-ons pref("dom.apps.customization.enabled", true); -// Enable touch caret by default -pref("touchcaret.enabled", true); +// Original caret implementation on collapsed selection. +pref("touchcaret.enabled", false); -// Enable selection caret by default -pref("selectioncaret.enabled", true); +// Original caret implementation on non-collapsed selection. +pref("selectioncaret.enabled", false); + +// New implementation to unify touch-caret and selection-carets. +pref("layout.accessiblecaret.enabled", true); // Enable sync and mozId with Firefox Accounts. pref("services.sync.fxaccounts.enabled", true); diff --git a/modules/libpref/init/all.js b/modules/libpref/init/all.js index 08b07b692f5b..cad1b7ca576d 100644 --- a/modules/libpref/init/all.js +++ b/modules/libpref/init/all.js @@ -4739,7 +4739,7 @@ pref("browser.trackingprotection.gethashURL", "https://tracking.services.mozilla // Turn off Spatial navigation by default. pref("snav.enabled", false); -// Turn off touch caret by default. +// Original caret implementation on collapsed selection. pref("touchcaret.enabled", false); // This will inflate the size of the touch caret frame when checking if user @@ -4751,7 +4751,7 @@ pref("touchcaret.inflatesize.threshold", 40); // In milliseconds. (0 means disable this feature) pref("touchcaret.expiration.time", 3000); -// Turn off selection caret by default +// Original caret implementation on non-collapsed selection. pref("selectioncaret.enabled", false); // This will inflate size of selection caret frame when we checking if From 906996fe29c1599c492b5699556ec785463f0524 Mon Sep 17 00:00:00 2001 From: Jean-Yves Avenard Date: Sun, 26 Jul 2015 21:28:48 +1000 Subject: [PATCH 083/136] Bug 1185886: P1. Ensure DrainComplete() is called when draining. r=cpearce If no samples were ever passed to the H264 wrapper, no decoder would have been created. --- dom/media/platforms/wrappers/H264Converter.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/dom/media/platforms/wrappers/H264Converter.cpp b/dom/media/platforms/wrappers/H264Converter.cpp index 9defd2ac52f2..c80d7f71754d 100644 --- a/dom/media/platforms/wrappers/H264Converter.cpp +++ b/dom/media/platforms/wrappers/H264Converter.cpp @@ -95,6 +95,7 @@ H264Converter::Drain() if (mDecoder) { return mDecoder->Drain(); } + mCallback->DrainComplete(); return mLastError; } From 0259a11e37d51c439dc49a367b290d28c514ca12 Mon Sep 17 00:00:00 2001 From: Jean-Yves Avenard Date: Sun, 26 Jul 2015 21:52:22 +1000 Subject: [PATCH 084/136] Bug 1185886: P2. Don't unnecessarily drain decoders when there's no frames pending. r=cpearce --- dom/media/MediaFormatReader.cpp | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/dom/media/MediaFormatReader.cpp b/dom/media/MediaFormatReader.cpp index 81f8c9b5463b..f6220cee495c 100644 --- a/dom/media/MediaFormatReader.cpp +++ b/dom/media/MediaFormatReader.cpp @@ -715,6 +715,7 @@ MediaFormatReader::NotifyDrainComplete(TrackType aTrack) { MOZ_ASSERT(OnTaskQueue()); auto& decoder = GetDecoderData(aTrack); + LOG("%s", TrackTypeToStr(aTrack)); if (!decoder.mOutputRequested) { LOG("MediaFormatReader called DrainComplete() before flushing, ignoring."); return; @@ -983,6 +984,11 @@ MediaFormatReader::DrainDecoder(TrackType aTrack) return; } decoder.mOutputRequested = true; + if (decoder.mNumSamplesInput == decoder.mNumSamplesOutput) { + // No frames to drain. + NotifyDrainComplete(aTrack); + return; + } decoder.mDecoder->Drain(); decoder.mDraining = true; LOG("Requesting %s decoder to drain", TrackTypeToStr(aTrack)); From afb92e807004b3fdba3b54911d71d955d81ffd1d Mon Sep 17 00:00:00 2001 From: Jean-Yves Avenard Date: Wed, 22 Jul 2015 16:28:14 +1000 Subject: [PATCH 085/136] Bug 1185972: P1. Remove DECODER_STATE_DECODING_FIRSTFRAME state. r=jwwang We want to be able to process the steps following decoding of the first frame independent of a state. --- dom/media/MediaDecoderStateMachine.cpp | 83 ++++++++++++++------------ dom/media/MediaDecoderStateMachine.h | 6 +- 2 files changed, 49 insertions(+), 40 deletions(-) diff --git a/dom/media/MediaDecoderStateMachine.cpp b/dom/media/MediaDecoderStateMachine.cpp index 2ca215ca06f9..7462db340a42 100644 --- a/dom/media/MediaDecoderStateMachine.cpp +++ b/dom/media/MediaDecoderStateMachine.cpp @@ -217,6 +217,7 @@ MediaDecoderStateMachine::MediaDecoderStateMachine(MediaDecoder* aDecoder, mDecodeToSeekTarget(false), mCurrentTimeBeforeSeek(0), mCorruptFrames(30), + mDecodingFirstFrame(false), mDisabledHardwareAcceleration(false), mDecodingFrozenAtStateDecoding(false), mSentLoadedMetadataEvent(false), @@ -441,7 +442,7 @@ MediaDecoderStateMachine::NeedToDecodeVideo() HaveEnoughDecodedVideo()); return IsVideoDecoding() && ((mState == DECODER_STATE_SEEKING && mDecodeToSeekTarget) || - (mState == DECODER_STATE_DECODING_FIRSTFRAME && + (IsDecodingFirstFrame() && IsVideoDecoding() && VideoQueue().GetSize() == 0) || (!mMinimizePreroll && !HaveEnoughDecodedVideo())); } @@ -451,7 +452,7 @@ MediaDecoderStateMachine::NeedToSkipToNextKeyframe() { MOZ_ASSERT(OnTaskQueue()); AssertCurrentThreadInMonitor(); - if (mState == DECODER_STATE_DECODING_FIRSTFRAME) { + if (IsDecodingFirstFrame()) { return false; } MOZ_ASSERT(mState == DECODER_STATE_DECODING || @@ -508,7 +509,7 @@ MediaDecoderStateMachine::NeedToDecodeAudio() return IsAudioDecoding() && ((mState == DECODER_STATE_SEEKING && mDecodeToSeekTarget) || - (mState == DECODER_STATE_DECODING_FIRSTFRAME && + (IsDecodingFirstFrame() && IsAudioDecoding() && AudioQueue().GetSize() == 0) || (!mMinimizePreroll && !HaveEnoughDecodedAudio(mAmpleAudioThresholdUsecs * mPlaybackRate) && @@ -560,12 +561,6 @@ MediaDecoderStateMachine::OnAudioDecoded(AudioData* aAudioSample) (audio ? audio->mDiscontinuity : 0)); switch (mState) { - case DECODER_STATE_DECODING_FIRSTFRAME: { - Push(audio); - MaybeFinishDecodeFirstFrame(); - return; - } - case DECODER_STATE_BUFFERING: { // If we're buffering, this may be the sample we need to stop buffering. // Save it and schedule the state machine. @@ -576,6 +571,10 @@ MediaDecoderStateMachine::OnAudioDecoded(AudioData* aAudioSample) case DECODER_STATE_DECODING: { Push(audio); + if (IsDecodingFirstFrame()) { + MaybeFinishDecodeFirstFrame(); + return; + } if (mIsAudioPrerolling && DonePrerollingAudio()) { StopPrerollingAudio(); } @@ -781,13 +780,12 @@ MediaDecoderStateMachine::OnNotDecoded(MediaData::Type aType, StopPrerollingVideo(); } switch (mState) { - case DECODER_STATE_DECODING_FIRSTFRAME: { - MaybeFinishDecodeFirstFrame(); - return; - } - case DECODER_STATE_BUFFERING: case DECODER_STATE_DECODING: { + if (IsDecodingFirstFrame()) { + MaybeFinishDecodeFirstFrame(); + return; + } CheckIfDecodeComplete(); mDecoder->GetReentrantMonitor().NotifyAll(); // Tell AudioSink to wake up for audio queue is finished. @@ -852,12 +850,6 @@ MediaDecoderStateMachine::OnVideoDecoded(VideoData* aVideoSample) (video ? video->mDiscontinuity : 0)); switch (mState) { - case DECODER_STATE_DECODING_FIRSTFRAME: { - Push(video); - MaybeFinishDecodeFirstFrame(); - return; - } - case DECODER_STATE_BUFFERING: { // If we're buffering, this may be the sample we need to stop buffering. // Save it and schedule the state machine. @@ -868,6 +860,10 @@ MediaDecoderStateMachine::OnVideoDecoded(VideoData* aVideoSample) case DECODER_STATE_DECODING: { Push(video); + if (IsDecodingFirstFrame()) { + MaybeFinishDecodeFirstFrame(); + return; + } if (mIsVideoPrerolling && DonePrerollingVideo()) { StopPrerollingVideo(); } @@ -1144,7 +1140,6 @@ static const char* const gMachineStateStr[] = { "DECODING_METADATA", "WAIT_FOR_RESOURCES", "WAIT_FOR_CDM", - "DECODING_FIRSTFRAME", "DORMANT", "DECODING", "SEEKING", @@ -1166,6 +1161,10 @@ void MediaDecoderStateMachine::SetState(State aState) mState = aState; + if (mState != DECODER_STATE_DECODING) { + mDecodingFirstFrame = false; + } + mIsShutdown = mState == DECODER_STATE_ERROR || mState == DECODER_STATE_SHUTDOWN; // Clear state-scoped state. @@ -1319,7 +1318,7 @@ void MediaDecoderStateMachine::StartDecoding() { MOZ_ASSERT(OnTaskQueue()); ReentrantMonitorAutoEnter mon(mDecoder->GetReentrantMonitor()); - if (mState == DECODER_STATE_DECODING) { + if (mState == DECODER_STATE_DECODING && !mDecodingFirstFrame) { return; } SetState(DECODER_STATE_DECODING); @@ -1353,7 +1352,8 @@ void MediaDecoderStateMachine::NotifyWaitingForResourcesStatusChanged() ScheduleStateMachine(); } else if (mState == DECODER_STATE_WAIT_FOR_CDM && !mReader->IsWaitingOnCDMResource()) { - SetState(DECODER_STATE_DECODING_FIRSTFRAME); + SetState(DECODER_STATE_DECODING); + mDecodingFirstFrame = true; EnqueueDecodeFirstFrameTask(); } } @@ -1454,7 +1454,7 @@ MediaDecoderStateMachine::Seek(SeekTarget aTarget) NS_ASSERTION(mState > DECODER_STATE_DECODING_METADATA, "We should have got duration already"); - if (mState < DECODER_STATE_DECODING) { + if (mState < DECODER_STATE_DECODING || IsDecodingFirstFrame()) { DECODER_LOG("Seek() Not Enough Data to continue at this stage, queuing seek"); mQueuedSeek.RejectIfExists(__func__); mQueuedSeek.mTarget = aTarget; @@ -1489,7 +1489,7 @@ MediaDecoderStateMachine::EnqueueDecodeFirstFrameTask() { MOZ_ASSERT(OnTaskQueue()); AssertCurrentThreadInMonitor(); - MOZ_ASSERT(mState == DECODER_STATE_DECODING_FIRSTFRAME); + MOZ_ASSERT(IsDecodingFirstFrame()); nsCOMPtr task( NS_NewRunnableMethod(this, &MediaDecoderStateMachine::CallDecodeFirstFrame)); @@ -1504,7 +1504,6 @@ MediaDecoderStateMachine::DispatchDecodeTasksIfNeeded() AssertCurrentThreadInMonitor(); if (mState != DECODER_STATE_DECODING && - mState != DECODER_STATE_DECODING_FIRSTFRAME && mState != DECODER_STATE_BUFFERING && mState != DECODER_STATE_SEEKING) { return; @@ -1653,7 +1652,6 @@ MediaDecoderStateMachine::EnsureAudioDecodeTaskQueued() IsAudioDecoding(), AudioRequestStatus()); if (mState != DECODER_STATE_DECODING && - mState != DECODER_STATE_DECODING_FIRSTFRAME && mState != DECODER_STATE_BUFFERING && mState != DECODER_STATE_SEEKING) { return NS_OK; @@ -1725,7 +1723,6 @@ MediaDecoderStateMachine::EnsureVideoDecodeTaskQueued() IsVideoDecoding(), VideoRequestStatus()); if (mState != DECODER_STATE_DECODING && - mState != DECODER_STATE_DECODING_FIRSTFRAME && mState != DECODER_STATE_BUFFERING && mState != DECODER_STATE_SEEKING) { return NS_OK; @@ -1862,7 +1859,7 @@ bool MediaDecoderStateMachine::HasLowUndecodedData(int64_t aUsecs) { MOZ_ASSERT(OnTaskQueue()); AssertCurrentThreadInMonitor(); - NS_ASSERTION(mState > DECODER_STATE_DECODING_FIRSTFRAME, + NS_ASSERTION(mState >= DECODER_STATE_DECODING && !IsDecodingFirstFrame(), "Must have loaded first frame for mBuffered to be valid"); // If we don't have a duration, mBuffered is probably not going to have @@ -1993,7 +1990,8 @@ MediaDecoderStateMachine::OnMetadataRead(MetadataHolder* aMetadata) return; } - SetState(DECODER_STATE_DECODING_FIRSTFRAME); + SetState(DECODER_STATE_DECODING); + mDecodingFirstFrame = true; EnqueueDecodeFirstFrameTask(); ScheduleStateMachine(); } @@ -2050,7 +2048,7 @@ MediaDecoderStateMachine::CallDecodeFirstFrame() { MOZ_ASSERT(OnTaskQueue()); ReentrantMonitorAutoEnter mon(mDecoder->GetReentrantMonitor()); - if (mState != DECODER_STATE_DECODING_FIRSTFRAME) { + if (!IsDecodingFirstFrame()) { return; } if (NS_FAILED(DecodeFirstFrame())) { @@ -2064,7 +2062,7 @@ MediaDecoderStateMachine::DecodeFirstFrame() { MOZ_ASSERT(OnTaskQueue()); AssertCurrentThreadInMonitor(); - MOZ_ASSERT(mState == DECODER_STATE_DECODING_FIRSTFRAME); + MOZ_ASSERT(IsDecodingFirstFrame()); DECODER_LOG("DecodeFirstFrame started"); if (IsRealTime()) { @@ -2088,6 +2086,12 @@ MediaDecoderStateMachine::DecodeFirstFrame() return NS_OK; } +bool +MediaDecoderStateMachine::IsDecodingFirstFrame() +{ + return mState == DECODER_STATE_DECODING && mDecodingFirstFrame; +} + nsresult MediaDecoderStateMachine::FinishDecodeFirstFrame() { @@ -2137,11 +2141,13 @@ MediaDecoderStateMachine::FinishDecodeFirstFrame() mPendingSeek.Steal(mQueuedSeek); SetState(DECODER_STATE_SEEKING); ScheduleStateMachine(); - } else if (mState == DECODER_STATE_DECODING_FIRSTFRAME) { + } else if (IsDecodingFirstFrame()) { // StartDecoding() will also check if decode is completed. StartDecoding(); } + mDecodingFirstFrame = false; + return NS_OK; } @@ -2338,12 +2344,11 @@ nsresult MediaDecoderStateMachine::RunStateMachine() return NS_OK; } - case DECODER_STATE_DECODING_FIRSTFRAME: { - // DECODER_STATE_DECODING_FIRSTFRAME will be started by OnMetadataRead. - return NS_OK; - } - case DECODER_STATE_DECODING: { + if (IsDecodingFirstFrame()) { + // DECODER_STATE_DECODING will be started by OnMetadataRead. + return NS_OK; + } if (mPlayState != MediaDecoder::PLAY_STATE_PLAYING && IsPlaying()) { // We're playing, but the element/decoder is in paused state. Stop @@ -2890,7 +2895,7 @@ void MediaDecoderStateMachine::UpdateNextFrameStatus() MediaDecoderOwner::NextFrameStatus status; const char* statusString; - if (mState <= DECODER_STATE_DECODING_FIRSTFRAME) { + if (mState <= DECODER_STATE_WAIT_FOR_CDM || IsDecodingFirstFrame()) { status = MediaDecoderOwner::NEXT_FRAME_UNAVAILABLE; statusString = "NEXT_FRAME_UNAVAILABLE"; } else if (IsBuffering()) { diff --git a/dom/media/MediaDecoderStateMachine.h b/dom/media/MediaDecoderStateMachine.h index ea485d4e9d08..874eb08dac1b 100644 --- a/dom/media/MediaDecoderStateMachine.h +++ b/dom/media/MediaDecoderStateMachine.h @@ -138,7 +138,6 @@ public: DECODER_STATE_DECODING_METADATA, DECODER_STATE_WAIT_FOR_RESOURCES, DECODER_STATE_WAIT_FOR_CDM, - DECODER_STATE_DECODING_FIRSTFRAME, DECODER_STATE_DORMANT, DECODER_STATE_DECODING, DECODER_STATE_SEEKING, @@ -407,6 +406,7 @@ protected: MediaQueue& AudioQueue() { return mAudioQueue; } MediaQueue& VideoQueue() { return mVideoQueue; } + bool IsDecodingFirstFrame(); nsresult FinishDecodeFirstFrame(); // True if our buffers of decoded audio are not full, and we should @@ -1262,6 +1262,10 @@ private: mozilla::RollingMean mCorruptFrames; + // True if we need to call FinishDecodeFirstFrame() upon frame decoding + // successeeding. + bool mDecodingFirstFrame; + bool mDisabledHardwareAcceleration; // mDecodingFrozenAtStateDecoding: turn on/off at From b7937eabbd91c2df56b900ff787bbf482c907e3c Mon Sep 17 00:00:00 2001 From: Jean-Yves Avenard Date: Sat, 25 Jul 2015 18:25:13 +1000 Subject: [PATCH 086/136] Bug 1185972: P2. Refactor handling of first frame decoded. r=jwwang --- dom/media/MediaDecoderStateMachine.cpp | 138 ++++++++----------------- dom/media/MediaDecoderStateMachine.h | 26 ++--- 2 files changed, 50 insertions(+), 114 deletions(-) diff --git a/dom/media/MediaDecoderStateMachine.cpp b/dom/media/MediaDecoderStateMachine.cpp index 7462db340a42..c5693180d9ac 100644 --- a/dom/media/MediaDecoderStateMachine.cpp +++ b/dom/media/MediaDecoderStateMachine.cpp @@ -217,7 +217,7 @@ MediaDecoderStateMachine::MediaDecoderStateMachine(MediaDecoder* aDecoder, mDecodeToSeekTarget(false), mCurrentTimeBeforeSeek(0), mCorruptFrames(30), - mDecodingFirstFrame(false), + mDecodingFirstFrame(true), mDisabledHardwareAcceleration(false), mDecodingFrozenAtStateDecoding(false), mSentLoadedMetadataEvent(false), @@ -571,8 +571,7 @@ MediaDecoderStateMachine::OnAudioDecoded(AudioData* aAudioSample) case DECODER_STATE_DECODING: { Push(audio); - if (IsDecodingFirstFrame()) { - MaybeFinishDecodeFirstFrame(); + if (MaybeFinishDecodeFirstFrame()) { return; } if (mIsAudioPrerolling && DonePrerollingAudio()) { @@ -782,8 +781,7 @@ MediaDecoderStateMachine::OnNotDecoded(MediaData::Type aType, switch (mState) { case DECODER_STATE_BUFFERING: case DECODER_STATE_DECODING: { - if (IsDecodingFirstFrame()) { - MaybeFinishDecodeFirstFrame(); + if (MaybeFinishDecodeFirstFrame()) { return; } CheckIfDecodeComplete(); @@ -819,18 +817,26 @@ MediaDecoderStateMachine::OnNotDecoded(MediaData::Type aType, } } -void +bool MediaDecoderStateMachine::MaybeFinishDecodeFirstFrame() { MOZ_ASSERT(OnTaskQueue()); AssertCurrentThreadInMonitor(); - if ((IsAudioDecoding() && AudioQueue().GetSize() == 0) || + if (!IsDecodingFirstFrame() || + (IsAudioDecoding() && AudioQueue().GetSize() == 0) || (IsVideoDecoding() && VideoQueue().GetSize() == 0)) { - return; + return false; } - if (NS_FAILED(FinishDecodeFirstFrame())) { - DecodeError(); + FinishDecodeFirstFrame(); + if (!mQueuedSeek.Exists()) { + return false; } + + // We can now complete the pending seek. + mPendingSeek.Steal(mQueuedSeek); + SetState(DECODER_STATE_SEEKING); + ScheduleStateMachine(); + return true; } void @@ -860,8 +866,7 @@ MediaDecoderStateMachine::OnVideoDecoded(VideoData* aVideoSample) case DECODER_STATE_DECODING: { Push(video); - if (IsDecodingFirstFrame()) { - MaybeFinishDecodeFirstFrame(); + if (MaybeFinishDecodeFirstFrame()) { return; } if (mIsVideoPrerolling && DonePrerollingVideo()) { @@ -888,7 +893,8 @@ MediaDecoderStateMachine::OnVideoDecoded(VideoData* aVideoSample) return; } TimeDuration decodeTime = TimeStamp::Now() - mVideoDecodeStartTime; - if (THRESHOLD_FACTOR * DurationToUsecs(decodeTime) > mLowAudioThresholdUsecs && + if (!IsDecodingFirstFrame() && + THRESHOLD_FACTOR * DurationToUsecs(decodeTime) > mLowAudioThresholdUsecs && !HasLowUndecodedData()) { mLowAudioThresholdUsecs = @@ -1161,10 +1167,6 @@ void MediaDecoderStateMachine::SetState(State aState) mState = aState; - if (mState != DECODER_STATE_DECODING) { - mDecodingFirstFrame = false; - } - mIsShutdown = mState == DECODER_STATE_ERROR || mState == DECODER_STATE_SHUTDOWN; // Clear state-scoped state. @@ -1273,6 +1275,7 @@ void MediaDecoderStateMachine::SetDormant(bool aDormant) mDecodingFrozenAtStateDecoding = true; ScheduleStateMachine(); mCurrentPosition = 0; + mDecodingFirstFrame = true; SetState(DECODER_STATE_DECODING_NONE); mDecoder->GetReentrantMonitor().NotifyAll(); } @@ -1323,6 +1326,22 @@ void MediaDecoderStateMachine::StartDecoding() } SetState(DECODER_STATE_DECODING); + if (mDecodingFirstFrame && + (IsRealTime() || mSentFirstFrameLoadedEvent)) { + // if mSentFirstFrameLoadedEvent is set : + // We're resuming from dormant state, so we don't need to request + // the first samples in order to determine the media start time, + // we have the start time from last time we loaded. + FinishDecodeFirstFrame(); + if (mQueuedSeek.Exists()) { + // We are returning from dormant, complete any pending seek. + mPendingSeek.Steal(mQueuedSeek); + SetState(DECODER_STATE_SEEKING); + ScheduleStateMachine(); + return; + } + } + mDecodeStartTime = TimeStamp::Now(); CheckIfDecodeComplete(); @@ -1352,9 +1371,7 @@ void MediaDecoderStateMachine::NotifyWaitingForResourcesStatusChanged() ScheduleStateMachine(); } else if (mState == DECODER_STATE_WAIT_FOR_CDM && !mReader->IsWaitingOnCDMResource()) { - SetState(DECODER_STATE_DECODING); - mDecodingFirstFrame = true; - EnqueueDecodeFirstFrameTask(); + StartDecoding(); } } @@ -1484,19 +1501,6 @@ void MediaDecoderStateMachine::StopAudioThread() mAudioSinkPromise.DisconnectIfExists(); } -nsresult -MediaDecoderStateMachine::EnqueueDecodeFirstFrameTask() -{ - MOZ_ASSERT(OnTaskQueue()); - AssertCurrentThreadInMonitor(); - MOZ_ASSERT(IsDecodingFirstFrame()); - - nsCOMPtr task( - NS_NewRunnableMethod(this, &MediaDecoderStateMachine::CallDecodeFirstFrame)); - OwnerThread()->Dispatch(task.forget()); - return NS_OK; -} - void MediaDecoderStateMachine::DispatchDecodeTasksIfNeeded() { @@ -1990,9 +1994,8 @@ MediaDecoderStateMachine::OnMetadataRead(MetadataHolder* aMetadata) return; } - SetState(DECODER_STATE_DECODING); - mDecodingFirstFrame = true; - EnqueueDecodeFirstFrameTask(); + StartDecoding(); + ScheduleStateMachine(); } @@ -2043,66 +2046,19 @@ MediaDecoderStateMachine::EnqueueFirstFrameLoadedEvent() mSentFirstFrameLoadedEvent = true; } -void -MediaDecoderStateMachine::CallDecodeFirstFrame() -{ - MOZ_ASSERT(OnTaskQueue()); - ReentrantMonitorAutoEnter mon(mDecoder->GetReentrantMonitor()); - if (!IsDecodingFirstFrame()) { - return; - } - if (NS_FAILED(DecodeFirstFrame())) { - DECODER_WARN("Decode failed to start, shutting down decoder"); - DecodeError(); - } -} - -nsresult -MediaDecoderStateMachine::DecodeFirstFrame() -{ - MOZ_ASSERT(OnTaskQueue()); - AssertCurrentThreadInMonitor(); - MOZ_ASSERT(IsDecodingFirstFrame()); - DECODER_LOG("DecodeFirstFrame started"); - - if (IsRealTime()) { - nsresult res = FinishDecodeFirstFrame(); - NS_ENSURE_SUCCESS(res, res); - } else if (mSentFirstFrameLoadedEvent) { - // We're resuming from dormant state, so we don't need to request - // the first samples in order to determine the media start time, - // we have the start time from last time we loaded. - nsresult res = FinishDecodeFirstFrame(); - NS_ENSURE_SUCCESS(res, res); - } else { - if (HasAudio()) { - RequestAudioData(); - } - if (HasVideo()) { - RequestVideoData(); - } - } - - return NS_OK; -} - bool MediaDecoderStateMachine::IsDecodingFirstFrame() { return mState == DECODER_STATE_DECODING && mDecodingFirstFrame; } -nsresult +void MediaDecoderStateMachine::FinishDecodeFirstFrame() { MOZ_ASSERT(OnTaskQueue()); AssertCurrentThreadInMonitor(); DECODER_LOG("FinishDecodeFirstFrame"); - if (IsShutdown()) { - return NS_ERROR_FAILURE; - } - if (!IsRealTime() && !mSentFirstFrameLoadedEvent) { RenderVideoFrames(1); } @@ -2137,18 +2093,7 @@ MediaDecoderStateMachine::FinishDecodeFirstFrame() } EnqueueFirstFrameLoadedEvent(); - if (mQueuedSeek.Exists()) { - mPendingSeek.Steal(mQueuedSeek); - SetState(DECODER_STATE_SEEKING); - ScheduleStateMachine(); - } else if (IsDecodingFirstFrame()) { - // StartDecoding() will also check if decode is completed. - StartDecoding(); - } - mDecodingFirstFrame = false; - - return NS_OK; } void @@ -2346,7 +2291,8 @@ nsresult MediaDecoderStateMachine::RunStateMachine() case DECODER_STATE_DECODING: { if (IsDecodingFirstFrame()) { - // DECODER_STATE_DECODING will be started by OnMetadataRead. + // We haven't completed decoding our first frames, we can't start + // playback yet. return NS_OK; } if (mPlayState != MediaDecoder::PLAY_STATE_PLAYING && IsPlaying()) diff --git a/dom/media/MediaDecoderStateMachine.h b/dom/media/MediaDecoderStateMachine.h index 874eb08dac1b..ac5bc525ad2e 100644 --- a/dom/media/MediaDecoderStateMachine.h +++ b/dom/media/MediaDecoderStateMachine.h @@ -406,9 +406,6 @@ protected: MediaQueue& AudioQueue() { return mAudioQueue; } MediaQueue& VideoQueue() { return mVideoQueue; } - bool IsDecodingFirstFrame(); - nsresult FinishDecodeFirstFrame(); - // True if our buffers of decoded audio are not full, and we should // decode more. bool NeedToDecodeAudio(); @@ -555,11 +552,6 @@ protected: void EnqueueFirstFrameLoadedEvent(); - // Dispatches a task to the state machine thread to begin decoding content. - // This is threadsafe and can be called on any thread. - // The decoder monitor must be held. - nsresult EnqueueDecodeFirstFrameTask(); - // Clears any previous seeking state and initiates a new see on the decoder. // The decoder monitor must be held. void InitiateSeek(); @@ -617,16 +609,14 @@ protected: void OnMetadataRead(MetadataHolder* aMetadata); void OnMetadataNotRead(ReadMetadataFailureReason aReason); - // Initiate first content decoding. Called on the state machine thread. - // The decoder monitor must be held with exactly one lock count. - nsresult DecodeFirstFrame(); - - // Wraps the call to DecodeFirstFrame(), signals a DecodeError() on failure. - void CallDecodeFirstFrame(); - - // Checks whether we're finished decoding first audio and/or video packets, - // and switches to DECODING state if so. - void MaybeFinishDecodeFirstFrame(); + // Checks whether we're finished decoding first audio and/or video packets. + // If so will trigger firing loadeddata event. + // If there are any queued seek, will change state to DECODER_STATE_SEEKING + // and return true. + bool MaybeFinishDecodeFirstFrame(); + // Return true if we are currently decoding the first frames. + bool IsDecodingFirstFrame(); + void FinishDecodeFirstFrame(); // Seeks to mSeekTarget. Called on the decode thread. The decoder monitor // must be held with exactly one lock count. From 797031e88a9f34e291ad1bf0c6c20bf46668a8ae Mon Sep 17 00:00:00 2001 From: Jean-Yves Avenard Date: Sat, 25 Jul 2015 18:28:14 +1000 Subject: [PATCH 087/136] Bug 1185972: P3. Don't reduce our buffer threshold coming out of dormant mode. r=jwwang Each time we would come out of dormant mode, the buffer threshold for audio-only stream would be reduced. --- dom/media/MediaDecoderStateMachine.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dom/media/MediaDecoderStateMachine.cpp b/dom/media/MediaDecoderStateMachine.cpp index c5693180d9ac..60dcdecc56d8 100644 --- a/dom/media/MediaDecoderStateMachine.cpp +++ b/dom/media/MediaDecoderStateMachine.cpp @@ -2072,7 +2072,7 @@ MediaDecoderStateMachine::FinishDecodeFirstFrame() "transportSeekable=%d, mediaSeekable=%d", Duration().ToMicroseconds(), mDecoder->IsTransportSeekable(), mDecoder->IsMediaSeekable()); - if (HasAudio() && !HasVideo()) { + if (HasAudio() && !HasVideo() && !mSentFirstFrameLoadedEvent) { // We're playing audio only. We don't need to worry about slow video // decodes causing audio underruns, so don't buffer so much audio in // order to reduce memory usage. From c5999c60f3cb5ca208681eb0b4efbfe25f2df2da Mon Sep 17 00:00:00 2001 From: Jean-Yves Avenard Date: Sat, 25 Jul 2015 18:42:41 +1000 Subject: [PATCH 088/136] Bug 1185972: P4. Initiate seek as early as conditions permit. r=jwwang We can initiate a seek as soon as we have a start time and metadata have been read. However, only enable this feature for MSE as some tests expect events in a specific order. --- dom/media/MediaDecoderStateMachine.cpp | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/dom/media/MediaDecoderStateMachine.cpp b/dom/media/MediaDecoderStateMachine.cpp index 60dcdecc56d8..ab6fea08d7b9 100644 --- a/dom/media/MediaDecoderStateMachine.cpp +++ b/dom/media/MediaDecoderStateMachine.cpp @@ -1471,7 +1471,8 @@ MediaDecoderStateMachine::Seek(SeekTarget aTarget) NS_ASSERTION(mState > DECODER_STATE_DECODING_METADATA, "We should have got duration already"); - if (mState < DECODER_STATE_DECODING || IsDecodingFirstFrame()) { + if (mState < DECODER_STATE_DECODING || + (IsDecodingFirstFrame() && !mReader->ForceZeroStartTime())) { DECODER_LOG("Seek() Not Enough Data to continue at this stage, queuing seek"); mQueuedSeek.RejectIfExists(__func__); mQueuedSeek.mTarget = aTarget; @@ -2126,6 +2127,12 @@ MediaDecoderStateMachine::SeekCompleted() } mPlayDuration = newCurrentTime; + if (mDecodingFirstFrame) { + // We were resuming from dormant, or initiated a seek early. + // We can fire loadeddata now. + FinishDecodeFirstFrame(); + } + // Change state to DECODING or COMPLETED now. SeekingStopped will // call MediaDecoderStateMachine::Seek to reset our state to SEEKING // if we need to seek again. From fa397ab3b4c1a1ba941fd842eaed149fd761672a Mon Sep 17 00:00:00 2001 From: Jean-Yves Avenard Date: Thu, 23 Jul 2015 11:40:58 +1000 Subject: [PATCH 089/136] Bug 1185972: P5. Add mochitest testing new seek behaviour. r=jwwang Test ensures that seeking starts right after metadata is processed if we have a known start time. --- dom/media/mediasource/test/mochitest.ini | 2 + .../mediasource/test/test_SeekNoData_mp4.html | 53 +++++++++++++++++++ 2 files changed, 55 insertions(+) create mode 100644 dom/media/mediasource/test/test_SeekNoData_mp4.html diff --git a/dom/media/mediasource/test/mochitest.ini b/dom/media/mediasource/test/mochitest.ini index e8c02548dd8a..9099bdddba05 100644 --- a/dom/media/mediasource/test/mochitest.ini +++ b/dom/media/mediasource/test/mochitest.ini @@ -81,6 +81,8 @@ skip-if = ((os == "win" && os_version == "5.1") || (os != "win" && os != "mac")) skip-if = true # bug 1182946 [test_SeekableBeforeEndOfStreamSplit_mp4.html] skip-if = ((os == "win" && os_version == "5.1") || (os != "win" && os != "mac")) # Only supported on osx and vista+ +[test_SeekNoData_mp4.html] +skip-if = ((os == "win" && os_version == "5.1") || (os != "win" && os != "mac")) # Only supported on osx and vista+ [test_SeekTwice_mp4.html] skip-if = ((os == "win" && os_version == "5.1") || (os != "win" && os != "mac")) # Only supported on osx and vista+ [test_SetModeThrows.html] diff --git a/dom/media/mediasource/test/test_SeekNoData_mp4.html b/dom/media/mediasource/test/test_SeekNoData_mp4.html new file mode 100644 index 000000000000..15f6703b0a40 --- /dev/null +++ b/dom/media/mediasource/test/test_SeekNoData_mp4.html @@ -0,0 +1,53 @@ + + + + MSE: basic functionality + + + + + +
+
+
+ + From 8d428f4beca2e8087a8a4e035e25d88790b47e55 Mon Sep 17 00:00:00 2001 From: Jean-Yves Avenard Date: Sun, 26 Jul 2015 11:57:11 +1000 Subject: [PATCH 090/136] Bug 1185972: P6. Ensure exiting dormant mode has completed seek before notifying decoder. r=jwwang --- dom/media/MediaDecoderStateMachine.cpp | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/dom/media/MediaDecoderStateMachine.cpp b/dom/media/MediaDecoderStateMachine.cpp index ab6fea08d7b9..08929dd14976 100644 --- a/dom/media/MediaDecoderStateMachine.cpp +++ b/dom/media/MediaDecoderStateMachine.cpp @@ -1328,13 +1328,18 @@ void MediaDecoderStateMachine::StartDecoding() if (mDecodingFirstFrame && (IsRealTime() || mSentFirstFrameLoadedEvent)) { - // if mSentFirstFrameLoadedEvent is set : - // We're resuming from dormant state, so we don't need to request - // the first samples in order to determine the media start time, - // we have the start time from last time we loaded. - FinishDecodeFirstFrame(); + if (IsRealTime()) { + FinishDecodeFirstFrame(); + } else { + // We're resuming from dormant state, so we don't need to request + // the first samples in order to determine the media start time, + // we have the start time from last time we loaded. + // FinishDecodeFirstFrame will be launched upon completion of the seek when + // we have data ready to play. + MOZ_ASSERT(mQueuedSeek.Exists() && mSentFirstFrameLoadedEvent, + "Return from dormant must have queued seek"); + } if (mQueuedSeek.Exists()) { - // We are returning from dormant, complete any pending seek. mPendingSeek.Steal(mQueuedSeek); SetState(DECODER_STATE_SEEKING); ScheduleStateMachine(); From 51adbe4deb5de38bf0cb0c19cdcfa830941f32d0 Mon Sep 17 00:00:00 2001 From: Makoto Kato Date: Mon, 27 Jul 2015 14:37:02 +0900 Subject: [PATCH 091/136] Bug 1181000 - Use logical pixel to set IME candidate window. r=karlt --- widget/gtk/IMContextWrapper.cpp | 15 ++++++--------- widget/gtk/nsWindow.h | 3 ++- 2 files changed, 8 insertions(+), 10 deletions(-) diff --git a/widget/gtk/IMContextWrapper.cpp b/widget/gtk/IMContextWrapper.cpp index 2ca34da0f2c1..e58917407eed 100644 --- a/widget/gtk/IMContextWrapper.cpp +++ b/widget/gtk/IMContextWrapper.cpp @@ -1585,19 +1585,16 @@ IMContextWrapper::SetCursorPosition(GtkIMContext* aContext) static_cast(mLastFocusedWindow->GetTopLevelWidget()); // Get the position of the rootWindow in screen. - gint rootX, rootY; - gdk_window_get_origin(rootWindow->GetGdkWindow(), &rootX, &rootY); + LayoutDeviceIntPoint root = rootWindow->WidgetToScreenOffset(); // Get the position of IM context owner window in screen. - gint ownerX, ownerY; - gdk_window_get_origin(mOwnerWindow->GetGdkWindow(), &ownerX, &ownerY); + LayoutDeviceIntPoint owner = mOwnerWindow->WidgetToScreenOffset(); // Compute the caret position in the IM owner window. - GdkRectangle area; - area.x = charRect.mReply.mRect.x + rootX - ownerX; - area.y = charRect.mReply.mRect.y + rootY - ownerY; - area.width = 0; - area.height = charRect.mReply.mRect.height; + LayoutDeviceIntRect rect = charRect.mReply.mRect + root - owner; + rect.width = 0; + GdkRectangle area = rootWindow->DevicePixelsToGdkRectRoundOut( + LayoutDeviceIntRect::ToUntyped(rect)); gtk_im_context_set_cursor_location(aContext, &area); } diff --git a/widget/gtk/nsWindow.h b/widget/gtk/nsWindow.h index af3f7373a40c..8ebee70f6afc 100644 --- a/widget/gtk/nsWindow.h +++ b/widget/gtk/nsWindow.h @@ -166,6 +166,8 @@ public: // value that can be passed to gdk_window_set_decorations gint ConvertBorderStyles(nsBorderStyle aStyle); + GdkRectangle DevicePixelsToGdkRectRoundOut(nsIntRect rect); + // event callbacks #if (MOZ_WIDGET_GTK == 2) gboolean OnExposeEvent(GdkEventExpose *aEvent); @@ -499,7 +501,6 @@ private: gint DevicePixelsToGdkCoordRoundUp(int pixels); gint DevicePixelsToGdkCoordRoundDown(int pixels); GdkPoint DevicePixelsToGdkPointRoundDown(nsIntPoint point); - GdkRectangle DevicePixelsToGdkRectRoundOut(nsIntRect rect); GdkRectangle DevicePixelsToGdkSizeRoundUp(nsIntSize pixelSize); // From GDK From d9c1315ad6736514ba0491fb71fba14b99fd8b50 Mon Sep 17 00:00:00 2001 From: "Carsten \"Tomcat\" Book" Date: Mon, 27 Jul 2015 08:00:29 +0200 Subject: [PATCH 092/136] Backed out changeset 8e006947db44 (bug 1186780) --- dom/base/nsDocument.cpp | 343 +++++++++++++++++++---------- dom/base/nsDocument.h | 2 - dom/base/nsFrameMessageManager.cpp | 187 ++++++++++------ dom/xbl/nsXBLDocumentInfo.cpp | 11 +- 4 files changed, 348 insertions(+), 195 deletions(-) diff --git a/dom/base/nsDocument.cpp b/dom/base/nsDocument.cpp index 01e4ae1756c6..10c1abc0825a 100644 --- a/dom/base/nsDocument.cpp +++ b/dom/base/nsDocument.cpp @@ -336,55 +336,86 @@ const nsIID nsIStyleRule::COMTypeInfo::kIID = NS_ISTYLE_RULE_II namespace mozilla { namespace dom { +static PLDHashOperator +CustomDefinitionsTraverse(CustomElementHashKey* aKey, + CustomElementDefinition* aDefinition, + void* aArg) +{ + nsCycleCollectionTraversalCallback* cb = + static_cast(aArg); + + nsAutoPtr& callbacks = aDefinition->mCallbacks; + + if (callbacks->mAttributeChangedCallback.WasPassed()) { + NS_CYCLE_COLLECTION_NOTE_EDGE_NAME(*cb, + "mCustomDefinitions->mCallbacks->mAttributeChangedCallback"); + cb->NoteXPCOMChild(aDefinition->mCallbacks->mAttributeChangedCallback.Value()); + } + + if (callbacks->mCreatedCallback.WasPassed()) { + NS_CYCLE_COLLECTION_NOTE_EDGE_NAME(*cb, + "mCustomDefinitions->mCallbacks->mCreatedCallback"); + cb->NoteXPCOMChild(aDefinition->mCallbacks->mCreatedCallback.Value()); + } + + if (callbacks->mAttachedCallback.WasPassed()) { + NS_CYCLE_COLLECTION_NOTE_EDGE_NAME(*cb, + "mCustomDefinitions->mCallbacks->mAttachedCallback"); + cb->NoteXPCOMChild(aDefinition->mCallbacks->mAttachedCallback.Value()); + } + + if (callbacks->mDetachedCallback.WasPassed()) { + NS_CYCLE_COLLECTION_NOTE_EDGE_NAME(*cb, + "mCustomDefinitions->mCallbacks->mDetachedCallback"); + cb->NoteXPCOMChild(aDefinition->mCallbacks->mDetachedCallback.Value()); + } + + return PL_DHASH_NEXT; +} + +static PLDHashOperator +CandidatesTraverse(CustomElementHashKey* aKey, + nsTArray>* aData, + void* aArg) +{ + nsCycleCollectionTraversalCallback *cb = + static_cast(aArg); + for (size_t i = 0; i < aData->Length(); ++i) { + NS_CYCLE_COLLECTION_NOTE_EDGE_NAME(*cb, "mCandidatesMap->Element"); + cb->NoteXPCOMChild(aData->ElementAt(i)); + } + return PL_DHASH_NEXT; +} + +struct CustomDefinitionTraceArgs +{ + const TraceCallbacks& callbacks; + void* closure; +}; + +static PLDHashOperator +CustomDefinitionTrace(CustomElementHashKey *aKey, + CustomElementDefinition *aData, + void *aArg) +{ + CustomDefinitionTraceArgs* traceArgs = static_cast(aArg); + MOZ_ASSERT(aData, "Definition must not be null"); + traceArgs->callbacks.Trace(&aData->mPrototype, "mCustomDefinitions prototype", + traceArgs->closure); + return PL_DHASH_NEXT; +} + NS_IMPL_CYCLE_COLLECTION_CLASS(Registry) NS_IMPL_CYCLE_COLLECTION_TRACE_BEGIN(Registry) - for (auto iter = tmp->mCustomDefinitions.ConstIter(); !iter.Done(); - iter.Next()) { - aCallbacks.Trace(&iter.UserData()->mPrototype, - "mCustomDefinitions prototype", - aClosure); - } + CustomDefinitionTraceArgs customDefinitionArgs = { aCallbacks, aClosure }; + tmp->mCustomDefinitions.EnumerateRead(CustomDefinitionTrace, + &customDefinitionArgs); NS_IMPL_CYCLE_COLLECTION_TRACE_END NS_IMPL_CYCLE_COLLECTION_TRAVERSE_BEGIN(Registry) - for (auto iter = tmp->mCustomDefinitions.ConstIter(); !iter.Done(); - iter.Next()) { - CustomElementDefinition* definition = iter.UserData(); - auto callbacks = definition->mCallbacks; - - if (callbacks->mAttributeChangedCallback.WasPassed()) { - NS_CYCLE_COLLECTION_NOTE_EDGE_NAME(cb, - "mCustomDefinitions->mCallbacks->mAttributeChangedCallback"); - cb.NoteXPCOMChild(callbacks->mAttributeChangedCallback.Value()); - } - - if (callbacks->mCreatedCallback.WasPassed()) { - NS_CYCLE_COLLECTION_NOTE_EDGE_NAME(cb, - "mCustomDefinitions->mCallbacks->mCreatedCallback"); - cb.NoteXPCOMChild(callbacks->mCreatedCallback.Value()); - } - - if (callbacks->mAttachedCallback.WasPassed()) { - NS_CYCLE_COLLECTION_NOTE_EDGE_NAME(cb, - "mCustomDefinitions->mCallbacks->mAttachedCallback"); - cb.NoteXPCOMChild(callbacks->mAttachedCallback.Value()); - } - - if (callbacks->mDetachedCallback.WasPassed()) { - NS_CYCLE_COLLECTION_NOTE_EDGE_NAME(cb, - "mCustomDefinitions->mCallbacks->mDetachedCallback"); - cb.NoteXPCOMChild(callbacks->mDetachedCallback.Value()); - } - } - - for (auto iter = tmp->mCandidatesMap.ConstIter(); !iter.Done(); iter.Next()) { - auto data = iter.UserData(); - for (size_t i = 0; i < data->Length(); ++i) { - NS_CYCLE_COLLECTION_NOTE_EDGE_NAME(cb, "mCandidatesMap->Element"); - cb.NoteXPCOMChild(data->ElementAt(i)); - } - } + tmp->mCustomDefinitions.EnumerateRead(CustomDefinitionsTraverse, &cb); + tmp->mCandidatesMap.EnumerateRead(CandidatesTraverse, &cb); NS_IMPL_CYCLE_COLLECTION_TRAVERSE_SCRIPT_OBJECTS NS_IMPL_CYCLE_COLLECTION_TRAVERSE_END @@ -911,60 +942,99 @@ nsExternalResourceMap::RequestResource(nsIURI* aURI, return nullptr; } +struct +nsExternalResourceEnumArgs +{ + nsIDocument::nsSubDocEnumFunc callback; + void *data; +}; + +static PLDHashOperator +ExternalResourceEnumerator(nsIURI* aKey, + nsExternalResourceMap::ExternalResource* aData, + void* aClosure) +{ + nsExternalResourceEnumArgs* args = + static_cast(aClosure); + bool next = + aData->mDocument ? args->callback(aData->mDocument, args->data) : true; + return next ? PL_DHASH_NEXT : PL_DHASH_STOP; +} + void nsExternalResourceMap::EnumerateResources(nsIDocument::nsSubDocEnumFunc aCallback, void* aData) { - for (auto iter = mMap.ConstIter(); !iter.Done(); iter.Next()) { - auto data = iter.UserData(); - if (data->mDocument && !aCallback(data->mDocument, aData)) { - break; - } - } + nsExternalResourceEnumArgs args = { aCallback, aData }; + mMap.EnumerateRead(ExternalResourceEnumerator, &args); +} + +static PLDHashOperator +ExternalResourceTraverser(nsIURI* aKey, + nsExternalResourceMap::ExternalResource* aData, + void* aClosure) +{ + nsCycleCollectionTraversalCallback *cb = + static_cast(aClosure); + + NS_CYCLE_COLLECTION_NOTE_EDGE_NAME(*cb, + "mExternalResourceMap.mMap entry" + "->mDocument"); + cb->NoteXPCOMChild(aData->mDocument); + + NS_CYCLE_COLLECTION_NOTE_EDGE_NAME(*cb, + "mExternalResourceMap.mMap entry" + "->mViewer"); + cb->NoteXPCOMChild(aData->mViewer); + + NS_CYCLE_COLLECTION_NOTE_EDGE_NAME(*cb, + "mExternalResourceMap.mMap entry" + "->mLoadGroup"); + cb->NoteXPCOMChild(aData->mLoadGroup); + + return PL_DHASH_NEXT; } void -nsExternalResourceMap::Traverse(nsCycleCollectionTraversalCallback* cb) const +nsExternalResourceMap::Traverse(nsCycleCollectionTraversalCallback* aCallback) const { // mPendingLoads will get cleared out as the requests complete, so // no need to worry about those here. - for (auto iter = mMap.ConstIter(); !iter.Done(); iter.Next()) { - auto data = iter.UserData(); - NS_CYCLE_COLLECTION_NOTE_EDGE_NAME(*cb, - "mExternalResourceMap.mMap entry" - "->mDocument"); - cb->NoteXPCOMChild(data->mDocument); + mMap.EnumerateRead(ExternalResourceTraverser, aCallback); +} - NS_CYCLE_COLLECTION_NOTE_EDGE_NAME(*cb, - "mExternalResourceMap.mMap entry" - "->mViewer"); - cb->NoteXPCOMChild(data->mViewer); - - NS_CYCLE_COLLECTION_NOTE_EDGE_NAME(*cb, - "mExternalResourceMap.mMap entry" - "->mLoadGroup"); - cb->NoteXPCOMChild(data->mLoadGroup); +static PLDHashOperator +ExternalResourceHider(nsIURI* aKey, + nsExternalResourceMap::ExternalResource* aData, + void* aClosure) +{ + if (aData->mViewer) { + aData->mViewer->Hide(); } + return PL_DHASH_NEXT; } void nsExternalResourceMap::HideViewers() { - for (auto iter = mMap.ConstIter(); !iter.Done(); iter.Next()) { - if (auto viewer = iter.UserData()->mViewer) { - viewer->Hide(); - } + mMap.EnumerateRead(ExternalResourceHider, nullptr); +} + +static PLDHashOperator +ExternalResourceShower(nsIURI* aKey, + nsExternalResourceMap::ExternalResource* aData, + void* aClosure) +{ + if (aData->mViewer) { + aData->mViewer->Show(); } + return PL_DHASH_NEXT; } void nsExternalResourceMap::ShowViewers() { - for (auto iter = mMap.ConstIter(); !iter.Done(); iter.Next()) { - if (auto viewer = iter.UserData()->mViewer) { - viewer->Show(); - } - } + mMap.EnumerateRead(ExternalResourceShower, nullptr); } void @@ -1533,6 +1603,15 @@ nsDocument::nsDocument(const char* aContentType) } } +static PLDHashOperator +ClearAllBoxObjects(nsIContent* aKey, nsPIBoxObject* aBoxObject, void* aUserArg) +{ + if (aBoxObject) { + aBoxObject->Clear(); + } + return PL_DHASH_NEXT; +} + nsIDocument::~nsIDocument() { MOZ_ASSERT(PR_CLIST_IS_EMPTY(&mDOMMediaQueryLists), @@ -1673,7 +1752,10 @@ nsDocument::~nsDocument() delete mHeaderData; - MaybeClearBoxObjectTable(); + if (mBoxObjectTable) { + mBoxObjectTable->EnumerateRead(ClearAllBoxObjects, nullptr); + delete mBoxObjectTable; + } mPendingTitleChangeEvent.Revoke(); @@ -1784,6 +1866,18 @@ RadioGroupsTraverser(const nsAString& aKey, nsRadioGroupStruct* aData, return PL_DHASH_NEXT; } +static PLDHashOperator +BoxObjectTraverser(nsIContent* key, nsPIBoxObject* boxObject, void* userArg) +{ + nsCycleCollectionTraversalCallback *cb = + static_cast(userArg); + + NS_CYCLE_COLLECTION_NOTE_EDGE_NAME(*cb, "mBoxObjectTable entry"); + cb->NoteXPCOMChild(boxObject); + + return PL_DHASH_NEXT; +} + static const char* kNSURIs[] = { "([none])", "(xmlns)", @@ -1865,11 +1959,7 @@ NS_IMPL_CYCLE_COLLECTION_TRAVERSE_BEGIN_INTERNAL(nsDocument) // The boxobject for an element will only exist as long as it's in the // document, so we'll traverse the table here instead of from the element. if (tmp->mBoxObjectTable) { - for (auto iter = tmp->mBoxObjectTable->ConstIter(); !iter.Done(); - iter.Next()) { - NS_CYCLE_COLLECTION_NOTE_EDGE_NAME(cb, "mBoxObjectTable entry"); - cb.NoteXPCOMChild(iter.UserData()); - } + tmp->mBoxObjectTable->EnumerateRead(BoxObjectTraverser, &cb); } NS_IMPL_CYCLE_COLLECTION_TRAVERSE(mChannel) @@ -1988,7 +2078,12 @@ NS_IMPL_CYCLE_COLLECTION_UNLINK_BEGIN(nsDocument) NS_IMPL_CYCLE_COLLECTION_UNLINK(mPreloadingImages) - tmp->MaybeClearBoxObjectTable(); + + if (tmp->mBoxObjectTable) { + tmp->mBoxObjectTable->EnumerateRead(ClearAllBoxObjects, nullptr); + delete tmp->mBoxObjectTable; + tmp->mBoxObjectTable = nullptr; + } if (tmp->mListenerManager) { tmp->mListenerManager->Disconnect(); @@ -3756,23 +3851,6 @@ nsDocument::MaybeRescheduleAnimationFrameNotifications() } } -void -nsDocument::MaybeClearBoxObjectTable() -{ - if (!mBoxObjectTable) { - return; - } - - for (auto iter = mBoxObjectTable->ConstIter(); !iter.Done(); iter.Next()) { - if (auto boxObject = iter.UserData()) { - boxObject->Clear(); - } - } - - delete mBoxObjectTable; - mBoxObjectTable = nullptr; -} - void nsIDocument::TakeFrameRequestCallbacks(FrameRequestCallbackList& aCallbacks) { @@ -3821,6 +3899,14 @@ nsIDocument::ShouldThrottleFrameRequests() return false; } +PLDHashOperator RequestDiscardEnumerator(imgIRequest* aKey, + uint32_t aData, + void* userArg) +{ + aKey->RequestDiscard(); + return PL_DHASH_NEXT; +} + void nsDocument::DeleteShell() { @@ -3835,9 +3921,7 @@ nsDocument::DeleteShell() // When our shell goes away, request that all our images be immediately // discarded, so we don't carry around decoded image data for a document we // no longer intend to paint. - for (auto iter = mImageTracker.ConstIter(); !iter.Done(); iter.Next()) { - iter.Key()->RequestDiscard(); - } + mImageTracker.EnumerateRead(RequestDiscardEnumerator, nullptr); // Now that we no longer have a shell, we need to forget about any FontFace // objects for @font-face rules that came from the style set. @@ -10545,6 +10629,24 @@ nsDocument::NotifyMediaFeatureValuesChanged() } } +PLDHashOperator LockEnumerator(imgIRequest* aKey, + uint32_t aData, + void* userArg) +{ + aKey->LockImage(); + aKey->RequestDecode(); + return PL_DHASH_NEXT; +} + +PLDHashOperator UnlockEnumerator(imgIRequest* aKey, + uint32_t aData, + void* userArg) +{ + aKey->UnlockImage(); + return PL_DHASH_NEXT; +} + + nsresult nsDocument::SetImageLockingState(bool aLocked) { @@ -10558,15 +10660,9 @@ nsDocument::SetImageLockingState(bool aLocked) return NS_OK; // Otherwise, iterate over our images and perform the appropriate action. - for (auto iter = mImageTracker.ConstIter(); !iter.Done(); iter.Next()) { - imgIRequest* image = iter.Key(); - if (aLocked) { - image->LockImage(); - image->RequestDecode(); - } else { - image->UnlockImage(); - } - } + mImageTracker.EnumerateRead(aLocked ? LockEnumerator + : UnlockEnumerator, + nullptr); // Update state. mLockingImages = aLocked; @@ -10574,6 +10670,22 @@ nsDocument::SetImageLockingState(bool aLocked) return NS_OK; } +PLDHashOperator IncrementAnimationEnumerator(imgIRequest* aKey, + uint32_t aData, + void* userArg) +{ + aKey->IncrementAnimationConsumers(); + return PL_DHASH_NEXT; +} + +PLDHashOperator DecrementAnimationEnumerator(imgIRequest* aKey, + uint32_t aData, + void* userArg) +{ + aKey->DecrementAnimationConsumers(); + return PL_DHASH_NEXT; +} + void nsDocument::SetImagesNeedAnimating(bool aAnimating) { @@ -10582,14 +10694,9 @@ nsDocument::SetImagesNeedAnimating(bool aAnimating) return; // Otherwise, iterate over our images and perform the appropriate action. - for (auto iter = mImageTracker.ConstIter(); !iter.Done(); iter.Next()) { - imgIRequest* image = iter.Key(); - if (aAnimating) { - image->IncrementAnimationConsumers(); - } else { - image->DecrementAnimationConsumers(); - } - } + mImageTracker.EnumerateRead(aAnimating ? IncrementAnimationEnumerator + : DecrementAnimationEnumerator, + nullptr); // Update state. mAnimatingImages = aAnimating; diff --git a/dom/base/nsDocument.h b/dom/base/nsDocument.h index 38eaf716e85b..1e64d95be47b 100644 --- a/dom/base/nsDocument.h +++ b/dom/base/nsDocument.h @@ -1737,8 +1737,6 @@ private: // requestAnimationFrame, if it's OK to do so. void MaybeRescheduleAnimationFrameNotifications(); - void MaybeClearBoxObjectTable(); - // These are not implemented and not supported. nsDocument(const nsDocument& aOther); nsDocument& operator=(const nsDocument& aOther); diff --git a/dom/base/nsFrameMessageManager.cpp b/dom/base/nsFrameMessageManager.cpp index 3444c4ffa3bb..9d33b8d3ffeb 100644 --- a/dom/base/nsFrameMessageManager.cpp +++ b/dom/base/nsFrameMessageManager.cpp @@ -120,18 +120,26 @@ nsFrameMessageManager::~nsFrameMessageManager() } } +static PLDHashOperator +CycleCollectorTraverseListeners(const nsAString& aKey, + nsAutoTObserverArray* aListeners, + void* aCb) +{ + nsCycleCollectionTraversalCallback* cb = + static_cast (aCb); + uint32_t count = aListeners->Length(); + for (uint32_t i = 0; i < count; ++i) { + NS_CYCLE_COLLECTION_NOTE_EDGE_NAME(*cb, "listeners[i] mStrongListener"); + cb->NoteXPCOMChild(aListeners->ElementAt(i).mStrongListener.get()); + } + return PL_DHASH_NEXT; +} + NS_IMPL_CYCLE_COLLECTION_CLASS(nsFrameMessageManager) NS_IMPL_CYCLE_COLLECTION_TRAVERSE_BEGIN(nsFrameMessageManager) - for (auto iter = tmp->mListeners.ConstIter(); !iter.Done(); iter.Next()) { - auto listeners = iter.UserData(); - const uint32_t count = listeners->Length(); - - for (uint32_t i = 0; i < count; ++i) { - NS_CYCLE_COLLECTION_NOTE_EDGE_NAME(cb, "listeners[i] mStrongListener"); - cb.NoteXPCOMChild(listeners->ElementAt(i).mStrongListener.get()); - } - } + tmp->mListeners.EnumerateRead(CycleCollectorTraverseListeners, + static_cast(&cb)); NS_IMPL_CYCLE_COLLECTION_TRAVERSE(mChildManagers) NS_IMPL_CYCLE_COLLECTION_TRAVERSE(mParentManager) NS_IMPL_CYCLE_COLLECTION_TRAVERSE_SCRIPT_OBJECTS @@ -407,6 +415,35 @@ nsFrameMessageManager::RemoveMessageListener(const nsAString& aMessage, return NS_OK; } +#ifdef DEBUG +typedef struct +{ + nsCOMPtr mCanonical; + nsWeakPtr mWeak; +} CanonicalCheckerParams; + +static PLDHashOperator +CanonicalChecker(const nsAString& aKey, + nsAutoTObserverArray* aListeners, + void* aParams) +{ + CanonicalCheckerParams* params = + static_cast (aParams); + + uint32_t count = aListeners->Length(); + for (uint32_t i = 0; i < count; i++) { + if (!aListeners->ElementAt(i).mWeakListener) { + continue; + } + nsCOMPtr otherCanonical = + do_QueryReferent(aListeners->ElementAt(i).mWeakListener); + MOZ_ASSERT((params->mCanonical == otherCanonical) == + (params->mWeak == aListeners->ElementAt(i).mWeakListener)); + } + return PL_DHASH_NEXT; +} +#endif + NS_IMETHODIMP nsFrameMessageManager::AddWeakMessageListener(const nsAString& aMessage, nsIMessageListener* aListener) @@ -415,24 +452,15 @@ nsFrameMessageManager::AddWeakMessageListener(const nsAString& aMessage, NS_ENSURE_TRUE(weak, NS_ERROR_NO_INTERFACE); #ifdef DEBUG - { - // It's technically possible that one object X could give two different - // nsIWeakReference*'s when you do_GetWeakReference(X). We really don't - // want this to happen; it will break e.g. RemoveWeakMessageListener. So - // let's check that we're not getting ourselves into that situation. - nsCOMPtr canonical = do_QueryInterface(aListener); - - for (auto iter = mListeners.ConstIter(); !iter.Done(); iter.Next()) { - auto listeners = iter.UserData(); - const uint32_t count = listeners->Length(); - for (uint32_t i = 0; i < count; i++) { - if (auto listener = listeners->ElementAt(i).mWeakListener) { - nsCOMPtr otherCanonical = do_QueryReferent(listener); - MOZ_ASSERT((canonical == otherCanonical) == (weak == listener)); - } - } - } - } + // It's technically possible that one object X could give two different + // nsIWeakReference*'s when you do_GetWeakReference(X). We really don't want + // this to happen; it will break e.g. RemoveWeakMessageListener. So let's + // check that we're not getting ourselves into that situation. + nsCOMPtr canonical = do_QueryInterface(aListener); + CanonicalCheckerParams params; + params.mCanonical = canonical; + params.mWeak = weak; + mListeners.EnumerateRead(CanonicalChecker, (void*)¶ms); #endif nsAutoTObserverArray* listeners = @@ -1444,45 +1472,55 @@ protected: NS_IMPL_ISUPPORTS(MessageManagerReporter, nsIMemoryReporter) +static PLDHashOperator +CollectMessageListenerData(const nsAString& aKey, + nsAutoTObserverArray* aListeners, + void* aData) +{ + MessageManagerReferentCount* referentCount = + static_cast(aData); + + uint32_t listenerCount = aListeners->Length(); + if (!listenerCount) { + return PL_DHASH_NEXT; + } + + nsString key(aKey); + uint32_t oldCount = 0; + referentCount->mMessageCounter.Get(key, &oldCount); + uint32_t currentCount = oldCount + listenerCount; + referentCount->mMessageCounter.Put(key, currentCount); + + // Keep track of messages that have a suspiciously large + // number of referents (symptom of leak). + if (currentCount == MessageManagerReporter::kSuspectReferentCount) { + referentCount->mSuspectMessages.AppendElement(key); + } + + for (uint32_t i = 0; i < listenerCount; ++i) { + const nsMessageListenerInfo& listenerInfo = + aListeners->ElementAt(i); + if (listenerInfo.mWeakListener) { + nsCOMPtr referent = + do_QueryReferent(listenerInfo.mWeakListener); + if (referent) { + referentCount->mWeakAlive++; + } else { + referentCount->mWeakDead++; + } + } else { + referentCount->mStrong++; + } + } + return PL_DHASH_NEXT; +} + void MessageManagerReporter::CountReferents(nsFrameMessageManager* aMessageManager, MessageManagerReferentCount* aReferentCount) { - for (auto iter = aMessageManager->mListeners.ConstIter(); - !iter.Done(); iter.Next()) { - auto listeners = iter.UserData(); - const uint32_t listenerCount = listeners->Length(); - if (!listenerCount) { - continue; - } - - nsString key(iter.Key()); - uint32_t oldCount = 0; - aReferentCount->mMessageCounter.Get(key, &oldCount); - uint32_t currentCount = oldCount + listenerCount; - aReferentCount->mMessageCounter.Put(key, currentCount); - - // Keep track of messages that have a suspiciously large - // number of referents (symptom of leak). - if (currentCount == MessageManagerReporter::kSuspectReferentCount) { - aReferentCount->mSuspectMessages.AppendElement(key); - } - - for (uint32_t i = 0; i < listenerCount; ++i) { - const nsMessageListenerInfo& listenerInfo = listeners->ElementAt(i); - if (listenerInfo.mWeakListener) { - nsCOMPtr referent = - do_QueryReferent(listenerInfo.mWeakListener); - if (referent) { - aReferentCount->mWeakAlive++; - } else { - aReferentCount->mWeakDead++; - } - } else { - aReferentCount->mStrong++; - } - } - } + aMessageManager->mListeners.EnumerateRead(CollectMessageListenerData, + aReferentCount); // Add referent count in child managers because the listeners // participate in messages dispatched from parent message manager. @@ -2129,19 +2167,24 @@ NS_NewChildProcessMessageManager(nsISyncMessageSender** aResult) } +static PLDHashOperator +CycleCollectorMarkListeners(const nsAString& aKey, + nsAutoTObserverArray* aListeners, + void* aData) +{ + uint32_t count = aListeners->Length(); + for (uint32_t i = 0; i < count; i++) { + if (aListeners->ElementAt(i).mStrongListener) { + xpc_TryUnmarkWrappedGrayObject(aListeners->ElementAt(i).mStrongListener); + } + } + return PL_DHASH_NEXT; +} + bool nsFrameMessageManager::MarkForCC() { - for (auto iter = mListeners.ConstIter(); !iter.Done(); iter.Next()) { - auto listeners = iter.UserData(); - const uint32_t count = listeners->Length(); - - for (uint32_t i = 0; i < count; i++) { - if (auto listener = listeners->ElementAt(i).mStrongListener) { - xpc_TryUnmarkWrappedGrayObject(listener); - } - } - } + mListeners.EnumerateRead(CycleCollectorMarkListeners, nullptr); if (mRefCnt.IsPurple()) { mRefCnt.RemovePurple(); diff --git a/dom/xbl/nsXBLDocumentInfo.cpp b/dom/xbl/nsXBLDocumentInfo.cpp index daf9f544ab2d..f9560350416e 100644 --- a/dom/xbl/nsXBLDocumentInfo.cpp +++ b/dom/xbl/nsXBLDocumentInfo.cpp @@ -316,13 +316,18 @@ nsXBLDocumentInfo::SetFirstPrototypeBinding(nsXBLPrototypeBinding* aBinding) mFirstBinding = aBinding; } +static PLDHashOperator +FlushScopedSkinSheets(const nsACString &aKey, nsXBLPrototypeBinding *aProto, void* aClosure) +{ + aProto->FlushSkinSheets(); + return PL_DHASH_NEXT; +} + void nsXBLDocumentInfo::FlushSkinStylesheets() { if (mBindingTable) { - for (auto iter = mBindingTable->ConstIter(); !iter.Done(); iter.Next()) { - iter.UserData()->FlushSkinSheets(); - } + mBindingTable->EnumerateRead(FlushScopedSkinSheets, nullptr); } } From c9839dd8f906d04aafdc6effb65c326ba2e751cb Mon Sep 17 00:00:00 2001 From: "Carsten \"Tomcat\" Book" Date: Mon, 27 Jul 2015 08:01:09 +0200 Subject: [PATCH 093/136] Backed out changeset 1ca5723f69d4 (bug 1186780) for dom crashes --- dom/events/DataContainerEvent.cpp | 16 +++++++++-- dom/events/DataContainerEvent.h | 3 ++ dom/xbl/nsXBLDocumentInfo.cpp | 47 +++++++++++++++++++++++-------- xpcom/glue/nsBaseHashtable.h | 35 +++++++++++++++++++++++ xpcom/glue/nsInterfaceHashtable.h | 7 +++-- xpcom/glue/nsRefPtrHashtable.h | 7 +++-- 6 files changed, 95 insertions(+), 20 deletions(-) diff --git a/dom/events/DataContainerEvent.cpp b/dom/events/DataContainerEvent.cpp index 4878f467f336..66d10be099f0 100644 --- a/dom/events/DataContainerEvent.cpp +++ b/dom/events/DataContainerEvent.cpp @@ -28,11 +28,11 @@ DataContainerEvent::DataContainerEvent(EventTarget* aOwner, NS_IMPL_CYCLE_COLLECTION_CLASS(DataContainerEvent) NS_IMPL_CYCLE_COLLECTION_UNLINK_BEGIN_INHERITED(DataContainerEvent, Event) - NS_IMPL_CYCLE_COLLECTION_UNLINK(mData) + tmp->mData.Clear(); NS_IMPL_CYCLE_COLLECTION_UNLINK_END NS_IMPL_CYCLE_COLLECTION_TRAVERSE_BEGIN_INHERITED(DataContainerEvent, Event) - NS_IMPL_CYCLE_COLLECTION_TRAVERSE(mData) + tmp->mData.EnumerateRead(TraverseEntry, &cb); NS_IMPL_CYCLE_COLLECTION_TRAVERSE_END NS_IMPL_ADDREF_INHERITED(DataContainerEvent, Event) @@ -81,6 +81,18 @@ DataContainerEvent::SetData(JSContext* aCx, const nsAString& aKey, aRv = SetData(aKey, val); } +PLDHashOperator +DataContainerEvent::TraverseEntry(const nsAString& aKey, + nsIVariant* aDataItem, + void* aUserArg) +{ + nsCycleCollectionTraversalCallback *cb = + static_cast(aUserArg); + cb->NoteXPCOMChild(aDataItem); + + return PL_DHASH_NEXT; +} + } // namespace dom } // namespace mozilla diff --git a/dom/events/DataContainerEvent.h b/dom/events/DataContainerEvent.h index 15acfeb44b7d..51cbe2bcb4c5 100644 --- a/dom/events/DataContainerEvent.h +++ b/dom/events/DataContainerEvent.h @@ -51,6 +51,9 @@ protected: ~DataContainerEvent() {} private: + static PLDHashOperator + TraverseEntry(const nsAString& aKey, nsIVariant* aDataItem, void* aUserArg); + nsInterfaceHashtable mData; }; diff --git a/dom/xbl/nsXBLDocumentInfo.cpp b/dom/xbl/nsXBLDocumentInfo.cpp index f9560350416e..645b1f9ea17e 100644 --- a/dom/xbl/nsXBLDocumentInfo.cpp +++ b/dom/xbl/nsXBLDocumentInfo.cpp @@ -39,14 +39,42 @@ using namespace mozilla::dom; static const char kXBLCachePrefix[] = "xblcache"; /* Implementation file */ + +static PLDHashOperator +TraverseProtos(const nsACString &aKey, nsXBLPrototypeBinding *aProto, void* aClosure) +{ + nsCycleCollectionTraversalCallback *cb = + static_cast(aClosure); + aProto->Traverse(*cb); + return PL_DHASH_NEXT; +} + +static PLDHashOperator +UnlinkProto(const nsACString &aKey, nsXBLPrototypeBinding *aProto, void* aClosure) +{ + aProto->Unlink(); + return PL_DHASH_NEXT; +} + +struct ProtoTracer +{ + const TraceCallbacks &mCallbacks; + void *mClosure; +}; + +static PLDHashOperator +TraceProtos(const nsACString &aKey, nsXBLPrototypeBinding *aProto, void* aClosure) +{ + ProtoTracer* closure = static_cast(aClosure); + aProto->Trace(closure->mCallbacks, closure->mClosure); + return PL_DHASH_NEXT; +} + NS_IMPL_CYCLE_COLLECTION_CLASS(nsXBLDocumentInfo) NS_IMPL_CYCLE_COLLECTION_UNLINK_BEGIN(nsXBLDocumentInfo) if (tmp->mBindingTable) { - for (auto iter = tmp->mBindingTable->ConstIter(); - !iter.Done(); iter.Next()) { - iter.UserData()->Unlink(); - } + tmp->mBindingTable->EnumerateRead(UnlinkProto, nullptr); } NS_IMPL_CYCLE_COLLECTION_UNLINK(mDocument) NS_IMPL_CYCLE_COLLECTION_UNLINK_END @@ -58,19 +86,14 @@ NS_IMPL_CYCLE_COLLECTION_TRAVERSE_BEGIN(nsXBLDocumentInfo) } NS_IMPL_CYCLE_COLLECTION_TRAVERSE(mDocument) if (tmp->mBindingTable) { - for (auto iter = tmp->mBindingTable->ConstIter(); - !iter.Done(); iter.Next()) { - iter.UserData()->Traverse(cb); - } + tmp->mBindingTable->EnumerateRead(TraverseProtos, &cb); } NS_IMPL_CYCLE_COLLECTION_TRAVERSE_SCRIPT_OBJECTS NS_IMPL_CYCLE_COLLECTION_TRAVERSE_END NS_IMPL_CYCLE_COLLECTION_TRACE_BEGIN(nsXBLDocumentInfo) if (tmp->mBindingTable) { - for (auto iter = tmp->mBindingTable->ConstIter(); - !iter.Done(); iter.Next()) { - iter.UserData()->Trace(aCallbacks, aClosure); - } + ProtoTracer closure = { aCallbacks, aClosure }; + tmp->mBindingTable->EnumerateRead(TraceProtos, &closure); } NS_IMPL_CYCLE_COLLECTION_TRACE_END diff --git a/xpcom/glue/nsBaseHashtable.h b/xpcom/glue/nsBaseHashtable.h index 50658f5d62ce..eef5b386b03e 100644 --- a/xpcom/glue/nsBaseHashtable.h +++ b/xpcom/glue/nsBaseHashtable.h @@ -343,6 +343,41 @@ protected: void* aArg); }; +class nsCycleCollectionTraversalCallback; + +struct MOZ_STACK_CLASS nsBaseHashtableCCTraversalData +{ + nsBaseHashtableCCTraversalData(nsCycleCollectionTraversalCallback& aCallback, + const char* aName, + uint32_t aFlags) + : mCallback(aCallback) + , mName(aName) + , mFlags(aFlags) + { + } + + nsCycleCollectionTraversalCallback& mCallback; + const char* mName; + uint32_t mFlags; + +}; + +template +PLDHashOperator +ImplCycleCollectionTraverse_EnumFunc(K aKey, + T aData, + void* aUserData) +{ + nsBaseHashtableCCTraversalData* userData = + static_cast(aUserData); + + CycleCollectionNoteChild(userData->mCallback, + aData, + userData->mName, + userData->mFlags); + return PL_DHASH_NEXT; +} + // // nsBaseHashtableET definitions // diff --git a/xpcom/glue/nsInterfaceHashtable.h b/xpcom/glue/nsInterfaceHashtable.h index 14368af63764..ee803bce67ad 100644 --- a/xpcom/glue/nsInterfaceHashtable.h +++ b/xpcom/glue/nsInterfaceHashtable.h @@ -69,9 +69,10 @@ ImplCycleCollectionTraverse(nsCycleCollectionTraversalCallback& aCallback, const char* aName, uint32_t aFlags = 0) { - for (auto iter = aField.ConstIter(); !iter.Done(); iter.Next()) { - CycleCollectionNoteChild(aCallback, iter.UserData(), aName, aFlags); - } + nsBaseHashtableCCTraversalData userData(aCallback, aName, aFlags); + + aField.EnumerateRead(ImplCycleCollectionTraverse_EnumFunc, + &userData); } // diff --git a/xpcom/glue/nsRefPtrHashtable.h b/xpcom/glue/nsRefPtrHashtable.h index e49274ae53c1..be9777d90650 100644 --- a/xpcom/glue/nsRefPtrHashtable.h +++ b/xpcom/glue/nsRefPtrHashtable.h @@ -84,9 +84,10 @@ ImplCycleCollectionTraverse(nsCycleCollectionTraversalCallback& aCallback, const char* aName, uint32_t aFlags = 0) { - for (auto iter = aField.ConstIter(); !iter.Done(); iter.Next()) { - CycleCollectionNoteChild(aCallback, iter.UserData(), aName, aFlags); - } + nsBaseHashtableCCTraversalData userData(aCallback, aName, aFlags); + + aField.EnumerateRead(ImplCycleCollectionTraverse_EnumFunc, + &userData); } // From 3585bedd89bc8a96ce921b76990d3e5a4ed313be Mon Sep 17 00:00:00 2001 From: Cameron McCormack Date: Mon, 27 Jul 2015 16:43:44 +1000 Subject: [PATCH 094/136] Bug 1181011 - Don't use cached rule node structs for animations within pseudo-elements. r=dbaron a=abillings --- layout/style/AnimationCommon.cpp | 11 ++++++++ layout/style/nsRuleNode.cpp | 21 +++++++++++--- layout/style/nsRuleNode.h | 47 ++++++++++++++++++++++++++++---- layout/style/nsStyleSet.cpp | 8 ++++++ layout/style/nsStyleStruct.h | 4 +++ 5 files changed, 81 insertions(+), 10 deletions(-) diff --git a/layout/style/AnimationCommon.cpp b/layout/style/AnimationCommon.cpp index eaa04ce71e48..ebabe547b680 100644 --- a/layout/style/AnimationCommon.cpp +++ b/layout/style/AnimationCommon.cpp @@ -231,6 +231,7 @@ CommonAnimationManager::RulesMatching(ElementRuleProcessorData* aData) nsCSSPseudoElements::ePseudo_NotPseudoElement); if (rule) { aData->mRuleWalker->Forward(rule); + aData->mRuleWalker->CurrentNode()->SetIsAnimationRule(); } } @@ -250,6 +251,7 @@ CommonAnimationManager::RulesMatching(PseudoElementRuleProcessorData* aData) nsIStyleRule *rule = GetAnimationRule(aData->mElement, aData->mPseudoType); if (rule) { aData->mRuleWalker->Forward(rule); + aData->mRuleWalker->CurrentNode()->SetIsAnimationRule(); } } @@ -486,6 +488,15 @@ AnimValuesStyleRule::MapRuleInfoInto(nsRuleData* aRuleData) // Don't apply transitions or animations to things inside of // pseudo-elements. // FIXME (Bug 522599): Add tests for this. + + // Prevent structs from being cached on the rule node since we're inside + // a pseudo-element, as we could determine cacheability differently + // when walking the rule tree for a style context that is not inside + // a pseudo-element. Note that nsRuleNode::GetStyle##name_ and GetStyleData + // will never look at cached structs when we're animating things inside + // a pseduo-element, so that we don't incorrectly return a struct that + // is only appropriate for non-pseudo-elements. + aRuleData->mConditions.SetUncacheable(); return; } diff --git a/layout/style/nsRuleNode.cpp b/layout/style/nsRuleNode.cpp index d03564b1f658..5aa95d896452 100644 --- a/layout/style/nsRuleNode.cpp +++ b/layout/style/nsRuleNode.cpp @@ -1475,7 +1475,8 @@ nsRuleNode::nsRuleNode(nsPresContext* aContext, nsRuleNode* aParent, mNextSibling(nullptr), mDependentBits((uint32_t(aLevel) << NS_RULE_NODE_LEVEL_SHIFT) | (aIsImportant ? NS_RULE_NODE_IS_IMPORTANT : 0)), - mNoneBits(0), + mNoneBits(aParent ? aParent->mNoneBits & NS_RULE_NODE_HAS_ANIMATION_DATA : + 0), mRefCnt(0) { MOZ_ASSERT(aContext); @@ -9321,9 +9322,14 @@ nsRuleNode::GetStyleData(nsStyleStructID aSID, "in some way."); const void *data; - data = mStyleData.GetStyleData(aSID, aContext); - if (MOZ_LIKELY(data != nullptr)) - return data; // We have a fully specified struct. Just return it. + + // Never use cached data for animated style inside a pseudo-element; + // see comment on cacheability in AnimValuesStyleRule::MapRuleInfoInto. + if (!(HasAnimationData() && ParentHasPseudoElementData(aContext))) { + data = mStyleData.GetStyleData(aSID, aContext); + if (MOZ_LIKELY(data != nullptr)) + return data; // We have a fully specified struct. Just return it. + } if (MOZ_UNLIKELY(!aComputeData)) return nullptr; @@ -9779,3 +9785,10 @@ nsRuleNode::ComputeColor(const nsCSSValue& aValue, nsPresContext* aPresContext, MOZ_ASSERT(ok || !(aPresContext && aStyleContext)); return ok; } + +/* static */ bool +nsRuleNode::ParentHasPseudoElementData(nsStyleContext* aContext) +{ + nsStyleContext* parent = aContext->GetParent(); + return parent && parent->HasPseudoElementData(); +} diff --git a/layout/style/nsRuleNode.h b/layout/style/nsRuleNode.h index 854719adb9f4..1fbc49553bc6 100644 --- a/layout/style/nsRuleNode.h +++ b/layout/style/nsRuleNode.h @@ -843,6 +843,29 @@ public: return (mDependentBits & NS_RULE_NODE_USED_DIRECTLY) != 0; } + /** + * Is the mRule of this rule node an AnimValuesStyleRule? + */ + void SetIsAnimationRule() { + MOZ_ASSERT(!HaveChildren() || + (mDependentBits & NS_RULE_NODE_IS_ANIMATION_RULE), + "SetIsAnimationRule must only set the IS_ANIMATION_RULE bit " + "before the rule node has children"); + mDependentBits |= NS_RULE_NODE_IS_ANIMATION_RULE; + mNoneBits |= NS_RULE_NODE_HAS_ANIMATION_DATA; + } + bool IsAnimationRule() const { + return (mDependentBits & NS_RULE_NODE_IS_ANIMATION_RULE) != 0; + } + + /** + * Is the mRule of this rule node or any of its ancestors an + * AnimValuesStyleRule? + */ + bool HasAnimationData() const { + return (mNoneBits & NS_RULE_NODE_HAS_ANIMATION_DATA) != 0; + } + // NOTE: Does not |AddRef|. Null only for the root. nsIStyleRule* GetRule() const { return mRule; } // NOTE: Does not |AddRef|. Never null. @@ -866,9 +889,14 @@ public: "in some way."); \ \ const nsStyle##name_ *data; \ - data = mStyleData.GetStyle##name_(); \ - if (MOZ_LIKELY(data != nullptr)) \ - return data; \ + \ + /* Never use cached data for animated style inside a pseudo-element; */ \ + /* see comment on cacheability in AnimValuesStyleRule::MapRuleInfoInto */ \ + if (!(HasAnimationData() && ParentHasPseudoElementData(aContext))) { \ + data = mStyleData.GetStyle##name_(); \ + if (MOZ_LIKELY(data != nullptr)) \ + return data; \ + } \ \ if (!aComputeData) \ return nullptr; \ @@ -891,9 +919,14 @@ public: "in some way."); \ \ const nsStyle##name_ *data; \ - data = mStyleData.GetStyle##name_(aContext); \ - if (MOZ_LIKELY(data != nullptr)) \ - return data; \ + \ + /* Never use cached data for animated style inside a pseudo-element; */ \ + /* see comment on cacheability in AnimValuesStyleRule::MapRuleInfoInto */ \ + if (!(HasAnimationData() && ParentHasPseudoElementData(aContext))) { \ + data = mStyleData.GetStyle##name_(aContext); \ + if (MOZ_LIKELY(data != nullptr)) \ + return data; \ + } \ \ if (!aComputeData) \ return nullptr; \ @@ -1017,6 +1050,8 @@ public: nsPresContext* aPresContext, nsStyleContext* aStyleContext, nscolor& aResult); + + static bool ParentHasPseudoElementData(nsStyleContext* aContext); }; #endif diff --git a/layout/style/nsStyleSet.cpp b/layout/style/nsStyleSet.cpp index b7932c19346d..422e50ad017d 100644 --- a/layout/style/nsStyleSet.cpp +++ b/layout/style/nsStyleSet.cpp @@ -845,6 +845,7 @@ ReplaceAnimationRule(nsRuleNode *aOldRuleNode, if (aNewAnimRule) { n = n->Transition(aNewAnimRule, nsStyleSet::eAnimationSheet, false); + n->SetIsAnimationRule(); } for (uint32_t i = moreSpecificNodes.Length(); i-- != 0; ) { @@ -1439,6 +1440,7 @@ struct RuleNodeInfo { nsIStyleRule* mRule; uint8_t mLevel; bool mIsImportant; + bool mIsAnimationRule; }; struct CascadeLevel { @@ -1508,6 +1510,7 @@ nsStyleSet::RuleNodeWithReplacement(Element* aElement, curRule->mRule = ruleNode->GetRule(); curRule->mLevel = ruleNode->GetLevel(); curRule->mIsImportant = ruleNode->IsImportantRule(); + curRule->mIsAnimationRule = ruleNode->IsAnimationRule(); } nsRuleWalker ruleWalker(mRuleTree, mAuthorStyleDisabled); @@ -1538,6 +1541,7 @@ nsStyleSet::RuleNodeWithReplacement(Element* aElement, GetAnimationRule(aElement, aPseudoType); if (rule) { ruleWalker.ForwardOnPossiblyCSSRule(rule); + ruleWalker.CurrentNode()->SetIsAnimationRule(); } } break; @@ -1550,6 +1554,7 @@ nsStyleSet::RuleNodeWithReplacement(Element* aElement, GetAnimationRule(aElement, aPseudoType); if (rule) { ruleWalker.ForwardOnPossiblyCSSRule(rule); + ruleWalker.CurrentNode()->SetIsAnimationRule(); } } break; @@ -1615,6 +1620,9 @@ nsStyleSet::RuleNodeWithReplacement(Element* aElement, if (!doReplace) { ruleWalker.ForwardOnPossiblyCSSRule(ruleInfo.mRule); + if (ruleInfo.mIsAnimationRule) { + ruleWalker.CurrentNode()->SetIsAnimationRule(); + } } } } diff --git a/layout/style/nsStyleStruct.h b/layout/style/nsStyleStruct.h index c5c0e6c4d7a6..15e59f13ae23 100644 --- a/layout/style/nsStyleStruct.h +++ b/layout/style/nsStyleStruct.h @@ -67,12 +67,16 @@ class imgIContainer; #define NS_STYLE_CONTEXT_TYPE_SHIFT 34 // Additional bits for nsRuleNode's mDependentBits: +#define NS_RULE_NODE_IS_ANIMATION_RULE 0x01000000 #define NS_RULE_NODE_GC_MARK 0x02000000 #define NS_RULE_NODE_USED_DIRECTLY 0x04000000 #define NS_RULE_NODE_IS_IMPORTANT 0x08000000 #define NS_RULE_NODE_LEVEL_MASK 0xf0000000 #define NS_RULE_NODE_LEVEL_SHIFT 28 +// Additional bits for nsRuleNode's mNoneBits: +#define NS_RULE_NODE_HAS_ANIMATION_DATA 0x80000000 + // The lifetime of these objects is managed by the presshell's arena. struct nsStyleFont { From e4c7727ffde3d09132c843dd82f210d74f93d327 Mon Sep 17 00:00:00 2001 From: "Carsten \"Tomcat\" Book" Date: Mon, 27 Jul 2015 08:47:00 +0200 Subject: [PATCH 095/136] Backed out changeset d4b6f85c0d42 (bug 1172382) --HG-- extra : rebase_source : 9f4c229d85a66afd40afb02ebdcaed912b53f153 --- b2g/app/b2g.js | 11 ++++------- modules/libpref/init/all.js | 4 ++-- 2 files changed, 6 insertions(+), 9 deletions(-) diff --git a/b2g/app/b2g.js b/b2g/app/b2g.js index 7e9afdd3980a..136aace65078 100644 --- a/b2g/app/b2g.js +++ b/b2g/app/b2g.js @@ -1100,14 +1100,11 @@ pref("dom.wakelock.enabled", true); // Enable webapps add-ons pref("dom.apps.customization.enabled", true); -// Original caret implementation on collapsed selection. -pref("touchcaret.enabled", false); +// Enable touch caret by default +pref("touchcaret.enabled", true); -// Original caret implementation on non-collapsed selection. -pref("selectioncaret.enabled", false); - -// New implementation to unify touch-caret and selection-carets. -pref("layout.accessiblecaret.enabled", true); +// Enable selection caret by default +pref("selectioncaret.enabled", true); // Enable sync and mozId with Firefox Accounts. pref("services.sync.fxaccounts.enabled", true); diff --git a/modules/libpref/init/all.js b/modules/libpref/init/all.js index cad1b7ca576d..08b07b692f5b 100644 --- a/modules/libpref/init/all.js +++ b/modules/libpref/init/all.js @@ -4739,7 +4739,7 @@ pref("browser.trackingprotection.gethashURL", "https://tracking.services.mozilla // Turn off Spatial navigation by default. pref("snav.enabled", false); -// Original caret implementation on collapsed selection. +// Turn off touch caret by default. pref("touchcaret.enabled", false); // This will inflate the size of the touch caret frame when checking if user @@ -4751,7 +4751,7 @@ pref("touchcaret.inflatesize.threshold", 40); // In milliseconds. (0 means disable this feature) pref("touchcaret.expiration.time", 3000); -// Original caret implementation on non-collapsed selection. +// Turn off selection caret by default pref("selectioncaret.enabled", false); // This will inflate size of selection caret frame when we checking if From ac10f60e11a0bd6738a53d3d7264c2f7d20852a8 Mon Sep 17 00:00:00 2001 From: "Carsten \"Tomcat\" Book" Date: Mon, 27 Jul 2015 08:47:23 +0200 Subject: [PATCH 096/136] Backed out changeset c5e6edadb0d1 (bug 1172382) for mulet R6 Reftest Failures --HG-- extra : rebase_source : f592d5f7b3785548007033e9946cea5af9ebc7c9 --- dom/events/test/test_clickevent_on_input.html | 3 +-- editor/reftests/reftest.list | 4 ++-- layout/base/tests/test_bug558663.html | 3 +-- layout/base/tests/test_reftests_with_caret.html | 10 ++++------ 4 files changed, 8 insertions(+), 12 deletions(-) diff --git a/dom/events/test/test_clickevent_on_input.html b/dom/events/test/test_clickevent_on_input.html index a426f8b1df24..86737329f93c 100644 --- a/dom/events/test/test_clickevent_on_input.html +++ b/dom/events/test/test_clickevent_on_input.html @@ -52,8 +52,7 @@ function isEnabledMiddleClickPaste() function isEnabledTouchCaret() { try { - return SpecialPowers.getBoolPref("touchcaret.enabled") || - SpecialPowers.getBoolPref("layout.accessiblecaret.enabled"); + return SpecialPowers.getBoolPref("touchcaret.enabled"); } catch (e) { return false; } diff --git a/editor/reftests/reftest.list b/editor/reftests/reftest.list index 0e9c48140a5f..5b11dcd387a5 100644 --- a/editor/reftests/reftest.list +++ b/editor/reftests/reftest.list @@ -104,11 +104,11 @@ skip-if(Android||B2G||Mulet) needs-focus == 462758-grabbers-resizers.html 462758 == 388980-1.html 388980-1-ref.html needs-focus == spellcheck-superscript-1.html spellcheck-superscript-1-ref.html skip-if(B2G||Mulet) fails-if(Android) needs-focus != spellcheck-superscript-2.html spellcheck-superscript-2-ref.html # bug 783658 # Initial mulet triage: parity with B2G/B2G Desktop -needs-focus pref(selectioncaret.enabled,false) pref(layout.accessiblecaret.enabled,false) == 824080-1.html 824080-1-ref.html +needs-focus pref(selectioncaret.enabled,false) == 824080-1.html 824080-1-ref.html needs-focus pref(selectioncaret.enabled,false) == 824080-2.html 824080-2-ref.html needs-focus pref(selectioncaret.enabled,false) == 824080-3.html 824080-3-ref.html needs-focus != 824080-2.html 824080-3.html -needs-focus pref(selectioncaret.enabled,false) pref(layout.accessiblecaret.enabled,false) == 824080-4.html 824080-4-ref.html +needs-focus pref(selectioncaret.enabled,false) == 824080-4.html 824080-4-ref.html needs-focus pref(selectioncaret.enabled,false) == 824080-5.html 824080-5-ref.html needs-focus != 824080-4.html 824080-5.html needs-focus == 824080-6.html 824080-6-ref.html diff --git a/layout/base/tests/test_bug558663.html b/layout/base/tests/test_bug558663.html index 737d32d62845..21543360f505 100644 --- a/layout/base/tests/test_bug558663.html +++ b/layout/base/tests/test_bug558663.html @@ -28,8 +28,7 @@ SimpleTest.waitForExplicitFinish(); // Selection caret's pref is checked only when PresShell is initialized. To turn // off the pref, we test bug 558663 in an iframe. - SpecialPowers.pushPrefEnv({"set": [['selectioncaret.enabled', false], - ['layout.accessiblecaret.enabled', false]]}, function() { + SpecialPowers.pushPrefEnv({"set": [['selectioncaret.enabled', false]]}, function() { var iframe = document.createElement("iframe"); iframe.src = "bug558663.html"; document.getElementById('container').appendChild(iframe); diff --git a/layout/base/tests/test_reftests_with_caret.html b/layout/base/tests/test_reftests_with_caret.html index cc617ba24465..452cd77ca289 100644 --- a/layout/base/tests/test_reftests_with_caret.html +++ b/layout/base/tests/test_reftests_with_caret.html @@ -109,9 +109,8 @@ var tests = [ // The following test cases are all involving with one sending // synthesizeKey(), the other without. They fail when the touch // or selection caret is enabled. Test them with these preferences off. - function() {SpecialPowers.pushPrefEnv({'set': [['touchcaret.enabled', false], - ['selectioncaret.enabled', false], - ['layout.accessiblecaret.enabled', false]]}, nextTest);} , + function() {SpecialPowers.pushPrefEnv({'set': [['touchcaret.enabled', false]]}, nextTest);} , + function() {SpecialPowers.pushPrefEnv({'set': [['selectioncaret.enabled', false]]}, nextTest);} , [ 'bug240933-1.html' , 'bug240933-1-ref.html' ] , [ 'bug240933-2.html' , 'bug240933-1-ref.html' ] , [ 'bug389321-1.html' , 'bug389321-1-ref.html' ] , @@ -157,9 +156,8 @@ var tests = [ [ 'bug1123067-2.html' , 'bug1123067-ref.html' ] , [ 'bug1123067-3.html' , 'bug1123067-ref.html' ] , [ 'bug1132768-1.html' , 'bug1132768-1-ref.html'] , - function() {SpecialPowers.pushPrefEnv({'clear': [['touchcaret.enabled'], - ['selectioncaret.enabled'], - ['layout.accessiblecaret.enabled']]}, nextTest);} , + function() {SpecialPowers.pushPrefEnv({'clear': [['touchcaret.enabled']]}, nextTest);} , + function() {SpecialPowers.pushPrefEnv({'clear': [['selectioncaret.enabled']]}, nextTest);} , ]; if (navigator.appVersion.indexOf("Android") == -1 && From 601846243f8e69ec002e3e71bdc533bc6c507340 Mon Sep 17 00:00:00 2001 From: Jonathan Kew Date: Mon, 27 Jul 2015 08:06:46 +0100 Subject: [PATCH 097/136] Bug 1184295 - Ensure the containing block has a constrained size during logical-properties tests, to suppress unconstrained-isize warnings. r=heycam --- layout/style/test/test_logical_properties.html | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/layout/style/test/test_logical_properties.html b/layout/style/test/test_logical_properties.html index 842b638021e6..3b3dbf415f23 100644 --- a/layout/style/test/test_logical_properties.html +++ b/layout/style/test/test_logical_properties.html @@ -5,7 +5,12 @@ -
+ + + +
+ - - - - -
-
-
- -