Verified Commit e710fcf4 authored by Tom Schuster's avatar Tom Schuster Committed by ma1
Browse files

Bug 1973900 - Remove support for the codebase attribute from <object>. r=farre,dom-core

parent 46fcfe95
Loading
Loading
Loading
Loading
+5 −3
Original line number Diff line number Diff line
@@ -73,6 +73,7 @@
#include "mozilla/PresShell.h"
#include "mozilla/ProfilerLabels.h"
#include "mozilla/StaticPrefs_browser.h"
#include "mozilla/StaticPrefs_dom.h"
#include "nsChannelClassifier.h"
#include "nsFocusManager.h"
#include "ReferrerInfo.h"
@@ -720,11 +721,12 @@ nsObjectLoadingContent::UpdateObjectParameters() {
  /// Codebase
  ///

  nsAutoString codebaseStr;
  nsIURI* docBaseURI = el->GetBaseURI();
  el->GetAttr(nsGkAtoms::codebase, codebaseStr);

  if (!codebaseStr.IsEmpty()) {
  nsAutoString codebaseStr;
  el->GetAttr(nsGkAtoms::codebase, codebaseStr);
  if (StaticPrefs::dom_object_embed_codebase_enabled() &&
      !codebaseStr.IsEmpty()) {
    rv = nsContentUtils::NewURIWithDocumentCharset(
        getter_AddRefs(newBaseURI), codebaseStr, el->OwnerDoc(), docBaseURI);
    if (NS_FAILED(rv)) {
+6 −0
Original line number Diff line number Diff line
@@ -3206,6 +3206,12 @@
  value: true
  mirror: always

# Whether the codebase attribute in an <object> is used as the base URI.
- name: dom.object_embed.codebase.enabled
  type: bool
  value: false
  mirror: always

# Whether origin trials are enabled.
- name: dom.origin-trials.enabled
  type: bool
+13 −0
Original line number Diff line number Diff line
@@ -30,4 +30,17 @@ async_test(t => {
  obj.onerror = t.unreached_func();
  document.body.appendChild(obj);
}, "object's typemustmatch content attribute should not be supported");

async_test(t => {
  const obj = document.createElement("object");
  t.add_cleanup(() => obj.remove());
  obj.setAttribute("data", "/common/blank.html");
  obj.setAttribute("codebase", "https://test.invalid/");
  obj.onload = t.step_func_done(() => {
    assert_not_equals(obj.contentDocument, null, "/common/blank.html should be loaded");
    assert_equals(obj.contentDocument.location.origin, location.origin, "document should be loaded with current origin as base");
  });
  obj.onerror = t.unreached_func();
  document.body.appendChild(obj);
}, "object's codebase content attribute should not be supported");
</script>