diff --git a/BUILD.gn b/BUILD.gn index 2327eb9d67..1bc9cbc97a 100644 --- a/BUILD.gn +++ b/BUILD.gn @@ -5,6 +5,7 @@ import("//third_party/blink/public/public_features.gni") all_devtools_files = [ + "front_end/shell.js", "front_end/accessibility_test_runner/AccessibilityPaneTestRunner.js", "front_end/accessibility_test_runner/module.json", "front_end/accessibility/accessibilityNode.css", @@ -902,7 +903,6 @@ all_devtools_modules = [ "front_end/resources/ApplicationCacheItemsView.js", "front_end/resources/AppManifestView.js", "front_end/root.js", - "front_end/root.js", "front_end/Runtime.js", "front_end/screencast/InputModel.js", "front_end/screencast/screencast.js", diff --git a/front_end/devtools_app.html b/front_end/devtools_app.html index 7387941327..e48b815a1f 100644 --- a/front_end/devtools_app.html +++ b/front_end/devtools_app.html @@ -10,7 +10,7 @@ - + diff --git a/front_end/devtools_app.js b/front_end/devtools_app.js index 75cbe26a15..b7ae6715a3 100644 --- a/front_end/devtools_app.js +++ b/front_end/devtools_app.js @@ -1,4 +1,6 @@ // Copyright 2018 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 './shell.js'; + Root.Runtime.startApplication('devtools_app'); diff --git a/front_end/inspector.html b/front_end/inspector.html index e26cd22c1b..27fbabfca5 100644 --- a/front_end/inspector.html +++ b/front_end/inspector.html @@ -10,7 +10,7 @@ - + diff --git a/front_end/inspector.js b/front_end/inspector.js index bfb7f060d7..55b39dbc1e 100644 --- a/front_end/inspector.js +++ b/front_end/inspector.js @@ -1,4 +1,6 @@ // Copyright 2014 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 './devtools_app.js'; + Root.Runtime.startApplication('inspector'); diff --git a/front_end/integration_test_runner.html b/front_end/integration_test_runner.html index 8abe4fb462..aee0fc6931 100644 --- a/front_end/integration_test_runner.html +++ b/front_end/integration_test_runner.html @@ -9,7 +9,7 @@ - + diff --git a/front_end/integration_test_runner.js b/front_end/integration_test_runner.js index f6f6a7a0f3..5a3cc4c1ee 100644 --- a/front_end/integration_test_runner.js +++ b/front_end/integration_test_runner.js @@ -2,6 +2,8 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. +import './devtools_app.js'; + if (self.testRunner) { testRunner.dumpAsText(); testRunner.waitUntilDone(); diff --git a/front_end/js_app.html b/front_end/js_app.html index 8d7b199edf..adb1052817 100644 --- a/front_end/js_app.html +++ b/front_end/js_app.html @@ -10,7 +10,7 @@ - + diff --git a/front_end/js_app.js b/front_end/js_app.js index 076e3f77af..7e2051d427 100644 --- a/front_end/js_app.js +++ b/front_end/js_app.js @@ -1,4 +1,6 @@ // Copyright 2018 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 './shell.js'; + Root.Runtime.startApplication('js_app'); diff --git a/front_end/ndb_app.html b/front_end/ndb_app.html index 9c25b868e2..d9b00615d5 100644 --- a/front_end/ndb_app.html +++ b/front_end/ndb_app.html @@ -10,7 +10,7 @@ - + diff --git a/front_end/ndb_app.js b/front_end/ndb_app.js index 379d9b27f0..c70422d628 100644 --- a/front_end/ndb_app.js +++ b/front_end/ndb_app.js @@ -1,4 +1,6 @@ // Copyright 2018 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 './shell.js'; + Root.Runtime.startApplication('ndb_app'); diff --git a/front_end/node_app.html b/front_end/node_app.html index f24991cafc..7bccb8678c 100644 --- a/front_end/node_app.html +++ b/front_end/node_app.html @@ -10,7 +10,7 @@ - + diff --git a/front_end/node_app.js b/front_end/node_app.js index 1125741b4f..4002463b32 100644 --- a/front_end/node_app.js +++ b/front_end/node_app.js @@ -1,5 +1,6 @@ // Copyright 2018 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 './shell.js'; Root.Runtime.startApplication('node_app'); diff --git a/front_end/shell.js b/front_end/shell.js new file mode 100644 index 0000000000..160503807a --- /dev/null +++ b/front_end/shell.js @@ -0,0 +1,5 @@ +// Copyright 2020 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 './Runtime.js'; +// We generate the descriptors in this file, which depend on the runtime. diff --git a/front_end/toolbox.html b/front_end/toolbox.html index 98dbdd366a..fb3a738055 100644 --- a/front_end/toolbox.html +++ b/front_end/toolbox.html @@ -9,7 +9,7 @@ - + diff --git a/front_end/worker_app.html b/front_end/worker_app.html index 09f263de7f..0cf7fbfb0c 100644 --- a/front_end/worker_app.html +++ b/front_end/worker_app.html @@ -10,7 +10,7 @@ - + diff --git a/front_end/worker_app.js b/front_end/worker_app.js index 68642793de..26c5b887c0 100644 --- a/front_end/worker_app.js +++ b/front_end/worker_app.js @@ -1,5 +1,6 @@ // Copyright 2018 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 './shell.js'; Root.Runtime.startApplication('worker_app'); diff --git a/scripts/build/build_release_applications.py b/scripts/build/build_release_applications.py index 7286648a77..67cd573a23 100644 --- a/scripts/build/build_release_applications.py +++ b/scripts/build/build_release_applications.py @@ -121,34 +121,13 @@ class ReleaseBuilder(object): def build_app(self): if self.descriptors.has_html: - self._build_html() + html_entrypoint = self.app_file('html') + write_file(join(self.output_dir, html_entrypoint), read_file(join(self.application_dir, html_entrypoint))) self._build_app_script() for module in filter(lambda desc: (not desc.get('type') or desc.get('type') == 'remote'), self.descriptors.application.values()): self._concatenate_dynamic_module(module['name']) - def _write_include_tags(self, descriptors, output): - if descriptors.extends: - self._write_include_tags(descriptors.extends, output) - output.write(self._generate_include_tag(descriptors.application_name + '.js')) - - def _build_html(self): - html_name = self.app_file('html') - output = StringIO() - with open(join(self.application_dir, html_name), 'r') as app_input_html: - for line in app_input_html: - if ('\n' % minify_js(read_file(js_file))) - output.write(line) - - write_file(join(self.output_dir, html_name), output.getvalue()) - output.close() - def _build_app_script(self): script_name = self.app_file('js') output = StringIO() @@ -156,12 +135,6 @@ class ReleaseBuilder(object): write_file(join(self.output_dir, script_name), minify_js(output.getvalue())) output.close() - def _generate_include_tag(self, resource_path): - if resource_path.endswith('.js'): - return ' \n' % resource_path - else: - assert resource_path - def _release_module_descriptors(self): module_descriptors = self.descriptors.modules result = [] @@ -210,10 +183,6 @@ class ReleaseBuilder(object): if len(non_autostart_deps): bail_error( 'Non-autostart dependencies specified for the autostarted module "%s": %s' % (name, non_autostart_deps)) - namespace = self._map_module_to_namespace(name) - output.write('\n/* Module %s */\n' % name) - output.write('\nself[\'%s\'] = self[\'%s\'] || {};\n' % (namespace, namespace)) - modular_build.concatenate_scripts(desc.get('scripts'), join(self.application_dir, name), self.output_dir, output) else: non_autostart.add(name) @@ -222,22 +191,15 @@ class ReleaseBuilder(object): return self._special_case_namespaces.get(module, camel_case_namespace) def _concatenate_application_script(self, output): - if not self.descriptors.extends: - output.write('Root.allDescriptors.push(...%s);' % self._release_module_descriptors()) - output.write('/* Application descriptor %s */\n' % self.app_file('json')) - output.write('Root.applicationDescriptor = %s;' % self.descriptors.application_json()) - else: - output.write('/* Additional descriptors */\n') - output.write('Root.allDescriptors.push(...%s);' % self._release_module_descriptors()) - output.write('/* Additional descriptors %s */\n' % self.app_file('json')) + output.write('Root.allDescriptors.push(...%s);' % self._release_module_descriptors()) + if self.descriptors.extends: output.write('Root.applicationDescriptor.modules.push(...%s);' % json.dumps(self.descriptors.application.values())) - - output.write('\n/* Autostart modules */\n') - if (self.descriptors.worker): - output.write(minify_js(read_file(join(self.application_dir, self.app_file('js'))))) else: - self._concatenate_autostart_modules(output) - output.write(';\n/* Autostart resources */\n') + output.write('Root.applicationDescriptor = %s;' % self.descriptors.application_json()) + + output.write(minify_js(read_file(join(self.application_dir, self.app_file('js'))))) + self._concatenate_autostart_modules(output) + self._write_module_resources(self.autorun_resource_names(), output) if not self.descriptors.has_html and not self.descriptors.worker: js_file = join(self.application_dir, self.app_file('js'))