Commit fdf0b3ee authored by cbruni's avatar cbruni Committed by Commit bot

Revert of [tools] Support custom script injection for callstats.py (patchset...

Revert of [tools] Support custom script injection for callstats.py (patchset #1 id:1 of https://codereview.chromium.org/2455623002/ )

Reason for revert:
speculative revert to address regressions on cnn.com benchmark.

Original issue's description:
> [tools] Support custom script injection for callstats.py
>
> This is a poor-man's solution to trigger page interactions.
>
> BUG=

TBR=jochen@chromium.org
# Not skipping CQ checks because original CL landed more than 1 days ago.
BUG=

Review-Url: https://codereview.chromium.org/2464053005
Cr-Commit-Position: refs/heads/master@{#40710}
parent fdca1bb2
......@@ -84,8 +84,6 @@ def stop_replay_server(server):
def generate_injection(f, sites, refreshes=0):
print >> f, """\
(function() {
var sites =
""", json.dumps(sites), """;
var s = window.sessionStorage.getItem("refreshCounter");
var refreshTotal = """, refreshes, """;
var refreshCounter = s ? parseInt(s) : refreshTotal;
......@@ -101,15 +99,7 @@ def generate_injection(f, sites, refreshes=0):
url_wanted = "https://" + url_wanted.substr(7);
}
return url.startsWith(url_wanted);
}
function runCustomScript(site) {
if (site.script === undefined) return;
/* Combine a script from the given array. */
if (typeof site.script !== "string") {
site.script = site.script.join(' ');
}
eval(site.script);
}
};
function onLoad(url) {
for (var item of sites) {
if (!match(url, item)) continue;
......@@ -127,15 +117,13 @@ def generate_injection(f, sites, refreshes=0):
window.location.reload();
}
}, timeout);
runCustomScript(item);
return;
}
console.log("Ignoring: " + url);
};
/* Avoid re-triggering the runtime stats for html imports */
if (document.currentScript.ownerDocument === document) {
var sites =
""", json.dumps(sites), """;
onLoad(window.location.href);
}
})();"""
def get_chrome_flags(js_flags, user_data_dir):
......
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