[page-speed] r2572 committed - merge changes from trunk

6 views
Skip to first unread message

page-...@googlecode.com

unread,
Apr 8, 2014, 5:37:16 PM4/8/14
to page-speed...@googlegroups.com
Revision: 2572
Author: ls...@google.com
Date: Tue Apr 8 21:37:01 2014 UTC
Log: merge changes from trunk
http://code.google.com/p/page-speed/source/detail?r=2572

Modified:
/firefox_addon/tags/page-speed-1.12.9.2/src/DEPS
/firefox_addon/tags/page-speed-1.12.9.2/src/build/common.gypi

/firefox_addon/tags/page-speed-1.12.9.2/src/pagespeed_firefox/cpp/pagespeed/pagespeed_json_input.cc

/firefox_addon/tags/page-speed-1.12.9.2/src/pagespeed_firefox/cpp/pagespeed/pagespeed_rules.cc

/firefox_addon/tags/page-speed-1.12.9.2/src/pagespeed_firefox/js/components/componentCollectorService.js

/firefox_addon/tags/page-speed-1.12.9.2/src/pagespeed_firefox/js/pagespeed/util.js

/firefox_addon/tags/page-speed-1.12.9.2/src/pagespeed_firefox/xpi_resources/install.rdf

=======================================
--- /firefox_addon/tags/page-speed-1.12.9.2/src/DEPS Sat Mar 31 00:08:09
2012 UTC
+++ /firefox_addon/tags/page-speed-1.12.9.2/src/DEPS Tue Apr 8 21:37:01
2014 UTC
@@ -22,7 +22,7 @@
# commented-out line below.
"chromium_trunk":
"http://src.chromium.org/svn/trunk",
- "chromium_revision": "@90205",
+ "chromium_revision": "@161115",
}

deps = {
@@ -68,6 +68,7 @@
(Var("libpagespeed_trunk") + "/src/third_party" +
Var("libpagespeed_revision")),

+ "src/build/ios": From(Var("libpagespeed_deps_root")),
"src/build/linux": From(Var("libpagespeed_deps_root")),
"src/build/mac": From(Var("libpagespeed_deps_root")),
"src/build/win": From(Var("libpagespeed_deps_root")),
@@ -79,18 +80,21 @@
"src/third_party/protobuf": From(Var("libpagespeed_deps_root")),
"src/third_party/chromium/src/base": From(Var("libpagespeed_deps_root")),
"src/third_party/chromium/src/build":
From(Var("libpagespeed_deps_root")),
- "src/tools/data_pack": From(Var("libpagespeed_deps_root")),
- "src/tools/grit": From(Var("libpagespeed_deps_root")),
+ "src/tools/clang": From(Var("libpagespeed_deps_root")),

"src/googleurl": From(Var("chromium_deps_root")),
"src/net/instaweb": From(Var("libpagespeed_deps_root")),
"src/testing/gtest": From(Var("chromium_deps_root")),
+ "src/tools/grit": From(Var("chromium_deps_root")),
"src/tools/gyp": From(Var("chromium_deps_root")),

"src/third_party/gflags": "/deps/gflags-2.0",
+ "src/third_party/giflib": "/deps/giflib-4.1.6",
"src/third_party/icu": "/deps/icu461",
"src/third_party/libjpeg": "/deps/jpeg-8c",
"src/third_party/libpng": "/deps/libpng-1.5.4",
+ "src/third_party/libwebp": "/deps/libwebp-0.2.0",
+ "src/third_party/optipng": "/deps/optipng-0.7.4",
"src/third_party/zlib": "/deps/zlib-1.2.5",
}

@@ -121,6 +125,13 @@


