WebCore/ChangeLog

 12010-08-26 Darin Adler <darin@apple.com>
 2
 3 Reviewed by NOBODY (OOPS!).
 4
 5 Some IDL attributes don't reflect URL content attributes properly
 6 https://bugs.webkit.org/show_bug.cgi?id=43650
 7
 8 * dom/Document.cpp:
 9 (WebCore::Document::processBaseElement): Added. Implements the rules for base elements
 10 from the HTML5 specification. Handles multiple base elements in the same document.
 11
 12 * dom/Document.h: Removed setBaseElementURL and setBaseElementTarget, replacing them
 13 with processBaseElement.
 14
 15 * html/HTMLBaseElement.cpp:
 16 (WebCore::HTMLBaseElement::parseMappedAttribute): Call the new processBaseElement
 17 function.
 18 (WebCore::HTMLBaseElement::insertedIntoDocument): Ditto.
 19 (WebCore::HTMLBaseElement::removedFromDocument): Ditto.
 20 (WebCore::HTMLBaseElement::isURLAttribute): Added.
 21 (WebCore::HTMLBaseElement::target): Moved here from the .h file and changed to not
 22 realy on an m_target local variable.
 23
 24 * html/HTMLBaseElement.h: Added an override of the isURLAttribute function. Removed
 25 unneeded process function. Removed declaration of nonexistent setHref and setTarget
 26 functions. Removed unneeded m_hrefAttrValue, m_href, and m_target. Moved
 27 implementation of target function into the .cpp file.
 28
 29 * html/HTMLBaseElement.idl: Marked the href attribute as URL.
 30
 31 * html/HTMLBlockquoteElement.cpp:
 32 (WebCore::HTMLBlockquoteElement::isURLAttribute): Added.
 33 * html/HTMLBlockquoteElement.h: Added isURLAttribute.
 34 * html/HTMLBlockquoteElement.idl: Marked the cite attribute as URL.
 35
 36 * html/HTMLEmbedElement.idl: Marked the src attribute as URL.
 37
 38 * html/HTMLFormElement.cpp: Added a comment about the action function, which should
 39 be removed.
 40
 41 * html/HTMLFormElement.idl: Marked the action attribute as URL.
 42
 43 * html/HTMLHtmlElement.cpp:
 44 (WebCore::HTMLHtmlElement::isURLAttribute): Added.
 45 (WebCore::HTMLHtmlElement::insertedIntoDocument): Tweaked a bit.
 46 * html/HTMLHtmlElement.h: Added isURLAttribute.
 47 * html/HTMLHtmlElement.idl: Marked the manifest attribute as URL.
 48
 49 * html/HTMLIFrameElement.idl: Marked the src attribute a URL.
 50
 51 * html/HTMLModElement.cpp:
 52 (WebCore::HTMLModElement::isURLAttribute): Added.
 53 * html/HTMLModElement.h: Added isURLAttribute.
 54 * html/HTMLModElement.idl: Marked the cite attribute as URL.
 55
 56 * html/HTMLQuoteElement.cpp:
 57 (WebCore::HTMLQuoteElement::isURLAttribute): Added.
 58 * html/HTMLQuoteElement.h: Added isURLAttribute.
 59 * html/HTMLQuoteElement.idl: Marked the cite attribute as URL.
 60
 61 * html/HTMLViewSourceDocument.cpp:
 62 (WebCore::HTMLViewSourceDocument::processTagToken): Changed code to create a base
 63 element instead of calling setBaseElementURL directly.
 64 (WebCore::HTMLViewSourceDocument::addSpanWithClassName): Use AtomicString instead of String.
 65 (WebCore::HTMLViewSourceDocument::addLine): Ditto.
 66 (WebCore::HTMLViewSourceDocument::addText): Ditto.
 67 (WebCore::HTMLViewSourceDocument::addBase): Added. Creates a base element and inserts it.
 68 (WebCore::HTMLViewSourceDocument::addLink): Use AtomicString instead of String.
 69
 70 * html/HTMLViewSourceDocument.h: Updated function declarations as above.
 71
1722010-08-26 Zhenyao Mo <zmo@google.com>
273
374 Reviewed by Kenneth Russell.
66288

