+ Goal of this test is to check that modifying defaultValue and value attribute
+ of input types is working as expected.
+
+
+
+
+
+
+
diff --git a/content/media/MediaDecoderStateMachine.cpp b/content/media/MediaDecoderStateMachine.cpp
index c5ae7d08c663..f2e3449484fc 100644
--- a/content/media/MediaDecoderStateMachine.cpp
+++ b/content/media/MediaDecoderStateMachine.cpp
@@ -2449,6 +2449,15 @@ void MediaDecoderStateMachine::StartBuffering()
{
AssertCurrentThreadInMonitor();
+ if (mState != DECODER_STATE_DECODING) {
+ // We only move into BUFFERING state if we're actually decoding.
+ // If we're currently doing something else, we don't need to buffer,
+ // and more importantly, we shouldn't overwrite mState to interrupt
+ // the current operation, as that could leave us in an inconsistent
+ // state!
+ return;
+ }
+
if (IsPlaying()) {
StopPlayback();
}
diff --git a/content/media/MediaResource.cpp b/content/media/MediaResource.cpp
index eb83fb0a7ce3..79517bc2ceef 100644
--- a/content/media/MediaResource.cpp
+++ b/content/media/MediaResource.cpp
@@ -1643,6 +1643,9 @@ public:
void BaseMediaResource::DispatchBytesConsumed(int64_t aNumBytes, int64_t aOffset)
{
+ if (aNumBytes <= 0) {
+ return;
+ }
RefPtr event(new DispatchBytesConsumedEvent(mDecoder, aNumBytes, aOffset));
NS_DispatchToMainThread(event, NS_DISPATCH_NORMAL);
}
diff --git a/content/media/directshow/DirectShowReader.cpp b/content/media/directshow/DirectShowReader.cpp
index e9760ecb5585..bafd3f83026f 100644
--- a/content/media/directshow/DirectShowReader.cpp
+++ b/content/media/directshow/DirectShowReader.cpp
@@ -84,6 +84,11 @@ ParseMP3Headers(MP3FrameParser *aParser, MediaResource *aResource)
MAX_READ_SIZE, &bytesRead);
NS_ENSURE_SUCCESS(rv, rv);
+ if (!bytesRead) {
+ // End of stream.
+ return NS_ERROR_FAILURE;
+ }
+
aParser->Parse(buffer, bytesRead, offset);
offset += bytesRead;
}
diff --git a/docshell/base/moz.build b/docshell/base/moz.build
index f5a398b51912..2fe80c744f23 100644
--- a/docshell/base/moz.build
+++ b/docshell/base/moz.build
@@ -37,6 +37,7 @@ XPIDL_MODULE = 'docshell'
EXPORTS += [
'nsDocShellLoadTypes.h',
'nsILinkHandler.h',
+ 'nsIScrollObserver.h',
'nsIWebShellServices.h',
'SerializedLoadContext.h',
]
diff --git a/docshell/base/nsDocShell.cpp b/docshell/base/nsDocShell.cpp
index 732f61ae7d56..91e2e37a73a7 100644
--- a/docshell/base/nsDocShell.cpp
+++ b/docshell/base/nsDocShell.cpp
@@ -67,6 +67,7 @@
#include "nsITimedChannel.h"
#include "nsIPrivacyTransitionObserver.h"
#include "nsIReflowObserver.h"
+#include "nsIScrollObserver.h"
#include "nsIDocShellTreeItem.h"
#include "nsIChannel.h"
#include "IHistory.h"
@@ -2857,6 +2858,39 @@ nsDocShell::GetCurrentDocChannel()
return nullptr;
}
+NS_IMETHODIMP
+nsDocShell::AddWeakScrollObserver(nsIScrollObserver* aObserver)
+{
+ nsWeakPtr weakObs = do_GetWeakReference(aObserver);
+ if (!weakObs) {
+ return NS_ERROR_FAILURE;
+ }
+ return mScrollObservers.AppendElement(weakObs) ? NS_OK : NS_ERROR_FAILURE;
+}
+
+NS_IMETHODIMP
+nsDocShell::RemoveWeakScrollObserver(nsIScrollObserver* aObserver)
+{
+ nsWeakPtr obs = do_GetWeakReference(aObserver);
+ return mScrollObservers.RemoveElement(obs) ? NS_OK : NS_ERROR_FAILURE;
+}
+
+NS_IMETHODIMP
+nsDocShell::NotifyScrollObservers()
+{
+ nsTObserverArray::ForwardIterator iter(mScrollObservers);
+ while (iter.HasMore()) {
+ nsWeakPtr ref = iter.GetNext();
+ nsCOMPtr obs = do_QueryReferent(ref);
+ if (obs) {
+ obs->ScrollPositionChanged();
+ } else {
+ mScrollObservers.RemoveElement(ref);
+ }
+ }
+ return NS_OK;
+}
+
//*****************************************************************************
// nsDocShell::nsIDocShellTreeItem
//*****************************************************************************
@@ -9280,19 +9314,6 @@ nsDocShell::InternalLoad(nsIURI * aURI,
sameExceptHashes && !newHash.IsEmpty());
if (doShortCircuitedLoad) {
- // Cancel an outstanding new-document load if this is a history
- // load.
- //
- // We can't cancel the oustanding load unconditionally, because if a
- // page does
- // - load a.html
- // - start loading b.html
- // - load a.html#h
- // we break the web if we cancel the load of b.html.
- if (aSHEntry && mDocumentRequest) {
- mDocumentRequest->Cancel(NS_BINDING_ABORTED);
- }
-
// Save the position of the scrollers.
nscoord cx = 0, cy = 0;
GetCurScrollPos(ScrollOrientation_X, &cx);
@@ -9324,6 +9345,8 @@ nsDocShell::InternalLoad(nsIURI * aURI,
mURIResultedInDocument = true;
+ nsCOMPtr oldLSHE = mLSHE;
+
/* we need to assign mLSHE to aSHEntry right here, so that on History loads,
* SetCurrentURI() called from OnNewURI() will send proper
* onLocationChange() notifications to the browser to update
@@ -9401,10 +9424,10 @@ nsDocShell::InternalLoad(nsIURI * aURI,
SetCurScrollPosEx(bx, by);
}
- /* Clear out mLSHE so that further anchor visits get
- * recorded in SH and SH won't misbehave.
+ /* Restore the original LSHE if we were loading something
+ * while short-circuited load was initiated.
*/
- SetHistoryEntry(&mLSHE, nullptr);
+ SetHistoryEntry(&mLSHE, oldLSHE);
/* Set the title for the SH entry for this target url. so that
* SH menus in go/back/forward buttons won't be empty for this.
*/
diff --git a/docshell/base/nsDocShell.h b/docshell/base/nsDocShell.h
index 83ac34f86588..c19177742107 100644
--- a/docshell/base/nsDocShell.h
+++ b/docshell/base/nsDocShell.h
@@ -900,6 +900,7 @@ private:
nsCOMPtr mParentCharsetPrincipal;
nsTObserverArray mPrivacyObservers;
nsTObserverArray mReflowObservers;
+ nsTObserverArray mScrollObservers;
nsCString mOriginalUriString;
// Separate function to do the actual name (i.e. not _top, _self etc.)
diff --git a/docshell/base/nsIDocShell.idl b/docshell/base/nsIDocShell.idl
index 1a9cf2bccf9c..ed323c903d65 100644
--- a/docshell/base/nsIDocShell.idl
+++ b/docshell/base/nsIDocShell.idl
@@ -41,10 +41,11 @@ interface nsIWebBrowserPrint;
interface nsIVariant;
interface nsIPrivacyTransitionObserver;
interface nsIReflowObserver;
+interface nsIScrollObserver;
typedef unsigned long nsLoadFlags;
-[scriptable, builtinclass, uuid(d0eaef67-4234-47de-b05a-9c7b324eb4f4)]
+[scriptable, builtinclass, uuid(e46d924d-c20f-4add-8cf5-1e1c817b2181)]
interface nsIDocShell : nsIDocShellTreeItem
{
/**
@@ -667,6 +668,24 @@ interface nsIDocShell : nsIDocShellTreeItem
in DOMHighResTimeStamp start,
in DOMHighResTimeStamp end);
+ /**
+ * Add an observer to the list of parties to be notified when scroll position
+ * of some elements is changed.
+ */
+ [noscript] void addWeakScrollObserver(in nsIScrollObserver obs);
+
+ /**
+ * Add an observer to the list of parties to be notified when scroll position
+ * of some elements is changed.
+ */
+ [noscript] void removeWeakScrollObserver(in nsIScrollObserver obs);
+
+ /**
+ * Notify all attached observers that the scroll position of some element
+ * has changed.
+ */
+ [noscript] void notifyScrollObservers();
+
/**
* Returns true if this docshell corresponds to an