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

Unified Diff: extensions/renderer/resources/file_entry_binding_util.js

Issue 2959583002: [Extensions Bindings] Don't load lastError module with native bindings (Closed)
Patch Set: rebase Created 3 years, 5 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 | « extensions/renderer/dispatcher.cc ('k') | extensions/renderer/resources/messaging.js » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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);
}
}
}
« no previous file with comments | « extensions/renderer/dispatcher.cc ('k') | extensions/renderer/resources/messaging.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698