WebCore/dom/Document.cpp

136136#include "XMLHttpRequest.h"
137137#include "XMLNSNames.h"
138138#include "XMLNames.h"
 139#include "XSSAuditor.h"
139140#include "htmlediting.h"
140141#include <wtf/CurrentTime.h>
141142#include <wtf/HashFunctions.h>

@@void Document::setURL(const KURL& url)
21962197 updateBaseURL();
21972198}
21982199
2199 void Document::setBaseElementURL(const KURL& baseElementURL)
2200 {
2201  m_baseElementURL = baseElementURL;
2202  updateBaseURL();
2203 }
2204 
22052200void Document::updateBaseURL()
22062201{
22072202 // DOM 3 Core: When the Document supports the feature "HTML" [DOM Level 2 HTML], the base URI is computed using

@@void Document::updateBaseURL()
22222217 m_mappedElementSheet->setFinalURL(m_baseURL);
22232218}
22242219
 2220void Document::processBaseElement()
 2221{
 2222 // Find the first href attribute in a base element and the first target attribute in a base element.
 2223 const AtomicString* href = 0;
 2224 const AtomicString* target = 0;
 2225 for (Node* node = document()->firstChild(); node && (!href || !target); node = node->traverseNextNode()) {
 2226 if (node->hasTagName(baseTag)) {
 2227 if (!href) {
 2228 const AtomicString& value = static_cast<Element*>(node)->fastGetAttribute(hrefAttr);
 2229 if (!value.isNull())
 2230 href = &value;
 2231 }
 2232 if (!target) {
 2233 const AtomicString& value = static_cast<Element*>(node)->fastGetAttribute(targetAttr);
 2234 if (!value.isNull())
 2235 target = &value;
 2236 }
 2237 }
 2238 }
 2239
 2240 // FIXME: Since this doesn't share code with completeURL it may not handle encodings correctly.
 2241 KURL baseElementURL;
 2242 if (href) {
 2243 String strippedHref = deprecatedParseURL(*href);
 2244 if (!strippedHref.isEmpty() && (!frame() || frame()->script()->xssAuditor()->canSetBaseElementURL(*href)))
 2245 baseElementURL = KURL(url(), strippedHref);
 2246 }
 2247 if (m_baseElementURL != baseElementURL) {
 2248 m_baseElementURL = baseElementURL;
 2249 updateBaseURL();
 2250 }
 2251
 2252 m_baseTarget = target ? *target : nullAtom;
 2253}
 2254
