OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 (function() { | 5 (function() { |
6 | 6 |
7 // We are going to kill all of the builtins, so hold onto the ones we need. | 7 // We are going to kill all of the builtins, so hold onto the ones we need. |
8 var defineGetter = Object.prototype.__defineGetter__; | 8 var defineGetter = Object.prototype.__defineGetter__; |
9 var defineSetter = Object.prototype.__defineSetter__; | 9 var defineSetter = Object.prototype.__defineSetter__; |
10 var Error = window.Error; | 10 var Error = window.Error; |
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
78 | 78 |
79 // Our tab's location. Normally this would be our document's location but if | 79 // Our tab's location. Normally this would be our document's location but if |
80 // we're an iframe it will be the location of the parent - in which case, | 80 // we're an iframe it will be the location of the parent - in which case, |
81 // expect to be told. | 81 // expect to be told. |
82 var tabLocationHref = null; | 82 var tabLocationHref = null; |
83 | 83 |
84 if (parent == window) { | 84 if (parent == window) { |
85 tabLocationHref = document.location.href; | 85 tabLocationHref = document.location.href; |
86 } else { | 86 } else { |
87 window.addEventListener('message', function listener(event) { | 87 window.addEventListener('message', function listener(event) { |
88 window.removeEventListener(listener); | 88 window.removeEventListener('message', listener); |
89 tabLocationHref = event.data; | 89 tabLocationHref = event.data; |
90 }); | 90 }); |
91 } | 91 } |
92 | 92 |
93 function checkLastError(reply) { | 93 function checkLastError(reply) { |
94 if (!chrome.runtime.lastError) | 94 if (!chrome.runtime.lastError) |
95 return true; | 95 return true; |
96 var kCouldNotEstablishConnection = | 96 var kCouldNotEstablishConnection = |
97 'Could not establish connection. Receiving end does not exist.'; | 97 'Could not establish connection. Receiving end does not exist.'; |
98 if (chrome.runtime.lastError.message == kCouldNotEstablishConnection) | 98 if (chrome.runtime.lastError.message == kCouldNotEstablishConnection) |
(...skipping 186 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
285 if (!message) | 285 if (!message) |
286 message = kMessage; | 286 message = kMessage; |
287 | 287 |
288 chrome.runtime.sendMessage(extensionId, message, | 288 chrome.runtime.sendMessage(extensionId, message, |
289 {'includeTlsChannelId': includeTlsChannelId}, | 289 {'includeTlsChannelId': includeTlsChannelId}, |
290 checkTlsChannelIdResponse); | 290 checkTlsChannelIdResponse); |
291 } | 291 } |
292 }; | 292 }; |
293 | 293 |
294 }()); | 294 }()); |
OLD | NEW |