Add support for chrome.extension API in devtools extension.
This commit is contained in:
parent
39b98b0e4d
commit
8051ad8b2a
5 changed files with 19 additions and 1 deletions
1
atom.gyp
1
atom.gyp
|
@ -39,6 +39,7 @@
|
||||||
'atom/common/api/lib/screen.coffee',
|
'atom/common/api/lib/screen.coffee',
|
||||||
'atom/common/api/lib/shell.coffee',
|
'atom/common/api/lib/shell.coffee',
|
||||||
'atom/common/lib/init.coffee',
|
'atom/common/lib/init.coffee',
|
||||||
|
'atom/renderer/lib/chrome-api.coffee',
|
||||||
'atom/renderer/lib/init.coffee',
|
'atom/renderer/lib/init.coffee',
|
||||||
'atom/renderer/lib/inspector.coffee',
|
'atom/renderer/lib/inspector.coffee',
|
||||||
'atom/renderer/lib/override.coffee',
|
'atom/renderer/lib/override.coffee',
|
||||||
|
|
|
@ -199,6 +199,10 @@ bool AtomRendererClient::IsNodeBindingEnabled(blink::WebFrame* frame) {
|
||||||
// Node integration is enabled in main frame unless explictly disabled.
|
// Node integration is enabled in main frame unless explictly disabled.
|
||||||
else if (frame == main_frame_)
|
else if (frame == main_frame_)
|
||||||
return true;
|
return true;
|
||||||
|
// Enable node integration in chrome extensions.
|
||||||
|
else if (frame != NULL &&
|
||||||
|
GURL(frame->document().url()).SchemeIs("chrome-extension"))
|
||||||
|
return true;
|
||||||
else if (node_integration_ == MANUAL_ENABLE_IFRAME &&
|
else if (node_integration_ == MANUAL_ENABLE_IFRAME &&
|
||||||
frame != NULL &&
|
frame != NULL &&
|
||||||
frame->uniqueName().utf8().find(kSecurityEnableNodeIntegration)
|
frame->uniqueName().utf8().find(kSecurityEnableNodeIntegration)
|
||||||
|
|
10
atom/renderer/lib/chrome-api.coffee
Normal file
10
atom/renderer/lib/chrome-api.coffee
Normal file
|
@ -0,0 +1,10 @@
|
||||||
|
url = require 'url'
|
||||||
|
|
||||||
|
chrome = window.chrome = window.chrome || {}
|
||||||
|
chrome.extension =
|
||||||
|
getURL: (path) ->
|
||||||
|
url.format
|
||||||
|
protocol: location.protocol
|
||||||
|
slashes: true
|
||||||
|
hostname: location.hostname
|
||||||
|
pathname: path
|
|
@ -46,6 +46,9 @@ else
|
||||||
if location.protocol is 'chrome-devtools:'
|
if location.protocol is 'chrome-devtools:'
|
||||||
# Override some inspector APIs.
|
# Override some inspector APIs.
|
||||||
require path.join(__dirname, 'inspector')
|
require path.join(__dirname, 'inspector')
|
||||||
|
else if location.protocol is 'chrome-extension:'
|
||||||
|
# Add implementations of chrome API.
|
||||||
|
require path.join(__dirname, 'chrome-api')
|
||||||
else
|
else
|
||||||
# Override default web functions.
|
# Override default web functions.
|
||||||
require path.join(__dirname, 'override')
|
require path.join(__dirname, 'override')
|
||||||
|
|
2
vendor/brightray
vendored
2
vendor/brightray
vendored
|
@ -1 +1 @@
|
||||||
Subproject commit 602403baae04c28ab04ea6f8b4f0b1aa697a3630
|
Subproject commit de769889118c6e68ecb0c729be5ab6caef333bf6
|
Loading…
Add table
Add a link
Reference in a new issue