22252255String Document::userAgent(const KURL& url) const
22262256{
22272257 return frame() ? frame()->loader()->userAgent(url) : String();
66287

WebCore/dom/Document.h

@@public:
543543 void setURL(const KURL&);
544544
545545 const KURL& baseURL() const { return m_baseURL; }
546  // Setting the BaseElementURL will change the baseURL.
547  void setBaseElementURL(const KURL&);
548 
549546 const String& baseTarget() const { return m_baseTarget; }
550  // Setting the BaseElementTarget will change the baseTarget.
551  void setBaseElementTarget(const String& baseTarget) { m_baseTarget = baseTarget; }
 547 void processBaseElement();
552548
553549 KURL completeURL(const String&) const;
554550
66287

WebCore/html/HTMLBaseElement.cpp

2424#include "HTMLBaseElement.h"
2525
2626#include "Attribute.h"
27 #include "CSSHelper.h"
2827#include "Document.h"
29 #include "Frame.h"
3028#include "HTMLNames.h"
31 #include "XSSAuditor.h"
3229
3330namespace WebCore {
3431

@@PassRefPtr<HTMLBaseElement> HTMLBaseElem
4542 return adoptRef(new HTMLBaseElement(tagName, document));
4643}
4744
48 void HTMLBaseElement::parseMappedAttribute(Attribute* attr)
 45void HTMLBaseElement::parseMappedAttribute(Attribute* attribute)
4946{
50  if (attr->name() == hrefAttr) {
51  m_hrefAttrValue = attr->value();
52  m_href = deprecatedParseURL(attr->value());
53  process();
54  } else if (attr->name() == targetAttr) {
55  m_target = attr->value();
56  process();
57  } else
58  HTMLElement::parseMappedAttribute(attr);
 47 if (attribute->name() == hrefAttr || attribute->name() == targetAttr)
 48 document()->processBaseElement();
 49 else
 50 HTMLElement::parseMappedAttribute(attribute);
5951}
6052
6153void HTMLBaseElement::insertedIntoDocument()
6254{
6355 HTMLElement::insertedIntoDocument();
64  process();
 56 document()->processBaseElement();
6557}
6658
6759void HTMLBaseElement::removedFromDocument()
6860{
6961 HTMLElement::removedFromDocument();
70 
71  // Since the document doesn't have a base element, clear the base URL and target.
72  // FIXME: This does not handle the case of multiple base elements correctly.
73  document()->setBaseElementURL(KURL());
74  document()->setBaseElementTarget(String());
 62 document()->processBaseElement();
7563}
7664
77 void HTMLBaseElement::process()
 65bool HTMLBaseElement::isURLAttribute(Attribute* attribute) const
7866{
79  if (!inDocument())
80  return;
81 
82  if (!m_href.isEmpty() && (!document()->frame() || document()->frame()->script()->xssAuditor()->canSetBaseElementURL(m_hrefAttrValue)))
83  document()->setBaseElementURL(KURL(document()->url(), m_href));
84 
85  if (!m_target.isEmpty())
86  document()->setBaseElementTarget(m_target);
 67 return attribute->name() == hrefAttr;
 68}
8769
88  // FIXME: Changing a document's base URL should probably automatically update the resolved relative URLs of all images, stylesheets, etc.
 70String HTMLBaseElement::target() const
 71{
 72 return fastGetAttribute(targetAttr);
8973}
9074
9175}
66287

WebCore/html/HTMLBaseElement.h

@@public:
3434private:
3535 HTMLBaseElement(const QualifiedName&, Document*);
3636
37  virtual String target() const { return m_target; }
38 
 37 virtual String target() const;
 38 virtual bool isURLAttribute(Attribute*) const;
3939 virtual void parseMappedAttribute(Attribute*);
4040 virtual void insertedIntoDocument();
4141 virtual void removedFromDocument();
42 
43  void process();
44 
45  void setHref(const String&);
46  void setTarget(const String&);
47 
48  String m_hrefAttrValue;
49  String m_href;
50  String m_target;
5142};
5243
5344} // namespace
66287

WebCore/html/HTMLBaseElement.idl

11/*
2  * Copyright (C) 2006, 2009 Apple Inc. All rights reserved.
 2 * Copyright (C) 2006, 2009, 2010 Apple Inc. All rights reserved.
33 *
44 * This library is free software; you can redistribute it and/or
55 * modify it under the terms of the GNU Library General Public

2020module html {
2121
2222 interface HTMLBaseElement : HTMLElement {
23  attribute [Reflect] DOMString href;
 23 attribute [Reflect,URL] DOMString href;
2424 attribute [Reflect] DOMString target;
2525 };
2626
66287

WebCore/html/HTMLBlockquoteElement.cpp

@@PassRefPtr<HTMLBlockquoteElement> HTMLBl
4545 return adoptRef(new HTMLBlockquoteElement(tagName, document));
4646}
4747
 48bool HTMLBlockquoteElement::isURLAttribute(Attribute* attribute) const
 49{
 50 return attribute->name() == citeAttr;
 51}
 52
4853}
66287

WebCore/html/HTMLBlockquoteElement.h

@@public:
3434
3535private:
3636 HTMLBlockquoteElement(const QualifiedName&, Document*);
 37
 38 virtual bool isURLAttribute(Attribute*) const;
3739};
3840
3941} // namespace WebCore
66287

WebCore/html/HTMLBlockquoteElement.idl

11/*
2  * Copyright (C) 2006, 2009 Apple Inc. All rights reserved.
 2 * Copyright (C) 2006, 2009, 2010 Apple Inc. All rights reserved.
33 *
44 * This library is free software; you can redistribute it and/or
55 * modify it under the terms of the GNU Library General Public

2020module html {
2121
2222 interface HTMLBlockquoteElement : HTMLElement {
23  attribute [Reflect] DOMString cite;
 23 attribute [Reflect,URL] DOMString cite;
2424 };
2525
2626}
66287

WebCore/html/HTMLEmbedElement.idl

@@module html {
3232 attribute [Reflect] long height;
3333#endif
3434 attribute [Reflect] DOMString name;
35  attribute [Reflect] DOMString src;
 35 attribute [Reflect,URL] DOMString src;
3636 attribute [Reflect] DOMString type;
3737#if defined(LANGUAGE_JAVASCRIPT) && LANGUAGE_JAVASCRIPT
3838 attribute [Reflect] DOMString width;
66287

WebCore/html/HTMLFormElement.cpp

@@bool HTMLFormElement::noValidate() const
449449 return !getAttribute(novalidateAttr).isNull();
450450}
451451
 452// FIXME: This function should be removed because it does not do the same thing as the
 453// JavaScript binding for action, which treats action as a URL attribute. Last time I
 454// (Darin Adler) removed this, someone added it back, so I am leaving it in for now.
452455String HTMLFormElement::action() const
453456{
454457 return getAttribute(actionAttr);
66287

WebCore/html/HTMLFormElement.idl

@@module html {
3030 attribute [Reflect] DOMString name;
3131 attribute [Reflect] boolean noValidate;
3232 attribute [Reflect=accept_charset] DOMString acceptCharset;
33  attribute [Reflect] DOMString action;
 33 attribute [Reflect,URL] DOMString action;
3434 attribute [ConvertNullToNullString] DOMString encoding; /* Netscape/Firefox legacy attribute. Same as enctype. */
3535 attribute [ConvertNullToNullString] DOMString enctype;
3636 attribute [Reflect] DOMString method;
66287

WebCore/html/HTMLHtmlElement.cpp

@@PassRefPtr<HTMLHtmlElement> HTMLHtmlElem
5050 return adoptRef(new HTMLHtmlElement(tagName, document));
5151}
5252
 53bool HTMLHtmlElement::isURLAttribute(Attribute* attribute) const
 54{
 55 return attribute->name() == manifestAttr;
 56}
 57
5358#if ENABLE(OFFLINE_WEB_APPLICATIONS)
5459void HTMLHtmlElement::insertedIntoDocument()
5560{

@@void HTMLHtmlElement::insertedIntoDocume
6873 // Check the manifest attribute
6974 // FIXME: Revisit this when we get a clarification from whatwg on how to handle empty
7075 // manifest attributes. As spec'd, and coded here, the system will initiate an update
71  // passing in the document url as the manifest url. That's not a good thing.
72  AtomicString manifest = getAttribute(manifestAttr);
 76 // passing in the document URL as the manifest URL. That's not a good thing.
 77 const AtomicString& manifest = getAttribute(manifestAttr);
7378 if (manifest.isNull())
7479 documentLoader->applicationCacheHost()->selectCacheWithoutManifest();
7580 else
66287

WebCore/html/HTMLHtmlElement.h

@@public:
3636private:
3737 HTMLHtmlElement(const QualifiedName&, Document*);
3838
 39 virtual bool isURLAttribute(Attribute*) const;
 40
3941#if ENABLE(OFFLINE_WEB_APPLICATIONS)
4042 virtual void insertedIntoDocument();
4143#endif
66287

WebCore/html/HTMLHtmlElement.idl

@@module html {
2121
2222 interface HTMLHtmlElement : HTMLElement {
2323 attribute [Reflect] DOMString version;
 24 attribute [Reflect,URL] DOMString manifest;
2425 };
2526
2627}
66287

WebCore/html/HTMLIFrameElement.idl

@@module html {
3030 attribute [Reflect] DOMString name;
3131 attribute [Reflect] DOMString sandbox;
3232 attribute [Reflect] DOMString scrolling;
33  attribute [Reflect] DOMString src;
 33 attribute [Reflect,URL] DOMString src;
3434 attribute [Reflect] DOMString width;
3535
3636 // Introduced in DOM Level 2:
66287

WebCore/html/HTMLModElement.cpp

@@PassRefPtr<HTMLModElement> HTMLModElemen
3939 return adoptRef(new HTMLModElement(tagName, document));
4040}
4141
 42bool HTMLModElement::isURLAttribute(Attribute* attribute) const
 43{
 44 return attribute->name() == citeAttr;
 45}
 46
4247}
66287

WebCore/html/HTMLModElement.h

@@public:
3434
3535private:
3636 HTMLModElement(const QualifiedName&, Document*);
 37
 38 virtual bool isURLAttribute(Attribute*) const;
3739};
3840
3941} //namespace
66287

WebCore/html/HTMLModElement.idl

2020module html {
2121
2222 interface HTMLModElement : HTMLElement {
23  attribute [Reflect] DOMString cite;
 23 attribute [Reflect,URL] DOMString cite;
2424 attribute [Reflect] DOMString dateTime;
2525 };
2626
66287

WebCore/html/HTMLQuoteElement.cpp

@@void HTMLQuoteElement::insertedIntoDocum
4848 HTMLElement::insertedIntoDocument();
4949}
5050
 51bool HTMLQuoteElement::isURLAttribute(Attribute* attribute) const
 52{
 53 return attribute->name() == citeAttr;
 54}
 55
5156}
66287

WebCore/html/HTMLQuoteElement.h

@@private:
3737 HTMLQuoteElement(const QualifiedName&, Document*);
3838
3939 virtual void insertedIntoDocument();
 40 virtual bool isURLAttribute(Attribute*) const;
4041};
4142
4243} //namespace
66287

WebCore/html/HTMLQuoteElement.idl

2020module html {
2121
2222 interface HTMLQuoteElement : HTMLElement {
23  attribute [Reflect] DOMString cite;
 23 attribute [Reflect,URL] DOMString cite;
2424 };
2525}
66287

WebCore/html/HTMLViewSourceDocument.cpp

2828#include "Attribute.h"
2929#include "DOMImplementation.h"
3030#include "HTMLAnchorElement.h"
 31#include "HTMLBaseElement.h"
3132#include "HTMLBodyElement.h"
3233#include "HTMLDivElement.h"
3334#include "HTMLHtmlElement.h"

@@void HTMLViewSourceDocument::processDoct
140141
141142void HTMLViewSourceDocument::processTagToken(const String& source, HTMLToken& token)
142143{
143  String classNameStr = "webkit-html-tag";
144  m_current = addSpanWithClassName(classNameStr);
 144 m_current = addSpanWithClassName("webkit-html-tag");
145145
146146 AtomicString tagName(token.name().data(), token.name().size());
147147

@@void HTMLViewSourceDocument::processTagT
161161 index = addRange(source, index, iter->m_nameRange.m_start - token.startIndex(), "");
162162 index = addRange(source, index, iter->m_nameRange.m_end - token.startIndex(), "webkit-html-attribute-name");
163163
164  if (tagName == baseTag && name == hrefAttr) {
165  // Catch the href attribute in the base element. It will be used
166  // for rendering anchors created by addLink() below.
167  setBaseElementURL(KURL(url(), value));
168  }
 164 if (tagName == baseTag && name == hrefAttr)
 165 m_current = addBase(value);
169166
170167 index = addRange(source, index, iter->m_valueRange.m_start - token.startIndex(), "");
171168

@@void HTMLViewSourceDocument::processChar
189186 addText(source, "");
190187}
191188
192 PassRefPtr<Element> HTMLViewSourceDocument::addSpanWithClassName(const String& className)
 189PassRefPtr<Element> HTMLViewSourceDocument::addSpanWithClassName(const AtomicString& className)
