diff options
Diffstat (limited to 'dom')
-rw-r--r-- | dom/events/EventListenerManager.cpp | 5 | ||||
-rw-r--r-- | dom/html/nsHTMLDocument.cpp | 12 | ||||
-rw-r--r-- | dom/media/GraphDriver.cpp | 1 | ||||
-rwxr-xr-x | dom/performance/PerformanceTiming.cpp | 27 | ||||
-rwxr-xr-x | dom/performance/PerformanceTiming.h | 2 | ||||
-rw-r--r-- | dom/performance/tests/test_performance_user_timing.js | 2 |
6 files changed, 42 insertions, 7 deletions
diff --git a/dom/events/EventListenerManager.cpp b/dom/events/EventListenerManager.cpp index c8db4f2a1..a8c48ede8 100644 --- a/dom/events/EventListenerManager.cpp +++ b/dom/events/EventListenerManager.cpp @@ -996,14 +996,12 @@ EventListenerManager::CompileEventHandlerInternal(Listener* aListener, } aListener = nullptr; - uint32_t lineNo = 0; nsAutoCString url (NS_LITERAL_CSTRING("-moz-evil:lying-event-listener")); MOZ_ASSERT(body); MOZ_ASSERT(aElement); nsIURI *uri = aElement->OwnerDoc()->GetDocumentURI(); if (uri) { uri->GetSpec(url); - lineNo = 1; } nsCOMPtr<nsPIDOMWindowInner> win = do_QueryInterface(mTarget); @@ -1073,8 +1071,9 @@ EventListenerManager::CompileEventHandlerInternal(Listener* aListener, return NS_ERROR_FAILURE; } JS::CompileOptions options(cx); + // Use line 0 to make the function body starts from line 1. options.setIntroductionType("eventHandler") - .setFileAndLine(url.get(), lineNo) + .setFileAndLine(url.get(), 0) .setVersion(JSVERSION_DEFAULT) .setElement(&v.toObject()) .setElementAttributeName(jsStr); diff --git a/dom/html/nsHTMLDocument.cpp b/dom/html/nsHTMLDocument.cpp index fea78dc37..be5a34d41 100644 --- a/dom/html/nsHTMLDocument.cpp +++ b/dom/html/nsHTMLDocument.cpp @@ -1536,6 +1536,18 @@ nsHTMLDocument::Open(JSContext* cx, nsCOMPtr<nsIDocument> ret = this; return ret.forget(); } + + // Now double-check that our invariants still hold. + if (!mScriptGlobalObject) { + nsCOMPtr<nsIDocument> ret = this; + return ret.forget(); + } + + nsPIDOMWindowOuter* outer = GetWindow(); + if (!outer || (GetInnerWindow() != outer->GetCurrentInnerWindow())) { + nsCOMPtr<nsIDocument> ret = this; + return ret.forget(); + } } nsCOMPtr<nsIWebNavigation> webnav(do_QueryInterface(shell)); diff --git a/dom/media/GraphDriver.cpp b/dom/media/GraphDriver.cpp index 9b74bd58c..40e3b72cf 100644 --- a/dom/media/GraphDriver.cpp +++ b/dom/media/GraphDriver.cpp @@ -1055,6 +1055,7 @@ AudioCallbackDriver::StateCallback(cubeb_state aState) { STREAM_LOG(LogLevel::Debug, ("AudioCallbackDriver State: %d", aState)); if (aState == CUBEB_STATE_ERROR && mShouldFallbackIfError) { + mShouldFallbackIfError = false; MonitorAutoLock lock(GraphImpl()->GetMonitor()); // Fall back to a driver using a normal thread. If needed, // the graph will try to re-open an audio stream later. diff --git a/dom/performance/PerformanceTiming.cpp b/dom/performance/PerformanceTiming.cpp index 5f771f0aa..e2f76a21f 100755 --- a/dom/performance/PerformanceTiming.cpp +++ b/dom/performance/PerformanceTiming.cpp @@ -46,6 +46,23 @@ PerformanceTiming::PerformanceTiming(Performance* aPerformance, mReportCrossOriginRedirect = mTimingAllowed && redirectsPassCheck; } + mSecureConnection = false; + nsCOMPtr<nsIURI> uri; + if (aHttpChannel) { + aHttpChannel->GetURI(getter_AddRefs(uri)); + } else { + nsCOMPtr<nsIHttpChannel> httpChannel = do_QueryInterface(aChannel); + if (httpChannel) { + httpChannel->GetURI(getter_AddRefs(uri)); + } + } + + if (uri) { + nsresult rv = uri->SchemeIs("https", &mSecureConnection); + if (NS_FAILED(rv)) { + mSecureConnection = false; + } + } InitializeTimingInfo(aChannel); } @@ -89,7 +106,8 @@ PerformanceTiming::InitializeTimingInfo(nsITimedChannel* aChannel) mConnectStart = mAsyncOpen; } - if (!mSecureConnectionStart.IsNull() && mSecureConnectionStart < mAsyncOpen) { + if (mSecureConnection && !mSecureConnectionStart.IsNull() && + mSecureConnectionStart < mAsyncOpen) { mSecureConnectionStart = mAsyncOpen; } @@ -307,8 +325,11 @@ PerformanceTiming::SecureConnectionStartHighRes() if (!nsContentUtils::IsPerformanceTimingEnabled() || !IsInitialized()) { return mZeroTime; } - return mSecureConnectionStart.IsNull() ? mZeroTime - : TimerClamping::ReduceMsTimeValue(TimeStampToDOMHighRes(mSecureConnectionStart)); + return !mSecureConnection + ? 0 // We use 0 here, because mZeroTime is sometimes set to the navigation + // start time. + : (mSecureConnectionStart.IsNull() ? mZeroTime + : TimerClamping::ReduceMsTimeValue(TimeStampToDOMHighRes(mSecureConnectionStart))); } DOMTimeMilliSec diff --git a/dom/performance/PerformanceTiming.h b/dom/performance/PerformanceTiming.h index edfac8d02..fc7e7d5bd 100755 --- a/dom/performance/PerformanceTiming.h +++ b/dom/performance/PerformanceTiming.h @@ -274,6 +274,8 @@ private: // redirectEnd attributes. It is false if there were no redirects, or if // any of the responses didn't pass the timing-allow-check bool mReportCrossOriginRedirect; + + bool mSecureConnection; }; } // namespace dom diff --git a/dom/performance/tests/test_performance_user_timing.js b/dom/performance/tests/test_performance_user_timing.js index 3d05ebb77..cd8261bbd 100644 --- a/dom/performance/tests/test_performance_user_timing.js +++ b/dom/performance/tests/test_performance_user_timing.js @@ -263,7 +263,7 @@ var steps = [ performance.measure("test", n); ok(true, "Measure created from reserved name as starting time: " + n); } catch (e) { - ok(["redirectStart", "redirectEnd", "unloadEventStart", "unloadEventEnd", "loadEventEnd"].indexOf(n) >= 0, + ok(["redirectStart", "redirectEnd", "unloadEventStart", "unloadEventEnd", "loadEventEnd", "secureConnectionStart"].indexOf(n) >= 0, "Measure created from reserved name as starting time: " + n + " and threw expected error"); } }; |