Commit 3585346a authored by rbpotter's avatar rbpotter Committed by Commit Bot

Print Preview: Make chrome://print/a/b/ load chrome://print

Update loading chrome://print/a/b/ to work in debug builds instead of
resulting in errors by adding <base href="chrome://print">. Also
automatically correct URLs like this to chrome://print, to match
the behavior of the settings and extensions pages.

Bug: none
Change-Id: I466558eff395ac8ac726e3ba7f5e8e7788c6f796
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1592048
Commit-Queue: Rebekah Potter <rbpotter@chromium.org>
Reviewed-by: default avatarDemetrios Papadopoulos <dpapad@chromium.org>
Cr-Commit-Position: refs/heads/master@{#656208}
parent 46554add
......@@ -3,6 +3,9 @@
$i18n{dark} $i18n{newprintpreviewlayout}>
<head>
<meta charset="utf-8">
<if expr="not optimize_webui">
<base href="chrome://print">
</if>
<style>
html {
background: rgb(232, 234, 237); /* --google-grey-200 */
......
......@@ -14,7 +14,8 @@
<structures>
<structure name="IDR_PRINT_PREVIEW_HTML"
file="print_preview.html"
type="chrome_html" />
type="chrome_html"
preprocess="true" />
<structure name="IDR_PRINT_PREVIEW_UI_APP_HTML"
file="ui/app.html"
type="chrome_html"
......
......@@ -107,6 +107,17 @@ Polymer({
/** @private {!Array<!CrDialogElement>} */
openDialogs_: [],
/** @override */
created: function() {
// Regular expression that captures the leading slash, the content and the
// trailing slash in three different groups.
const CANONICAL_PATH_REGEX = /(^\/)([\/-\w]+)(\/$)/;
const path = location.pathname.replace(CANONICAL_PATH_REGEX, '$1$2');
if (path !== '/') { // There are no subpages in Print Preview.
window.history.replaceState(undefined /* stateObject */, '', '/');
}
},
/** @override */
ready: function() {
cr.ui.FocusOutlineManager.forDocument(document);
......
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