Bug 888834 - Java sees no-explicit-codebase as . not baseURI. r=josh, a=bajaj
authorJohn Schoenick <jschoenick@mozilla.com>
Mon, 01 Jul 2013 14:14:56 -0700
changeset 143111 b4fa00ef357f
parent 143110 aa1e0d96de39
child 143112 da80d09909f3
push id2655
push userryanvm@gmail.com
push date2013-07-20 01:48 +0000
treeherdermozilla-beta@da80d09909f3 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjosh, bajaj
bugs888834
milestone23.0
Bug 888834 - Java sees no-explicit-codebase as . not baseURI. r=josh, a=bajaj
content/base/src/nsObjectLoadingContent.cpp
--- a/content/base/src/nsObjectLoadingContent.cpp
+++ b/content/base/src/nsObjectLoadingContent.cpp
@@ -1468,22 +1468,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)) {