]> khamidou — GitHub mirrors - electron.git/commitdiff
Add "disablewebsecurity" attribute for <webview>
authorCheng Zhao <zcbenz@gmail.com>
Thu, 18 Dec 2014 00:32:25 +0000 (16:32 -0800)
committerCheng Zhao <zcbenz@gmail.com>
Thu, 18 Dec 2014 02:13:20 +0000 (18:13 -0800)
atom/browser/lib/guest-view-manager.coffee
atom/browser/web_view/web_view_manager.cc
atom/browser/web_view/web_view_manager.h
atom/browser/web_view/web_view_renderer_state.h
atom/renderer/lib/web-view/web-view-attributes.coffee
atom/renderer/lib/web-view/web-view-constants.coffee

index bbabf3c5d6f4d5730a24ac200c41becf5a941f67..51e7bdf91d69d0832acec8045132385fd2d84825 100644 (file)
@@ -93,6 +93,7 @@ attachGuest = (embedder, elementInstanceId, guestInstanceId, params) ->
   webViewManager.addGuest guestInstanceId, elementInstanceId, embedder, guest,
     nodeIntegration: params.nodeintegration
     plugins: params.plugins
+    disableWebSecurity: params.disablewebsecurity
     preloadUrl: params.preload ? ''
 
   guest.attachParams = params
index c638c18e123aee3978649ab615354219e1711d43..20c508810976d50d1ca75e59f44c378d80275cf2 100644 (file)
@@ -41,7 +41,8 @@ struct Converter<atom::WebViewManager::WebViewOptions> {
       return false;
     return options.Get("nodeIntegration", &(out->node_integration)) &&
            options.Get("plugins", &(out->plugins)) &&
-           options.Get("preloadUrl", &(out->preload_url));
+           options.Get("preloadUrl", &(out->preload_url)) &&
+           options.Get("disableWebSecurity", &(out->disable_web_security));
   }
 };
 
@@ -63,7 +64,10 @@ void WebViewManager::AddGuest(int guest_instance_id,
   web_contents_map_[guest_instance_id] = { web_contents, embedder };
 
   WebViewRendererState::WebViewInfo web_view_info = {
-    guest_instance_id, options.node_integration, options.plugins
+    guest_instance_id,
+    options.node_integration,
+    options.plugins,
+    options.disable_web_security,
   };
   net::FileURLToFilePath(options.preload_url, &web_view_info.preload_script);
   content::BrowserThread::PostTask(
index e14d31cec0567a3c8a1287f5cb9ae51c1d0bfe4f..bc58bd34f49d620c8fc644bb19990a9229a419a9 100644 (file)
@@ -24,6 +24,7 @@ class WebViewManager : public content::BrowserPluginGuestManager {
   struct WebViewOptions {
     bool node_integration;
     bool plugins;
+    bool disable_web_security;
     GURL preload_url;
   };
 
index bddf803704aa757cddddc2c7ab95ba8073fe513e..57373b5449197e8027fedc5961e2ad6f05068034 100644 (file)
@@ -24,6 +24,7 @@ class WebViewRendererState {
     int guest_instance_id;
     bool node_integration;
     bool plugins;
+    bool disable_web_security;
     base::FilePath preload_script;
   };
 
index a3e97b5be4bada7aa5a940c5dc1b2347c4933bf7..00d076cdd8aa47fbf83d6eda39d6e1297c4e0a26 100644 (file)
@@ -195,6 +195,7 @@ WebViewImpl::setupWebViewAttributes = ->
   @attributes[webViewConstants.ATTRIBUTE_HTTPREFERRER] = new HttpReferrerAttribute(this)
   @attributes[webViewConstants.ATTRIBUTE_NODEINTEGRATION] = new BooleanAttribute(webViewConstants.ATTRIBUTE_NODEINTEGRATION, this)
   @attributes[webViewConstants.ATTRIBUTE_PLUGINS] = new BooleanAttribute(webViewConstants.ATTRIBUTE_PLUGINS, this)
+  @attributes[webViewConstants.ATTRIBUTE_DISABLEWEBSECURITY] = new BooleanAttribute(webViewConstants.ATTRIBUTE_DISABLEWEBSECURITY, this)
   @attributes[webViewConstants.ATTRIBUTE_PRELOAD] = new PreloadAttribute(this)
 
   autosizeAttributes = [
index f40f14c4d757152a805f7a0fa4eac1c5e710b1e6..9c9beaecf9e33add6e175b03a355bec217355c66 100644 (file)
@@ -12,6 +12,7 @@ module.exports =
   ATTRIBUTE_HTTPREFERRER: 'httpreferrer'
   ATTRIBUTE_NODEINTEGRATION: 'nodeintegration'
   ATTRIBUTE_PLUGINS: 'plugins'
+  ATTRIBUTE_DISABLEWEBSECURITY: 'disablewebsecurity'
   ATTRIBUTE_PRELOAD: 'preload'
 
   # Internal attribute.