Skip to content

Commit c92d253

Browse files
committed
Add "disablewebsecurity" attribute for <webview>
1 parent 6d168b8 commit c92d253

File tree

6 files changed

+11
-2
lines changed

6 files changed

+11
-2
lines changed

atom/browser/lib/guest-view-manager.coffee

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -93,6 +93,7 @@ attachGuest = (embedder, elementInstanceId, guestInstanceId, params) ->
9393
webViewManager.addGuest guestInstanceId, elementInstanceId, embedder, guest,
9494
nodeIntegration: params.nodeintegration
9595
plugins: params.plugins
96+
disableWebSecurity: params.disablewebsecurity
9697
preloadUrl: params.preload ? ''
9798

9899
guest.attachParams = params

atom/browser/web_view/web_view_manager.cc

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,8 @@ struct Converter<atom::WebViewManager::WebViewOptions> {
4141
return false;
4242
return options.Get("nodeIntegration", &(out->node_integration)) &&
4343
options.Get("plugins", &(out->plugins)) &&
44-
options.Get("preloadUrl", &(out->preload_url));
44+
options.Get("preloadUrl", &(out->preload_url)) &&
45+
options.Get("disableWebSecurity", &(out->disable_web_security));
4546
}
4647
};
4748

@@ -63,7 +64,10 @@ void WebViewManager::AddGuest(int guest_instance_id,
6364
web_contents_map_[guest_instance_id] = { web_contents, embedder };
6465

6566
WebViewRendererState::WebViewInfo web_view_info = {
66-
guest_instance_id, options.node_integration, options.plugins
67+
guest_instance_id,
68+
options.node_integration,
69+
options.plugins,
70+
options.disable_web_security,
6771
};
6872
net::FileURLToFilePath(options.preload_url, &web_view_info.preload_script);
6973
content::BrowserThread::PostTask(

atom/browser/web_view/web_view_manager.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ class WebViewManager : public content::BrowserPluginGuestManager {
2424
struct WebViewOptions {
2525
bool node_integration;
2626
bool plugins;
27+
bool disable_web_security;
2728
GURL preload_url;
2829
};
2930

atom/browser/web_view/web_view_renderer_state.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ class WebViewRendererState {
2424
int guest_instance_id;
2525
bool node_integration;
2626
bool plugins;
27+
bool disable_web_security;
2728
base::FilePath preload_script;
2829
};
2930

atom/renderer/lib/web-view/web-view-attributes.coffee

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -195,6 +195,7 @@ WebViewImpl::setupWebViewAttributes = ->
195195
@attributes[webViewConstants.ATTRIBUTE_HTTPREFERRER] = new HttpReferrerAttribute(this)
196196
@attributes[webViewConstants.ATTRIBUTE_NODEINTEGRATION] = new BooleanAttribute(webViewConstants.ATTRIBUTE_NODEINTEGRATION, this)
197197
@attributes[webViewConstants.ATTRIBUTE_PLUGINS] = new BooleanAttribute(webViewConstants.ATTRIBUTE_PLUGINS, this)
198+
@attributes[webViewConstants.ATTRIBUTE_DISABLEWEBSECURITY] = new BooleanAttribute(webViewConstants.ATTRIBUTE_DISABLEWEBSECURITY, this)
198199
@attributes[webViewConstants.ATTRIBUTE_PRELOAD] = new PreloadAttribute(this)
199200

200201
autosizeAttributes = [

atom/renderer/lib/web-view/web-view-constants.coffee

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ module.exports =
1212
ATTRIBUTE_HTTPREFERRER: 'httpreferrer'
1313
ATTRIBUTE_NODEINTEGRATION: 'nodeintegration'
1414
ATTRIBUTE_PLUGINS: 'plugins'
15+
ATTRIBUTE_DISABLEWEBSECURITY: 'disablewebsecurity'
1516
ATTRIBUTE_PRELOAD: 'preload'
1617

1718
# Internal attribute.

0 commit comments

Comments
 (0)