Commit 5de71312 authored by's avatar

Make sure MHTML documents use the domain of the MHTML file.

Reviewed by Adam Barth.


* dom/Document.h:
* loader/FrameLoader.cpp:


* mhtml/check_domain-expected.txt: Added.
* mhtml/check_domain.mht: Added.

git-svn-id: 268f45cc-cd09-0410-ab3c-d52691b4dbfc
parent 533a1fe0
2011-11-16 Jay Civelli <>
Make sure MHTML documents use the domain of the MHTML file.
Reviewed by Adam Barth.
* mhtml/check_domain-expected.txt: Added.
* mhtml/check_domain.mht: Added.
2011-11-11 Adrienne Walker <>
[chromium] Expose mock scrollbars to window.internals
This is a very simple page
Very basic page.
From: <Saved by UnMHT>
Subject: =?iso-2022-jp?B?QSBzaW1wbGUgcGFnZQ==?=
Date: Wed, May 11 2011 15:36:36 GMT-0700
MIME-Version: 1.0
Content-Type: multipart/related;
Content-Type: text/html; charset="ISO-8859-1"
Content-Transfer-Encoding: quoted-printable
Content-Location: http://localhost/simple_page.html
<html><head><meta http-equiv=3D"Content-Type" content=3D"text/html; charset=
<title>A simple page</title>
if (window.layoutTestController) {
window.onload = function() {
var span=3Ddocument.createElement("span");
if (window.location !=3D 'http://localhost/simple_page.html' &&
document.domain !=3D 'localhost') {
span.innerHTML = "PASS";
} else {
span.innerHTML = "FAIL window.location=" + window.location +
" document.domain=" + document.domain;
<base href=3D"http://localhost/"></base></head><body>
<h1>This is a very simple page</h1>
Very <b>basic</b> page.
<div id=3D'locDiv'></div>
2011-11-16 Jay Civelli <>
Make sure MHTML documents use the domain of the MHTML file.
Reviewed by Adam Barth.
* dom/Document.h:
* loader/FrameLoader.cpp:
2011-11-16 Julien Chaffraix <>
Update supported display list after -webkit-grid and -webkit-inline-grid addition
......@@ -2403,12 +2403,16 @@ void Document::updateBaseURL()
// DOM 3 Core: When the Document supports the feature "HTML" [DOM Level 2 HTML], the base URI is computed using
// first the value of the href attribute of the HTML BASE element if any, and the value of the documentURI attribute
// from the Document interface otherwise.
if (m_baseElementURL.isEmpty()) {
if (!m_baseElementURL.isEmpty())
m_baseURL = m_baseElementURL;
else if (!m_baseURLOverride.isEmpty())
m_baseURL = m_baseURLOverride;
else {
// The documentURI attribute is an arbitrary string. DOM 3 Core does not specify how it should be resolved,
// so we use a null base URL.
m_baseURL = KURL(KURL(), documentURI());
} else
m_baseURL = m_baseElementURL;
if (!m_baseURL.isValid())
m_baseURL = KURL();
......@@ -2418,6 +2422,12 @@ void Document::updateBaseURL()
void Document::setBaseURLOverride(const KURL& url)
m_baseURLOverride = url;
void Document::processBaseElement()
// Find the first href attribute in a base element and the first target attribute in a base element.
......@@ -608,6 +608,8 @@ public:
void setURL(const KURL&);
const KURL& baseURL() const { return m_baseURL; }
void setBaseURLOverride(const KURL&);
const KURL& baseURLOverride() const { return m_baseURLOverride; }
const String& baseTarget() const { return m_baseTarget; }
void processBaseElement();
......@@ -1186,6 +1188,7 @@ private:
// Document URLs.
KURL m_url; // Document.URL: The URL from which this document was retrieved.
KURL m_baseURL; // Node.baseURI: The URL to use when resolving relative URLs.
KURL m_baseURLOverride; // An alternative base URL that takes precedence ove m_baseURL (but not m_baseElementURL).
KURL m_baseElementURL; // The URL set by the <base> element.
KURL m_cookieURL; // The URL to use for cookie access.
KURL m_firstPartyForCookies; // The policy URL for third-party cookie blocking.
......@@ -563,7 +563,7 @@ void FrameLoader::clear(bool clearWindowProperties, bool clearScriptObjects, boo
void FrameLoader::receivedFirstData()
KURL workingURL = activeDocumentLoader()->documentURL();
// FIXME: The document loader, not the frame loader, should be in charge of loading web archives.
// Once this is done, we can just make DocumentLoader::documentURL() return the right URL
// based on whether it has a non-null archive or not.
......@@ -576,7 +576,15 @@ void FrameLoader::receivedFirstData()
if (m_archive) {
// The origin is the MHTML file, we need to set the base URL to the document encoded in the MHTML so
// relative URLs are resolved properly.
if (m_documentLoader) {
StringWithDirection ptitle = m_documentLoader->title();
// If we have a title let the WebView know about it.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment