Index: extensions/renderer/resources/file_entry_binding_util.js |
diff --git a/extensions/renderer/resources/file_entry_binding_util.js b/extensions/renderer/resources/file_entry_binding_util.js |
index 6ae219cfca387a29609fafc86fd9ccda8888608b..cdef72220a64adfc59890626e592dff38ec3941a 100644 |
--- a/extensions/renderer/resources/file_entry_binding_util.js |
+++ b/extensions/renderer/resources/file_entry_binding_util.js |
@@ -4,12 +4,20 @@ |
var fileSystemNatives = requireNative('file_system_natives'); |
var GetIsolatedFileSystem = fileSystemNatives.GetIsolatedFileSystem; |
-var lastError = require('lastError'); |
var GetModuleSystem = requireNative('v8_context').GetModuleSystem; |
// TODO(sammc): Don't require extension. See http://crbug.com/235689. |
var GetExtensionViews = requireNative('runtime').GetExtensionViews; |
var safeCallbackApply = require('uncaught_exception_handler').safeCallbackApply; |
+var jsLastError = bindingUtil ? undefined : require('lastError'); |
+function runCallbackWithLastError(name, message, stack, callback) { |
+ if (bindingUtil) |
+ bindingUtil.runCallbackWithLastError(message, callback); |
+ else |
+ jsLastError.run(name, message, stack, callback); |
+} |
+ |
+ |
var WINDOW = {}; |
try { |
WINDOW = window; |
@@ -51,7 +59,7 @@ function getFileBindingsForApi(apiName) { |
var getEntryError = function(fileError) { |
if (!hasError) { |
hasError = true; |
- lastError.run( |
+ runCallbackWithLastError( |
apiName + '.' + functionName, |
'Error getting fileEntry, code: ' + fileError.code, |
request.stack, |
@@ -103,10 +111,9 @@ function getFileBindingsForApi(apiName) { |
} catch (e) { |
if (!hasError) { |
hasError = true; |
- lastError.run(apiName + '.' + functionName, |
- 'Error getting fileEntry: ' + e.stack, |
- request.stack, |
- callback); |
+ runCallbackWithLastError(apiName + '.' + functionName, |
+ 'Error getting fileEntry: ' + e.stack, |
+ request.stack, callback); |
} |
} |
}); |
@@ -150,16 +157,15 @@ function getBindDirectoryEntryCallback() { |
try { |
fs.root.getDirectory(baseName, {}, callback, function(fileError) { |
- lastError.run('runtime.' + functionName, |
- 'Error getting Entry, code: ' + fileError.code, |
- request.stack, |
- callback); |
+ runCallbackWithLastError( |
+ 'runtime.' + functionName, |
+ 'Error getting Entry, code: ' + fileError.code, |
+ request.stack, callback); |
}); |
} catch (e) { |
- lastError.run('runtime.' + functionName, |
- 'Error: ' + e.stack, |
- request.stack, |
- callback); |
+ runCallbackWithLastError('runtime.' + functionName, |
+ 'Error: ' + e.stack, |
+ request.stack, callback); |
} |
} |
} |