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

Side by Side Diff: chrome/renderer/resources/extensions/extension_custom_bindings.js

Issue 17451011: Make the externally connectable browser test clobber all of the builtins, (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebase Created 7 years, 6 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 // Custom binding for the extension API. 5 // Custom binding for the extension API.
6 6
7 var binding = require('binding').Binding.create('extension'); 7 var binding = require('binding').Binding.create('extension');
8 8
9 var extensionNatives = requireNative('extension'); 9 var extensionNatives = requireNative('extension');
10 var GetExtensionViews = extensionNatives.GetExtensionViews; 10 var GetExtensionViews = extensionNatives.GetExtensionViews;
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after
73 'Port', 73 'Port',
74 // Functions 74 // Functions
75 'connect', 'sendMessage', 'connectNative', 'sendNativeMessage', 75 'connect', 'sendMessage', 'connectNative', 'sendNativeMessage',
76 // Events 76 // Events
77 'onConnect', 'onConnectExternal', 'onMessage', 'onMessageExternal' 77 'onConnect', 'onConnectExternal', 'onMessage', 'onMessageExternal'
78 ]; 78 ];
79 $Array.forEach(mayNeedAlias, function(alias) { 79 $Array.forEach(mayNeedAlias, function(alias) {
80 // Checking existence isn't enough since some functions are disabled via 80 // Checking existence isn't enough since some functions are disabled via
81 // getters that throw exceptions. Assume that any getter is such a function. 81 // getters that throw exceptions. Assume that any getter is such a function.
82 if (chrome.runtime && 82 if (chrome.runtime &&
83 chrome.runtime.hasOwnProperty(alias) && 83 $Object.hasOwnProperty(chrome.runtime, alias) &&
84 chrome.runtime.__lookupGetter__(alias) === undefined) { 84 chrome.runtime.__lookupGetter__(alias) === undefined) {
85 extension[alias] = chrome.runtime[alias]; 85 extension[alias] = chrome.runtime[alias];
86 } 86 }
87 }); 87 });
88 88
89 apiFunctions.setUpdateArgumentsPreValidate('sendRequest', 89 apiFunctions.setUpdateArgumentsPreValidate('sendRequest',
90 $Function.bind(miscBindings.sendMessageUpdateArguments, 90 $Function.bind(miscBindings.sendMessageUpdateArguments,
91 null, 'sendRequest')); 91 null, 'sendRequest'));
92 92
93 apiFunctions.setHandleRequest('sendRequest', 93 apiFunctions.setHandleRequest('sendRequest',
(...skipping 11 matching lines...) Expand all
105 }; 105 };
106 if (contextType == 'BLESSED_EXTENSION') { 106 if (contextType == 'BLESSED_EXTENSION') {
107 extension.onRequestExternal.addListener = function() { 107 extension.onRequestExternal.addListener = function() {
108 throw new Error(sendRequestIsDisabled); 108 throw new Error(sendRequestIsDisabled);
109 }; 109 };
110 } 110 }
111 } 111 }
112 }); 112 });
113 113
114 exports.binding = binding.generate(); 114 exports.binding = binding.generate();
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698