[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-commits
Subject: branches/KDE/4.6/kdelibs/khtml
From: Maks Orlovich <maksim () kde ! org>
Date: 2011-01-19 1:00:42
Message-ID: 20110119010042.03CAEAC8B7 () svn ! kde ! org
[Download RAW message or body]
SVN commit 1215545 by orlovich:
Merged revision:r1215544 | orlovich | 2011-01-18 19:59:02 -0500 (Tue, 18 \
Jan 2011) | 18 lines
Various fixes for the new twitter website:
1) The alleged DOM 0 DOMNode::item doesn't exist in Gecko and WebCore at \
least, and it confuses the script loader (as we have NodeList-like .item, \
but not an index [[Get]]). Remove it, but add one to HTMLSelectElement as \
that's legit HTML5.
2) When document.domain is set to the present domain, we still want to call
setDomainFromDOM(), as it would set the 'script-set domain' bit moving the
origin into that namespace --- otherwise it will be inaccessible to other
things that opted in.
3) XMLHttpRequest should complete relative URLs in its own context, not the
dynamic one.
BUG: 261041
M +0 -6 ecma/kjs_dom.cpp
M +1 -1 ecma/kjs_dom.h
M +5 -0 ecma/kjs_html.cpp
M +1 -1 ecma/kjs_html.h
M +1 -4 ecma/xmlhttprequest.cpp
M +7 -2 xml/dom_docimpl.cpp
--- branches/KDE/4.6/kdelibs/khtml/ecma/kjs_dom.cpp #1215544:1215545
@@ -107,8 +107,6 @@
# IE extensions
contains DOMNode::Contains DontDelete|Function 1
insertAdjacentHTML DOMNode::InsertAdjacentHTML DontDelete|Function 2
-# "DOM level 0" (from Gecko DOM reference; also in WinIE)
- item DOMNode::Item DontDelete|Function 1
@end
*/
KJS_IMPLEMENT_PROTOFUNC(DOMNodeProtoFunc)
@@ -693,10 +691,6 @@
return jsUndefined();
}
- case DOMNode::Item: {
- SharedPtr<NodeListImpl> childNodes = node.childNodes();
- return getDOMNode(exec, childNodes->item(static_cast<unsigned \
long>(args[0]->toNumber(exec))));
- }
case DOMNode::CompareDocumentPosition: {
DOM::NodeImpl* other = toNode(args[0]);
if (!other)
--- branches/KDE/4.6/kdelibs/khtml/ecma/kjs_dom.h #1215544:1215545
@@ -56,7 +56,7 @@
virtual void pushEventHandlerScope(ExecState *exec, ScopeChain &scope) \
const;
enum { NodeName, NodeValue, NodeType, ParentNode, ParentElement,
- ChildNodes, FirstChild, LastChild, PreviousSibling, \
NextSibling, Item, + ChildNodes, FirstChild, LastChild, \
PreviousSibling, NextSibling,
Attributes, NamespaceURI, Prefix, LocalName, OwnerDocument, \
InsertBefore,
ReplaceChild, RemoveChild, AppendChild, HasAttributes, \
HasChildNodes,
CloneNode, Normalize, IsSupported, AddEventListener, \
RemoveEventListener,
--- branches/KDE/4.6/kdelibs/khtml/ecma/kjs_html.cpp #1215544:1215545
@@ -808,6 +808,7 @@
@end
@begin HTMLSelectElementProtoTable 4
add KJS::HTMLElement::SelectAdd DontDelete|Function 2
+ item KJS::HTMLElement::SelectItem DontDelete|Function 1
remove KJS::HTMLElement::SelectRemove DontDelete|Function 1
@end
@begin HTMLOptGroupElementTable 2
@@ -2206,6 +2207,10 @@
select.add(toHTMLElement(args[0]),toHTMLElement(args[1]),exception);
return jsUndefined();
}
+ else if (id == KJS::HTMLElement::SelectItem) {
+ SharedPtr<DOM::HTMLCollectionImpl> opts = select.options();
+ return getDOMNode(exec, opts->item(static_cast<unsigned \
long>(args[0]->toNumber(exec)))); + }
else if (id == KJS::HTMLElement::SelectRemove) {
// Apparently this takes both elements and indices (ebay.fr)
DOM::NodeImpl* node = toNode(args[0]);
--- branches/KDE/4.6/kdelibs/khtml/ecma/kjs_html.h #1215544:1215545
@@ -100,7 +100,7 @@
FormReset, FormTarget, FormName, FormMethod, FormSubmit, \
SelectAdd,
SelectTabIndex, SelectValue, SelectSelectedIndex, SelectLength,
SelectRemove, SelectForm, SelectType, SelectOptions,
- SelectDisabled, SelectMultiple, SelectName, SelectSize,
+ SelectDisabled, SelectMultiple, SelectName, SelectSize, \
SelectItem, OptGroupDisabled, OptGroupLabel, OptionIndex, \
OptionSelected, OptionForm, OptionText, OptionDefaultSelected, \
OptionDisabled, OptionLabel, OptionValue, InputReadOnly, InputAccept,
--- branches/KDE/4.6/kdelibs/khtml/ecma/xmlhttprequest.cpp #1215544:1215545
@@ -917,10 +917,7 @@
return throwError(exec, SyntaxError, "Not enough arguments");
QString method = args[0]->toString(exec).qstring();
- KHTMLPart *part = \
qobject_cast<KHTMLPart*>(Window::retrieveActive(exec)->part());
- if (!part)
- return jsUndefined();
- KUrl url = KUrl(part->document().completeURL(args[1]->toString(exec).qstring()).string());
+ KUrl url = KUrl(request->doc->completeURL(args[1]->toString(exec).qstring()));
bool async = true;
if (args.size() >= 3) {
--- branches/KDE/4.6/kdelibs/khtml/xml/dom_docimpl.cpp #1215544:1215545
@@ -2870,8 +2870,7 @@
// the new domain is a suffix of the old domain.
int oldLength = oldDomain.length();
int newLength = newDomain.length();
- if ( newLength < oldLength ) // e.g. newDomain=kde.org (7) and \
m_domain=www.kde.org (11)
- {
+ if ( newLength < oldLength ) { // e.g. newDomain=kde.org (7) and \
m_domain=www.kde.org (11) DOMString test = oldDomain.copy();
DOMString reference = newDomain.lower();
if ( test[oldLength - newLength - 1] == '.' ) // Check that it's a \
subdomain, not e.g. "de.org" @@ -2880,6 +2879,12 @@
if ( test == reference ) // and we check that \
it's the same thing as newDomain m_origin->setDomainFromDOM( \
reference.string() ); }
+ } else if ( oldLength == newLength ) {
+ // It's OK and not a no-op to set the domain to the present one:
+ // we want to set the 'set from DOM' bit in that case
+ DOMString reference = newDomain.lower();
+ if ( oldDomain.lower() == reference )
+ m_origin->setDomainFromDOM( reference.string() );
}
}
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic