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 147989 e3d234674a863d7baaebf7a534684919cb12cd02
parent 147988 b3aa850f03fc54392a9dc26a46096d89902a165b
child 147990 1dffe1098d37ff4b1402198fd92af243d664c09d
push id2697
push userbbajaj@mozilla.com
push dateMon, 05 Aug 2013 18:49:53 +0000
treeherdermozilla-beta@dfec938c7b63 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjosh, bajaj
bugs888834
milestone24.0a2
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
@@ -1464,22 +1464,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)) {