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

Delta Between Two Patch Sets: files/download.js

Issue 8493027: Acquired Opera AdBlock code (Closed)
Left Patch Set: Created Oct. 2, 2012, 1:15 p.m.
Right Patch Set: Created Oct. 8, 2012, 5:58 a.m.
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
Left: Side by side diff | Download
Right: Side by side diff | Download
« no previous file with change/comment | « files/default.js ('k') | files/lists.js » ('j') | no next file with change/comment »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
LEFTRIGHT
1 function download(url) { 1 function download(url) {
2 if(url.indexOf("http") == 0) { //Only accepts http and https URLs 2 if(url.indexOf("http") == 0) { //Only accepts http and https URLs
3 try { 3 try {
4 var request = new window.XMLHttpRequest(); 4 var request = new window.XMLHttpRequest();
5 request.open('GET', url, false); 5 request.open('GET', url, false);
6 if(opera.version() >= 12.1)
7 request.timeout(12000); //Only supported in Oper a 12.1+, 12 seconds timeout
6 request.send(); 8 request.send();
7 if (request.readyState == 4 && request.status == 200) { 9 if (request.readyState == 4 && request.status == 200) {
8 return request.responseText; 10 return request.responseText;
9 } 11 }
10 } 12 }
11 catch(e) {} 13 catch(e) {}
12 } 14 }
13 return false; 15 return false;
14 } 16 }
LEFTRIGHT

Powered by Google App Engine
This is Rietveld