193190{
194191 if (m_current == m_tbody) {
195192 addLine(className);

@@PassRefPtr<Element> HTMLViewSourceDocume
205202 return span.release();
206203}
207204
208 void HTMLViewSourceDocument::addLine(const String& className)
 205void HTMLViewSourceDocument::addLine(const AtomicString& className)
209206{
210207 // Create a table row.
211208 RefPtr<HTMLTableRowElement> trow = HTMLTableRowElement::create(this);

@@void HTMLViewSourceDocument::addLine(con
243240 }
244241}
245242
246 void HTMLViewSourceDocument::addText(const String& text, const String& className)
 243void HTMLViewSourceDocument::addText(const String& text, const AtomicString& className)
247244{
248245 if (text.isEmpty())
249246 return;

@@int HTMLViewSourceDocument::addRange(con
292289 return end;
293290}
294291
295 PassRefPtr<Element> HTMLViewSourceDocument::addLink(const String& url, bool isAnchor)
 292PassRefPtr<Element> HTMLViewSourceDocument::addBase(const AtomicString& href)
 293{
 294 RefPtr<HTMLBaseElement> base = HTMLBaseElement::create(baseTag, this);
 295 RefPtr<NamedNodeMap> attributeMap = NamedNodeMap::create();
 296 attributeMap->addAttribute(Attribute::createMapped(hrefAttr, href));
 297 base->setAttributeMap(attributeMap.release());
 298 m_current->parserAddChild(base);
 299 base->attach();
 300 return base.release();
 301}
 302
 303PassRefPtr<Element> HTMLViewSourceDocument::addLink(const AtomicString& url, bool isAnchor)
296304{
297305 if (m_current == m_tbody)
298306 addLine("webkit-html-tag");
66287

WebCore/html/HTMLViewSourceDocument.h

@@private:
5757 void processCharacterToken(const String& source, HTMLToken&);
5858
5959 void createContainingTable();
60  PassRefPtr<Element> addSpanWithClassName(const String&);
61  void addLine(const String& className);
62  void addText(const String& text, const String& className);
 60 PassRefPtr<Element> addSpanWithClassName(const AtomicString&);
 61 void addLine(const AtomicString& className);
 62 void addText(const String& text, const AtomicString& className);
6363 int addRange(const String& source, int start, int end, const String& className, bool isLink = false, bool isAnchor = false);
64  PassRefPtr<Element> addLink(const String& url, bool isAnchor);
 64 PassRefPtr<Element> addLink(const AtomicString& url, bool isAnchor);
 65 PassRefPtr<Element> addBase(const AtomicString& href);
6566
6667 String m_type;
6768 RefPtr<Element> m_current;
66287

LayoutTests/ChangeLog

 12010-08-27 Darin Adler <darin@apple.com>
 2
 3 Reviewed by NOBODY (OOPS!).
 4
 5 Some IDL attributes don't reflect URL content attributes properly
 6 https://bugs.webkit.org/show_bug.cgi?id=43650
 7
 8 * dom/html/level2/html/button03.js: Added a "WebKit modification" section so this
 9 correctly expects the action attribute to return a completed URL.
 10 * dom/xhtml/level2/html/button03.js: Ditto.
 11
 12 * fast/dom/URL-attribute-reflection-expected.txt: Updaed expected results to expecte
 13 more successes.
 14
 15 * fast/dom/script-tests/URL-attribute-reflection.js:
 16 (testURLReflection): Fixed wrong variable name in the test script.
 17
 18 * http/tests/security/xssAuditor/full-block-iframe-no-inherit.php: Removed a call
 19 to encodeURI that was needed to work around our incorrect implementation of
 20 HTMLIFrameElement's src attribute.
 21
 22 * fast/dom/HTMLBaseElement: Added.
 23 * fast/dom/HTMLBaseElement/multiple-base-elements-expected.txt: Added.
 24 * fast/dom/HTMLBaseElement/multiple-base-elements.html: Added.
 25 * fast/dom/HTMLBaseElement/script-tests: Added.
 26 * fast/dom/HTMLBaseElement/script-tests/TEMPLATE.html:
 27 Copied from fast/dom/HTMLAnchorElement/script-tests/TEMPLATE.html.
 28 * fast/dom/HTMLBaseElement/script-tests/multiple-base-elements.js: Added.
 29
1302010-08-27 Jon Honeycutt <jhoneycutt@apple.com>
231
332 Add tests to the WebKit2 skipped list.

4759347622 * platform/mac/editing/pasteboard/styled-element-markup-expected.checksum: Replaced.
4759447623 * platform/mac/editing/pasteboard/styled-element-markup-expected.png: Replaced.
4759547624 * platform/mac/editing/pasteboard/subframe-dragndrop-1-expected.che
 47625svn
66289

LayoutTests/dom/html/level2/html/button03.js

@@testNode = nodeList.item(0);
103103
104104 vfaction = formNode.action;
105105
106  assertEquals("formLink","...",vfaction);
 106// WebKit modification: 26-August-2010
 107 var expectedAction = document.URL.replace(/[^/]*$/, "") + "...";
 108// End WebKit modification
 109
 110 assertEquals("formLink",expectedAction,vfaction);
107111
108112}
109113
66287

LayoutTests/dom/xhtml/level2/html/button03.js

@@testNode = nodeList.item(0);
103103
104104 vfaction = formNode.action;
105105
106  assertEquals("formLink","...",vfaction);
 106// WebKit modification: 26-August-2010
 107 var expectedAction = document.URL.replace(/[^/]*$/, "") + "...";
 108// End WebKit modification
 109
 110 assertEquals("formLink",expectedAction,vfaction);
107111
108112}
109113
66287

LayoutTests/fast/dom/URL-attribute-reflection-expected.txt

@@On success, you will see a series of "PA
55
66PASS testURLReflection('attribute', 'element') is 'none'
77PASS testURLReflection('id', 'element') is 'non-URL'
8 FAIL testURLReflection('action', 'form') should be URL. Was non-URL.
9 FAIL testURLReflection('cite', 'blockquote') should be URL. Was non-URL.
10 FAIL testURLReflection('cite', 'del') should be URL. Was non-URL.
11 FAIL testURLReflection('cite', 'ins') should be URL. Was non-URL.
12 FAIL testURLReflection('cite', 'q') should be URL. Was non-URL.
 8PASS testURLReflection('action', 'form') is 'URL'
 9PASS testURLReflection('cite', 'blockquote') is 'URL'
 10PASS testURLReflection('cite', 'del') is 'URL'
 11PASS testURLReflection('cite', 'ins') is 'URL'
 12PASS testURLReflection('cite', 'q') is 'URL'
1313PASS testURLReflection('data', 'object') is 'URL'
1414FAIL testURLReflection('formaction', 'button') should be URL. Was none.
1515FAIL testURLReflection('formaction', 'input') should be URL. Was none.
1616PASS testURLReflection('href', 'a') is 'URL'
1717PASS testURLReflection('href', 'area') is 'URL'
1818PASS testURLReflection('href', 'link') is 'URL'
19 FAIL testURLReflection('href', 'base') should be URL. Was non-URL.
 19PASS testURLReflection('href', 'base') is 'URL'
2020FAIL testURLReflection('icon', 'command') should be URL. Was none.
21 FAIL testURLReflection('manifest', 'html') should be URL. Was none.
 21PASS testURLReflection('manifest', 'html') is 'URL'
2222PASS testURLReflection('poster', 'video') is 'URL'
2323PASS testURLReflection('src', 'audio') is 'URL'
24 FAIL testURLReflection('src', 'embed') should be URL. Was non-URL.
25 FAIL testURLReflection('src', 'iframe') should be URL. Was non-URL.
 24PASS testURLReflection('src', 'embed') is 'URL'
 25PASS testURLReflection('src', 'iframe') is 'URL'
2626PASS testURLReflection('src', 'img') is 'URL'
2727PASS testURLReflection('src', 'input') is 'URL'
2828PASS testURLReflection('src', 'script') is 'URL'
66287

LayoutTests/fast/dom/HTMLBaseElement/multiple-base-elements-expected.txt

 1Test the behavior of multiple base elements.
 2
 3On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
 4
 5
 6PASS clean(anchor.href) is 'http://originalbase.com/file'
 7PASS document.head.appendChild(base), clean(anchor.href) is 'http://domain.com/base/file'
 8PASS base.href = 'http://domain.com/base-changed/', clean(anchor.href) is 'http://domain.com/base-changed/file'
 9PASS document.head.removeChild(base), clean(anchor.href) is 'http://originalbase.com/file'
 10PASS document.head.appendChild(base), document.head.appendChild(base2), clean(anchor.href) is 'http://domain.com/base/file'
 11PASS base.removeAttribute('href'), clean(anchor.href) is 'http://domain.com/base2/file'
 12PASS document.head.appendChild(base3), clean(anchor.href) is 'http://domain.com/base2/file'
 13PASS successfullyParsed is true
 14
 15TEST COMPLETE
 16
0

LayoutTests/fast/dom/HTMLBaseElement/multiple-base-elements.html

 1<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
 2<html>
 3<head>
 4<link rel="stylesheet" href="../../js/resources/js-test-style.css">
 5<script src="../../js/resources/js-test-pre.js"></script>
 6</head>
 7<body>
 8<p id="description"></p>
 9<div id="console"></div>
 10<script src="script-tests/multiple-base-elements.js"></script>
 11<script src="../../js/resources/js-test-post.js"></script>
 12</body>
 13</html>
0

LayoutTests/fast/dom/HTMLBaseElement/script-tests/TEMPLATE.html

 1<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
 2<html>
 3<head>
 4<link rel="stylesheet" href="../../js/resources/js-test-style.css">
 5<script src="../../js/resources/js-test-pre.js"></script>
 6</head>
 7<body>
 8<p id="description"></p>
 9<div id="console"></div>
 10<script src="YOUR_JS_FILE_HERE"></script>
 11<script src="../../js/resources/js-test-post.js"></script>
 12</body>
 13</html>
66287

LayoutTests/fast/dom/HTMLBaseElement/script-tests/multiple-base-elements.js

 1description('Test the behavior of multiple base elements.');
 2
 3var originalBase = document.URL.replace(/[^/]*$/, "");
 4
 5function clean(url)
 6{
 7 if (url.length < originalBase.length)
 8 return url;
 9 if (url.substring(0, originalBase.length) !== originalBase)
 10 return url;
 11 return "http://originalbase.com/" + url.substring(originalBase.length);
 12}
 13
 14var anchor = document.createElement('a');
 15anchor.href = "file";
 16
 17document.body.appendChild(anchor);
 18
 19shouldBe("clean(anchor.href)", "'http://originalbase.com/file'");
 20
 21var base = document.createElement('base');
 22base.href = "http://domain.com/base/";
 23
 24shouldBe("document.head.appendChild(base), clean(anchor.href)", "'http://domain.com/base/file'");
 25shouldBe("base.href = 'http://domain.com/base-changed/', clean(anchor.href)", "'http://domain.com/base-changed/file'");
 26shouldBe("document.head.removeChild(base), clean(anchor.href)", "'http://originalbase.com/file'");
 27
 28base.href = "http://domain.com/base/";
 29
 30var base2 = document.createElement('base');
 31base2.href = "http://domain.com/base2/";
 32
 33var base3 = document.createElement('base');
 34base3.href = "http://domain.com/base3/";
 35
 36shouldBe("document.head.appendChild(base), document.head.appendChild(base2), clean(anchor.href)", "'http://domain.com/base/file'");
 37shouldBe("base.removeAttribute('href'), clean(anchor.href)", "'http://domain.com/base2/file'");
 38shouldBe("document.head.appendChild(base3), clean(anchor.href)", "'http://domain.com/base2/file'");
 39
 40document.head.removeChild(base);
 41document.head.removeChild(base2);
 42document.head.removeChild(base3);
 43
 44var successfullyParsed = true;
0

LayoutTests/fast/dom/script-tests/URL-attribute-reflection.js

@@function testURLReflection(attributeName
2424 if (xValue === "x")
2525 return "non-URL";
2626 if (xValue !== document.baseURI.replace(/[^\/]+$/, "x"))
27  return "error: " + xValue;
 27 return "error (x): " + xValue;
2828 if (emptyValue === "")
2929 return "non-empty URL";
3030 if (emptyValue === document.baseURI)
3131 return "URL";
32  return "error: " + value;
 32 return "error (empty): " + emptyValue;
3333}
3434
3535shouldBe("testURLReflection('attribute', 'element')", "'none'");
66287

LayoutTests/http/tests/security/xssAuditor/full-block-iframe-no-inherit.php

@@if (window.layoutTestController) {
1414}
1515function checkIfDone()
1616{
17  checkIfFrameLocationMatchesURLAndCallDone('frame', encodeURI(document.getElementById('frame').src));
 17 checkIfFrameLocationMatchesURLAndCallDone('frame', document.getElementById('frame').src);
1818}
1919</script>
2020</head>
66287