Skip to content

Commit ba4e616

Browse files
Landodminor
authored andcommitted
Bug 1720570: apply code formatting via Lando
# ignore-this-changeset
1 parent 27214f9 commit ba4e616

File tree

8 files changed

+35
-28
lines changed

8 files changed

+35
-28
lines changed

dom/script/ModuleLoader.cpp

Lines changed: 15 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -26,12 +26,12 @@
2626
#include "mozilla/CycleCollectedJSContext.h"
2727
#include "mozilla/LoadInfo.h"
2828
#include "mozilla/Maybe.h"
29+
#include "mozilla/StyleSheet.h"
30+
#include "mozilla/StyleSheetInlines.h"
2931
#include "mozilla/dom/AutoEntryScript.h"
3032
#include "mozilla/dom/Document.h"
3133
#include "mozilla/dom/Element.h"
3234
#include "mozilla/dom/RequestBinding.h"
33-
#include "mozilla/StyleSheet.h"
34-
#include "mozilla/StyleSheetInlines.h"
3535
#include "nsContentSecurityManager.h"
3636
#include "nsError.h"
3737
#include "nsIContent.h"
@@ -373,10 +373,11 @@ nsresult ModuleLoader::CompileCssModule(
373373
ErrorResult error;
374374
auto compile = [&](auto& source) {
375375
using T = decltype(source);
376-
static_assert(std::is_same_v<T, JS::SourceText<char16_t>&> || std::is_same_v<T, JS::SourceText<Utf8Unit>&>);
376+
static_assert(std::is_same_v<T, JS::SourceText<char16_t>&> ||
377+
std::is_same_v<T, JS::SourceText<Utf8Unit>&>);
377378

378379
nsCOMPtr<nsPIDOMWindowInner> window =
379-
do_QueryInterface(aRequest->GetGlobalObject());
380+
do_QueryInterface(aRequest->GetGlobalObject());
380381
if (!window) {
381382
error.ThrowNotSupportedError("Not supported when there is no document");
382383
return;
@@ -388,19 +389,22 @@ nsresult ModuleLoader::CompileCssModule(
388389
return;
389390
}
390391

391-
// 5. Let sheet be the result of running the steps to create a constructed CSSStyleSheet
392+
// 5. Let sheet be the result of running the steps to create a constructed
393+
// CSSStyleSheet
392394
// with an empty dictionary as the argument.
393-
// Note that according to the specification, the baseURL should be the baseURL of the document,
394-
// but that doesn't seem correct (see https://github.com/whatwg/html/issues/11629).
395+
// Note that according to the specification, the baseURL should be the
396+
// baseURL of the document, but that doesn't seem correct (see
397+
// https://github.com/whatwg/html/issues/11629).
395398
dom::CSSStyleSheetInit options;
396-
RefPtr<StyleSheet> sheet = StyleSheet::CreateConstructedSheet(*constructorDocument, aRequest->mBaseURL, options, error);
399+
RefPtr<StyleSheet> sheet = StyleSheet::CreateConstructedSheet(
400+
*constructorDocument, aRequest->mBaseURL, options, error);
397401
if (error.Failed()) {
398402
return;
399403
}
400404

401-
// 6. Run the steps to synchronously replace the rules of a CSSStyleSheet on sheet given source.
402-
// Ideally we wouldn't run this on the main thread for large scripts,
403-
// see https://bugzilla.mozilla.org/show_bug.cgi?id=1987143.
405+
// 6. Run the steps to synchronously replace the rules of a CSSStyleSheet on
406+
// sheet given source. Ideally we wouldn't run this on the main thread for
407+
// large scripts, see https://bugzilla.mozilla.org/show_bug.cgi?id=1987143.
404408
if constexpr (std::is_same_v<T, JS::SourceText<mozilla::Utf8Unit>&>) {
405409
nsDependentCSubstring text(source.get(), source.length());
406410
sheet->ReplaceSync(text, error);

dom/workers/loader/WorkerModuleLoader.h

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -94,8 +94,10 @@ class WorkerModuleLoader : public JS::loader::ModuleLoaderBase {
9494

9595
bool IsModuleTypeAllowed(JS::ModuleType aModuleType) override {
9696
// https://html.spec.whatwg.org/#module-type-allowed
97-
// If moduleType is "css" and the CSSStyleSheet interface is not exposed in settings's realm, then return false.
98-
return aModuleType != JS::ModuleType::Unknown && aModuleType != JS::ModuleType::CSS;
97+
// If moduleType is "css" and the CSSStyleSheet interface is not exposed in
98+
// settings's realm, then return false.
99+
return aModuleType != JS::ModuleType::Unknown &&
100+
aModuleType != JS::ModuleType::CSS;
99101
}
100102
};
101103

dom/worklet/loader/WorkletModuleLoader.h

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -92,8 +92,10 @@ class WorkletModuleLoader : public JS::loader::ModuleLoaderBase {
9292

9393
bool IsModuleTypeAllowed(JS::ModuleType aModuleType) override {
9494
// https://html.spec.whatwg.org/#module-type-allowed
95-
// If moduleType is "css" and the CSSStyleSheet interface is not exposed in settings's realm, then return false.
96-
return aModuleType != JS::ModuleType::Unknown && aModuleType != JS::ModuleType::CSS;
95+
// If moduleType is "css" and the CSSStyleSheet interface is not exposed in
96+
// settings's realm, then return false.
97+
return aModuleType != JS::ModuleType::Unknown &&
98+
aModuleType != JS::ModuleType::CSS;
9799
}
98100

99101
// A hashtable to map a nsIURI(from main thread) to a ModuleLoadRequest(in

js/loader/ModuleLoaderBase.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -426,7 +426,8 @@ class ModuleLoaderBase : public nsISupports {
426426
return false;
427427
}
428428

429-
if (aModuleType == ModuleType::CSS && !mozilla::StaticPrefs::layout_css_module_scripts_enabled()) {
429+
if (aModuleType == ModuleType::CSS &&
430+
!mozilla::StaticPrefs::layout_css_module_scripts_enabled()) {
430431
return false;
431432
}
432433

js/src/shell/ModuleLoader.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -548,8 +548,8 @@ JSObject* ModuleLoader::loadAndParse(JSContext* cx, HandleString pathArg,
548548
}
549549
break;
550550
case JS::ModuleType::CSS:
551-
// We don't support CSS modules in the shell because we don't have access to a
552-
// CSS parser in standalone shell builds.
551+
// We don't support CSS modules in the shell because we don't have access
552+
// to a CSS parser in standalone shell builds.
553553
JS_ReportErrorNumberASCII(cx, GetErrorMessage, nullptr,
554554
JSMSG_BAD_MODULE_TYPE);
555555
return nullptr;

js/src/vm/Modules.cpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -297,7 +297,6 @@ JS_PUBLIC_API JSObject* JS::CompileJsonModule(
297297
JS_PUBLIC_API JSObject* JS::CreateCssModule(
298298
JSContext* cx, const ReadOnlyCompileOptions& options,
299299
const Value& cssValue) {
300-
301300
Rooted<ExportNameVector> exportNames(cx);
302301
if (!exportNames.append(cx->names().default_)) {
303302
ReportOutOfMemory(cx);

layout/style/StyleSheet.cpp

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,8 @@ already_AddRefed<StyleSheet> StyleSheet::Constructor(
9797
return nullptr;
9898
}
9999

100-
return CreateConstructedSheet(*constructorDocument, constructorDocument->GetBaseURI(), aOptions, aRv);
100+
return CreateConstructedSheet(
101+
*constructorDocument, constructorDocument->GetBaseURI(), aOptions, aRv);
101102
}
102103

103104
StyleSheet::~StyleSheet() {
@@ -1154,9 +1155,8 @@ void StyleSheet::FixUpAfterInnerClone() {
11541155
/* static */
11551156
// https://wicg.github.io/construct-stylesheets/#dom-cssstylesheet-cssstylesheet
11561157
already_AddRefed<StyleSheet> StyleSheet::CreateConstructedSheet(
1157-
dom::Document& aConstructorDocument, nsIURI* aBaseURI, const dom::CSSStyleSheetInit& aOptions,
1158-
ErrorResult& aRv) {
1159-
1158+
dom::Document& aConstructorDocument, nsIURI* aBaseURI,
1159+
const dom::CSSStyleSheetInit& aOptions, ErrorResult& aRv) {
11601160
// 1. Construct a sheet and set its properties (see spec).
11611161
auto sheet =
11621162
MakeRefPtr<StyleSheet>(css::SheetParsingMode::eAuthorSheetFeatures,
@@ -1169,7 +1169,7 @@ already_AddRefed<StyleSheet> StyleSheet::CreateConstructedSheet(
11691169
baseURI = aBaseURI;
11701170
} else {
11711171
nsresult rv = NS_NewURI(getter_AddRefs(baseURI), aOptions.mBaseURL.Value(),
1172-
nullptr, aConstructorDocument.GetBaseURI());
1172+
nullptr, aConstructorDocument.GetBaseURI());
11731173
if (NS_FAILED(rv)) {
11741174
aRv.ThrowNotAllowedError(
11751175
"Constructed style sheets must have a valid base URL");

layout/style/StyleSheet.h

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -123,10 +123,9 @@ class StyleSheet final : public nsICSSLoaderObserver, public nsWrapperCache {
123123
NS_DECL_CYCLE_COLLECTING_ISUPPORTS
124124
NS_DECL_CYCLE_COLLECTION_WRAPPERCACHE_CLASS(StyleSheet)
125125

126-
static already_AddRefed<StyleSheet> CreateConstructedSheet(dom::Document& aConstructorDocument,
127-
nsIURI* aBaseURI,
128-
const dom::CSSStyleSheetInit& aOptions,
129-
ErrorResult& aError);
126+
static already_AddRefed<StyleSheet> CreateConstructedSheet(
127+
dom::Document& aConstructorDocument, nsIURI* aBaseURI,
128+
const dom::CSSStyleSheetInit& aOptions, ErrorResult& aError);
130129

131130
already_AddRefed<StyleSheet> CreateEmptyChildSheet(
132131
already_AddRefed<dom::MediaList> aMediaList) const;

0 commit comments

Comments
 (0)