diff options
Diffstat (limited to 'dom/base')
32 files changed, 100 insertions, 80 deletions
diff --git a/dom/base/BlobSet.h b/dom/base/BlobSet.h index 3e22955dd..bf98cb023 100644 --- a/dom/base/BlobSet.h +++ b/dom/base/BlobSet.h @@ -8,6 +8,9 @@ #define mozilla_dom_BlobSet_h #include "mozilla/RefPtr.h" +#include "jsfriendapi.h" +#include "nsString.h" +#include "nsTArray.h" namespace mozilla { namespace dom { diff --git a/dom/base/CORSMode.h b/dom/base/CORSMode.h index 82f2f570d..577e78725 100644 --- a/dom/base/CORSMode.h +++ b/dom/base/CORSMode.h @@ -7,6 +7,8 @@ #ifndef CORSMode_h_ #define CORSMode_h_ +#include <stdint.h> + namespace mozilla { enum CORSMode : uint8_t { diff --git a/dom/base/ChromeUtils.cpp b/dom/base/ChromeUtils.cpp index 3cde261f0..b25f0b76b 100644 --- a/dom/base/ChromeUtils.cpp +++ b/dom/base/ChromeUtils.cpp @@ -7,6 +7,7 @@ #include "mozilla/Base64.h" #include "mozilla/BasePrincipal.h" +#include "jsfriendapi.h" namespace mozilla { namespace dom { diff --git a/dom/base/ChromeUtils.h b/dom/base/ChromeUtils.h index 051217c84..58a67b4f2 100644 --- a/dom/base/ChromeUtils.h +++ b/dom/base/ChromeUtils.h @@ -10,6 +10,7 @@ #include "mozilla/dom/BindingDeclarations.h" #include "mozilla/dom/ChromeUtilsBinding.h" #include "mozilla/dom/ThreadSafeChromeUtilsBinding.h" +#include "mozilla/dom/UnionTypes.h" #include "mozilla/ErrorResult.h" namespace mozilla { diff --git a/dom/base/CustomElementRegistry.cpp b/dom/base/CustomElementRegistry.cpp index 3f202d33b..f582d635f 100644 --- a/dom/base/CustomElementRegistry.cpp +++ b/dom/base/CustomElementRegistry.cpp @@ -7,8 +7,11 @@ #include "mozilla/dom/CustomElementRegistry.h" #include "mozilla/dom/CustomElementRegistryBinding.h" +#include "mozilla/dom/Element.h" #include "mozilla/dom/HTMLElementBinding.h" #include "mozilla/dom/WebComponentsBinding.h" +#include "mozilla/dom/Promise.h" +#include "nsContentUtils.h" #include "nsIParserService.h" #include "jsapi.h" diff --git a/dom/base/DocGroup.cpp b/dom/base/DocGroup.cpp index 226879985..ba9189168 100644 --- a/dom/base/DocGroup.cpp +++ b/dom/base/DocGroup.cpp @@ -6,6 +6,7 @@ #include "mozilla/StaticPtr.h" #include "mozilla/ClearOnShutdown.h" #include "nsIDocShell.h" +#include "nsNetCID.h" namespace mozilla { namespace dom { diff --git a/dom/base/DocGroup.h b/dom/base/DocGroup.h index f4f7ac8ad..6ecd284c1 100644 --- a/dom/base/DocGroup.h +++ b/dom/base/DocGroup.h @@ -7,6 +7,7 @@ #ifndef DocGroup_h #define DocGroup_h +#include "nsIDocument.h" #include "nsISupports.h" #include "nsISupportsImpl.h" #include "nsIPrincipal.h" diff --git a/dom/base/GroupedSHistory.h b/dom/base/GroupedSHistory.h index 8c88a0aaf..c5e75d639 100644 --- a/dom/base/GroupedSHistory.h +++ b/dom/base/GroupedSHistory.h @@ -7,6 +7,8 @@ #ifndef GroupedSHistory_h #define GroupedSHistory_h +#include "nsCOMArray.h" +#include "nsCycleCollectionParticipant.h" // NS_DECL_CYCLE_* #include "nsIFrameLoader.h" #include "nsIGroupedSHistory.h" #include "nsIPartialSHistory.h" diff --git a/dom/base/ImageTracker.cpp b/dom/base/ImageTracker.cpp index 9fef059bc..d0c231981 100644 --- a/dom/base/ImageTracker.cpp +++ b/dom/base/ImageTracker.cpp @@ -8,6 +8,8 @@ * animating */ #include "ImageTracker.h" +#include "mozilla/Preferences.h" +#include "nsAppRunner.h" // for XRE_IsContentProcess namespace mozilla { namespace dom { diff --git a/dom/base/ImageTracker.h b/dom/base/ImageTracker.h index d33dc55f8..f16461192 100644 --- a/dom/base/ImageTracker.h +++ b/dom/base/ImageTracker.h @@ -10,6 +10,7 @@ #ifndef mozilla_dom_ImageTracker #define mozilla_dom_ImageTracker +#include "imgIRequest.h" #include "nsDataHashtable.h" #include "nsHashKeys.h" diff --git a/dom/base/MutableBlobStorage.h b/dom/base/MutableBlobStorage.h index fad391b16..ed368e5e6 100644 --- a/dom/base/MutableBlobStorage.h +++ b/dom/base/MutableBlobStorage.h @@ -7,6 +7,9 @@ #ifndef mozilla_dom_MutableBlobStorage_h #define mozilla_dom_MutableBlobStorage_h +#include "nsCycleCollectionParticipant.h" +#include "nsThreadUtils.h" +#include "nsProxyRelease.h" #include "mozilla/RefPtr.h" #include "prio.h" diff --git a/dom/base/MutableBlobStreamListener.cpp b/dom/base/MutableBlobStreamListener.cpp index 6769ad3e6..afcc04d9f 100644 --- a/dom/base/MutableBlobStreamListener.cpp +++ b/dom/base/MutableBlobStreamListener.cpp @@ -5,6 +5,7 @@ #include "MutableBlobStreamListener.h" #include "MutableBlobStorage.h" +#include "nsIInputStream.h" namespace mozilla { namespace dom { diff --git a/dom/base/Navigator.cpp b/dom/base/Navigator.cpp index fdf151b6c..a544f23c1 100644 --- a/dom/base/Navigator.cpp +++ b/dom/base/Navigator.cpp @@ -37,10 +37,7 @@ #include "mozilla/dom/PowerManager.h" #include "mozilla/dom/WakeLock.h" #include "mozilla/dom/power/PowerManagerService.h" -#include "mozilla/dom/FlyWebPublishedServer.h" -#include "mozilla/dom/FlyWebService.h" #include "mozilla/dom/Permissions.h" -#include "mozilla/dom/Presentation.h" #include "mozilla/dom/ServiceWorkerContainer.h" #include "mozilla/dom/StorageManager.h" #include "mozilla/dom/TCPSocket.h" @@ -67,8 +64,6 @@ #include "nsIAppsService.h" #include "mozIApplication.h" #include "WidgetUtils.h" -#include "nsIPresentationService.h" - #include "mozilla/dom/MediaDevices.h" #include "MediaManager.h" @@ -218,7 +213,6 @@ NS_IMPL_CYCLE_COLLECTION_TRAVERSE_BEGIN(Navigator) #ifdef MOZ_EME NS_IMPL_CYCLE_COLLECTION_TRAVERSE(mMediaKeySystemAccessManager) #endif - NS_IMPL_CYCLE_COLLECTION_TRAVERSE(mPresentation) #ifdef MOZ_GAMEPAD NS_IMPL_CYCLE_COLLECTION_TRAVERSE(mGamepadServiceTest) #endif @@ -284,10 +278,6 @@ Navigator::Invalidate() mTimeManager = nullptr; } - if (mPresentation) { - mPresentation = nullptr; - } - mServiceWorkerContainer = nullptr; #ifdef MOZ_EME @@ -1364,41 +1354,6 @@ Navigator::GetBattery(ErrorResult& aRv) return mBatteryPromise; } -already_AddRefed<Promise> -Navigator::PublishServer(const nsAString& aName, - const FlyWebPublishOptions& aOptions, - ErrorResult& aRv) -{ - RefPtr<FlyWebService> service = FlyWebService::GetOrCreate(); - if (!service) { - aRv.Throw(NS_ERROR_FAILURE); - return nullptr; - } - - RefPtr<FlyWebPublishPromise> mozPromise = - service->PublishServer(aName, aOptions, mWindow); - MOZ_ASSERT(mozPromise); - - nsCOMPtr<nsIGlobalObject> global = do_QueryInterface(mWindow); - ErrorResult result; - RefPtr<Promise> domPromise = Promise::Create(global, result); - if (result.Failed()) { - aRv.Throw(NS_ERROR_FAILURE); - return nullptr; - } - - mozPromise->Then(AbstractThread::MainThread(), - __func__, - [domPromise] (FlyWebPublishedServer* aServer) { - domPromise->MaybeResolve(aServer); - }, - [domPromise] (nsresult aStatus) { - domPromise->MaybeReject(aStatus); - }); - - return domPromise.forget(); -} - PowerManager* Navigator::GetMozPower(ErrorResult& aRv) { @@ -1931,19 +1886,5 @@ Navigator::RequestMediaKeySystemAccess(const nsAString& aKeySystem, } #endif -Presentation* -Navigator::GetPresentation(ErrorResult& aRv) -{ - if (!mPresentation) { - if (!mWindow) { - aRv.Throw(NS_ERROR_UNEXPECTED); - return nullptr; - } - mPresentation = Presentation::Create(mWindow); - } - - return mPresentation; -} - } // namespace dom } // namespace mozilla diff --git a/dom/base/Navigator.h b/dom/base/Navigator.h index 91b7fc15c..4ddaaabab 100644 --- a/dom/base/Navigator.h +++ b/dom/base/Navigator.h @@ -39,8 +39,6 @@ class WakeLock; class ArrayBufferViewOrBlobOrStringOrFormData; class ServiceWorkerContainer; class DOMRequest; -struct FlyWebPublishOptions; -struct FlyWebFilter; } // namespace dom } // namespace mozilla @@ -74,7 +72,6 @@ class Connection; } // namespace network class PowerManager; -class Presentation; class LegacyMozTCPSocket; class StorageManager; @@ -141,9 +138,6 @@ public: Geolocation* GetGeolocation(ErrorResult& aRv); Promise* GetBattery(ErrorResult& aRv); - already_AddRefed<Promise> PublishServer(const nsAString& aName, - const FlyWebPublishOptions& aOptions, - ErrorResult& aRv); static void AppName(nsAString& aAppName, bool aUsePrefOverriddenValue); static nsresult GetPlatform(nsAString& aPlatform, @@ -210,8 +204,6 @@ public: system::AudioChannelManager* GetMozAudioChannelManager(ErrorResult& aRv); #endif // MOZ_AUDIO_CHANNEL_MANAGER - Presentation* GetPresentation(ErrorResult& aRv); - bool SendBeacon(const nsAString& aUrl, const Nullable<ArrayBufferViewOrBlobOrStringOrFormData>& aData, ErrorResult& aRv); @@ -288,7 +280,6 @@ private: RefPtr<time::TimeManager> mTimeManager; RefPtr<ServiceWorkerContainer> mServiceWorkerContainer; nsCOMPtr<nsPIDOMWindowInner> mWindow; - RefPtr<Presentation> mPresentation; #ifdef MOZ_GAMEPAD RefPtr<GamepadServiceTest> mGamepadServiceTest; #endif diff --git a/dom/base/NodeInfo.cpp b/dom/base/NodeInfo.cpp index d32a00fd3..f055dfc75 100644 --- a/dom/base/NodeInfo.cpp +++ b/dom/base/NodeInfo.cpp @@ -15,6 +15,7 @@ #include "mozilla/ArrayUtils.h" #include "mozilla/Likely.h" +#include "mozilla/Unused.h" #include "nsNodeInfoManager.h" #include "nsCOMPtr.h" diff --git a/dom/base/Pose.h b/dom/base/Pose.h index c7ef1b381..0817c8c96 100644 --- a/dom/base/Pose.h +++ b/dom/base/Pose.h @@ -8,6 +8,7 @@ #define mozilla_dom_Pose_h #include "nsWrapperCache.h" +#include "mozilla/ErrorResult.h" namespace mozilla { namespace dom { diff --git a/dom/base/TabGroup.h b/dom/base/TabGroup.h index f9fa9eec5..c436ce98d 100644 --- a/dom/base/TabGroup.h +++ b/dom/base/TabGroup.h @@ -7,10 +7,12 @@ #ifndef TabGroup_h #define TabGroup_h +#include "nsIDocument.h" #include "nsISupports.h" #include "nsISupportsImpl.h" #include "nsIPrincipal.h" #include "nsTHashtable.h" +#include "nsHashKeys.h" #include "nsString.h" #include "mozilla/RefPtr.h" diff --git a/dom/base/ThirdPartyUtil.cpp b/dom/base/ThirdPartyUtil.cpp index 61d97f634..37d326dbc 100644 --- a/dom/base/ThirdPartyUtil.cpp +++ b/dom/base/ThirdPartyUtil.cpp @@ -10,6 +10,7 @@ #include "nsIChannel.h" #include "nsIServiceManager.h" #include "nsIHttpChannelInternal.h" +#include "nsPIDOMWindow.h" #include "nsIDOMWindow.h" #include "nsILoadContext.h" #include "nsIPrincipal.h" diff --git a/dom/base/TimeoutHandler.cpp b/dom/base/TimeoutHandler.cpp index 78c3f16dd..f34275840 100644 --- a/dom/base/TimeoutHandler.cpp +++ b/dom/base/TimeoutHandler.cpp @@ -5,6 +5,7 @@ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ #include "TimeoutHandler.h" +#include "nsJSUtils.h" namespace mozilla { namespace dom { diff --git a/dom/base/TimeoutHandler.h b/dom/base/TimeoutHandler.h index cb0a0ce94..a80dc2995 100644 --- a/dom/base/TimeoutHandler.h +++ b/dom/base/TimeoutHandler.h @@ -7,9 +7,11 @@ #ifndef mozilla_dom_timeout_handler_h #define mozilla_dom_timeout_handler_h +#include "nsCycleCollectionParticipant.h" // NS_DECL_CYCLE_* #include "nsCOMPtr.h" #include "nsISupports.h" #include "nsITimeoutHandler.h" +#include "nsString.h" namespace mozilla { namespace dom { diff --git a/dom/base/TimerClamping.h b/dom/base/TimerClamping.h index 2ffd6add5..2bd1f019c 100755 --- a/dom/base/TimerClamping.h +++ b/dom/base/TimerClamping.h @@ -7,6 +7,8 @@ #ifndef TimerClamping_h___ #define TimerClamping_h___ +#include <math.h> + namespace mozilla { class TimerClamping diff --git a/dom/base/moz.build b/dom/base/moz.build index 75ddefded..89f1785ca 100755 --- a/dom/base/moz.build +++ b/dom/base/moz.build @@ -225,7 +225,7 @@ EXPORTS.mozilla.dom += [ 'WindowOrientationObserver.h', ] -UNIFIED_SOURCES += [ +SOURCES += [ 'AnonymousContent.cpp', 'Attr.cpp', 'BarProps.cpp', @@ -376,7 +376,7 @@ UNIFIED_SOURCES += [ ] if CONFIG['MOZ_WEBRTC']: - UNIFIED_SOURCES += [ + SOURCES += [ 'nsDOMDataChannel.cpp', ] diff --git a/dom/base/nsAttrValue.cpp b/dom/base/nsAttrValue.cpp index ebddcb7ed..2418fb501 100644 --- a/dom/base/nsAttrValue.cpp +++ b/dom/base/nsAttrValue.cpp @@ -1526,6 +1526,40 @@ nsAttrValue::ParseIntWithFallback(const nsAString& aString, int32_t aDefault, SetIntValueAndType(val, eInteger, nonStrict ? &aString : nullptr); } +void +nsAttrValue::ParseClampedNonNegativeInt(const nsAString& aString, + int32_t aDefault, int32_t aMin, + int32_t aMax) +{ + ResetIfSet(); + + nsContentUtils::ParseHTMLIntegerResultFlags result; + int32_t val = nsContentUtils::ParseHTMLInteger(aString, &result); + bool nonStrict = (result & nsContentUtils::eParseHTMLInteger_IsPercent) || + (result & nsContentUtils::eParseHTMLInteger_NonStandard) || + (result & nsContentUtils::eParseHTMLInteger_DidNotConsumeAllInput); + + if (result & nsContentUtils::eParseHTMLInteger_ErrorOverflow) { + if (result & nsContentUtils::eParseHTMLInteger_Negative) { + val = aDefault; + } else { + val = aMax; + } + nonStrict = true; + } else if ((result & nsContentUtils::eParseHTMLInteger_Error) || val < 0) { + val = aDefault; + nonStrict = true; + } else if (val < aMin) { + val = aMin; + nonStrict = true; + } else if (val > aMax) { + val = aMax; + nonStrict = true; + } + + SetIntValueAndType(val, eInteger, nonStrict ? &aString : nullptr); +} + bool nsAttrValue::ParseNonNegativeIntValue(const nsAString& aString) { diff --git a/dom/base/nsAttrValue.h b/dom/base/nsAttrValue.h index 655e4ca61..23f61a614 100644 --- a/dom/base/nsAttrValue.h +++ b/dom/base/nsAttrValue.h @@ -362,6 +362,19 @@ public: */ bool ParseNonNegativeIntValue(const nsAString& aString); + /** + * Parse a string value into a clamped non-negative integer. + * This method follows the rules for parsing non-negative integer from: + * https://html.spec.whatwg.org/multipage/infrastructure.html#clamped-to-the-range + * + * @param aString the string to parse + * @param aDefault value to return for negative or invalid values + * @param aMin minimum value + * @param aMax maximum value + */ + void ParseClampedNonNegativeInt(const nsAString& aString, int32_t aDefault, + int32_t aMin, int32_t aMax); + /** * Parse a string value into a positive integer. * This method follows the rules for parsing non-negative integer from: diff --git a/dom/base/nsContentUtils.cpp b/dom/base/nsContentUtils.cpp index 800f40fa1..6a9904bf9 100644 --- a/dom/base/nsContentUtils.cpp +++ b/dom/base/nsContentUtils.cpp @@ -1080,6 +1080,7 @@ nsContentUtils::ParseHTMLInteger(const nsAString& aValue, int sign = 1; if (*iter == char16_t('-')) { sign = -1; + result |= eParseHTMLInteger_Negative; ++iter; } else if (*iter == char16_t('+')) { result |= eParseHTMLInteger_NonStandard; diff --git a/dom/base/nsContentUtils.h b/dom/base/nsContentUtils.h index 606d67de9..ffbd15e78 100644 --- a/dom/base/nsContentUtils.h +++ b/dom/base/nsContentUtils.h @@ -444,7 +444,9 @@ public: // Set if one or more error flags were set. eParseHTMLInteger_Error = 1 << 3, eParseHTMLInteger_ErrorNoValue = 1 << 4, - eParseHTMLInteger_ErrorOverflow = 1 << 5 + eParseHTMLInteger_ErrorOverflow = 1 << 5, + // Use this flag to detect the difference between overflow and underflow + eParseHTMLInteger_Negative = 1 << 6, }; static int32_t ParseHTMLInteger(const nsAString& aValue, ParseHTMLIntegerResultFlags *aResult); diff --git a/dom/base/nsDOMMutationObserver.cpp b/dom/base/nsDOMMutationObserver.cpp index 858a30ce5..0273b7b94 100644 --- a/dom/base/nsDOMMutationObserver.cpp +++ b/dom/base/nsDOMMutationObserver.cpp @@ -7,6 +7,7 @@ #include "nsDOMMutationObserver.h" #include "mozilla/AnimationTarget.h" +#include "mozilla/CycleCollectedJSContext.h" #include "mozilla/Maybe.h" #include "mozilla/OwningNonNull.h" @@ -29,6 +30,9 @@ using mozilla::dom::TreeOrderComparator; using mozilla::dom::Animation; using mozilla::dom::Element; +using namespace mozilla; +using namespace mozilla::dom; + AutoTArray<RefPtr<nsDOMMutationObserver>, 4>* nsDOMMutationObserver::sScheduledMutationObservers = nullptr; diff --git a/dom/base/nsDocument.cpp b/dom/base/nsDocument.cpp index afe88a454..380593737 100644 --- a/dom/base/nsDocument.cpp +++ b/dom/base/nsDocument.cpp @@ -166,7 +166,6 @@ #include "mozilla/dom/HTMLIFrameElement.h" #include "mozilla/dom/HTMLImageElement.h" #include "mozilla/dom/MediaSource.h" -#include "mozilla/dom/FlyWebService.h" #include "mozAutoDocUpdate.h" #include "nsGlobalWindow.h" @@ -8369,13 +8368,6 @@ nsDocument::CanSavePresentation(nsIRequest *aNewRequest) return false; } - // Don't save presentation if there are active FlyWeb connections or FlyWeb - // servers. - FlyWebService* flyWebService = FlyWebService::GetExisting(); - if (flyWebService && flyWebService->HasConnectionOrServer(win->WindowID())) { - return false; - } - if (mSubDocuments) { for (auto iter = mSubDocuments->Iter(); !iter.Done(); iter.Next()) { auto entry = static_cast<SubDocMapEntry*>(iter.Get()); diff --git a/dom/base/nsFocusManager.cpp b/dom/base/nsFocusManager.cpp index fb350fa12..01c1944be 100644 --- a/dom/base/nsFocusManager.cpp +++ b/dom/base/nsFocusManager.cpp @@ -1261,6 +1261,15 @@ nsFocusManager::SetFocusInner(nsIContent* aNewContent, int32_t aFlags, isElementInActiveWindow = (mActiveWindow && newRootWindow == mActiveWindow); } + // Exit fullscreen if a website focuses another window + if (!isElementInActiveWindow && aFlags & FLAG_RAISE) { + if (nsIDocument* doc = mActiveWindow ? mActiveWindow->GetDoc() : nullptr) { + if (doc && doc->GetFullscreenElement()) { + nsIDocument::AsyncExitFullscreen(doc); + } + } + } + // Exit fullscreen if we're focusing a windowed plugin on a non-MacOSX // system. We don't control event dispatch to windowed plugins on non-MacOSX, // so we can't display the "Press ESC to leave fullscreen mode" warning on diff --git a/dom/base/nsJSEnvironment.cpp b/dom/base/nsJSEnvironment.cpp index dfd380fc2..efea3ee40 100644 --- a/dom/base/nsJSEnvironment.cpp +++ b/dom/base/nsJSEnvironment.cpp @@ -57,6 +57,7 @@ #include "mozilla/dom/ErrorEvent.h" #include "nsAXPCNativeCallContext.h" #include "mozilla/CycleCollectedJSContext.h" +#include "mozilla/Telemetry.h" #include "nsJSPrincipals.h" diff --git a/dom/base/nsJSUtils.cpp b/dom/base/nsJSUtils.cpp index 98b367b66..c9cec96db 100644 --- a/dom/base/nsJSUtils.cpp +++ b/dom/base/nsJSUtils.cpp @@ -31,6 +31,7 @@ #include "mozilla/dom/Element.h" #include "mozilla/dom/ScriptSettings.h" +using namespace mozilla; using namespace mozilla::dom; bool diff --git a/dom/base/nsScriptLoader.cpp b/dom/base/nsScriptLoader.cpp index 3ac00142d..25482fe7b 100644 --- a/dom/base/nsScriptLoader.cpp +++ b/dom/base/nsScriptLoader.cpp @@ -1144,7 +1144,7 @@ nsScriptLoader::InstantiateModuleTree(nsModuleLoadRequest* aRequest) nsModuleScript* ms = aRequest->mModuleScript; MOZ_ASSERT(ms); - if (!ms->ModuleRecord()) { + if (!ms || !ms->ModuleRecord()) { return false; } |