diff --git a/atom/renderer/lib/init.coffee b/atom/renderer/lib/init.coffee index 69e76e98e155..ebf69ac3a65b 100644 --- a/atom/renderer/lib/init.coffee +++ b/atom/renderer/lib/init.coffee @@ -37,9 +37,11 @@ for arg in process.argv if location.protocol is 'chrome-devtools:' # Override some inspector APIs. require path.join(__dirname, 'inspector') + nodeIntegration = 'true' else if location.protocol is 'chrome-extension:' # Add implementations of chrome API. require path.join(__dirname, 'chrome-api') + nodeIntegration = 'true' else # Override default web functions. require path.join(__dirname, 'override') diff --git a/atom/renderer/lib/inspector.coffee b/atom/renderer/lib/inspector.coffee index 8b6f748e00e1..87906e69949f 100644 --- a/atom/renderer/lib/inspector.coffee +++ b/atom/renderer/lib/inspector.coffee @@ -1,7 +1,7 @@ window.onload = -> # Use menu API to show context menu. - InspectorFrontendHost.showContextMenu = (event, items) -> - createMenu items, event + InspectorFrontendHost.showContextMenuAtPoint = (x, y, items, document) -> + createMenu items # Use dialog API to override file chooser dialog. WebInspector.createFileSelectorElement = (callback) -> @@ -32,17 +32,19 @@ convertToMenuTemplate = (items) -> label: item.label enabled: item.enabled if item.id? - transformed.click = -> WebInspector.contextMenuItemSelected item.id + transformed.click = -> InspectorFrontendAPI.contextMenuItemSelected item.id template.push transformed template -createMenu = (items, event) -> +createMenu = (items) -> remote = require 'remote' Menu = remote.require 'menu' menu = Menu.buildFromTemplate convertToMenuTemplate(items) - menu.popup remote.getCurrentWindow() - event.consume true + # The menu is expected to show asynchronously. + setImmediate -> + menu.popup remote.getCurrentWindow() + InspectorFrontendAPI.contextMenuCleared() showFileChooserDialog = (callback) -> remote = require 'remote'