summaryrefslogtreecommitdiffstats
path: root/dom
diff options
context:
space:
mode:
Diffstat (limited to 'dom')
-rw-r--r--dom/media/PeerConnection.js17
-rw-r--r--dom/performance/PerformanceNavigationTiming.cpp17
-rw-r--r--dom/plugins/base/nsPluginStreamListenerPeer.cpp18
3 files changed, 34 insertions, 18 deletions
diff --git a/dom/media/PeerConnection.js b/dom/media/PeerConnection.js
index 0c3021799..0569b15ae 100644
--- a/dom/media/PeerConnection.js
+++ b/dom/media/PeerConnection.js
@@ -516,6 +516,18 @@ RTCPeerConnection.prototype = {
};
},
+ // This implements the fairly common "Queue a task" logic
+ async _queueTaskWithClosedCheck(func) {
+ return new Promise(resolve => {
+ Services.tm.mainThread.dispatch({ run() {
+ if (!this._closed) {
+ func();
+ resolve();
+ }
+ }}, Ci.nsIThread.DISPATCH_NORMAL);
+ });
+ },
+
/**
* An RTCConfiguration may look like this:
*
@@ -1445,7 +1457,10 @@ PeerConnectionObserver.prototype = {
break;
case "IceConnectionState":
- this.handleIceConnectionStateChange(this._dompc._pc.iceConnectionState);
+ let connState = this._dompc._pc.iceConnectionState;
+ this._dompc._queueTaskWithClosedCheck(() => {
+ this.handleIceConnectionStateChange(connState);
+ });
break;
case "IceGatheringState":
diff --git a/dom/performance/PerformanceNavigationTiming.cpp b/dom/performance/PerformanceNavigationTiming.cpp
index 4e00b2bb2..d7e16725a 100644
--- a/dom/performance/PerformanceNavigationTiming.cpp
+++ b/dom/performance/PerformanceNavigationTiming.cpp
@@ -6,6 +6,7 @@
#include "mozilla/dom/PerformanceNavigationTiming.h"
#include "mozilla/dom/PerformanceNavigationTimingBinding.h"
+#include "mozilla/TimerClamping.h"
using namespace mozilla::dom;
@@ -24,49 +25,49 @@ PerformanceNavigationTiming::WrapObject(JSContext* aCx, JS::Handle<JSObject*> aG
DOMHighResTimeStamp
PerformanceNavigationTiming::UnloadEventStart() const
{
- return mTiming->GetDOMTiming()->GetUnloadEventStartHighRes();
+ return TimerClamping::ReduceMsTimeValue(mTiming->GetDOMTiming()->GetUnloadEventStartHighRes());
}
DOMHighResTimeStamp
PerformanceNavigationTiming::UnloadEventEnd() const
{
- return mTiming->GetDOMTiming()->GetUnloadEventEndHighRes();
+ return TimerClamping::ReduceMsTimeValue(mTiming->GetDOMTiming()->GetUnloadEventEndHighRes());
}
DOMHighResTimeStamp
PerformanceNavigationTiming::DomInteractive() const
{
- return mTiming->GetDOMTiming()->GetDomInteractiveHighRes();
+ return TimerClamping::ReduceMsTimeValue(mTiming->GetDOMTiming()->GetDomInteractiveHighRes());
}
DOMHighResTimeStamp
PerformanceNavigationTiming::DomContentLoadedEventStart() const
{
- return mTiming->GetDOMTiming()->GetDomContentLoadedEventStartHighRes();
+ return TimerClamping::ReduceMsTimeValue(mTiming->GetDOMTiming()->GetDomContentLoadedEventStartHighRes());
}
DOMHighResTimeStamp
PerformanceNavigationTiming::DomContentLoadedEventEnd() const
{
- return mTiming->GetDOMTiming()->GetDomContentLoadedEventEndHighRes();
+ return TimerClamping::ReduceMsTimeValue(mTiming->GetDOMTiming()->GetDomContentLoadedEventEndHighRes());
}
DOMHighResTimeStamp
PerformanceNavigationTiming::DomComplete() const
{
- return mTiming->GetDOMTiming()->GetDomCompleteHighRes();
+ return TimerClamping::ReduceMsTimeValue(mTiming->GetDOMTiming()->GetDomCompleteHighRes());
}
DOMHighResTimeStamp
PerformanceNavigationTiming::LoadEventStart() const
{
- return mTiming->GetDOMTiming()->GetLoadEventStartHighRes();
+ return TimerClamping::ReduceMsTimeValue(mTiming->GetDOMTiming()->GetLoadEventStartHighRes());
}
DOMHighResTimeStamp
PerformanceNavigationTiming::LoadEventEnd() const
{
- return mTiming->GetDOMTiming()->GetLoadEventEndHighRes();
+ return TimerClamping::ReduceMsTimeValue(mTiming->GetDOMTiming()->GetLoadEventEndHighRes());
}
NavigationType
diff --git a/dom/plugins/base/nsPluginStreamListenerPeer.cpp b/dom/plugins/base/nsPluginStreamListenerPeer.cpp
index 26e0318e3..665e11ec1 100644
--- a/dom/plugins/base/nsPluginStreamListenerPeer.cpp
+++ b/dom/plugins/base/nsPluginStreamListenerPeer.cpp
@@ -1381,15 +1381,6 @@ nsPluginStreamListenerPeer::AsyncOnChannelRedirect(nsIChannel *oldChannel, nsICh
return NS_ERROR_FAILURE;
}
- nsCOMPtr<nsIAsyncVerifyRedirectCallback> proxyCallback =
- new ChannelRedirectProxyCallback(this, callback, oldChannel, newChannel);
-
- // Give NPAPI a chance to control redirects.
- bool notificationHandled = mPStreamListener->HandleRedirectNotification(oldChannel, newChannel, proxyCallback);
- if (notificationHandled) {
- return NS_OK;
- }
-
// Don't allow cross-origin 307 POST redirects.
nsCOMPtr<nsIHttpChannel> oldHttpChannel(do_QueryInterface(oldChannel));
if (oldHttpChannel) {
@@ -1413,6 +1404,15 @@ nsPluginStreamListenerPeer::AsyncOnChannelRedirect(nsIChannel *oldChannel, nsICh
}
}
+ nsCOMPtr<nsIAsyncVerifyRedirectCallback> proxyCallback =
+ new ChannelRedirectProxyCallback(this, callback, oldChannel, newChannel);
+
+ // Give NPAPI a chance to control redirects.
+ bool notificationHandled = mPStreamListener->HandleRedirectNotification(oldChannel, newChannel, proxyCallback);
+ if (notificationHandled) {
+ return NS_OK;
+ }
+
// Fall back to channel event sink for window.
nsCOMPtr<nsIChannelEventSink> channelEventSink;
nsresult rv = GetInterfaceGlobal(NS_GET_IID(nsIChannelEventSink), getter_AddRefs(channelEventSink));