From 4d9ee13f3ecd85754cbbf7f3e3a00c63c5eba282 Mon Sep 17 00:00:00 2001 From: Kyle Machulis Date: Tue, 6 Nov 2018 22:31:00 +0000 Subject: [PATCH] Bug 1499169 - Split MIME type of nsObjectLoadingContent when retreived from tag; r=bzbarsky MIME type should be trimmed of parameters whenever it is retreived from the tag it relates to, otherwise other checks may fail. Differential Revision: https://phabricator.services.mozilla.com/D10803 --HG-- extra : moz-landing-system : lando --- dom/base/nsObjectLoadingContent.cpp | 5 ++++- dom/base/test/mochitest.ini | 3 +++ dom/base/test/test_bug1499169.html | 32 +++++++++++++++++++++++++++++ 3 files changed, 39 insertions(+), 1 deletion(-) create mode 100644 dom/base/test/test_bug1499169.html diff --git a/dom/base/nsObjectLoadingContent.cpp b/dom/base/nsObjectLoadingContent.cpp index d52e465b6a98..a3b0ab8a18fd 100644 --- a/dom/base/nsObjectLoadingContent.cpp +++ b/dom/base/nsObjectLoadingContent.cpp @@ -1612,7 +1612,10 @@ nsObjectLoadingContent::UpdateObjectParameters() thisElement->GetAttr(kNameSpaceID_None, nsGkAtoms::type, rawTypeAttr); if (!rawTypeAttr.IsEmpty()) { typeAttr = rawTypeAttr; - CopyUTF16toUTF8(rawTypeAttr, newMime); + nsAutoString params; + nsAutoString mime; + nsContentUtils::SplitMimeType(rawTypeAttr, mime, params); + CopyUTF16toUTF8(mime, newMime); } // If we failed to build a valid URI, use the document's base URI diff --git a/dom/base/test/mochitest.ini b/dom/base/test/mochitest.ini index 587923d2e8cc..f187edf96f61 100644 --- a/dom/base/test/mochitest.ini +++ b/dom/base/test/mochitest.ini @@ -237,6 +237,7 @@ support-files = PASS.html FAIL.html !/dom/events/test/event_leak_utils.js + ../../../browser/extensions/pdfjs/test/file_pdfjs_test.pdf [test_anchor_area_referrer.html] [test_anchor_area_referrer_changing.html] @@ -617,6 +618,8 @@ skip-if = toolkit == 'android' [test_bug1453693.html] skip-if = os == "mac" [test_bug1472427.html] +[test_bug1499169.html] +skip-if = toolkit == 'android' # Timeouts on android due to page closing issues with embedded pdf [test_caretPositionFromPoint.html] [test_change_policy.html] [test_clearTimeoutIntervalNoArg.html] diff --git a/dom/base/test/test_bug1499169.html b/dom/base/test/test_bug1499169.html new file mode 100644 index 000000000000..6dc79d12fa68 --- /dev/null +++ b/dom/base/test/test_bug1499169.html @@ -0,0 +1,32 @@ + + + + + + Test for Bug 1499169 + + + + + + + Mozilla Bug 1499169 + + +