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

Unified Diff: chrome/renderer/resources/extensions/extension_custom_bindings.js

Issue 9138009: Fix crash in extension_custom_bindings.js by defining WINDOW_ID_NONE locally (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 11 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/renderer/resources/extensions/extension_custom_bindings.js
diff --git a/chrome/renderer/resources/extensions/extension_custom_bindings.js b/chrome/renderer/resources/extensions/extension_custom_bindings.js
index c60b45cf2ec10ce70bb4d23dd6bd65d4a8d75af4..22a7f96b6a53e400ffa8ac565b9a06c0abe4b5f1 100644
--- a/chrome/renderer/resources/extensions/extension_custom_bindings.js
+++ b/chrome/renderer/resources/extensions/extension_custom_bindings.js
@@ -9,6 +9,13 @@
native function GetChromeHidden();
native function GetExtensionViews();
+// This should match chrome.windows.WINDOW_ID_NONE.
+//
+// We can't use chrome.windows.WINDOW_ID_NONE directly because the
+// chrome.windows API won't exist unless this extension has permission for it;
+// which may not be the case.
+var WINDOW_ID_NONE = -1;
+
GetChromeHidden().registerCustomHook('extension', function(bindingsAPI) {
// getTabContentses is retained for backwards compatibility.
// See http://crbug.com/21433
@@ -17,7 +24,7 @@ GetChromeHidden().registerCustomHook('extension', function(bindingsAPI) {
var apiFunctions = bindingsAPI.apiFunctions;
apiFunctions.setHandleRequest("extension.getViews", function(properties) {
- var windowId = chrome.windows.WINDOW_ID_NONE;
+ var windowId = WINDOW_ID_NONE;
var type = "ALL";
if (typeof(properties) != "undefined") {
if (typeof(properties.type) != "undefined") {
@@ -37,7 +44,7 @@ GetChromeHidden().registerCustomHook('extension', function(bindingsAPI) {
apiFunctions.setHandleRequest("extension.getExtensionTabs",
function(windowId) {
if (typeof(windowId) == "undefined")
- windowId = chrome.windows.WINDOW_ID_NONE;
+ windowId = WINDOW_ID_NONE;
return GetExtensionViews(windowId, "TAB");
});
});
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698