hooks = [
+ {
+ # Pull clang on mac. If nothing changed, or on non-mac platforms, this
takes
+ # zero seconds to run. If something changed, it downloads a prebuilt
clang,
+ # which takes ~20s, but clang speeds up builds by more than 20s.
+ "pattern": ".",
+ "action":
["python", "src/tools/clang/scripts/update.py", "--mac-only"],
+ },
{
# A change to a .gyp, .gypi, or to GYP itself should run the generator.
"pattern": ".",
=======================================
--- /firefox_addon/tags/page-speed-1.12.9.2/src/build/common.gypi Wed May
25 12:41:33 2011 UTC
+++ /firefox_addon/tags/page-speed-1.12.9.2/src/build/common.gypi Tue Apr
8 21:37:01 2014 UTC
@@ -11,65 +11,17 @@
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
-
+#
+# PageSpeed Firefox extension gyp configuration.
{
- 'variables': {
- 'conditions': [
- [ 'target_arch=="ia32"', {
- # We build for 10.4 for compatibility with Firefox 3.x.
- 'mac_deployment_target': '10.4',
- }, {
- # However mac x64 requires 10.5 as a minimum.
- 'mac_deployment_target': '10.5',
- }],
- ['OS=="win"', {
- 'xpcom_os': 'WINNT',
- 'xpcom_compiler_abi': 'msvc',
- }],
- ['OS=="linux"', {
- 'xpcom_os': 'Linux',
- 'xpcom_compiler_abi': 'gcc3',
- }],
- ['OS=="mac"', {
- 'xpcom_os': 'Darwin',
- 'xpcom_compiler_abi': 'gcc3',
- }],
- ['target_arch=="ia32"', {
- 'xpcom_cpu_arch': 'x86',
- }],
- ['target_arch=="x64"', {
- 'xpcom_cpu_arch': 'x86_64',
- }],
- ],
-
- 'variables': {
- # Version of xulrunner SDK we build against.
- 'xulrunner_sdk_version%': 2,
- },
-
- 'xulrunner_sdk_version%': '<(xulrunner_sdk_version)',
-
- # Make sure we link statically so everything gets linked into a
- # single shared object.
- 'library': 'static_library',
-
- # We're building a shared library, so everything needs to be built
- # with Position-Independent Code.
- 'linux_fpic': 1,
- },
'includes': [
- '../third_party/libpagespeed/src/build/common.gypi',
+ # Import Chromium's common.gypi to inherit their build
+ # configuration.
+ '../third_party/chromium/src/build/common.gypi',
+ # Import pagespeed's override gypi to inherit their overrides.
+ '../third_party/libpagespeed/src/build/pagespeed_overrides.gypi',
+ # Import our override gypi to modify the Chromium configuration as
+ # needed.
+ 'psff_overrides.gypi',
],
- 'conditions': [
- [ 'OS=="mac" and target_arch=="x64"', {
- 'target_defaults': {
- 'xcode_settings': {
- 'ARCHS': 'x86_64',
- 'OTHER_CFLAGS': [
- '-fPIC',
- ]
- }
- }
- }]
- ]
}
=======================================
---
/firefox_addon/tags/page-speed-1.12.9.2/src/pagespeed_firefox/cpp/pagespeed/pagespeed_json_input.cc
Thu Mar 8 22:18:16 2012 UTC
+++
/firefox_addon/tags/page-speed-1.12.9.2/src/pagespeed_firefox/cpp/pagespeed/pagespeed_json_input.cc
Tue Apr 8 21:37:01 2014 UTC
@@ -24,7 +24,7 @@
#include "base/basictypes.h"
#include "base/json/json_reader.h"
#include "base/logging.h"
-#include "base/scoped_ptr.h"
+#include "base/memory/scoped_ptr.h"
#include "base/values.h"
#include "pagespeed/core/pagespeed_input.h"
#include "pagespeed/core/resource.h"
@@ -46,25 +46,25 @@
~InputPopulator() {}

// Extract an integer from a JSON value.
- int ToInt(const Value& value);
+ int ToInt(const base::Value& value);

// Extract a string from a JSON value.
- const std::string ToString(const Value& value);
+ const std::string ToString(const base::Value& value);

// Given a JSON value representing one attribute of a resource, set the
// corresponding attribute on the Resource object.
void PopulateAttribute(const std::string& key,
- const Value& attribute_json,
+ const base::Value& attribute_json,
Resource* resource);

// Given a JSON value representing a single resource, populate the
Resource
// object.
- void PopulateResource(const DictionaryValue& attribute_json,
+ void PopulateResource(const base::DictionaryValue& attribute_json,
Resource* resource);

// Given a JSON value representing a list of resources, populate the
// PagespeedInput object.
- void PopulateInput(const Value& attribute_json, PagespeedInput* input);
+ void PopulateInput(const base::Value& attribute_json, PagespeedInput*
input);

bool error_; // true if there's been at least one error, false otherwise

@@ -74,7 +74,7 @@
// Macro to be used only within InputPopulator instance methods:
#define INPUT_POPULATOR_ERROR() error_ = true; LOG(DFATAL)

-int InputPopulator::ToInt(const Value& value) {
+int InputPopulator::ToInt(const base::Value& value) {
int integer;
if (value.GetAsInteger(&integer)) {
return integer;
@@ -84,7 +84,7 @@
}
}

-const std::string InputPopulator::ToString(const Value& value) {
+const std::string InputPopulator::ToString(const base::Value& value) {
std::string str;
if (value.GetAsString(&str)) {
return str;
@@ -95,7 +95,7 @@
}

void InputPopulator::PopulateAttribute(const std::string& key,
- const Value& attribute_json,
+ const base::Value& attribute_json,
Resource *resource) {
if (key == "url") {
// Nothing to do. we already validated this field in
@@ -107,27 +107,29 @@
}
}

-void InputPopulator::PopulateResource(const DictionaryValue& resource_json,
- Resource* resource) {
- for (DictionaryValue::key_iterator iter = resource_json.begin_keys(),
+void InputPopulator::PopulateResource(
+ const base::DictionaryValue& resource_json,
+ Resource* resource) {
+ for (base::DictionaryValue::key_iterator iter =
resource_json.begin_keys(),
end = resource_json.end_keys(); iter != end; ++iter) {
- Value* attribute_json;
+ const base::Value* attribute_json;
if (resource_json.Get(*iter, &attribute_json)) {
PopulateAttribute(*iter, *attribute_json, resource);
}
}
}

-void InputPopulator::PopulateInput(const Value& resources_json,
+void InputPopulator::PopulateInput(const base::Value& resources_json,
PagespeedInput* input) {
- if (!resources_json.IsType(Value::TYPE_LIST)) {
+ if (!resources_json.IsType(base::Value::TYPE_LIST)) {
INPUT_POPULATOR_ERROR() << "Top-level JSON value must be an array.";
return;
}
- const ListValue& list_json = *static_cast<const
ListValue*>(&resources_json);
+ const base::ListValue& list_json =
+ *static_cast<const base::ListValue*>(&resources_json);

for (size_t index = 0, size = list_json.GetSize(); index < size;
++index) {
- DictionaryValue* resource_json;
+ const base::DictionaryValue* resource_json;
if (!list_json.GetDictionary(index, &resource_json)) {
INPUT_POPULATOR_ERROR() << "Resource JSON value must be an object";
continue;
@@ -151,7 +153,7 @@

bool InputPopulator::Populate(PagespeedInput *input, const char
*json_data) {
std::string error_msg_out;
- scoped_ptr<const Value>
resources_json(base::JSONReader::ReadAndReturnError(
+ scoped_ptr<const base::Value>
resources_json(base::JSONReader::ReadAndReturnError(
json_data,
true, // allow_trailing_comma
NULL, // error_code_out (ReadAndReturnError permits NULL here)
=======================================
---
/firefox_addon/tags/page-speed-1.12.9.2/src/pagespeed_firefox/cpp/pagespeed/pagespeed_rules.cc
Thu Jun 23 22:48:07 2011 UTC
+++
/firefox_addon/tags/page-speed-1.12.9.2/src/pagespeed_firefox/cpp/pagespeed/pagespeed_rules.cc
Tue Apr 8 21:37:01 2014 UTC
@@ -28,7 +28,7 @@
#include "base/json/json_writer.h" // for base::JSONWriter::Write
#include "base/logging.h"
#include "base/md5.h"
-#include "base/scoped_ptr.h"
+#include "base/memory/scoped_ptr.h"
#include "base/string_number_conversions.h" // for base::IntToString
#include "base/string_util.h"
#include "base/utf_string_conversions.h"
@@ -42,6 +42,7 @@
#include "pagespeed/core/serializer.h"
#include "pagespeed/dom/json_dom.h"
#include "pagespeed/filters/ad_filter.h"
+#include "pagespeed/filters/landing_page_redirection_filter.h"
#include "pagespeed/filters/response_byte_result_filter.h"
#include "pagespeed/filters/tracker_filter.h"
#include "pagespeed/formatters/proto_formatter.h"
@@ -192,7 +193,7 @@
}

const std::string filename =
- pagespeed::ChooseOutputFilename(url, mime_type, MD5String(body));
+ pagespeed::ChooseOutputFilename(url, mime_type,
base::MD5String(body));
#if defined(OS_WIN)
std::wstring w_base_dir;
if (!UTF8ToWide(base_dir_.c_str(), base_dir_.size(), &w_base_dir)) {
@@ -398,7 +399,7 @@

// Compute and format the results. Keep the Results around so that we
can
// serialize optimized content.
- pagespeed::Results results;
+ pagespeed::Results filtered_results;
pagespeed::FormattedResults formatted_results;
{
std::vector<pagespeed::Rule*> rules;
@@ -408,7 +409,13 @@
pagespeed::Engine engine(&rules);
engine.Init();

- engine.ComputeResults(*input, &results);
+ pagespeed::Results unfiltered_results;
+ engine.ComputeResults(*input, &unfiltered_results);
+ // Filter the landing page redirection result, so that we do not flag
+ // redirection from foo.com to www.foo.com.
+ pagespeed::LandingPageRedirectionFilter redirection_filter;
+ engine.FilterResults(unfiltered_results, redirection_filter,
+ &filtered_results);

formatted_results.set_locale(localizer->GetLocale());
pagespeed::formatters::ProtoFormatter formatter(
@@ -416,7 +423,7 @@

// Filter the results (matching the code in Page Speed Online).
pagespeed::ResponseByteResultFilter result_filter;
- if (!engine.FormatResults(results, result_filter, &formatter)) {
+ if (!engine.FormatResults(filtered_results, result_filter,
&formatter)) {
LOG(ERROR) << "error formatting results in locale: " << locale;
return NULL;
}
@@ -435,7 +442,6 @@
pagespeed::FormattedRuleResults* rule_results =
formatted_results.mutable_rule_results(i);
if (rule_results->url_blocks_size() == 0) {
- rule_results->set_rule_score(100);
rule_results->set_rule_impact(0.0);
} else {
has_any_results = true;
@@ -459,8 +465,9 @@
scoped_ptr<DictionaryValue> paths(new DictionaryValue);
if (output_dir) {
PluginSerializer serializer(output_dir);
- for (int i = 0; i < results.rule_results_size(); ++i) {
- const pagespeed::RuleResults& rule_results = results.rule_results(i);
+ for (int i = 0; i < filtered_results.rule_results_size(); ++i) {
+ const pagespeed::RuleResults& rule_results =
+ filtered_results.rule_results(i);
for (int j = 0; j < rule_results.results_size(); ++j) {
const pagespeed::Result& result = rule_results.results(j);
if (result.has_optimized_content() && result.resource_urls_size()
> 0) {
@@ -484,7 +491,7 @@
scoped_ptr<DictionaryValue> root(new DictionaryValue);
root->Set("results", json_results.release());
root->Set("optimized_content", paths.release());
- base::JSONWriter::Write(root.get(), false, &output_string);
+ base::JSONWriter::Write(root.get(), &output_string);
}

return MallocString(output_string);
=======================================
---
/firefox_addon/tags/page-speed-1.12.9.2/src/pagespeed_firefox/js/components/componentCollectorService.js
Mon Mar 19 14:45:06 2012 UTC
+++
/firefox_addon/tags/page-speed-1.12.9.2/src/pagespeed_firefox/js/components/componentCollectorService.js
Tue Apr 8 21:37:01 2014 UTC
@@ -1768,6 +1768,30 @@

aStateFlags,
aStatus) {
if ((aStateFlags & this.EXPECTED_STATE) != this.EXPECTED_STATE) return;
+
+ // We are not interested in about:blank, and allowing it through can
+ // cause the Firefox Debugger to break. See
+ // http://code.google.com/p/page-speed/issues/detail?id=983 for
+ // more.
+ if (aRequest.name == 'about:blank') return;
+ var requestProtocolIdx = aRequest.name.indexOf(':');
+ if (requestProtocolIdx < 0) {
+ // The request name does not contain a protocol, so ignore it.
+ return;
+ }
+ var requestProtocol = aRequest.name.substr(0, requestProtocolIdx);
+ // The request should be http or https, *or* we allow through other
+ // about: requests since there is e.g. about:document-onload-blocker
+ // which we do actually need to allow through. In the event that
+ // about:document-onload-blocker is renamed or other important
+ // about: requests are added in the future, we whitelist all other
+ // about: URLs to be safe.
+ if (requestProtocol != 'http' &&
+ requestProtocol != 'https' &&
+ requestProtocol != 'about') {
+ return;
+ }
+
var win = aWebProgress.DOMWindow;
var doc = win.document;
var protocol = doc.location.protocol;
=======================================
---
/firefox_addon/tags/page-speed-1.12.9.2/src/pagespeed_firefox/js/pagespeed/util.js
Tue Aug 21 22:00:01 2012 UTC
+++
/firefox_addon/tags/page-speed-1.12.9.2/src/pagespeed_firefox/js/pagespeed/util.js
Tue Apr 8 21:37:01 2014 UTC
@@ -46,7 +46,11 @@

// TODO(lsong): Copied from chromium extension. Reduce duplication.
function collectElement(element, outList) {
- var obj = {tag: element.tagName};
+ var obj = {
+ tag: element.tagName
+ };
+ // Append the node before appending children to ensure pre-order
traversal.
+ outList.push(obj);
// If the tag has any attributes, add an attribute map to the output
object.
var attributes = element.attributes;
if (attributes && attributes.length > 0) {
@@ -56,10 +60,13 @@
obj.attrs[attribute.name] = attribute.value;
}
}
- // If the tag has any attributes, add children list to the output object.
+ // If the tag has any children, add children list to the output object.
var children = element.children;
if (children && children.length > 0) {
+ obj.children = [];
for (var j = 0, len = children.length; j < len; ++j) {
+ // Append the index of the next to be-added element to children list.
+ obj.children.push(outList.length);
collectElement(children[j], outList);
}
}
@@ -72,7 +79,6 @@
obj.width = element.width;
obj.height = element.height;
}
- outList.push(obj);
}

function collectDocument(doc) {
=======================================
---
/firefox_addon/tags/page-speed-1.12.9.2/src/pagespeed_firefox/xpi_resources/install.rdf
Tue Aug 21 22:00:01 2012 UTC
+++
/firefox_addon/tags/page-speed-1.12.9.2/src/pagespeed_firefox/xpi_resources/install.rdf
Tue Apr 8 21:37:01 2014 UTC
@@ -23,7 +23,7 @@
<!-- This GUID is hard-coded into util.js. If it is ever changed,
util.js needs to be updated. -->
<em:id>{e3f6c2cc-d8db-498c-af6c-499fb211db97}</em:id>
<em:name>Page Speed</em:name>
- <em:version>1.12.9.1</em:version>
+ <em:version>1.12.9.2</em:version>
<em:description>Speed up your web pages with this performance
diagnostics tool. Requires Firebug.</em:description>
<em:creator>Google Inc.</em:creator>

<em:homepageURL>http://code.google.com/speed/page-speed/</em:homepageURL>
Reply all
Reply to author
Forward
0 new messages