0

WebUI: Add webui_context_type in more targets, set default="relative"

Use the |webui_context_type| parameter in remaining build_webui clients,
and update the default to "relative" so that by default imports that
would cause runtime errors in either chrome:// or chrome-untrusted://
UIs will be caught at build time.

Bug: 328733315
Change-Id: I9b1e1127d0c6f2fd62b80dbed660ceb5e15c8d34
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5384619
Reviewed-by: Demetrios Papadopoulos <dpapad@chromium.org>
Commit-Queue: Rebekah Potter <rbpotter@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1278700}
This commit is contained in:
rbpotter
2024-03-27 00:09:00 +00:00
committed by Chromium LUCI CQ
parent 4042127eea
commit 075012ca9f
23 changed files with 27 additions and 3 deletions
components
commerce
core
internals
resources
download
resources
download_internals
flags_ui
resources
history_clusters
history_clusters_internals
resources
metrics
optimization_guide
optimization_guide_internals
resources
policy
resources
sync
service
resources
ukm
version_ui
resources
content/browser/resources
attribution_reporting
gpu
histograms
indexed_db
media
private_aggregation
process
quota
traces_internals
webxr_internals
docs
ui/webui
examples
resources
browser
resources

@ -34,5 +34,6 @@ build_webui("build") {
"//ui/webui/resources/mojo:build_ts",
]
webui_context_type = "trusted"
grit_output_dir = "$root_gen_dir/components"
}

@ -20,5 +20,6 @@ build_webui("build") {
ts_deps = [ "//ui/webui/resources/js:build_ts" ]
webui_context_type = "trusted"
grit_output_dir = "$root_gen_dir/components"
}

@ -20,6 +20,7 @@ build_webui("build") {
ts_composite = true
ts_definitions = [ "//tools/typescript/definitions/chrome_send.d.ts" ]
ts_deps = [ "//ui/webui/resources/js:build_ts" ]
webui_context_type = "trusted"
grit_output_dir = "$root_gen_dir/components"
}

@ -22,5 +22,6 @@ build_webui("build") {
"//ui/webui/resources/mojo:build_ts",
]
webui_context_type = "trusted"
grit_output_dir = "$root_gen_dir/components"
}

@ -39,6 +39,7 @@ build_webui("build") {
"//ui/webui/resources/js:build_ts",
]
webui_context_type = "trusted"
grit_output_dir = "$root_gen_dir/components"
}

@ -32,5 +32,6 @@ build_webui("build") {
"//ui/webui/resources/mojo:build_ts",
]
webui_context_type = "trusted"
grit_output_dir = "$root_gen_dir/components"
}

@ -45,5 +45,6 @@ build_webui("build") {
"//ui/webui/resources/js:build_ts",
]
webui_context_type = "trusted"
grit_output_dir = "$root_gen_dir/components"
}

@ -42,5 +42,6 @@ build_webui("build") {
"jstemplate.d.ts",
]
webui_context_type = "trusted"
grit_output_dir = "$root_gen_dir/components"
}

@ -28,5 +28,7 @@ build_webui("build") {
ts_deps = [ "//ui/webui/resources/js:build_ts" ]
webui_context_type = "trusted"
grit_output_dir = "$root_gen_dir/components"
}

@ -25,5 +25,6 @@ build_webui("build") {
}
ts_deps = [ "//ui/webui/resources/js:build_ts" ]
webui_context_type = "trusted"
grit_output_dir = "$root_gen_dir/components"
}

@ -25,6 +25,8 @@ build_webui("build") {
"//ui/webui/resources/mojo:build_ts",
]
webui_context_type = "trusted"
attribution_reporting_component_folder = "components/attribution_reporting"
attribution_reporting_content_folder = "content/browser/attribution_reporting"
network_folder = "services/network/public/mojom"

@ -29,6 +29,7 @@ build_webui("build") {
"//ui/webui/resources/js:build_ts",
"//ui/webui/resources/mojo:build_ts",
]
webui_context_type = "trusted"
grit_output_dir = "$root_gen_dir/content"
}

@ -17,5 +17,6 @@ build_webui("build") {
ts_composite = true
ts_deps = [ "//ui/webui/resources/js:build_ts" ]
webui_context_type = "trusted"
grit_output_dir = "$root_gen_dir/content"
}

@ -19,6 +19,7 @@ build_webui("build") {
"//ui/webui/resources/js:build_ts",
"//ui/webui/resources/mojo:build_ts",
]
webui_context_type = "trusted"
indexeddb_internal_folder = "content/browser/indexed_db"
indexeddb_bucket_folder = "components/services/storage/privileged/mojom"

@ -26,5 +26,7 @@ build_webui("build") {
"//ui/webui/resources/js:build_ts",
]
webui_context_type = "trusted"
grit_output_dir = "$root_gen_dir/content/browser/resources/media"
}

@ -24,6 +24,8 @@ build_webui("build") {
"//ui/webui/resources/mojo:build_ts",
]
webui_context_type = "trusted"
private_aggregation_content_folder = "content/browser/private_aggregation"
mojo_files = [ "$root_gen_dir/$private_aggregation_content_folder/private_aggregation_internals.mojom-webui.ts" ]

@ -24,5 +24,6 @@ build_webui("build") {
"//ui/webui/resources/mojo:build_ts",
]
webui_context_type = "trusted"
grit_output_dir = "$root_gen_dir/content"
}

@ -32,5 +32,6 @@ build_webui("build") {
"//ui/webui/resources/mojo:build_ts",
]
webui_context_type = "trusted"
grit_output_dir = "$root_gen_dir/content"
}

@ -29,6 +29,7 @@ build_webui("build") {
]
ts_composite = true
webui_context_type = "trusted"
mojo_files_deps =
[ "//content/browser/tracing/trace_report:mojo_bindings_ts__generator" ]

@ -47,5 +47,6 @@ build_webui("build") {
"//ui/webui/resources/mojo:build_ts",
]
webui_context_type = "trusted"
grit_output_dir = "$root_gen_dir/content"
}

@ -616,7 +616,7 @@ optimize_webui_in_files: See |in_files| in bundle_js().
Other params:
webui_context_type: See |webui_context_type| in webui_path_mappings(). Optional,
defaults to "trusted".
defaults to "relative".
generate_grdp: Whether to generate grdp file instead of a grd file. Defaults to
false.
grd_prefix: See |grd_prefix| in generate_grd(). Required parameter.

@ -3,7 +3,7 @@
// found in the LICENSE file.
import {PageHandlerFactory, PageHandlerRemote} from './browser.mojom-webui.js';
import {Url as MojoUrl} from 'chrome://resources/mojo/url/mojom/url.mojom-webui.js';
import {Url as MojoUrl} from '//resources/mojo/url/mojom/url.mojom-webui.js';
import {
DictionaryValue as mojoBase_mojom_DictionaryValue

@ -294,7 +294,7 @@ template("build_webui") {
ts_deps = invoker.ts_deps
visibility = [ ":build_ts" ]
webui_context_type = "trusted"
webui_context_type = "relative"
if (defined(invoker.webui_context_type)) {
webui_context_type = invoker.webui_context_type
}