Index: chrome/renderer/resources/extensions/runtime_custom_bindings.js |
diff --git a/chrome/renderer/resources/extensions/runtime_custom_bindings.js b/chrome/renderer/resources/extensions/runtime_custom_bindings.js |
index 85f04764c24e92c85afaa7f46b22883698e5f574..66245c9e3deb39a2d814997cc33e42d4067d335b 100644 |
--- a/chrome/renderer/resources/extensions/runtime_custom_bindings.js |
+++ b/chrome/renderer/resources/extensions/runtime_custom_bindings.js |
@@ -82,22 +82,21 @@ binding.registerCustomHook(function(binding, id, contextType) { |
}); |
apiFunctions.setHandleRequest('connect', function(targetId, connectInfo) { |
+ // Don't let orphaned content scripts communicate with their extension. |
+ // http://crbug.com/168263 |
+ if (unloadEvent.wasDispatched) |
+ throw new Error('Error connecting to extension ' + targetId); |
+ |
if (!targetId) |
targetId = runtime.id; |
+ |
var name = ''; |
if (connectInfo && connectInfo.name) |
name = connectInfo.name; |
- // Don't let orphaned content scripts communicate with their extension. |
- // http://crbug.com/168263 |
- if (!unloadEvent.wasDispatched) { |
- var portId = runtimeNatives.OpenChannelToExtension(runtime.id, |
- targetId, |
- name); |
- if (portId >= 0) |
- return miscBindings.createPort(portId, name); |
- } |
- throw new Error('Error connecting to extension ' + targetId); |
+ var portId = runtimeNatives.OpenChannelToExtension(targetId, name); |
+ if (portId >= 0) |
+ return miscBindings.createPort(portId, name); |
}); |
// |