From 235335986535502010c10f532f5c25572c055962 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Emilio=20Cobos=20=C3=81lvarez?= Date: Fri, 16 Aug 2019 10:56:03 +0000 Subject: [PATCH] Bug 1571530 - Make Loader APIs return a Result. r=heycam On the fence on this one, but I do think it's nicer. Differential Revision: https://phabricator.services.mozilla.com/D40850 --HG-- extra : moz-landing-system : lando --- dom/base/Document.cpp | 21 +++--- editor/libeditor/HTMLEditor.cpp | 14 ++-- layout/base/nsStyleSheetService.cpp | 18 ++---- layout/style/Loader.cpp | 81 ++++++++++-------------- layout/style/Loader.h | 48 ++++++-------- layout/style/PreloadedStyleSheet.cpp | 31 ++++----- layout/style/nsLayoutStylesheetCache.cpp | 55 +++++++--------- layout/style/nsLayoutStylesheetCache.h | 17 +++-- 8 files changed, 118 insertions(+), 167 deletions(-) diff --git a/dom/base/Document.cpp b/dom/base/Document.cpp index 2e575c724814..f8e104b04dd1 100644 --- a/dom/base/Document.cpp +++ b/dom/base/Document.cpp @@ -6485,9 +6485,12 @@ nsresult Document::LoadAdditionalStyleSheet(additionalSheetType aType, MOZ_CRASH("impossible value for aType"); } - RefPtr sheet; - nsresult rv = loader->LoadSheetSync(aSheetURI, parsingMode, true, &sheet); - NS_ENSURE_SUCCESS(rv, rv); + auto result = loader->LoadSheetSync(aSheetURI, parsingMode, true); + if (result.isErr()) { + return result.unwrapErr(); + } + + RefPtr sheet = result.unwrap(); sheet->SetAssociatedDocumentOrShadowRoot( this, StyleSheet::OwnedByDocumentOrShadowRoot); @@ -11442,15 +11445,15 @@ void Document::PreloadStyle( ReferrerInfo::CreateFromDocumentAndPolicyOverride(this, aReferrerPolicy); // Charset names are always ASCII. - CSSLoader()->LoadSheet(uri, true, NodePrincipal(), aEncoding, referrerInfo, - obs, Element::StringToCORSMode(aCrossOriginAttr), - aIntegrity); + Unused << CSSLoader()->LoadSheet( + uri, true, NodePrincipal(), aEncoding, referrerInfo, obs, + Element::StringToCORSMode(aCrossOriginAttr), aIntegrity); } RefPtr Document::LoadChromeSheetSync(nsIURI* uri) { - RefPtr sheet; - CSSLoader()->LoadSheetSync(uri, css::eAuthorSheetFeatures, false, &sheet); - return sheet; + return CSSLoader() + ->LoadSheetSync(uri, css::eAuthorSheetFeatures, false) + .unwrapOr(nullptr); } void Document::ResetDocumentDirection() { diff --git a/editor/libeditor/HTMLEditor.cpp b/editor/libeditor/HTMLEditor.cpp index 59c544087bec..c27aad4eea6a 100644 --- a/editor/libeditor/HTMLEditor.cpp +++ b/editor/libeditor/HTMLEditor.cpp @@ -3107,18 +3107,16 @@ nsresult HTMLEditor::AddOverrideStyleSheetInternal(const nsAString& aURL) { // We MUST ONLY load synchronous local files (no @import) // XXXbz Except this will actually try to load remote files // synchronously, of course.. - RefPtr sheet; // Editor override style sheets may want to style Gecko anonymous boxes - DebugOnly ignoredRv = - presShell->GetDocument()->CSSLoader()->LoadSheetSync( - uaURI, css::eAgentSheetFeatures, true, &sheet); - NS_WARNING_ASSERTION(NS_SUCCEEDED(ignoredRv), "LoadSheetSync() failed"); - + auto result = presShell->GetDocument()->CSSLoader()->LoadSheetSync( + uaURI, css::eAgentSheetFeatures, true); // Synchronous loads should ALWAYS return completed - if (NS_WARN_IF(!sheet)) { - return NS_ERROR_FAILURE; + if (NS_WARN_IF(result.isErr())) { + return result.unwrapErr(); } + RefPtr sheet = result.unwrap(); + // Add the override style sheet // (This checks if already exists) presShell->AddOverrideStyleSheet(sheet); diff --git a/layout/base/nsStyleSheetService.cpp b/layout/base/nsStyleSheetService.cpp index a9a8107d5b4a..cdf301ba5295 100644 --- a/layout/base/nsStyleSheetService.cpp +++ b/layout/base/nsStyleSheetService.cpp @@ -181,12 +181,6 @@ nsStyleSheetService::LoadAndRegisterSheet(nsIURI* aSheetURI, return rv; } -static nsresult LoadSheet(nsIURI* aURI, css::SheetParsingMode aParsingMode, - RefPtr* aResult) { - RefPtr loader = new css::Loader; - return loader->LoadSheetSync(aURI, aParsingMode, true, aResult); -} - nsresult nsStyleSheetService::LoadAndRegisterSheetInternal( nsIURI* aSheetURI, uint32_t aSheetType) { NS_ENSURE_ARG_POINTER(aSheetURI); @@ -210,12 +204,12 @@ nsresult nsStyleSheetService::LoadAndRegisterSheetInternal( return NS_ERROR_INVALID_ARG; } - RefPtr sheet; - nsresult rv = LoadSheet(aSheetURI, parsingMode, &sheet); - NS_ENSURE_SUCCESS(rv, rv); - MOZ_ASSERT(sheet); - mSheets[aSheetType].AppendElement(sheet); - + RefPtr loader = new css::Loader; + auto result = loader->LoadSheetSync(aSheetURI, parsingMode, true); + if (result.isErr()) { + return result.unwrapErr(); + } + mSheets[aSheetType].AppendElement(result.unwrap()); return NS_OK; } diff --git a/layout/style/Loader.cpp b/layout/style/Loader.cpp index 705e213e9aa4..511e46299939 100644 --- a/layout/style/Loader.cpp +++ b/layout/style/Loader.cpp @@ -2149,70 +2149,60 @@ nsresult Loader::LoadChildSheet(StyleSheet* aParentSheet, return rv; } -nsresult Loader::LoadSheetSync(nsIURI* aURL, SheetParsingMode aParsingMode, - bool aUseSystemPrincipal, - RefPtr* aSheet) { +Result, nsresult> Loader::LoadSheetSync( + nsIURI* aURL, SheetParsingMode aParsingMode, bool aUseSystemPrincipal) { LOG(("css::Loader::LoadSheetSync")); nsCOMPtr referrerInfo = new ReferrerInfo(nullptr); - return InternalLoadNonDocumentSheet(aURL, false, aParsingMode, - aUseSystemPrincipal, nullptr, nullptr, - aSheet, referrerInfo, nullptr); + return InternalLoadNonDocumentSheet( + aURL, false, aParsingMode, aUseSystemPrincipal, nullptr, nullptr, + referrerInfo, nullptr, CORS_NONE, EmptyString()); } -nsresult Loader::LoadSheet(nsIURI* aURL, SheetParsingMode aParsingMode, - bool aUseSystemPrincipal, - nsICSSLoaderObserver* aObserver, - RefPtr* aSheet) { - LOG( - ("css::Loader::LoadSheet(aURL, aParsingMode, aUseSystemPrincipal, " - "aObserver, aSheet)")); +Result, nsresult> Loader::LoadSheet( + nsIURI* aURI, SheetParsingMode aParsingMode, bool aUseSystemPrincipal, + nsICSSLoaderObserver* aObserver) { nsCOMPtr referrerInfo = new ReferrerInfo(nullptr); - return InternalLoadNonDocumentSheet(aURL, false, aParsingMode, - aUseSystemPrincipal, nullptr, nullptr, - aSheet, referrerInfo, aObserver); + return InternalLoadNonDocumentSheet( + aURI, false, aParsingMode, aUseSystemPrincipal, nullptr, nullptr, + referrerInfo, aObserver, CORS_NONE, EmptyString()); } -nsresult Loader::LoadSheet(nsIURI* aURL, bool aIsPreload, - nsIPrincipal* aOriginPrincipal, - const Encoding* aPreloadEncoding, - nsIReferrerInfo* aReferrerInfo, - nsICSSLoaderObserver* aObserver, CORSMode aCORSMode, - const nsAString& aIntegrity) { +Result, nsresult> Loader::LoadSheet( + nsIURI* aURL, bool aIsPreload, nsIPrincipal* aOriginPrincipal, + const Encoding* aPreloadEncoding, nsIReferrerInfo* aReferrerInfo, + nsICSSLoaderObserver* aObserver, CORSMode aCORSMode, + const nsAString& aIntegrity) { LOG(("css::Loader::LoadSheet(aURL, aObserver) api call")); - return InternalLoadNonDocumentSheet(aURL, aIsPreload, eAuthorSheetFeatures, - false, aOriginPrincipal, aPreloadEncoding, - nullptr, aReferrerInfo, aObserver, - aCORSMode, aIntegrity); + return InternalLoadNonDocumentSheet( + aURL, aIsPreload, eAuthorSheetFeatures, false, aOriginPrincipal, + aPreloadEncoding, aReferrerInfo, aObserver, aCORSMode, aIntegrity); } -nsresult Loader::InternalLoadNonDocumentSheet( +Result, nsresult> Loader::InternalLoadNonDocumentSheet( nsIURI* aURL, bool aIsPreload, SheetParsingMode aParsingMode, bool aUseSystemPrincipal, nsIPrincipal* aOriginPrincipal, - const Encoding* aPreloadEncoding, RefPtr* aSheet, - nsIReferrerInfo* aReferrerInfo, nsICSSLoaderObserver* aObserver, - CORSMode aCORSMode, const nsAString& aIntegrity) { + const Encoding* aPreloadEncoding, nsIReferrerInfo* aReferrerInfo, + nsICSSLoaderObserver* aObserver, CORSMode aCORSMode, + const nsAString& aIntegrity) { MOZ_ASSERT(aURL, "Must have a URI to load"); - MOZ_ASSERT(aSheet || aObserver, "Sheet and observer can't both be null"); MOZ_ASSERT(!aUseSystemPrincipal || !aObserver, "Shouldn't load system-principal sheets async"); MOZ_ASSERT(aReferrerInfo, "Must have referrerInfo"); LOG_URI(" Non-document sheet uri: '%s'", aURL); - if (aSheet) { - *aSheet = nullptr; - } - if (!mEnabled) { LOG_WARN((" Not enabled")); - return NS_ERROR_NOT_AVAILABLE; + return Err(NS_ERROR_NOT_AVAILABLE); } nsCOMPtr loadingPrincipal = (aOriginPrincipal && mDocument ? mDocument->NodePrincipal() : nullptr); nsresult rv = CheckContentPolicy(loadingPrincipal, aOriginPrincipal, aURL, mDocument, aIsPreload); - NS_ENSURE_SUCCESS(rv, rv); + if (NS_FAILED(rv)) { + return Err(rv); + } bool syncLoad = !aObserver; @@ -2230,11 +2220,11 @@ nsresult Loader::InternalLoadNonDocumentSheet( if (aObserver || !mObservers.IsEmpty()) { rv = PostLoadEvent(aURL, sheet, aObserver, IsAlternate::No, MediaMatched::Yes, aReferrerInfo, nullptr); + if (NS_FAILED(rv)) { + return Err(rv); + } } - if (aSheet) { - sheet.swap(*aSheet); - } - return rv; + return sheet; } SheetLoadData* data = new SheetLoadData( @@ -2243,16 +2233,13 @@ nsresult Loader::InternalLoadNonDocumentSheet( NS_ADDREF(data); rv = LoadSheet(data, state, aIsPreload); - NS_ENSURE_SUCCESS(rv, rv); - - if (aSheet) { - sheet.swap(*aSheet); + if (NS_FAILED(rv)) { + return Err(rv); } if (aObserver) { data->mMustNotify = true; } - - return rv; + return sheet; } nsresult Loader::PostLoadEvent(nsIURI* aURI, StyleSheet* aSheet, diff --git a/layout/style/Loader.h b/layout/style/Loader.h index f5d29057a791..062fae949504 100644 --- a/layout/style/Loader.h +++ b/layout/style/Loader.h @@ -190,7 +190,6 @@ class Loader final { * (see comments at enum SheetParsingMode, above). * @param aUseSystemPrincipal if true, give the resulting sheet the system * principal no matter where it's being loaded from. - * @param [out] aSheet the loaded, complete sheet. * * NOTE: At the moment, this method assumes the sheet will be UTF-8, but * ideally it would allow arbitrary encodings. Callers should NOT depend on @@ -200,16 +199,9 @@ class Loader final { * whether the data could be parsed as CSS and doesn't indicate anything * about the status of child sheets of the returned sheet. */ - nsresult LoadSheetSync(nsIURI* aURL, SheetParsingMode aParsingMode, - bool aUseSystemPrincipal, RefPtr* aSheet); - - /** - * As above, but defaults aParsingMode to eAuthorSheetFeatures and - * aUseSystemPrincipal to false. - */ - nsresult LoadSheetSync(nsIURI* aURL, RefPtr* aSheet) { - return LoadSheetSync(aURL, eAuthorSheetFeatures, false, aSheet); - } + Result, nsresult> LoadSheetSync( + nsIURI*, SheetParsingMode = eAuthorSheetFeatures, + bool aUseSystemPrincipal = false); /** * Asynchronously load the stylesheet at aURL. If a successful result is @@ -225,28 +217,25 @@ class Loader final { * @param aReferrerInfo referrer information of the sheet. * @param aObserver the observer to notify when the load completes. * Must not be null. - * @param [out] aSheet the sheet to load. Note that the sheet may well - * not be loaded by the time this method returns. + * @return the sheet to load. Note that the sheet may well not be loaded by + * the time this method returns. * * NOTE: At the moment, this method assumes the sheet will be UTF-8, but * ideally it would allow arbitrary encodings. Callers should NOT depend on * non-UTF8 sheets being treated as UTF-8 by this method. */ - nsresult LoadSheet(nsIURI* aURL, SheetParsingMode aParsingMode, - bool aUseSystemPrincipal, nsICSSLoaderObserver* aObserver, - RefPtr* aSheet); + Result, nsresult> LoadSheet( + nsIURI* aURI, bool aIsPreLoad, nsIPrincipal* aOriginPrincipal, + const Encoding* aPreloadEncoding, nsIReferrerInfo* aReferrerInfo, + nsICSSLoaderObserver* aObserver, CORSMode aCORSMode = CORS_NONE, + const nsAString& aIntegrity = EmptyString()); /** - * Same as above, to be used when the caller doesn't care about the - * not-yet-loaded sheet. + * As above, but without caring for a couple things. */ - nsresult LoadSheet(nsIURI* aURL, bool aIsPreload, - nsIPrincipal* aOriginPrincipal, - const Encoding* aPreloadEncoding, - nsIReferrerInfo* aReferrerInfo, - nsICSSLoaderObserver* aObserver, - CORSMode aCORSMode = CORS_NONE, - const nsAString& aIntegrity = EmptyString()); + Result, nsresult> LoadSheet(nsIURI*, SheetParsingMode, + bool aUseSystemPrincipal, + nsICSSLoaderObserver*); /** * Stop loading all sheets. All nsICSSLoaderObservers involved will be @@ -369,13 +358,12 @@ class Loader final { // Inserts a style sheet into a parent style sheet. void InsertChildSheet(StyleSheet& aSheet, StyleSheet& aParentSheet); - nsresult InternalLoadNonDocumentSheet( + Result, nsresult> InternalLoadNonDocumentSheet( nsIURI* aURL, bool aIsPreload, SheetParsingMode aParsingMode, bool aUseSystemPrincipal, nsIPrincipal* aOriginPrincipal, - const Encoding* aPreloadEncoding, RefPtr* aSheet, - nsIReferrerInfo* aReferrerInfo, nsICSSLoaderObserver* aObserver, - CORSMode aCORSMode = CORS_NONE, - const nsAString& aIntegrity = EmptyString()); + const Encoding* aPreloadEncoding, nsIReferrerInfo* aReferrerInfo, + nsICSSLoaderObserver* aObserver, CORSMode aCORSMode, + const nsAString& aIntegrity); // Post a load event for aObserver to be notified about aSheet. The // notification will be sent with status NS_OK unless the load event is diff --git a/layout/style/PreloadedStyleSheet.cpp b/layout/style/PreloadedStyleSheet.cpp index 3a7500561c61..2f553742b016 100644 --- a/layout/style/PreloadedStyleSheet.cpp +++ b/layout/style/PreloadedStyleSheet.cpp @@ -36,9 +36,11 @@ nsresult PreloadedStyleSheet::GetSheet(StyleSheet** aResult) { if (!mSheet) { RefPtr loader = new css::Loader; - nsresult rv = loader->LoadSheetSync(mURI, mParsingMode, true, &mSheet); - NS_ENSURE_SUCCESS(rv, rv); - MOZ_ASSERT(mSheet); + auto result = loader->LoadSheetSync(mURI, mParsingMode, true); + if (result.isErr()) { + return result.unwrapErr(); + } + mSheet = result.unwrap(); } *aResult = mSheet; @@ -47,21 +49,7 @@ nsresult PreloadedStyleSheet::GetSheet(StyleSheet** aResult) { nsresult PreloadedStyleSheet::Preload() { MOZ_DIAGNOSTIC_ASSERT(!mLoaded); - - // The nsIStyleSheetService.preloadSheet API doesn't tell us which backend - // the sheet will be used with, and it seems wasteful to eagerly create - // both a CSSStyleSheet and a ServoStyleSheet. So instead, we guess that - // the sheet type we will want matches the current value of the stylo pref, - // and preload a sheet of that type. - // - // If we guess wrong, we will re-load the sheet later with the requested type, - // and we won't really have front loaded the loading time as the name - // "preload" might suggest. Also, in theory we could get different data from - // fetching the URL again, but for the usage patterns of this API this is - // unlikely, and it doesn't seem worth trying to store the contents of the URL - // and duplicating a bunch of css::Loader's logic. mLoaded = true; - StyleSheet* sheet; return GetSheet(&sheet); } @@ -90,11 +78,14 @@ nsresult PreloadedStyleSheet::PreloadAsync(NotNull aPromise) { MOZ_DIAGNOSTIC_ASSERT(!mLoaded); RefPtr loader = new css::Loader; - RefPtr obs = new StylesheetPreloadObserver(aPromise, this); - - return loader->LoadSheet(mURI, mParsingMode, false, obs, &mSheet); + auto result = loader->LoadSheet(mURI, mParsingMode, false, obs); + if (result.isErr()) { + return result.unwrapErr(); + } + mSheet = result.unwrap(); + return NS_OK; } } // namespace mozilla diff --git a/layout/style/nsLayoutStylesheetCache.cpp b/layout/style/nsLayoutStylesheetCache.cpp index 88f2125b64da..84228c9c96bb 100644 --- a/layout/style/nsLayoutStylesheetCache.cpp +++ b/layout/style/nsLayoutStylesheetCache.cpp @@ -125,7 +125,7 @@ nsresult nsLayoutStylesheetCache::Observe(nsISupports* aSubject, #define STYLE_SHEET(identifier_, url_, shared_) \ NotNull nsLayoutStylesheetCache::identifier_##Sheet() { \ if (!m##identifier_##Sheet) { \ - LoadSheetURL(url_, &m##identifier_##Sheet, eAgentSheetFeatures, eCrash); \ + m##identifier_##Sheet = LoadSheetURL(url_, eAgentSheetFeatures, eCrash); \ } \ return WrapNotNull(m##identifier_##Sheet); \ } @@ -241,8 +241,8 @@ nsLayoutStylesheetCache::nsLayoutStylesheetCache() : mUsedSharedMemory(0) { if (gUserContentSheetURL) { MOZ_ASSERT(XRE_IsContentProcess(), "Only used in content processes."); - LoadSheet(gUserContentSheetURL, &mUserContentSheet, eUserSheetFeatures, - eLogToConsole); + mUserContentSheet = + LoadSheet(gUserContentSheetURL, eUserSheetFeatures, eLogToConsole); gUserContentSheetURL = nullptr; } @@ -446,37 +446,29 @@ void nsLayoutStylesheetCache::InitFromProfile() { contentFile->Append(NS_LITERAL_STRING("userContent.css")); chromeFile->Append(NS_LITERAL_STRING("userChrome.css")); - LoadSheetFile(contentFile, &mUserContentSheet, eUserSheetFeatures, - eLogToConsole); - LoadSheetFile(chromeFile, &mUserChromeSheet, eUserSheetFeatures, - eLogToConsole); + mUserContentSheet = LoadSheetFile(contentFile, eUserSheetFeatures); + mUserChromeSheet = LoadSheetFile(chromeFile, eUserSheetFeatures); } -void nsLayoutStylesheetCache::LoadSheetURL(const char* aURL, - RefPtr* aSheet, - SheetParsingMode aParsingMode, - FailureAction aFailureAction) { +RefPtr nsLayoutStylesheetCache::LoadSheetURL( + const char* aURL, SheetParsingMode aParsingMode, + FailureAction aFailureAction) { nsCOMPtr uri; NS_NewURI(getter_AddRefs(uri), aURL); - LoadSheet(uri, aSheet, aParsingMode, aFailureAction); - if (!aSheet) { - NS_ERROR(nsPrintfCString("Could not load %s", aURL).get()); - } + return LoadSheet(uri, aParsingMode, aFailureAction); } -void nsLayoutStylesheetCache::LoadSheetFile(nsIFile* aFile, - RefPtr* aSheet, - SheetParsingMode aParsingMode, - FailureAction aFailureAction) { +RefPtr nsLayoutStylesheetCache::LoadSheetFile( + nsIFile* aFile, SheetParsingMode aParsingMode) { bool exists = false; aFile->Exists(&exists); - - if (!exists) return; + if (!exists) { + return nullptr; + } nsCOMPtr uri; NS_NewFileURI(getter_AddRefs(uri), aFile); - - LoadSheet(uri, aSheet, aParsingMode, aFailureAction); + return LoadSheet(uri, aParsingMode, eLogToConsole); } static void ErrorLoadingSheet(nsIURI* aURI, const char* aMsg, @@ -495,20 +487,18 @@ static void ErrorLoadingSheet(nsIURI* aURI, const char* aMsg, MOZ_CRASH_UNSAFE(errorMessage.get()); } -void nsLayoutStylesheetCache::LoadSheet(nsIURI* aURI, - RefPtr* aSheet, - SheetParsingMode aParsingMode, - FailureAction aFailureAction) { +RefPtr nsLayoutStylesheetCache::LoadSheet( + nsIURI* aURI, SheetParsingMode aParsingMode, FailureAction aFailureAction) { if (!aURI) { ErrorLoadingSheet(aURI, "null URI", eCrash); - return; + return nullptr; } if (!gCSSLoader) { gCSSLoader = new Loader; if (!gCSSLoader) { ErrorLoadingSheet(aURI, "no Loader", eCrash); - return; + return nullptr; } } @@ -517,15 +507,16 @@ void nsLayoutStylesheetCache::LoadSheet(nsIURI* aURI, // parallel parsing on them. If that ever changes, we'll either need to find a // different way to prohibit parallel parsing for UA sheets, or handle // -moz-bool-pref and various other things in the parallel parsing code. - nsresult rv = gCSSLoader->LoadSheetSync(aURI, aParsingMode, true, aSheet); - if (NS_FAILED(rv)) { + auto result = gCSSLoader->LoadSheetSync(aURI, aParsingMode, true); + if (MOZ_UNLIKELY(result.isErr())) { ErrorLoadingSheet( aURI, nsPrintfCString("LoadSheetSync failed with error %" PRIx32, - static_cast(rv)) + static_cast(result.unwrapErr())) .get(), aFailureAction); } + return result.unwrapOr(nullptr); } /* static */ diff --git a/layout/style/nsLayoutStylesheetCache.h b/layout/style/nsLayoutStylesheetCache.h index 215ac2233948..a474b1dcc66c 100644 --- a/layout/style/nsLayoutStylesheetCache.h +++ b/layout/style/nsLayoutStylesheetCache.h @@ -114,15 +114,14 @@ class nsLayoutStylesheetCache final : public nsIObserver, void InitSharedSheetsInParent(); void InitSharedSheetsInChild(already_AddRefed aSharedMemory); void InitMemoryReporter(); - void LoadSheetURL(const char* aURL, RefPtr* aSheet, - mozilla::css::SheetParsingMode aParsingMode, - mozilla::css::FailureAction aFailureAction); - void LoadSheetFile(nsIFile* aFile, RefPtr* aSheet, - mozilla::css::SheetParsingMode aParsingMode, - mozilla::css::FailureAction aFailureAction); - void LoadSheet(nsIURI* aURI, RefPtr* aSheet, - mozilla::css::SheetParsingMode aParsingMode, - mozilla::css::FailureAction aFailureAction); + RefPtr LoadSheetURL( + const char* aURL, mozilla::css::SheetParsingMode aParsingMode, + mozilla::css::FailureAction aFailureAction); + RefPtr LoadSheetFile( + nsIFile* aFile, mozilla::css::SheetParsingMode aParsingMode); + RefPtr LoadSheet( + nsIURI* aURI, mozilla::css::SheetParsingMode aParsingMode, + mozilla::css::FailureAction aFailureAction); void LoadSheetFromSharedMemory(const char* aURL, RefPtr* aSheet, mozilla::css::SheetParsingMode aParsingMode,