Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(5404)

Unified Diff: chrome/browser/resources/vulcanize_gn.py

Issue 2573943002: WebUI: Vulcanize MD Settings at compile time. (Closed)
Patch Set: Fix path to crisper.js to not be relative. Created 3 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: chrome/browser/resources/vulcanize_gn.py
diff --git a/chrome/browser/resources/vulcanize_gn.py b/chrome/browser/resources/vulcanize_gn.py
index 0b2df59ac2b0f6ae5b0585090ddc1fcd40f5d4a6..2cf639a10637929869bfb1b02d7765469dd9ca1a 100755
--- a/chrome/browser/resources/vulcanize_gn.py
+++ b/chrome/browser/resources/vulcanize_gn.py
@@ -144,7 +144,8 @@ def _vulcanize(in_folder, out_folder, host, html_in_file,
output = _run_node(
[node_modules.PathToVulcanize()] +
_VULCANIZE_BASE_ARGS + _VULCANIZE_REDIRECT_ARGS +
- ['--out-request-list', os.path.join(out_path, _REQUEST_LIST_FILE),
+ ['--out-request-list', os.path.normpath(
+ os.path.join(out_path, _REQUEST_LIST_FILE)),
'--redirect', '"/|%s"' % in_path,
'--redirect', '"chrome://%s/|%s"' % (host, in_path),
# TODO(dpapad): Figure out why vulcanize treats the input path
@@ -165,6 +166,18 @@ def _vulcanize(in_folder, out_folder, host, html_in_file,
'--html', html_out_path,
'--js', js_out_path])
+ # Replace last line of vulcanized HTML to use an absolute path for
+ # crisper.js. TODO(dpapad): Is there a faster way to do this?
+ js_out_file = os.path.basename(js_out_path)
+ with open(html_out_path, 'r+') as f:
+ lines = f.readlines();
+ last_line = lines[-1]
+ updated_line = last_line.replace(
+ js_out_file, 'chrome://' + host + '/' + js_out_file)
+ lines[-1] = updated_line
+ f.seek(0)
+ f.write(''.join(lines))
+
# TODO(tsergeant): Remove when JS resources are minified by default:
# crbug.com/619091.
_run_node([node_modules.PathToUglifyJs(), js_out_path,

Powered by Google App Engine
This is Rietveld 408576698