Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code

Side by Side Diff: safari/ext/content.js

Issue 5678590574198784: Prevent Safari from freezing when loading large data: URLs (Closed)
Patch Set: Created March 10, 2014, 6:18 p.m.
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * This file is part of Adblock Plus <http://adblockplus.org/>, 2 * This file is part of Adblock Plus <http://adblockplus.org/>,
3 * Copyright (C) 2006-2013 Eyeo GmbH 3 * Copyright (C) 2006-2013 Eyeo GmbH
4 * 4 *
5 * Adblock Plus is free software: you can redistribute it and/or modify 5 * Adblock Plus is free software: you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License version 3 as 6 * it under the terms of the GNU General Public License version 3 as
7 * published by the Free Software Foundation. 7 * published by the Free Software Foundation.
8 * 8 *
9 * Adblock Plus is distributed in the hope that it will be useful, 9 * Adblock Plus is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of 10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
50 document.removeEventListener("visibilitychange", onVisibilitychange); 50 document.removeEventListener("visibilitychange", onVisibilitychange);
51 }; 51 };
52 document.addEventListener("visibilitychange", onVisibilitychange); 52 document.addEventListener("visibilitychange", onVisibilitychange);
53 } 53 }
54 54
55 55
56 /* Web requests */ 56 /* Web requests */
57 57
58 document.addEventListener("beforeload", function(event) 58 document.addEventListener("beforeload", function(event)
59 { 59 {
60 // we don't block non-HTTP requests anyway, so we can bail out
61 // without asking the background page. This is even necessary
62 // because passing large data (like a photo encoded as data: URL)
63 // to the background page, freezes Safari.
64 if (!/^https?:/.test(event.url))
65 return;
66
60 var type; 67 var type;
61 switch(event.target.localName) 68 switch(event.target.localName)
62 { 69 {
63 case "frame": 70 case "frame":
64 case "iframe": 71 case "iframe":
65 type = "sub_frame"; 72 type = "sub_frame";
66 break; 73 break;
67 case "img": 74 case "img":
68 type = "image"; 75 type = "image";
69 break; 76 break;
(...skipping 330 matching lines...) Expand 10 before | Expand all | Expand 10 after
400 messageProxy.handleResponse(event.message); 407 messageProxy.handleResponse(event.message);
401 break; 408 break;
402 case "proxyCallback": 409 case "proxyCallback":
403 backgroundPageProxy.handleCallback(event.message); 410 backgroundPageProxy.handleCallback(event.message);
404 break; 411 break;
405 } 412 }
406 } 413 }
407 } 414 }
408 }); 415 });
409 })(); 416 })();
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld