Bug 888834 - Java sees no-explicit-codebase as . not baseURI. r=josh
authorJohn Schoenick <jschoenick@mozilla.com>
Mon, 01 Jul 2013 14:14:56 -0700
changeset 137258 1f09176d269b0e7359db6035665403421e3c8c0c
parent 137257 b06bd5858999272dbdad41a91e323679eac017cf
child 137259 78fbb80cf76cc1fcb6c7c553b85ae80097a40182
push id1824
push userryanvm@gmail.com
push dateWed, 03 Jul 2013 18:16:56 +0000
treeherderfx-team@dcbbfcdf7bb4 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjosh
bugs888834
milestone25.0a1
Bug 888834 - Java sees no-explicit-codebase as . not baseURI. r=josh
content/base/src/nsObjectLoadingContent.cpp
--- a/content/base/src/nsObjectLoadingContent.cpp
+++ b/content/base/src/nsObjectLoadingContent.cpp
@@ -1454,22 +1454,25 @@ nsObjectLoadingContent::UpdateObjectPara
             }
           }
         }
       }
     }
   }
 
   if (isJava && hasCodebase && codebaseStr.IsEmpty()) {
-    // Java treats an empty codebase as the document codebase, but codebase=""
-    // as "/"
+    // Java treats codebase="" as "/"
     codebaseStr.AssignLiteral("/");
     // XXX(johns): This doesn't cover the case of "https:" which java would
     //             interpret as "https:///" but we interpret as this document's
     //             URI but with a changed scheme.
+  } else if (isJava && !hasCodebase) {
+    // Java expects a directory as the codebase, or else it will construct
+    // relative URIs incorrectly :(
+    codebaseStr.AssignLiteral(".");
   }
 
   if (!codebaseStr.IsEmpty()) {
     rv = nsContentUtils::NewURIWithDocumentCharset(getter_AddRefs(newBaseURI),
                                                    codebaseStr,
                                                    thisContent->OwnerDoc(),
                                                    docBaseURI);
     if (NS_SUCCEEDED(rv)) {