Commit e571337e authored by Demetrios Papadopoulos's avatar Demetrios Papadopoulos Committed by Commit Bot

Port chrome://conflicts to use JS modules.

Also adding JS type checking.

Bug: 1028829
Change-Id: Ib8b6c924a74495bde4b649a1bc10f308a717bebd
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1957901Reviewed-by: default avatarDan Beam <dbeam@chromium.org>
Commit-Queue: Demetrios Papadopoulos <dpapad@chromium.org>
Auto-Submit: Demetrios Papadopoulos <dpapad@chromium.org>
Cr-Commit-Position: refs/heads/master@{#723535}
parent c1e29be8
...@@ -70,6 +70,14 @@ if (closure_compile) { ...@@ -70,6 +70,14 @@ if (closure_compile) {
if (is_win || is_mac || is_desktop_linux) { if (is_win || is_mac || is_desktop_linux) {
deps += [ "browser_switch:closure_compile" ] deps += [ "browser_switch:closure_compile" ]
} }
# Note: The following targets should only be type-checked on Windows builds,
# but because Window bots don't depend on Java, |closure_compile| is off on
# Windows. Adding |is_linux| so that these targets are type-checked on at
# least one platform.
if (is_win || is_linux) {
deps += [ "conflicts:closure_compile" ]
}
} }
} }
......
# Copyright 2019 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
import("//third_party/closure_compiler/compile_js.gni")
js_type_check("closure_compile") {
uses_js_modules = true
deps = [
":about_conflicts",
]
}
js_library("about_conflicts") {
deps = [
"//third_party/jstemplate:jstemplate",
"//ui/webui/resources/js:cr.m",
"//ui/webui/resources/js:util.m",
]
}
...@@ -254,11 +254,7 @@ html[dir=rtl] .clearing { ...@@ -254,11 +254,7 @@ html[dir=rtl] .clearing {
</div> </div>
</div> </div>
</div> </div>
<script src="chrome://resources/js/cr.js"></script>
<script src="chrome://resources/js/jstemplate_compiled.js"></script> <script src="chrome://resources/js/jstemplate_compiled.js"></script>
<script src="chrome://resources/js/promise_resolver.js"></script> <script type="module" src="chrome://conflicts/conflicts.js"></script>
<script src="chrome://resources/js/util.js"></script>
<script src="chrome://conflicts/conflicts.js"></script>
</body> </body>
</html> </html>
...@@ -2,6 +2,9 @@ ...@@ -2,6 +2,9 @@
// Use of this source code is governed by a BSD-style license that can be // Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file. // found in the LICENSE file.
import {sendWithPromise} from 'chrome://resources/js/cr.m.js';
import {$} from 'chrome://resources/js/util.m.js';
/** /**
* This variable structure is here to document the structure that the template * This variable structure is here to document the structure that the template
* expects to correctly populate the page. * expects to correctly populate the page.
...@@ -39,7 +42,7 @@ function renderTemplate(moduleListData) { ...@@ -39,7 +42,7 @@ function renderTemplate(moduleListData) {
* and return detailed data about the configuration. * and return detailed data about the configuration.
*/ */
function requestModuleListData() { function requestModuleListData() {
cr.sendWithPromise('requestModuleList').then(returnModuleList); sendWithPromise('requestModuleList').then(returnModuleList);
} }
/** /**
...@@ -52,9 +55,9 @@ function filterModuleListData() { ...@@ -52,9 +55,9 @@ function filterModuleListData() {
const modules = document.getElementsByClassName('module'); const modules = document.getElementsByClassName('module');
// Loop through all modules, and hide all that don't match the filter. // Loop through all modules, and hide all that don't match the filter.
for (i = 0; i < modules.length; ++i) { for (const module of modules) {
modules[i].style.display = module.style.display =
modules[i].dataset.process.includes(filter) ? '' : 'none'; module.dataset['process'].includes(filter) ? '' : 'none';
} }
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment