Bug 1279218 - Remove Applet element support from WebBrowserPersist; r=jld draft
authorKyle Machulis <kyle@nonpolynomial.com>
Mon, 10 Jul 2017 16:07:20 -0700
changeset 617652 f73ccd6553b8eb169ded8a05e2bc3105d971af2e
parent 617651 af71af410082e1771ab5063887f41796fa6b97b5
child 617653 421234152e9863e0a72da82f61629dd1ad449c80
push id71110
push userbmo:kyle@nonpolynomial.com
push dateFri, 28 Jul 2017 19:36:45 +0000
reviewersjld
bugs1279218
milestone56.0a1
Bug 1279218 - Remove Applet element support from WebBrowserPersist; r=jld MozReview-Commit-ID: AH9GueLpxyN
dom/webbrowserpersist/WebBrowserPersistLocalDocument.cpp
--- a/dom/webbrowserpersist/WebBrowserPersistLocalDocument.cpp
+++ b/dom/webbrowserpersist/WebBrowserPersistLocalDocument.cpp
@@ -16,17 +16,16 @@
 #include "nsCycleCollectionParticipant.h"
 #include "nsFrameLoader.h"
 #include "nsIComponentRegistrar.h"
 #include "nsIContent.h"
 #include "nsIDOMAttr.h"
 #include "nsIDOMComment.h"
 #include "nsIDOMDocument.h"
 #include "nsIDOMHTMLAnchorElement.h"
-#include "nsIDOMHTMLAppletElement.h"
 #include "nsIDOMHTMLAreaElement.h"
 #include "nsIDOMHTMLBaseElement.h"
 #include "nsIDOMHTMLCollection.h"
 #include "nsIDOMHTMLDocument.h"
 #include "nsIDOMHTMLEmbedElement.h"
 #include "nsIDOMHTMLFrameElement.h"
 #include "nsIDOMHTMLIFrameElement.h"
 #include "nsIDOMHTMLImageElement.h"
@@ -536,52 +535,16 @@ ResourceReader::OnWalkDOMNode(nsIDOMNode
         return OnWalkAttribute(aNode, "src");
     }
 
     nsCOMPtr<nsIDOMHTMLObjectElement> nodeAsObject = do_QueryInterface(aNode);
     if (nodeAsObject) {
         return OnWalkAttribute(aNode, "data");
     }
 
-    nsCOMPtr<nsIDOMHTMLAppletElement> nodeAsApplet = do_QueryInterface(aNode);
-    if (nodeAsApplet) {
-        // For an applet, relative URIs are resolved relative to the
-        // codebase (which is resolved relative to the base URI).
-        nsCOMPtr<nsIURI> oldBase = mCurrentBaseURI;
-        nsAutoString codebase;
-        rv = nodeAsApplet->GetCodeBase(codebase);
-        NS_ENSURE_SUCCESS(rv, rv);
-        if (!codebase.IsEmpty()) {
-            nsCOMPtr<nsIURI> baseURI;
-            rv = NS_NewURI(getter_AddRefs(baseURI), codebase,
-                           mParent->GetCharacterSet(), mCurrentBaseURI);
-            NS_ENSURE_SUCCESS(rv, rv);
-            if (baseURI) {
-                mCurrentBaseURI = baseURI;
-                // Must restore this before returning (or ENSURE'ing).
-            }
-        }
-
-        // We only store 'code' locally if there is no 'archive',
-        // otherwise we assume the archive file(s) contains it (bug 430283).
-        nsAutoCString archiveAttr;
-        rv = ExtractAttribute(aNode, "archive", "", archiveAttr);
-        if (NS_SUCCEEDED(rv)) {
-            if (!archiveAttr.IsEmpty()) {
-                rv = OnWalkURI(archiveAttr);
-            } else {
-                rv = OnWalkAttribute(aNode, "core");
-            }
-        }
-
-        // restore the base URI we really want to have
-        mCurrentBaseURI = oldBase;
-        return rv;
-    }
-
     nsCOMPtr<nsIDOMHTMLLinkElement> nodeAsLink = do_QueryInterface(aNode);
     if (nodeAsLink) {
         // Test if the link has a rel value indicating it to be a stylesheet
         nsAutoString linkRel;
         if (NS_SUCCEEDED(nodeAsLink->GetRel(linkRel)) && !linkRel.IsEmpty()) {
             nsReadingIterator<char16_t> start;
             nsReadingIterator<char16_t> end;
             nsReadingIterator<char16_t> current;
@@ -1111,48 +1074,16 @@ PersistNodeFixup::FixupNode(nsIDOMNode *
     if (nodeAsObject) {
         rv = GetNodeToFixup(aNodeIn, aNodeOut);
         if (NS_SUCCEEDED(rv) && *aNodeOut) {
             FixupAttribute(*aNodeOut, "data");
         }
         return rv;
     }
 
-    nsCOMPtr<nsIDOMHTMLAppletElement> nodeAsApplet = do_QueryInterface(aNodeIn);
-    if (nodeAsApplet) {
-        rv = GetNodeToFixup(aNodeIn, aNodeOut);
-        if (NS_SUCCEEDED(rv) && *aNodeOut) {
-            nsCOMPtr<nsIDOMHTMLAppletElement> newApplet =
-                do_QueryInterface(*aNodeOut);
-            // For an applet, relative URIs are resolved relative to the
-            // codebase (which is resolved relative to the base URI).
-            nsCOMPtr<nsIURI> oldBase = mCurrentBaseURI;
-            nsAutoString codebase;
-            nodeAsApplet->GetCodeBase(codebase);
-            if (!codebase.IsEmpty()) {
-                nsCOMPtr<nsIURI> baseURI;
-                NS_NewURI(getter_AddRefs(baseURI), codebase,
-                          mParent->GetCharacterSet(), mCurrentBaseURI);
-                if (baseURI) {
-                    mCurrentBaseURI = baseURI;
-                }
-            }
-            // Unset the codebase too, since we'll correctly relativize the
-            // code and archive paths.
-            IgnoredErrorResult ignored;
-            static_cast<dom::HTMLSharedObjectElement*>(newApplet.get())->
-              RemoveAttribute(NS_LITERAL_STRING("codebase"), ignored);
-            FixupAttribute(*aNodeOut, "code");
-            FixupAttribute(*aNodeOut, "archive");
-            // restore the base URI we really want to have
-            mCurrentBaseURI = oldBase;
-        }
-        return rv;
-    }
-
     nsCOMPtr<nsIDOMHTMLLinkElement> nodeAsLink = do_QueryInterface(aNodeIn);
     if (nodeAsLink) {
         rv = GetNodeToFixup(aNodeIn, aNodeOut);
         if (NS_SUCCEEDED(rv) && *aNodeOut) {
             // First see if the link represents linked content
             rv = FixupAttribute(*aNodeOut, "href");
             if (NS_FAILED(rv)) {
                 // Perhaps this link is actually an anchor to related content