|
127 | 127 | #include "net/instaweb/rewriter/public/split_html_helper_filter.h"
|
128 | 128 | #include "net/instaweb/rewriter/public/strip_non_cacheable_filter.h"
|
129 | 129 | #include "net/instaweb/rewriter/public/strip_scripts_filter.h"
|
| 130 | +#include "net/instaweb/rewriter/public/strip_subresource_hints_filter.h" |
130 | 131 | #include "net/instaweb/rewriter/public/support_noscript_filter.h"
|
131 | 132 | #include "net/instaweb/rewriter/public/suppress_prehead_filter.h"
|
132 | 133 | #include "net/instaweb/rewriter/public/url_input_resource.h"
|
@@ -656,7 +657,9 @@ void RewriteDriver::FlushAsync(Function* callback) {
|
656 | 657 | }
|
657 | 658 | flush_requested_ = false;
|
658 | 659 |
|
659 |
| - DetermineEnabledFilters(); |
| 660 | + // Figure out which filters should be enabled and whether any enabled filter |
| 661 | + // can modify urls. |
| 662 | + DetermineFiltersBehavior(); |
660 | 663 |
|
661 | 664 | for (FilterList::iterator it = early_pre_render_filters_.begin();
|
662 | 665 | it != early_pre_render_filters_.end(); ++it) {
|
@@ -1010,7 +1013,9 @@ void RewriteDriver::AddPreRenderFilters() {
|
1010 | 1013 | dom_stats_filter_ = new DomStatsFilter(this);
|
1011 | 1014 | AddOwnedEarlyPreRenderFilter(dom_stats_filter_);
|
1012 | 1015 | }
|
1013 |
| - |
| 1016 | + if (!rewrite_options->preserve_subresource_hints()) { |
| 1017 | + AddOwnedEarlyPreRenderFilter(new StripSubresourceHintsFilter(this)); |
| 1018 | + } |
1014 | 1019 | if (rewrite_options->Enabled(RewriteOptions::kDecodeRewrittenUrls)) {
|
1015 | 1020 | AddOwnedEarlyPreRenderFilter(new DecodeRewrittenUrlsFilter(this));
|
1016 | 1021 | }
|
@@ -3589,12 +3594,12 @@ bool RewriteDriver::Write(const ResourceVector& inputs,
|
3589 | 3594 | return ret;
|
3590 | 3595 | }
|
3591 | 3596 |
|
3592 |
| -void RewriteDriver::DetermineEnabledFiltersImpl() { |
3593 |
| - DetermineEnabledFiltersInList(early_pre_render_filters_); |
3594 |
| - DetermineEnabledFiltersInList(pre_render_filters_); |
| 3597 | +void RewriteDriver::DetermineFiltersBehaviorImpl() { |
| 3598 | + DetermineFilterListBehavior(early_pre_render_filters_); |
| 3599 | + DetermineFilterListBehavior(pre_render_filters_); |
3595 | 3600 |
|
3596 |
| - // Call parent DetermineEnabled to setup post render filters. |
3597 |
| - HtmlParse::DetermineEnabledFiltersImpl(); |
| 3601 | + // Call parent to set up post render filters. |
| 3602 | + HtmlParse::DetermineFiltersBehaviorImpl(); |
3598 | 3603 | }
|
3599 | 3604 |
|
3600 | 3605 | void RewriteDriver::ClearRequestProperties() {
|
|
0 commit comments