Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(4899)

Unified Diff: chrome/test/data/prerender/prerender_loader_removing_links.html

Issue 10198040: New link rel=prerender api, using WebKit::WebPrerenderingPlatform (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: remediate to dominich review Created 8 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: chrome/test/data/prerender/prerender_loader_removing_links.html
diff --git a/chrome/test/data/prerender/prerender_loader_removing_links.html b/chrome/test/data/prerender/prerender_loader_removing_links.html
new file mode 100644
index 0000000000000000000000000000000000000000..8c9581dc1dd89986d794d373e91826cc78f05cfb
--- /dev/null
+++ b/chrome/test/data/prerender/prerender_loader_removing_links.html
@@ -0,0 +1,39 @@
+<html>
+<head>
+<title>Preloader</title>
+
+<script>
+function ExtractGetParameterBadlyAndInsecurely(param, default_value) {
mmenke 2012/04/30 18:35:22 nit: defaultValue. Don't ask my why Javascript n
gavinp 2012/04/30 23:55:39 Done. Matt, why does Javascript have a different n
mmenke 2012/05/01 16:23:21 For the same reason I misspelled pending.
+ var re = RegExp("[&?]" + param + "=([^&?#]*)");
mmenke 2012/04/30 18:35:22 nit: Use single quotes. Same goes for the rest o
gavinp 2012/04/30 23:55:39 Done.
+ var result = re.exec(document.location);
+ if (result)
+ return result[1];
+ return default_value;
+}
+
+var links_to_insert = ExtractGetParameterBadlyAndInsecurely(
+ 'links_to_insert', 1);
+var links_to_remove = ExtractGetParameterBadlyAndInsecurely(
+ 'links_to_remove', 1);
+
+function RemoveLinkElementAndNavigate() {
+ for (var i = 1; i <= links_to_remove; ++i) {
+ var link = document.getElementById("prerender_element_" + i);
+ link.parentElement.removeChild(link);
+ }
+ document.location = "REPLACE_WITH_DESTINATION_URL";
+}
+</script>
+
+</head>
+<body>
+<script>
+ for (var i = 1; i <= links_to_insert; ++i) {
+ document.write('<link id="prerender_element_' +
+ i +
+ '" rel="prerender" href="REPLACE_WITH_PRERENDER_URL"/>');
+ }
+</script>
+<a href="REPLACE_WITH_DESTINATION_URL">Link To Click</a>
+</body>
+</html>

Powered by Google App Engine
This is Rietveld 408576698