| LEFT | RIGHT |
| 1 /* | 1 /* |
| 2 * This Source Code is subject to the terms of the Mozilla Public License | 2 * This Source Code is subject to the terms of the Mozilla Public License |
| 3 * version 2.0 (the "License"). You can obtain a copy of the License at | 3 * version 2.0 (the "License"). You can obtain a copy of the License at |
| 4 * http://mozilla.org/MPL/2.0/. | 4 * http://mozilla.org/MPL/2.0/. |
| 5 */ | 5 */ |
| 6 | 6 |
| 7 "use strict"; | 7 "use strict"; |
| 8 | 8 |
| 9 const {classes: Cc, interfaces: Ci, utils: Cu, results: Cr} = Components; | 9 const {classes: Cc, interfaces: Ci, utils: Cu, results: Cr} = Components; |
| 10 | 10 |
| (...skipping 24 matching lines...) Expand all Loading... |
| 35 onStateChange: function(webProgress, request, flags, status) | 35 onStateChange: function(webProgress, request, flags, status) |
| 36 { | 36 { |
| 37 if (webProgress.DOMWindow == content && | 37 if (webProgress.DOMWindow == content && |
| 38 (flags & Ci.nsIWebProgressListener.STATE_STOP)) | 38 (flags & Ci.nsIWebProgressListener.STATE_STOP)) |
| 39 { | 39 { |
| 40 // First time we receive STATE_STOP for about:blank and the second time | 40 // First time we receive STATE_STOP for about:blank and the second time |
| 41 // for our interested URL which is distinct from about:blank. | 41 // for our interested URL which is distinct from about:blank. |
| 42 // However we should not process about:blank because it can happen that | 42 // However we should not process about:blank because it can happen that |
| 43 // the message with information about about:blank is delivered when the | 43 // the message with information about about:blank is delivered when the |
| 44 // code in crawler.js is already waiting for a message from this tab. | 44 // code in crawler.js is already waiting for a message from this tab. |
| 45 // Another not interesting for us case is about:newtab. | 45 // Another case we are not interested in is about:newtab. |
| 46 if (content.location.protocol == "about:") | 46 if (content.location.protocol == "about:") |
| 47 return; | 47 return; |
| 48 let pageInfo = {channelStatus: status}; | 48 let pageInfo = {channelStatus: status}; |
| 49 if (request instanceof Ci.nsIHttpChannel) | 49 if (request instanceof Ci.nsIHttpChannel) |
| 50 { | 50 { |
| 51 try | 51 try |
| 52 { | 52 { |
| 53 pageInfo.headers = []; | 53 pageInfo.headers = []; |
| 54 pageInfo.headers.push("HTTP/x.x " + request.responseStatus + " " + req
uest.responseStatusText); | 54 pageInfo.headers.push("HTTP/x.x " + request.responseStatus + " " + req
uest.responseStatusText); |
| 55 request.visitResponseHeaders((header, value) => pageInfo.headers.push(
header + ": " + value)); | 55 request.visitResponseHeaders((header, value) => pageInfo.headers.push(
header + ": " + value)); |
| (...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 120 result.source = serializer.serializeToString(document.documentElement); | 120 result.source = serializer.serializeToString(document.documentElement); |
| 121 } | 121 } |
| 122 catch(e) | 122 catch(e) |
| 123 { | 123 { |
| 124 reportException(e); | 124 reportException(e); |
| 125 result.errors.push("Cannot obtain page source code"); | 125 result.errors.push("Cannot obtain page source code"); |
| 126 } | 126 } |
| 127 | 127 |
| 128 return result; | 128 return result; |
| 129 } | 129 } |
| LEFT | RIGHT |