OLD | NEW |
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 webRequestInternal API. | 5 // Custom binding for the webRequestInternal API. |
6 | 6 |
7 var binding = require('binding').Binding.create('webRequestInternal'); | 7 var binding = require('binding').Binding.create('webRequestInternal'); |
8 var eventBindings = require('event_bindings'); | 8 var eventBindings = require('event_bindings'); |
9 var sendRequest = require('sendRequest').sendRequest; | 9 var sendRequest = require('sendRequest').sendRequest; |
10 var validate = require('schemaUtils').validate; | 10 var validate = require('schemaUtils').validate; |
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
83 if (opt_extraInfo && opt_extraInfo.indexOf('blocking') >= 0) { | 83 if (opt_extraInfo && opt_extraInfo.indexOf('blocking') >= 0) { |
84 var eventName = this.eventName; | 84 var eventName = this.eventName; |
85 subEventCallback = function() { | 85 subEventCallback = function() { |
86 var requestId = arguments[0].requestId; | 86 var requestId = arguments[0].requestId; |
87 try { | 87 try { |
88 var result = $Function.apply(cb, null, arguments); | 88 var result = $Function.apply(cb, null, arguments); |
89 webRequestInternal.eventHandled( | 89 webRequestInternal.eventHandled( |
90 eventName, subEventName, requestId, result); | 90 eventName, subEventName, requestId, result); |
91 } catch (e) { | 91 } catch (e) { |
92 webRequestInternal.eventHandled( | 92 webRequestInternal.eventHandled( |
93 eventName, subEventName, requestId, {cancel: true}); | 93 eventName, subEventName, requestId); |
94 throw e; | 94 throw e; |
95 } | 95 } |
96 }; | 96 }; |
97 } else if (opt_extraInfo && opt_extraInfo.indexOf('asyncBlocking') >= 0) { | 97 } else if (opt_extraInfo && opt_extraInfo.indexOf('asyncBlocking') >= 0) { |
98 var eventName = this.eventName; | 98 var eventName = this.eventName; |
99 subEventCallback = function() { | 99 subEventCallback = function() { |
100 var details = arguments[0]; | 100 var details = arguments[0]; |
101 var requestId = details.requestId; | 101 var requestId = details.requestId; |
102 var handledCallback = function(response) { | 102 var handledCallback = function(response) { |
103 webRequestInternal.eventHandled( | 103 webRequestInternal.eventHandled( |
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
181 'addListener', | 181 'addListener', |
182 'removeListener', | 182 'removeListener', |
183 'addRules', | 183 'addRules', |
184 'removeRules', | 184 'removeRules', |
185 'getRules' | 185 'getRules' |
186 ]); | 186 ]); |
187 | 187 |
188 webRequestInternal = binding.generate(); | 188 webRequestInternal = binding.generate(); |
189 exports.binding = webRequestInternal; | 189 exports.binding = webRequestInternal; |
190 exports.WebRequestEvent = WebRequestEvent; | 190 exports.WebRequestEvent = WebRequestEvent; |
OLD | NEW |