Skip to content

Commit

Permalink
Adds developer flag and defines Previews bit for a new NoScript preview
Browse files Browse the repository at this point in the history
This has basic definitions to allow us to write a new preview
intervention (for disabling javascript) behind a flag for further
testing.

Bug: 773834
Change-Id: Iedcae915d4c7d8c837b003b873118b16ff7625b1
Reviewed-on: https://chromium-review.googlesource.com/714217
Reviewed-by: Scott Little <sclittle@chromium.org>
Reviewed-by: Kinuko Yasuda <kinuko@chromium.org>
Commit-Queue: Doug Arnett <dougarnett@chromium.org>
Cr-Commit-Position: refs/heads/master@{#508431}
  • Loading branch information
Doug Arnett authored and Commit Bot committed Oct 12, 2017
1 parent 89cb8de commit 08b4067
Show file tree
Hide file tree
Showing 8 changed files with 21 additions and 0 deletions.
3 changes: 3 additions & 0 deletions chrome/browser/about_flags.cc
Original file line number Diff line number Diff line change
Expand Up @@ -2105,6 +2105,9 @@ const FeatureEntry kFeatureEntries[] = {
previews::features::kClientLoFi,
kClientPlaceholdersForServerLoFiFeatureVariations,
"PreviewsClientLoFi")},
{"enable-noscript-previews", flag_descriptions::kEnableNoScriptPreviewsName,
flag_descriptions::kEnableNoScriptPreviewsDescription, kOsAll,
FEATURE_VALUE_TYPE(previews::features::kNoScriptPreviews)},
{"allow-insecure-localhost", flag_descriptions::kAllowInsecureLocalhostName,
flag_descriptions::kAllowInsecureLocalhostDescription, kOsAll,
SINGLE_VALUE_TYPE(switches::kAllowInsecureLocalhost)},
Expand Down
5 changes: 5 additions & 0 deletions chrome/browser/flag_descriptions.cc
Original file line number Diff line number Diff line change
Expand Up @@ -299,6 +299,11 @@ const char kEnableClientLoFiName[] = "Client-side Lo-Fi previews";
const char kEnableClientLoFiDescription[] =
"Enable showing low fidelity images on some pages on slow networks.";

const char kEnableNoScriptPreviewsName[] = "NoScript previews";

const char kEnableNoScriptPreviewsDescription[] =
"Enable disabling JavaScript on some pages on slow networks.";

const char kEnableDataReductionProxyLitePageName[] =
"Lite pages for Data Saver Lo-Fi mode";
const char kEnableDataReductionProxyLitePageDescription[] =
Expand Down
3 changes: 3 additions & 0 deletions chrome/browser/flag_descriptions.h
Original file line number Diff line number Diff line change
Expand Up @@ -210,6 +210,9 @@ extern const char kEnableClearBrowsingDataCountersDescription[];
extern const char kEnableClientLoFiName[];
extern const char kEnableClientLoFiDescription[];

extern const char kEnableNoScriptPreviewsName[];
extern const char kEnableNoScriptPreviewsDescription[];

extern const char kEnableDataReductionProxyLitePageName[];
extern const char kEnableDataReductionProxyLitePageDescription[];

Expand Down
4 changes: 4 additions & 0 deletions components/previews/core/previews_features.cc
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,10 @@ const base::Feature kOfflinePreviews{"OfflinePreviews",
const base::Feature kClientLoFi{"ClientLoFi",
base::FEATURE_DISABLED_BY_DEFAULT};

// Enables the NoScript previews for Android.
const base::Feature kNoScriptPreviews{"NoScriptPreviews",
base::FEATURE_DISABLED_BY_DEFAULT};

// Enables the Stale Previews timestamp on Previews infobars.
const base::Feature kStalePreviewsTimestamp{"StalePreviewsTimestamp",
base::FEATURE_ENABLED_BY_DEFAULT};
Expand Down
1 change: 1 addition & 0 deletions components/previews/core/previews_features.h
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ namespace features {

extern const base::Feature kOfflinePreviews;
extern const base::Feature kClientLoFi;
extern const base::Feature kNoScriptPreviews;
extern const base::Feature kStalePreviewsTimestamp;
extern const base::Feature kAMPRedirection;

Expand Down
2 changes: 2 additions & 0 deletions content/public/common/previews_state.h
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ enum PreviewsTypes {
PREVIEWS_OFF = 1 << 5, // Request a normal (non-Preview) version of
// the resource. Server transformations may
// still happen if the page is heavy.
NOSCRIPT_ON = 1 << 6, // Request that script be disabled for page load.
PREVIEWS_STATE_LAST = PREVIEWS_OFF
};

Expand All @@ -59,6 +60,7 @@ STATIC_ASSERT_PREVIEWS_ENUM(SERVER_LITE_PAGE_ON,
STATIC_ASSERT_PREVIEWS_ENUM(PREVIEWS_NO_TRANSFORM,
blink::WebURLRequest::kPreviewsNoTransform);
STATIC_ASSERT_PREVIEWS_ENUM(PREVIEWS_OFF, blink::WebURLRequest::kPreviewsOff);
STATIC_ASSERT_PREVIEWS_ENUM(NOSCRIPT_ON, blink::WebURLRequest::kNoScriptOn);
STATIC_ASSERT_PREVIEWS_ENUM(PREVIEWS_STATE_LAST,
blink::WebURLRequest::kPreviewsStateLast);

Expand Down
1 change: 1 addition & 0 deletions third_party/WebKit/public/platform/WebURLRequest.h
Original file line number Diff line number Diff line change
Expand Up @@ -178,6 +178,7 @@ class WebURLRequest {
kPreviewsOff = 1 << 5, // Request a normal (non-Preview) version of
// the resource. Server transformations may
// still happen if the page is heavy.
kNoScriptOn = 1 << 6, // Request that script be disabled for page load.
kPreviewsStateLast = kPreviewsOff
};

Expand Down
2 changes: 2 additions & 0 deletions tools/metrics/histograms/enums.xml
Original file line number Diff line number Diff line change
Expand Up @@ -23530,6 +23530,7 @@ from previous Chrome versions.
<int value="-1631329950" label="ssl-version-max"/>
<int value="-1630419335" label="enable-download-notification"/>
<int value="-1624854957" label="enable-es3-apis"/>
<int value="-1620804800" label="NoScriptPreviews:disabled"/>
<int value="-1620568042" label="FeaturePolicy:disabled"/>
<int value="-1619757314" label="touch-scrolling-mode"/>
<int value="-1618707999" label="enable-webfonts-intervention-v2"/>
Expand Down Expand Up @@ -24514,6 +24515,7 @@ from previous Chrome versions.
<int value="1320201920" label="enable-touchpad-three-finger-click"/>
<int value="1330029351" label="AutofillUpstreamShowGoogleLogo:disabled"/>
<int value="1330264457" label="OmniboxUIExperimentVerticalLayout:disabled"/>
<int value="1333847867" label="NoScriptPreviews:enabled"/>
<int value="1340690624" label="WebPaymentsMethodSectionOrderV2:disabled"/>
<int value="1344833841" label="ImeThread:enabled"/>
<int value="1351830811" label="do-not-ignore-autocomplete-off"/>
Expand Down

0 comments on commit 08b4067

Please sign in to comment.