webview: respect properties provided during webview creation
authorRobo <hop2deep@gmail.com>
Wed, 13 Jan 2016 17:02:41 +0000 (22:32 +0530)
committerRobo <hop2deep@gmail.com>
Wed, 13 Jan 2016 17:10:55 +0000 (22:40 +0530)
atom/renderer/lib/web-view/web-view-attributes.js

index fd5dad2..b02cd75 100644 (file)
@@ -29,6 +29,7 @@ resolveURL = function(url) {
 WebViewAttribute = (function() {
   function WebViewAttribute(name, webViewImpl) {
     this.name = name;
+    this.value = webViewImpl.webviewNode[name] || '';
     this.webViewImpl = webViewImpl;
     this.ignoreMutation = false;
     this.defineProperty();
@@ -38,7 +39,7 @@ WebViewAttribute = (function() {
   /* Retrieves and returns the attribute's value. */
 
   WebViewAttribute.prototype.getValue = function() {
-    return this.webViewImpl.webviewNode.getAttribute(this.name) || '';
+    return this.webViewImpl.webviewNode.getAttribute(this.name) || this.value;
   };
 
 
@@ -228,7 +229,7 @@ SrcAttribute = (function(superClass) {
     if (this.webViewImpl.webviewNode.hasAttribute(this.name)) {
       return resolveURL(this.webViewImpl.webviewNode.getAttribute(this.name));
     } else {
-      return '';
+      return this.value;
     }
   };
 
@@ -368,7 +369,7 @@ PreloadAttribute = (function(superClass) {
   PreloadAttribute.prototype.getValue = function() {
     var preload, protocol;
     if (!this.webViewImpl.webviewNode.hasAttribute(this.name)) {
-      return '';
+      return this.value;
     }
     preload = resolveURL(this.webViewImpl.webviewNode.getAttribute(this.name));
     protocol = preload.substr(0, 5);