You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cordova.apache.org by pu...@apache.org on 2014/08/27 01:44:37 UTC

[1/2] git commit: CB-7377 Whitelist. Windows build error due to 'invalid URI rules in config.xml'

Repository: cordova-windows
Updated Branches:
  refs/heads/master 9ccd84e02 -> ea8315431


CB-7377 Whitelist. Windows build error due to 'invalid URI rules in config.xml'


Project: http://git-wip-us.apache.org/repos/asf/cordova-windows/repo
Commit: http://git-wip-us.apache.org/repos/asf/cordova-windows/commit/68f01153
Tree: http://git-wip-us.apache.org/repos/asf/cordova-windows/tree/68f01153
Diff: http://git-wip-us.apache.org/repos/asf/cordova-windows/diff/68f01153

Branch: refs/heads/master
Commit: 68f01153bd26a04eaa94ab505d70cc80d2fa52df
Parents: 352e526
Author: sgrebnov <v-...@microsoft.com>
Authored: Tue Aug 26 13:02:29 2014 +0400
Committer: sgrebnov <v-...@microsoft.com>
Committed: Tue Aug 26 13:02:29 2014 +0400

----------------------------------------------------------------------
 .../cordova/lib/ApplyPlatformConfig.ps1         | 36 ++++++++++++++++----
 1 file changed, 29 insertions(+), 7 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cordova-windows/blob/68f01153/windows/template/cordova/lib/ApplyPlatformConfig.ps1
----------------------------------------------------------------------
diff --git a/windows/template/cordova/lib/ApplyPlatformConfig.ps1 b/windows/template/cordova/lib/ApplyPlatformConfig.ps1
index 9e65a71..f4d4723 100644
--- a/windows/template/cordova/lib/ApplyPlatformConfig.ps1
+++ b/windows/template/cordova/lib/ApplyPlatformConfig.ps1
@@ -26,8 +26,6 @@ Write-Host "Applying Platform Config..."
 
 Function UpdateManifest ($manifestFile)
 {
-  $configFile = "$platformRoot\config.xml"
-  [xml]$config = Get-Content $configFile -Encoding UTF8
   [xml]$manifest = Get-Content $manifestFile -Encoding UTF8
 
   # Replace app start page with config.xml setting.
@@ -95,22 +93,20 @@ Function UpdateManifest ($manifestFile)
   }
 
   # Add domain whitelist rules
-  $acls = [string[]]$config.widget.access.origin
   $rules = $manifest.Package.Applications.Application.ApplicationContentUriRules
 
   # Remove existing rules from manifest
   if ($rules) {
-    $manifest.Package.Applications.Application.RemoveChild($rules)
+    $manifest.Package.Applications.Application.RemoveChild($rules) | Out-Null
   }
-
   if ($acls -and ($acls -notcontains "*")) {
     $rules = $manifest.CreateElement("ApplicationContentUriRules", $manifest.DocumentElement.NamespaceURI)
-    $manifest.Package.Applications.Application.AppendChild($rules)
+    $manifest.Package.Applications.Application.AppendChild($rules) | Out-Null
     $acls | foreach {
       $elem = $manifest.CreateElement("Rule", $manifest.DocumentElement.NamespaceURI)
       $elem.SetAttribute("Match", $_)
       $elem.SetAttribute("Type", "include")
-      $rules.AppendChild($elem)
+      $rules.AppendChild($elem) | Out-Null
     }
   }
 
@@ -204,6 +200,26 @@ Function CopyImage($src, $dest)
   Copy-Item $resolvedPath -Destination (join-path $platformRoot $dest)
 }
 
+Function Get-Access-Rules () 
+{
+  $aclsAll = ([string[]]$config.widget.access.origin)
+  if ($aclsAll -eq $null) {
+    return @();
+  }
+
+  $acls = @()
+ 
+  $aclsAll | foreach {
+      $_
+      if ($_.StartsWith("https://","CurrentCultureIgnoreCase") -or ($_ -eq "*")) {
+        $acls += $_
+      } else {
+        Write-Host "Access rules must begin with 'https://', the following rule is ignored: $_"
+      }
+    }
+  return $acls
+}
+
 Function UpdateAssets ()
 {
   $configFile = "$platformRoot\config.xml"
@@ -276,6 +292,12 @@ Function UpdateAssets ()
 
 }
 
+$configFile = "$platformRoot\config.xml"
+[xml]$config = Get-Content $configFile -Encoding UTF8
+
+# Domain whitelist rules defined in configuration file
+$acls = Get-Access-Rules $config
+
 UpdateManifest "$platformRoot\package.windows.appxmanifest"
 UpdateManifest "$platformRoot\package.windows80.appxmanifest"
 UpdateManifest "$platformRoot\package.phone.appxmanifest"


[2/2] git commit: Merge branch 'CB-7377' of https://github.com/MSOpenTech/cordova-windows

Posted by pu...@apache.org.
Merge branch 'CB-7377' of https://github.com/MSOpenTech/cordova-windows


Project: http://git-wip-us.apache.org/repos/asf/cordova-windows/repo
Commit: http://git-wip-us.apache.org/repos/asf/cordova-windows/commit/ea831543
Tree: http://git-wip-us.apache.org/repos/asf/cordova-windows/tree/ea831543
Diff: http://git-wip-us.apache.org/repos/asf/cordova-windows/diff/ea831543

Branch: refs/heads/master
Commit: ea83154310f8ba418189a8af03b9ac74b5025a2c
Parents: 9ccd84e 68f0115
Author: Jesse MacFadyen <pu...@gmail.com>
Authored: Tue Aug 26 16:44:21 2014 -0700
Committer: Jesse MacFadyen <pu...@gmail.com>
Committed: Tue Aug 26 16:44:21 2014 -0700

----------------------------------------------------------------------
 .../cordova/lib/ApplyPlatformConfig.ps1         | 36 ++++++++++++++++----
 1 file changed, 29 insertions(+), 7 deletions(-)
----------------------------------------------------------------------