Reviewers: shindig.remailer,

Description:
URLs without an HTTP or HTTPS scheme, like:
  "//www.example.com/shindig/api/"
... are legal and supported in HTML.  Such URLs automatically follow the
scheme of the container, and so are really handy for implementing
containers that support both HTTP and HTTPS.  However, I've had reports
of some issues with IE sending XHRs to schemeless URLs, and failures
with flash execution when swfs are loaded from schemeless URLs.  This
patch fixes up such URLs on the client.

Please review this at http://codereview.appspot.com/33080

Affected files:
  features/src/main/javascript/features/core.io/io.js
  features/src/main/javascript/features/flash/flash.js


Index: features/src/main/javascript/features/core.io/io.js
===================================================================
--- features/src/main/javascript/features/core.io/io.js (revision 762432)
+++ features/src/main/javascript/features/core.io/io.js (working copy)
@@ -199,6 +199,10 @@
       params, processResponseFunction, opt_contentType) {
     var xhr = makeXhr();

+    if (proxyUrl.indexOf('//') == 0) {
+      proxyUrl = document.location.protocol + proxyUrl;
+    }
+
     xhr.open(method, proxyUrl, true);
     if (callback) {
       xhr.onreadystatechange = gadgets.util.makeClosure(
Index: features/src/main/javascript/features/flash/flash.js
===================================================================
--- features/src/main/javascript/features/flash/flash.js        (revision 
762432)
+++ features/src/main/javascript/features/flash/flash.js        (working copy)
@@ -99,6 +99,10 @@
       return false;
   }

+  if (swfUrl.indexOf('//') == 0) {
+    swfUrl = document.location.protocol + swfUrl;
+  }
+
   var ver = gadgets.flash.getMajorVersion();
   if (ver) {
     var swfVer = parseInt(swfVersion, 10);


Reply via email to