Remove experimental mobilization flags.
This commit is contained in:
@@ -1984,8 +1984,6 @@ Listen 127.0.0.2:@@APACHE_TERTIARY_PORT@@
|
||||
ModPagespeedFetchProxy localhost:@@APACHE_SECONDARY_PORT@@
|
||||
ModPagespeedFileCachePath "@@MOD_PAGESPEED_CACHE@@_proxysuffix"
|
||||
ModPagespeedRewriteLevel PassThrough
|
||||
ModPagespeedMobNav on
|
||||
ModPagespeedAlwaysMobilize on
|
||||
ModPagespeedProxySuffix .suffix.net
|
||||
ModPagespeedEnableFilters rewrite_domains,collapse_whitespace,mobilize
|
||||
ModPagespeedEnableFilters rewrite_images,experiment_collect_mob_image_info,rewrite_css
|
||||
|
||||
@@ -394,9 +394,10 @@ void DomainRewriteFilter::StartElementImpl(HtmlElement* element) {
|
||||
// base tag applies for that set of elements.
|
||||
return;
|
||||
}
|
||||
// Disable rewriting if the iframe_fetcher is enabled
|
||||
const RewriteOptions* options = driver()->options();
|
||||
if (options->mob_iframe()) {
|
||||
// TODO(yassinh): Cleanup domain rewrite filter to remove DisableDomainRewrite
|
||||
// condition.
|
||||
if (options->DisableDomainRewrite()) {
|
||||
return;
|
||||
}
|
||||
resource_tag_scanner::UrlCategoryVector attributes;
|
||||
|
||||
@@ -153,7 +153,6 @@ TEST_F(DomainRewriteFilterTest, DontTouchIfAlreadyRewritten) {
|
||||
TEST_F(DomainRewriteFilterTest, RewriteHyperlinks) {
|
||||
options()->ClearSignatureForTesting();
|
||||
options()->set_domain_rewrite_hyperlinks(true);
|
||||
options()->set_mob_iframe(false);
|
||||
ValidateExpected("forms and a tags",
|
||||
StrCat("<a href=\"", kFrom1Domain,
|
||||
"link.html\"/>"
|
||||
@@ -179,33 +178,6 @@ TEST_F(DomainRewriteFilterTest, RewriteHyperlinks) {
|
||||
" src=\"http://to1.test.com/iframe.html\"/>");
|
||||
}
|
||||
|
||||
TEST_F(DomainRewriteFilterTest, NoRewriteWhenMobIframeIsEnabled) {
|
||||
options()->ClearSignatureForTesting();
|
||||
options()->set_domain_rewrite_hyperlinks(true);
|
||||
options()->set_mob_iframe(true);
|
||||
ValidateExpected("forms and a tags in iframe mode",
|
||||
StrCat("<a id=\"psmob-iframe\""
|
||||
" href=\"",
|
||||
kFrom1Domain,
|
||||
"link.html\"/>"
|
||||
"<iframe src=\"",
|
||||
kFrom1Domain,
|
||||
"iframe.html\"/>"
|
||||
"<iframe id=\"psmob-iframe\""
|
||||
" src=\"",
|
||||
kFrom1Domain, "iframe.html\"/>"),
|
||||
StrCat("<a id=\"psmob-iframe\""
|
||||
" href=\"",
|
||||
kFrom1Domain,
|
||||
"link.html\"/>"
|
||||
"<iframe src=\"",
|
||||
kFrom1Domain,
|
||||
"iframe.html\"/>"
|
||||
"<iframe id=\"psmob-iframe\""
|
||||
" src=\"",
|
||||
kFrom1Domain, "iframe.html\"/>"));
|
||||
}
|
||||
|
||||
TEST_F(DomainRewriteFilterTest, RewriteButDoNotShardHyperlinks) {
|
||||
options()->ClearSignatureForTesting();
|
||||
options()->set_domain_rewrite_hyperlinks(true);
|
||||
|
||||
@@ -67,6 +67,9 @@ class CustomRewriteTestBase : public RewriteTestBase {
|
||||
return new OptionsClass(factory()->thread_system());
|
||||
}
|
||||
|
||||
// Non-virtual override of options method defined in RewriteTestBase.
|
||||
OptionsClass* options() { return static_cast<OptionsClass*>(options_); }
|
||||
|
||||
private:
|
||||
// We must call the static Initialize method on the options class before
|
||||
// we construct a factory, which will 'new' the OptionsClass.
|
||||
|
||||
@@ -2683,60 +2683,7 @@ class RewriteOptions {
|
||||
void set_amp_link_pattern(const GoogleString& id) {
|
||||
set_option(id, &_link_pattern_);
|
||||
}
|
||||
|
||||
bool mob_always() const { return mob_always_.value(); }
|
||||
void set_mob_always(bool x) { set_option(x, &mob_always_); }
|
||||
bool mob_iframe() const { return mob_iframe_.value(); }
|
||||
const GoogleString& mob_iframe_viewport() const {
|
||||
return mob_iframe_viewport_.value();
|
||||
}
|
||||
bool mob_iframe_disable() const { return mob_iframe_disable_.value(); }
|
||||
void set_mob_beacon_url(StringPiece x) {
|
||||
set_option(x.as_string(), &mob_beacon_url_);
|
||||
}
|
||||
const GoogleString& mob_beacon_url() const { return mob_beacon_url_.value(); }
|
||||
void set_mob_beacon_category(StringPiece x) {
|
||||
set_option(x.as_string(), &mob_beacon_category_);
|
||||
}
|
||||
const GoogleString& mob_beacon_category() const {
|
||||
return mob_beacon_category_.value();
|
||||
}
|
||||
void set_mob_phone_number(StringPiece x) {
|
||||
set_option(x.as_string(), &mob_phone_number_);
|
||||
}
|
||||
const GoogleString& mob_phone_number() const {
|
||||
return mob_phone_number_.value();
|
||||
}
|
||||
void set_mob_map_location(StringPiece x) {
|
||||
set_option(x.as_string(), &mob_map_location_);
|
||||
}
|
||||
const GoogleString& mob_map_location() const {
|
||||
return mob_map_location_.value();
|
||||
}
|
||||
void set_mob_iframe(bool x) { set_option(x, &mob_iframe_); }
|
||||
void set_mob_iframe_disable(bool x) { set_option(x, &mob_iframe_disable_); }
|
||||
void set_mob_iframe_viewport(StringPiece x) {
|
||||
set_option(x.as_string(), &mob_iframe_viewport_);
|
||||
}
|
||||
const MobTheme& mob_theme() const { return mob_theme_.value(); }
|
||||
void set_mob_theme(const MobTheme& x) {
|
||||
set_option(x, &mob_theme_);
|
||||
}
|
||||
bool has_mob_theme() const { return mob_theme_.was_set(); }
|
||||
int64 mob_conversion_id() const { return mob_conversion_id_.value(); }
|
||||
void set_mob_conversion_id(int64 x) { set_option(x, &mob_conversion_id_); }
|
||||
const GoogleString& mob_map_conversion_label() const {
|
||||
return mob_map_conversion_label_.value();
|
||||
}
|
||||
void set_mob_map_conversion_label(StringPiece x) {
|
||||
set_option(x.as_string(), &mob_map_conversion_label_);
|
||||
}
|
||||
const GoogleString& mob_phone_conversion_label() const {
|
||||
return mob_phone_conversion_label_.value();
|
||||
}
|
||||
void set_mob_phone_conversion_label(StringPiece x) {
|
||||
set_option(x.as_string(), &mob_phone_conversion_label_);
|
||||
}
|
||||
virtual bool DisableDomainRewrite() const { return false; }
|
||||
|
||||
// Merge src into 'this'. Generally, options that are explicitly
|
||||
// set in src will override those explicitly set in 'this' (except that
|
||||
@@ -4239,24 +4186,6 @@ class RewriteOptions {
|
||||
|
||||
Option<ResourceCategorySet> inline_unauthorized_resource_types_;
|
||||
|
||||
Option<bool> mob_always_;
|
||||
Option<bool> mob_iframe_;
|
||||
Option<bool> mob_iframe_disable_;
|
||||
Option<GoogleString> mob_iframe_viewport_;
|
||||
Option<bool> mob_nav_;
|
||||
Option<bool> mob_labeled_mode_;
|
||||
Option<GoogleString> mob_nav_classes_;
|
||||
Option<bool> mob_static_;
|
||||
|
||||
Option<GoogleString> mob_beacon_url_;
|
||||
Option<GoogleString> mob_beacon_category_;
|
||||
Option<GoogleString> mob_map_location_;
|
||||
Option<GoogleString> mob_phone_number_;
|
||||
Option<int64> mob_conversion_id_;
|
||||
Option<GoogleString> mob_map_conversion_label_;
|
||||
Option<GoogleString> mob_phone_conversion_label_;
|
||||
Option<MobTheme> mob_theme_;
|
||||
|
||||
Option<int64> noop_;
|
||||
|
||||
// Comma separated list of headers which we can vary-on, or "Auto", or "None".
|
||||
|
||||
@@ -1297,8 +1297,7 @@ void RewriteDriver::AddPostRenderFilters() {
|
||||
// All filters that might add urls should come before the domain rewriter,
|
||||
// so they'll get rewritten.
|
||||
if (rewrite_options->domain_lawyer()->can_rewrite_domains() &&
|
||||
(rewrite_options->Enabled(RewriteOptions::kRewriteDomains) ||
|
||||
rewrite_options->mob_iframe())) {
|
||||
rewrite_options->Enabled(RewriteOptions::kRewriteDomains)) {
|
||||
// Rewrite mapped domains and shard any resources not otherwise rewritten.
|
||||
// We want do do this after all the content-changing rewrites, because they
|
||||
// will map & shard as part of their execution.
|
||||
|
||||
@@ -61,7 +61,6 @@ const char RewriteOptions::kAllowLoggingUrlsInLogRecord[] =
|
||||
"AllowLoggingUrlsInLogRecord";
|
||||
const char RewriteOptions::kAllowOptionsToBeSetByCookies[] =
|
||||
"AllowOptionsToBeSetByCookies";
|
||||
const char RewriteOptions::kAlwaysMobilize[] = "AlwaysMobilize";
|
||||
const char RewriteOptions::kAlwaysRewriteCss[] = "AlwaysRewriteCss";
|
||||
const char RewriteOptions::kAmpLinkPattern[] = "AmpLinkPattern";
|
||||
const char RewriteOptions::kAnalyticsID[] = "AnalyticsID";
|
||||
@@ -228,23 +227,6 @@ const char RewriteOptions::kMinImageSizeLowResolutionBytes[] =
|
||||
"MinImageSizeLowResolutionBytes";
|
||||
const char RewriteOptions::kMinResourceCacheTimeToRewriteMs[] =
|
||||
"MinResourceCacheTimeToRewriteMs";
|
||||
const char RewriteOptions::kMobBeaconCategory[] = "MobBeaconCategory";
|
||||
const char RewriteOptions::kMobBeaconUrl[] = "MobBeaconUrl";
|
||||
const char RewriteOptions::kMobMapLocation[] = "MobMapLocation";
|
||||
const char RewriteOptions::kMobPhoneNumber[] = "MobPhoneNumber";
|
||||
const char RewriteOptions::kMobConversionId[] = "MobConversionId";
|
||||
const char RewriteOptions::kMobMapConversionLabel[] =
|
||||
"MobMapConversionLabel";
|
||||
const char RewriteOptions::kMobPhoneConversionLabel[] =
|
||||
"MobPhoneConversionLabel";
|
||||
const char RewriteOptions::kMobIframe[] = "MobIframe";
|
||||
const char RewriteOptions::kMobIframeDisable[] = "MobIframeDisable";
|
||||
const char RewriteOptions::kMobIframeViewport[] = "MobIframeViewport";
|
||||
const char RewriteOptions::kMobNav[] = "MobNav";
|
||||
const char RewriteOptions::kMobLabeledMode[] = "MobLabeledMode";
|
||||
const char RewriteOptions::kMobNavClasses[] = "MobNavigationalClasses";
|
||||
const char RewriteOptions::kMobStatic[] = "MobStatic";
|
||||
const char RewriteOptions::kMobTheme[] = "MobTheme";
|
||||
const char RewriteOptions::kModifyCachingHeaders[] = "ModifyCachingHeaders";
|
||||
const char RewriteOptions::kNoop[] = "Noop";
|
||||
const char RewriteOptions::kNoTransformOptimizedImages[] =
|
||||
@@ -2245,84 +2227,6 @@ void RewriteOptions::AddProperties() {
|
||||
"\"Auto\", \"None\", or comma separated list of strings chosen from "
|
||||
"\"Save-Data\", \"User-Agent\", and \"Accept\".", true);
|
||||
|
||||
AddBaseProperty(
|
||||
false, &RewriteOptions::mob_always_, "malways", kAlwaysMobilize,
|
||||
kQueryScope,
|
||||
"(experimental) Unconditionally mobilize page regardless of user-agent.",
|
||||
true);
|
||||
AddBaseProperty(
|
||||
"", &RewriteOptions::mob_beacon_category_, "mbeaconcat",
|
||||
kMobBeaconCategory, kDirectoryScope,
|
||||
"(experimental) Additional category info to pass to beacon.",
|
||||
true);
|
||||
AddBaseProperty(
|
||||
kDefaultBeaconUrl, &RewriteOptions::mob_beacon_url_, "mbeaconurl",
|
||||
kMobBeaconUrl, kDirectoryScope,
|
||||
"(experimental) URL for beacons sent from the mobilization filter.",
|
||||
true);
|
||||
AddBaseProperty(
|
||||
"", &RewriteOptions::mob_map_location_, "mlocation", kMobMapLocation,
|
||||
kQueryScope,
|
||||
"(experimental) map location for click-to-navigate. This should be in "
|
||||
"a form suitable for sending to a map query, and will not be exposed in "
|
||||
"a web UI directly until map button is pressed", true);
|
||||
AddBaseProperty(
|
||||
"", &RewriteOptions::mob_phone_number_, "mphone", kMobPhoneNumber,
|
||||
kQueryScope,
|
||||
"(experimental) phone number for click-to-call. This should be in "
|
||||
"a form suitable for sending to a dialer, and will not be exposed in "
|
||||
"a web UI directly until call button is pressed", true);
|
||||
AddBaseProperty(
|
||||
0, &RewriteOptions::mob_conversion_id_, "mcnvid", kMobConversionId,
|
||||
kQueryScope,
|
||||
"(experimental) conversion ID", true);
|
||||
AddBaseProperty(
|
||||
"", &RewriteOptions::mob_map_conversion_label_, "mpcnvl",
|
||||
kMobMapConversionLabel, kQueryScope,
|
||||
"(experimental) phone conversion Label", true);
|
||||
AddBaseProperty(
|
||||
"", &RewriteOptions::mob_phone_conversion_label_, "mmcnvl",
|
||||
kMobPhoneConversionLabel, kQueryScope,
|
||||
"(experimental) map conversion Label", true);
|
||||
// TODO(jud): Remove this option, since we no longer support non-iframe mode.
|
||||
AddBaseProperty(
|
||||
false, &RewriteOptions::mob_iframe_, "miframe", kMobIframe, kQueryScope,
|
||||
"Deprecated. Whether to use an iframe rather than proxying", true);
|
||||
AddBaseProperty(
|
||||
false, &RewriteOptions::mob_iframe_disable_, "miframedis",
|
||||
kMobIframeDisable, kDirectoryScope,
|
||||
"(experimental) serves a redirect to the original page for every request "
|
||||
"for which MobIFrame is enabled. Intended as a safety valve when an "
|
||||
"iframed site is sending us traffic and we don't want to actually "
|
||||
"mobilize it.", true);
|
||||
// Note that setting this option to "none" turns off inserting an iframe. We
|
||||
// use this because it's otherwise difficult to set the option to a blank
|
||||
// string to override the default.
|
||||
AddBaseProperty(
|
||||
"width=device-width,initial-scale=1",
|
||||
&RewriteOptions::mob_iframe_viewport_, "miframev", kMobIframeViewport,
|
||||
kQueryScope,
|
||||
"(experimental) the content of the viewport tag to insert "
|
||||
"when in iframe mode. Set to \"none\" to avoid adding a viewport tag.",
|
||||
true);
|
||||
// TODO(jud): Remove this option.
|
||||
AddBaseProperty(false, &RewriteOptions::mob_nav_, "mnav", kMobNav,
|
||||
kQueryScope, "Deprecated.", true);
|
||||
// TODO(jud): Remove this option. It should always be true.
|
||||
AddBaseProperty(true, &RewriteOptions::mob_labeled_mode_, "mlabeled",
|
||||
kMobLabeledMode, kQueryScope, "Deprecated.", true);
|
||||
// TODO(jud): Remove this option.
|
||||
AddBaseProperty("", &RewriteOptions::mob_nav_classes_, "navcls",
|
||||
kMobNavClasses, kQueryScope, "Deprecated.", true);
|
||||
// TODO(jud): Remove this option.
|
||||
AddBaseProperty(false, &RewriteOptions::mob_static_, "mstatic", kMobStatic,
|
||||
kQueryScope, "Deprecated.", true);
|
||||
AddBaseProperty(
|
||||
MobTheme(), &RewriteOptions::mob_theme_, "mtheme", kMobTheme,
|
||||
kServerScope, // DO NOT MAKE THIS QueryScope --- that would XSS.
|
||||
"(experimental) pre-computed theme for mobilization JS",
|
||||
true);
|
||||
|
||||
// Test-only, so no enum.
|
||||
AddRequestProperty(false,
|
||||
&RewriteOptions::test_instant_fetch_rewrite_deadline_,
|
||||
|
||||
@@ -930,7 +930,6 @@ TEST_F(RewriteOptionsTest, LookupOptionByNameTest) {
|
||||
RewriteOptions::kAllowLoggingUrlsInLogRecord,
|
||||
RewriteOptions::kAllowOptionsToBeSetByCookies,
|
||||
RewriteOptions::kAllowVaryOn,
|
||||
RewriteOptions::kAlwaysMobilize,
|
||||
RewriteOptions::kAlwaysRewriteCss,
|
||||
RewriteOptions::kAmpLinkPattern,
|
||||
RewriteOptions::kAnalyticsID,
|
||||
@@ -1041,21 +1040,6 @@ TEST_F(RewriteOptionsTest, LookupOptionByNameTest) {
|
||||
RewriteOptions::kMetadataCacheStalenessThresholdMs,
|
||||
RewriteOptions::kMinImageSizeLowResolutionBytes,
|
||||
RewriteOptions::kMinResourceCacheTimeToRewriteMs,
|
||||
RewriteOptions::kMobBeaconCategory,
|
||||
RewriteOptions::kMobBeaconUrl,
|
||||
RewriteOptions::kMobConversionId,
|
||||
RewriteOptions::kMobIframe,
|
||||
RewriteOptions::kMobIframeDisable,
|
||||
RewriteOptions::kMobIframeViewport,
|
||||
RewriteOptions::kMobMapConversionLabel,
|
||||
RewriteOptions::kMobMapLocation,
|
||||
RewriteOptions::kMobNav,
|
||||
RewriteOptions::kMobLabeledMode,
|
||||
RewriteOptions::kMobNavClasses,
|
||||
RewriteOptions::kMobPhoneConversionLabel,
|
||||
RewriteOptions::kMobPhoneNumber,
|
||||
RewriteOptions::kMobStatic,
|
||||
RewriteOptions::kMobTheme,
|
||||
RewriteOptions::kModifyCachingHeaders,
|
||||
RewriteOptions::kNoop,
|
||||
RewriteOptions::kNoTransformOptimizedImages,
|
||||
@@ -3184,17 +3168,6 @@ TEST_F(RewriteOptionsTest, ParseFloats) {
|
||||
EXPECT_FALSE(RewriteOptions::ParseFromString("1 2 3", &densities));
|
||||
}
|
||||
|
||||
TEST_F(RewriteOptionsTest, MobilizeFiltersTest) {
|
||||
options_.SetRewriteLevel(RewriteOptions::kMobilizeFilters);
|
||||
EXPECT_TRUE(options_.Enabled(RewriteOptions::kMobilize));
|
||||
EXPECT_TRUE(options_.Enabled(RewriteOptions::kRewriteCss));
|
||||
EXPECT_TRUE(options_.Enabled(RewriteOptions::kRewriteDomains));
|
||||
|
||||
EXPECT_TRUE(options_.css_preserve_urls());
|
||||
EXPECT_TRUE(options_.domain_rewrite_hyperlinks());
|
||||
EXPECT_FALSE(options_.mob_always());
|
||||
}
|
||||
|
||||
TEST_F(RewriteOptionsTest, ParseAllowVaryOn) {
|
||||
// Explicitly listed headers should be supported, independently of "Via"
|
||||
// header.
|
||||
|
||||
@@ -91,12 +91,7 @@ bool SupportNoscriptFilter::IsAnyFilterRequiringScriptExecutionEnabled() const {
|
||||
filter_enabled = request_properties->SupportsImageInlining();
|
||||
break;
|
||||
case RewriteOptions::kMobilize:
|
||||
filter_enabled =
|
||||
(options->mob_always() ||
|
||||
(rewrite_driver_->server_context()
|
||||
->user_agent_matcher()
|
||||
->GetDeviceTypeForUA(rewrite_driver_->user_agent()) ==
|
||||
UserAgentMatcher::kMobile));
|
||||
filter_enabled = false;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
|
||||
Reference in New Issue
Block a user