Commit 640fa305 authored by darin@apple.com's avatar darin@apple.com

WebCore:

        Reviewed by Eric Seidel.

        Based on work by Marvin Decker <marv.decker@gmail.com>

        - fix http://bugs.webkit.org/show_bug.cgi?id=16538
          KURL should use String instead of DeprecatedString

        - fix http://bugs.webkit.org/show_bug.cgi?id=16485
          DocLoader::checkForReload will crash if the URL isNull
          and a similar problem in IconDatabase

        - fix http://bugs.webkit.org/show_bug.cgi?id=16487
          KURL doesn't preserve isNull when constructed with a DeprecatedString

        - changed completeURL and various DOM getters to return KURL, to avoid
          conversion back and forth from KURL to String

        - changed the conversion of KURL to NSURL or NSString to be automatic,
          to ease the use of KURL in Objective C DOM bindings, and eliminated
          the getNSURL function

        - because I had to visit the DOM bindings anyway, eliminated almost all
          the use of the KJS namespace for things in WebCore

        - fixed HTMLOptionElement constructor to check for undefined rather
          than size of the arguments array

        - eliminated some other unnecessary uses of DeprecatedString

        - changed String::split to take a Vector parameter instead of returning
          a Vector, for better performance

        - added a couple of missing calls to do layout in SVG image handling;
          I was able to reproduce these only because I had broken URLs for a
          while -- not sure how to reproduce them now but the changes are
          clearly needed

        Performance testing shows this to be at least a 1% speedup.

        Added a new function protocolIs to efficiently compare protocols
        without case errors and a blankURL function so we don't have to
        code "about:blank" in multiple places in the code and don't have to
        construct a frash KURL each time. Moved decode_string and encode_string
        out of KURL and gave them clearer names.

        Made KURL constructors explicit to highlight potentially-expensive
        operations and the poor semantics of KURL's constructor that takes
        a String.

        * WebCore.base.exp: Updated.

        * bindings/js/JSAttrCustom.cpp:
        (WebCore::JSAttr::setValue): Use protocolIs.
        * bindings/js/JSAudioConstructor.h: KJS namespace change.
        * bindings/js/JSCSSRuleCustom.cpp:
        (WebCore::toJS): Ditto.
        * bindings/js/JSCSSValueCustom.cpp:
        (WebCore::toJS): Ditto.
        * bindings/js/JSDocumentCustom.cpp:
        (WebCore::JSDocument::location): Ditto.
        (WebCore::JSDocument::setLocation): Updated for KURL change.
        (WebCore::toJS): KJS namespace change.
        * bindings/js/JSElementCustom.cpp:
        (WebCore::allowSettingSrcToJavascriptURL): Use protocolIs.
        (WebCore::JSElement::setAttribute): KJS namespace change.
        (WebCore::JSElement::setAttributeNode): Ditto.
        (WebCore::JSElement::setAttributeNS): Ditto.
        (WebCore::JSElement::setAttributeNodeNS): Ditto.
        * bindings/js/JSHTMLFrameElementCustom.cpp:
        (WebCore::allowSettingJavascriptURL): Use protocolIs.
        (WebCore::JSHTMLFrameElement::setSrc): KJS namespace change.
        (WebCore::JSHTMLFrameElement::setLocation): Ditto.
        * bindings/js/JSHTMLIFrameElementCustom.cpp:
        (WebCore::JSHTMLIFrameElement::setSrc): Use protocolIs.
        * bindings/js/JSHTMLOptionElementConstructor.cpp:
        (WebCore::JSHTMLOptionElementConstructor::JSHTMLOptionElementConstructor):
        (WebCore::JSHTMLOptionElementConstructor::construct): Cleaned up the
        structure a bit and changed checking to check for undefined rather than
        number of arguments.
        * bindings/js/JSHTMLOptionElementConstructor.h: KJS namespace change.
        * bindings/js/JSLocation.cpp:
        (WebCore::JSLocation::put): Eliminated some DeprecatedString use,
        and use protocolIs.
        (WebCore::jsLocationProtoFuncReplace): Ditto.
        (WebCore::jsLocationProtoFuncReload): Ditto.
        (WebCore::jsLocationProtoFuncAssign): Ditto.
        * bindings/js/JSLocation.h: KJS namespace change.
        * bindings/js/JSNamedNodeMapCustom.cpp:
        (WebCore::JSNamedNodeMap::canGetItemsForName): Ditto.
        (WebCore::JSNamedNodeMap::nameGetter): Ditto.
        * bindings/js/JSNamedNodesCollection.cpp:
        (WebCore::JSNamedNodesCollection::JSNamedNodesCollection): Ditto.
        * bindings/js/JSNamedNodesCollection.h: Ditto.
        * bindings/js/JSXMLHttpRequest.cpp:
        (WebCore::jsXMLHttpRequestPrototypeFunctionOpen): Removed
        DeprecatedString use.
        (WebCore::jsXMLHttpRequestPrototypeFunctionSend): Ditto.
        * bindings/js/JSXMLHttpRequest.h: Moved this class into the WebCore
        namespace.
        * bindings/js/JSXSLTProcessor.cpp: Namespace change.
        * bindings/js/JSXSLTProcessor.h: Ditto.

        * bindings/js/kjs_binding.cpp: Updated for namespace change.
        (WebCore::jsStringOrNull): Added an overload for KURL to allow DOM
        classes to return KURL even if the DOM expects a string.
        (WebCore::jsStringOrUndefined): Ditto.
        (WebCore::jsStringOrFalse): Ditto.
        * bindings/js/kjs_binding.h: Moved everything into the WebCore
        namespace.

        * bindings/js/kjs_css.h: Namespace change.
        * bindings/js/kjs_events.cpp: Removed an include.
        * bindings/js/kjs_events.h: Namespace change.
        * bindings/js/kjs_html.h: Namespace change.

        * bindings/js/kjs_navigator.cpp: Moved everything into the
        WebCore namespace.
        * bindings/js/kjs_navigator.h: Ditto.

        * bindings/js/kjs_window.cpp:
        (KJS::parseModalDialogFeatures): Updated for String::split change.
        (KJS::createWindow): Use protocolIs and removed some DeprecatedString.
        (KJS::Window::put): Ditto.
        (KJS::Window::allowsAccessFrom): Ditto.
        (KJS::windowProtoFuncOpen): Ditto.

        * bindings/objc/DOM.mm:
        (-[DOMElement _getURLAttribute:]): Removed getNSURL call.
        * bindings/objc/DOMHTML.mm:
        (-[DOMHTMLDocument _createDocumentFragmentWithMarkupString:baseURLString:]): Ditto.

        * bindings/scripts/CodeGeneratorCOM.pm: Updated includes so conversions from
        KURL will work.
        * bindings/scripts/CodeGeneratorJS.pm: Updated for namespace changes, and also
        updated includes so conversions from KURL will work.
        * bindings/scripts/CodeGeneratorObjC.pm: Updated includes so conversions from
        KURL will work.

        * bridge/mac/WebCoreAXObject.mm:
        (-[WebCoreAXObject accessibilityAttributeValue:]): Removed getNSURL call.
        Also streamlined the logic.
        (AXAttributedStringAppendText): Ditto.

        * bridge/mac/WebCoreScriptDebugger.mm:
        (toNSString): Tweaked.
        (toNSURL): Removed getNSURL call.

        * css/CSSImageValue.cpp:
        (WebCore::CSSImageValue::image): Removed DeprecatedString use.
        * css/CSSImportRule.cpp:
        (WebCore::CSSImportRule::insertedIntoParent): Ditto.
        * css/CSSParser.cpp:
        (WebCore::CSSParser::parseValue): Ditto.
        (WebCore::CSSParser::parseContent): Ditto.
        (WebCore::CSSParser::parseBackgroundImage): Ditto.
        (WebCore::CSSParser::parseFontFaceSrc): Ditto.
        (WebCore::CSSParser::parseBorderImage): Ditto.
        * css/CSSStyleSelector.cpp:
        (WebCore::CSSStyleSelector::setEncodedURL): Ditto.
        (WebCore::checkPseudoState): Ditto.
        * css/CSSStyleSelector.h: Ditto.

        * css/MediaList.cpp:
        (WebCore::MediaList::setMediaText): Updated for String::split change.

        * css/StyleBase.cpp:
        (WebCore::StyleBase::baseURL): Return KURL.
        * css/StyleBase.h: DItto.

        * dom/Document.cpp:
        (WebCore::Document::~Document): Updated for namespace change.
        (WebCore::Document::documentURI): Return KURL.
        (WebCore::Document::setDocumentURI): Removed DeprecatedString use.
        (WebCore::Document::baseURI): Return KURL.
        (WebCore::Document::open): Updated to use blankURL.
        (WebCore::Document::setURL): Take KURL.
        (WebCore::Document::shouldBeAllowedToLoadLocalResources): Updated for
        change to use KURL
        (WebCore::Document::setBaseURL): Take KURL.
        (WebCore::Document::elementSheet): Updated for KURL change.
        (WebCore::Document::mappedElementSheet): Ditto.
        (WebCore::Document::processHttpEquiv): Ditto.
        (WebCore::Document::recalcStyleSelector): Removed use of
        DeprecatedString -- also noticed some dead code here!
        (WebCore::Document::setCookie): Ditto.
        (WebCore::Document::completeURL): Return KURL.
        * dom/Document.h: Use KURL instead of String in a few places.

        * dom/DocumentType.cpp:
        (WebCore::DocumentType::baseURI): Return KURL.
        * dom/DocumentType.h: Ditto.

        * dom/Element.cpp:
        (WebCore::Element::baseURI): Return KURL.
        * dom/Element.h: Ditto.

        * dom/Node.cpp:
        (WebCore::Node::setDocument): Namespace change.
        (WebCore::Node::baseURI): Return KURL.
        * dom/Node.h: Ditto.

        * dom/ProcessingInstruction.cpp:
        (WebCore::ProcessingInstruction::checkStyleSheet): Updated for KURL change.
        * dom/StyleElement.cpp:
        (WebCore::StyleElement::process): Changed to use Vector<UChar> instead of
        String for better performance.
        (WebCore::StyleElement::createSheet): Removed use of DeprecateString.
        * dom/XMLTokenizer.cpp:
        (WebCore::XMLTokenizer::endElementNs): Updated for KURL change.
        (WebCore::XMLTokenizer::end): Ditto.
        (WebCore::xmlDocPtrForString): Removed use of DeprecateString.
        * dom/XMLTokenizer.h: Ditto.

        * editing/markup.cpp: Moved appendString to PlatformString.h.
        (WebCore::appendQuotedURLAttributeValue): Use protocolIs.
        (WebCore::completeURLs): Removed DeprecatedString use.
        (WebCore::createFragmentFromMarkup): Use blankURL.
        (WebCore::fillContainerFromString): Removed DeprecatedString use.
        (WebCore::createFragmentFromText): Ditto.

        * history/HistoryItem.cpp:
        (WebCore::HistoryItem::url): Removed DeprecatedString use.
        (WebCore::HistoryItem::originalURL): Ditto.
        * history/HistoryItem.h: Removed include.

        * html/HTMLAnchorElement.cpp:
        (WebCore::HTMLAnchorElement::defaultEventHandler): Removed use of
        DeprecatedString.
        (WebCore::HTMLAnchorElement::href): Return KURL.
        (WebCore::HTMLAnchorElement::hash): Removed DeprecatedString use.
        (WebCore::HTMLAnchorElement::host): Ditto.
        (WebCore::HTMLAnchorElement::hostname): Ditto.
        (WebCore::HTMLAnchorElement::pathname): Ditto.
        (WebCore::HTMLAnchorElement::port): Ditto.
        (WebCore::HTMLAnchorElement::protocol): Ditto.
        (WebCore::HTMLAnchorElement::search): Ditto.
        (WebCore::HTMLAnchorElement::toString): Ditto.
        * html/HTMLAnchorElement.h: Ditto.
        * html/HTMLAppletElement.cpp:
        (WebCore::HTMLAppletElement::createRenderer): Updated for KURL change.
        * html/HTMLAreaElement.cpp:
        (WebCore::HTMLAreaElement::href): Return KURL.
        * html/HTMLAreaElement.h: Ditto.
        * html/HTMLBaseElement.cpp:
        (WebCore::HTMLBaseElement::removedFromDocument): Updated for KURL change.
        (WebCore::HTMLBaseElement::process): Removed DeprecatedString use.
        * html/HTMLBodyElement.cpp:
        (WebCore::HTMLBodyElement::parseMappedAttribute): Updated for KURL change.
        * html/HTMLEmbedElement.cpp:
        (WebCore::HTMLEmbedElement::parseMappedAttribute): Removed use of
        DeprecatedString.
        * html/HTMLEmbedElement.h: Removed DeprecatedString use.
        * html/HTMLFormElement.cpp:
        (WebCore::HTMLFormElement::formWouldHaveSecureSubmission): Use protocolIs.
        (WebCore::encodeCString): Updated for change to String::split.
        (WebCore::HTMLFormElement::dataEncoding): Ditto.
        (WebCore::HTMLFormElement::formData): Removed DeprecatedString use.
        (WebCore::HTMLFormElement::isMailtoForm): Use protocolIs.
        (WebCore::HTMLFormElement::submit): Updated for KURL change.
        (WebCore::HTMLFormElement::reset): Ditto.
        * html/HTMLFrameElementBase.cpp:
        (WebCore::HTMLFrameElementBase::isURLAllowed): Updated for KURL change
        and use equalIgnoringRef instead of doing a setRef to get the same effect.
        (WebCore::HTMLFrameElementBase::openURL): Use blankURL.
        (WebCore::HTMLFrameElementBase::location): Return KURL.
        (WebCore::HTMLFrameElementBase::src): Return KURL.
        * html/HTMLFrameElementBase.h: Ditto.
        * html/HTMLImageElement.cpp:
        (WebCore::HTMLImageElement::parseMappedAttribute): Updated for KURL change.
        (WebCore::HTMLImageElement::longDesc): Return KURL.
        (WebCore::HTMLImageElement::lowsrc): Return KURL.
        (WebCore::HTMLImageElement::src): Return KURL.
        * html/HTMLImageElement.h: Ditto. Also removed imageMap() function.
        * html/HTMLInputElement.cpp:
        (WebCore::HTMLInputElement::src): Return KURL.
        * html/HTMLInputElement.h: Ditto.
        * html/HTMLLinkElement.cpp:
        (WebCore::HTMLLinkElement::parseMappedAttribute): Updated for KURL change.
        (WebCore::HTMLLinkElement::tokenizeRelAttribute): Updated for String::split change.
        (WebCore::HTMLLinkElement::href): Return KURL.
        * html/HTMLLinkElement.h: Ditto.
        * html/HTMLMediaElement.cpp:
        (WebCore::HTMLMediaElement::src): Return KURL.
        (WebCore::HTMLMediaElement::pickMedia): Updated for KURL change.
        * html/HTMLMediaElement.h: Ditto.
        * html/HTMLObjectElement.cpp:
        (WebCore::HTMLObjectElement::isImageType): Use protocolIs.
        (WebCore::HTMLObjectElement::data): Return KURL.
        * html/HTMLObjectElement.h: Ditto.
        * html/HTMLOptGroupElement.cpp:
        (WebCore::HTMLOptGroupElement::groupLabelText): Removed DeprecatedString use.
        * html/HTMLParser.cpp:
        (WebCore::HTMLParser::reportErrorToConsole): Updated for KURL change.
        * html/HTMLScriptElement.cpp:
        (WebCore::HTMLScriptElement::insertedIntoDocument): Ditto.
        (WebCore::HTMLScriptElement::text): Changed to use Vector<UChar> instead of
        String for better performance.
        (WebCore::HTMLScriptElement::src): Return KURL.
        * html/HTMLScriptElement.h: Ditto.
        * html/HTMLSourceElement.cpp:
        (WebCore::HTMLSourceElement::src): Return KURL.
        * html/HTMLSourceElement.h: Ditto.
        * html/HTMLTableElement.cpp:
        (WebCore::HTMLTableElement::parseMappedAttribute): Updated for KURL change.
        * html/HTMLTablePartElement.cpp:
        (WebCore::HTMLTablePartElement::parseMappedAttribute): Updated for KURL change.
        * html/HTMLTextAreaElement.cpp:
        (WebCore::HTMLTextAreaElement::setValue): Removed DeprecatedString use.
        * html/HTMLTokenizer.cpp:
        (WebCore::HTMLTokenizer::scriptExecution): Ditto.
        (WebCore::HTMLTokenizer::notifyFinished): Use protocolIs.
        * html/HTMLVideoElement.cpp:
        (WebCore::HTMLVideoElement::poster): Return KURL.
        * html/HTMLVideoElement.h: Ditto.
        * html/HTMLViewSourceDocument.cpp:
        (WebCore::HTMLViewSourceDocument::addText): Updated for String::split change.

        * loader/DocLoader.cpp:
        (WebCore::DocLoader::checkForReload): Add an explicit check for an empty URL
        here to avoid problems using its string as a hash table key later.
        (WebCore::DocLoader::requestResource): Removed DeprecatedString use.

        * loader/FTPDirectoryDocument.cpp:
        (WebCore::FTPDirectoryTokenizer::createTDForFilename): Updated for KURL change.
        (WebCore::FTPDirectoryTokenizer::parseAndAppendOneLine): Removed use of
        DeprecatedString.

        * loader/FrameLoader.cpp:
        (WebCore::FrameLoader::requestFrame): Use protocolIs.
        (WebCore::FrameLoader::loadSubframe): Use blankURL.
        (WebCore::FrameLoader::submitForm): Use protocolIs and removed use of
        DeprecatedString.
        (WebCore::FrameLoader::iconURL): Return KURL. Use protcolIs.
        (WebCore::FrameLoader::didOpenURL): Use protocolIs.
        (WebCore::FrameLoader::didExplicitOpen): Use blankURL.
        (WebCore::FrameLoader::executeIfJavaScriptURL): Use protocolIs.
        Update for name change to decodeURLEscapeSequences.
        (WebCore::FrameLoader::receivedFirstData): Updated for KURL changes.
        (WebCore::FrameLoader::begin): Removed DeprecatedString use.
        Renamed baseurl to baseURL. Updated to use KURL more.
        (WebCore::FrameLoader::gotoAnchor): Removed use of encodedHtmlRef
        function, which is no different from ref.
        (WebCore::FrameLoader::completeURL): Updated for KURL change.
        (WebCore::FrameLoader::scheduleLocationChange): Ditto.
        (WebCore::FrameLoader::canCachePage): Use protocolIs.
        (WebCore::FrameLoader::updatePolicyBaseURL): Update for KURL change.
        (WebCore::FrameLoader::setPolicyBaseURL): Take KURL.
        (WebCore::FrameLoader::startRedirectionTimer): Removed use of
        DeprecatedString.
        (WebCore::FrameLoader::load): Use protocolIs.
        (WebCore::FrameLoader::shouldHideReferrer): Use protocolIs.
        (WebCore::FrameLoader::shouldAllowNavigation): Updated for KURL change.
        (WebCore::FrameLoader::commitProvisionalLoad): Use blankURL.
        (WebCore::FrameLoader::open): Use protcolIs.
        (WebCore::FrameLoader::createHistoryItem): Use blankURL.
        (WebCore::FrameLoader::createJavaAppletWidget): Updated for KURL change.
        (WebCore::FrameLoader::switchOutLowBandwidthDisplayIfReady): Removed
        DeprecatedString use.
        * loader/FrameLoader.h: Ditto.

        * loader/ImageDocument.cpp:
        (WebCore::ImageDocument::createDocumentStructure): Updated for KURL change.
        * loader/PluginDocument.cpp:
        (WebCore::PluginTokenizer::createDocumentStructure): Ditto.

        * loader/icon/IconDatabase.cpp:
        (WebCore::IconDatabase::iconForPageURL): Added a check for an empty URL
        before trying to use it as a hash table key.

        * loader/icon/IconLoader.h: Tweaked includes.

        * loader/loader.cpp:
        (WebCore::Loader::servePendingRequests): Use protcolIs. Also removed some
        code to set up a local variable that is never used (and a DeprecatedString
        on to boot!).

        * loader/mac/LoaderNSURLExtras.m:
        (suggestedFilenameWithMIMEType): Removed unnecessary typecast.

        * page/ContextMenuController.cpp: Removed include.

        * page/mac/EventHandlerMac.mm:
        (WebCore::EventHandler::needsKeyboardEventDisambiguationQuirks):
        Use protocolIs.

        * page/mac/WebCoreFrameBridge.mm:
        (-[WebCoreFrameBridge URLWithAttributeString:]): Removed getNSURL call.
        (-[WebCoreFrameBridge baseURL]): Ditto.

        * platform/KURL.cpp:
        (WebCore::isSchemeFirstChar): Fixed bug in handling of values >= 0x80.
        (WebCore::isSchemeChar): Ditto.
        (WebCore::isPathSegmentEndChar): Ditto.
        (WebCore::hexDigitValue): Changed parameter type to UChar.
        (WebCore::copyASCII): Added.
        (WebCore::findFirstOf): Added.
        (WebCore::KURL::protocolIs): Added.
        (WebCore::KURL::KURL): Tightened logic up quite a bit. Changed parameter
        types from DeprecatedString to String.
        (WebCore::KURL::init): Changed parameter type to String. Preserved the
        passed-in string even if the base is invalid. Cleaned up logic to determine
        if the originalString should be pased in to the parse function. Simplified
        by calling the new parse overload that takes String in many cases.
        (WebCore::KURL::lastPathComponent): Return String.
        (WebCore::KURL::protocol): Ditto.
        (WebCore::KURL::host): Ditto.
        (WebCore::KURL::port): Changed logic to use early return for clarity.
        (WebCore::KURL::pass): Return String.
        (WebCore::KURL::user): Ditto.
        (WebCore::KURL::ref): Ditto.
        (WebCore::assertProtocolIsGood): Added.
        (WebCore::KURL::protocolIs): Added.
        (WebCore::KURL::query): Return String.
        (WebCore::KURL::path): Ditto.
        (WebCore::KURL::setProtocol): Take String.
        (WebCore::KURL::setHost): Ditto.
        (WebCore::KURL::setPort): Use String.
        (WebCore::KURL::setHostAndPort): Take String.
        (WebCore::KURL::setUser): Ditto.
        (WebCore::KURL::setPass): Ditto.
        (WebCore::KURL::setRef): Ditto.
        (WebCore::KURL::setQuery): Ditto.
        (WebCore::KURL::setPath): Ditto.
        (WebCore::KURL::prettyURL): Return String. Use Vector<UChar> to build it.
        (WebCore::decodeURLEscapeSequences): Renamed from KURL::decode_string.
        Return String. Use Vector<UChar> to build it.
        (WebCore::KURL::isLocalFile): Use protocolIs.
        (WebCore::KURL::parse): Added an overload that takes a String to replace
        the use of DeprecatedString::ascii at various call sites. Updated for
        name change (urlString -> m_string).
        (WebCore::equalIgnoringRef): Wrote a new implementation that doesn't
        do any allocation.
        (WebCore::encodeWithURLEscapeSequences): Renamed from KURL::encode_string.
        Return String.
        (WebCore::appendEncodedHostname): Added. Replaces encodeHostname and
        avoids the need to allocate a string.
        (WebCore::findHostnamesInMailToURL): Update to use findFirstOf instead of
        regular expressions.
        (WebCore::findHostnameInHierarchicalURL): Ditto.
        (WebCore::encodeHostnames): Use protocolIs and the other helpers above.
        (WebCore::encodeRelativeString): Changed to put result into a CharBuffer.
        (WebCore::substituteBackslashes): Updated to use String.
        (WebCore::KURL::copyToBuffer): Added.
        (WebCore::protocolIs): Added.
        (WebCore::blankURL): Added.
        (WebCore::KURL::print): Updated.
        * platform/KURL.h: Added a number of comments. Reorganized the header a bit.
        Made the string constructors explicit. Changed to use String instead of
        DeprecatedString. Removed encodedHTMLRef. Renamed and added a few functions.

        * platform/cf/KURLCFNet.cpp:
        (WebCore::KURL::KURL): Streamlined the logic a bit.
        (WebCore::KURL::createCFURL): Changed to use copyToBuffer.

        * platform/graphics/mac/MediaPlayerPrivateQTKit.mm:
        (WebCore::MediaPlayerPrivate::createQTMovie): Removed getNSURL call.
        Use protocolIs.
        * platform/mac/ClipboardMac.mm:
        (WebCore::ClipboardMac::declareAndWriteDragImage): Removed getNSURL call.
        * platform/mac/CookieJar.mm:
        (WebCore::cookies): Removed getNSURL call.
        (WebCore::setCookies): Removed getNSURL call.
        * platform/mac/KURLMac.mm:
        (WebCore::KURL::KURL): Streamlined the logic a bit.
        * platform/mac/PasteboardMac.mm:
        (WebCore::Pasteboard::writeURL): Removed getNSURL call.
        (WebCore::Pasteboard::writeImage): Ditto.
        * platform/mac/SSLKeyGeneratorMac.mm:
        (WebCore::signedPublicKeyAndChallengeString): Ditto.

        * platform/network/HTTPParsers.cpp:
        (WebCore::filenameFromHTTPContentDisposition): Updated for String::split.
        * platform/network/ResourceHandle.cpp:
        (WebCore::ResourceHandle::portAllowed): Use protocolIs.

        * platform/network/cf/ResourceErrorCF.cpp:
        (WebCore::ResourceError::operator CFErrorRef): Removed deprecatedString call.
        * platform/network/curl/ResourceHandleManager.cpp:
        (WebCore::headerCallback): Ditto.
        (WebCore::parseDataUrl): Use String instead of DeprecatedString.
        (WebCore::ResourceHandleManager::startJob): Updated for KURL changes.
        * platform/network/mac/ResourceErrorMac.mm:
        (WebCore::ResourceError::operator NSError*): Removed getNSURL call.
        * platform/network/mac/ResourceRequest.h:
        (WebCore::ResourceRequest::ResourceRequest): Removed DeprecatedString use.
        * platform/network/mac/ResourceRequestMac.mm:
        (WebCore::ResourceRequest::doUpdatePlatformRequest): Removed getNSURL call.
        * platform/network/mac/ResourceResponseMac.mm:
        (WebCore::ResourceResponse::nsURLResponse): Removed getNSURL call.

        * platform/qt/ClipboardQt.cpp:
        (WebCore::ClipboardQt::writeURL): Removed deprecatedString call.

        * platform/text/CString.h:
        (WebCore::CStringBuffer::length): Fixed size_t/unsigned mismatch to make it
        possible to compile this on Windows with higher warning level

        * platform/text/PlatformString.h: Updated split to modify a result parameter
        rather than returning a Vector. Added charactersAreAllASCII and an append
        function that appends a String to a Vector<UChar>.
        * platform/text/String.cpp:
        (WebCore::String::split): Updated.

        * platform/win/BString.cpp:
        (WebCore::BString::BString): Added conversion from KURL.
        * platform/win/BString.h: Ditto.

        * platform/win/ClipboardUtilitiesWin.cpp:
        (WebCore::markupToCF_HTML): Removed use of deprecatedString.
        * platform/win/ClipboardWin.cpp:
        (WebCore::filesystemPathFromUrlOrTitle): Ditto.
        (WebCore::createGlobalHDropContent): Ditto.
        (WebCore::ClipboardWin::setData): Ditto.
        (WebCore::ClipboardWin::writeRange): Ditto.
        * platform/win/PasteboardWin.cpp:
        (WebCore::Pasteboard::writeSelection): Ditto.
        * plugins/PluginStream.cpp:
        (WebCore::PluginStream::startStream): Ditto.
        (WebCore::PluginStream::destroyStream): Ditto.
        * plugins/win/PluginViewWin.cpp:
        (WebCore::scriptStringIfJavaScriptURL): Ditto.
        (WebCore::PluginView::performRequest): Ditto.
        (WebCore::PluginView::PluginView): Ditto.

        * rendering/HitTestResult.cpp:
        (WebCore::HitTestResult::absoluteImageURL): Removed DeprecatedString use.
        (WebCore::HitTestResult::absoluteLinkURL): Ditto.

        * rendering/RenderFrameSet.cpp:
        (WebCore::RenderFrameSet::layOutAxis): Fixed comment wording.
        * rendering/RenderImage.cpp:
        (WebCore::RenderImage::paintReplaced): Removed use of DeperecatedString,
        (WebCore::RenderImage::imageMap): Changed to call useMap instead of imageMap;
        both do the same thing, and the first is standard DOM.

        * rendering/RenderObject.cpp:
        (WebCore::RenderObject::addPDFURLRect): Rewrote and streamlined to remove
        DeprecatedString use.
        * rendering/RenderObject.h: Changed addPDFURLRect to take const IntRect&.

        * rendering/RenderPartObject.cpp:
        (WebCore::isURLAllowed): Updated for KURL change and use equalIgnoringRef
        instead of doing a setRef to get the same effect.
        (WebCore::RenderPartObject::updateWidget): Updated for KURL change.

        * rendering/RenderText.cpp:
        (WebCore::charactersAreAllASCII): Moved the guts to PlatformString.h.

        * rendering/SVGRenderSupport.cpp:
        (WebCore::renderSubtreeToImage): Added missing call to do layout. I ran
        into this while doing some layout tests while URL processing was broken.

        * rendering/SVGRenderTreeAsText.h: Removed include.

        * svg/SVGImageLoader.cpp:
        (WebCore::SVGImageLoader::updateFromElement): Removed DeprecatedString use.

        * svg/graphics/SVGImage.cpp:
        (WebCore::SVGImage::draw): Added missing call to do layout. I ran
        into this while doing some layout tests while URL processing was broken.
        (WebCore::SVGImage::dataChanged): Use a null URL rather than an arbitrary
        string for the document.

        * xml/XMLHttpRequest.cpp:
        (WebCore::XMLHttpRequest::getResponseXML): Removed DeprecatedString use.
        (WebCore::XMLHttpRequest::urlMatchesDocumentDomain): Ditto.
        (WebCore::XMLHttpRequest::open): Ditto.
        (WebCore::XMLHttpRequest::send):  Namespace change.
        (WebCore::XMLHttpRequest::dropProtection): Ditto.
        * xml/XMLHttpRequest.h: Removed DeprecatedString use.

        * xml/XSLImportRule.cpp:
        (WebCore::XSLImportRule::loadSheet): Removed DeprecatedString use.
        * xml/XSLStyleSheet.cpp:
        (WebCore::XSLStyleSheet::loadChildSheets): Ditto.
        (WebCore::XSLStyleSheet::loadChildSheet): Ditto.
        * xml/XSLStyleSheet.h: Ditto.
        * xml/XSLTProcessor.cpp:
        (WebCore::docLoaderFunc): Ditto.
        (WebCore::xsltStylesheetPointer): Ditto.
        (WebCore::xmlDocPtrFromNode): Ditto.

WebKit/gtk:

        * webkit/webkitwebframe.cpp: Removed DeprecatedString use to try to keep it building.
        * webkit/webkitwebview.cpp: Ditto.

WebKit/mac:

        Reviewed by Eric Seidel.

        - updated for WebCore KURL changes

        * History/WebHistoryItem.mm:
        (-[WebHistoryItem URL]): Removed getNSURL call.
        * Misc/WebElementDictionary.mm:
        (-[WebElementDictionary _absoluteImageURL]): Ditto.
        (-[WebElementDictionary _absoluteLinkURL]): Ditto.
        * Misc/WebNSAttributedStringExtras.mm:
        (fileWrapperForElement): Ditto.
        (+[NSAttributedString _web_attributedStringFromRange:]): Ditto.
        * Misc/WebNSURLExtras.mm:
        (-[NSString _webkit_stringByReplacingValidPercentEscapes]): Updated
        for function name change.
        * WebCoreSupport/WebContextMenuClient.mm:
        (WebContextMenuClient::downloadURL): Removed getNSURL call.
        * WebCoreSupport/WebDragClient.mm:
        (WebDragClient::createDragImageForLink): Ditto.
        * WebCoreSupport/WebFrameLoaderClient.mm:
        (WebFrameLoaderClient::dispatchWillPerformClientRedirect): Ditto.
        (WebFrameLoaderClient::startDownload): Ditto.
        (WebFrameLoaderClient::updateGlobalHistoryForStandardLoad): Ditto.
        (WebFrameLoaderClient::updateGlobalHistoryForReload): Ditto.
        (WebFrameLoaderClient::cancelledError): Ditto.
        (WebFrameLoaderClient::blockedError): Ditto.
        (WebFrameLoaderClient::cannotShowURLError): Ditto.
        (WebFrameLoaderClient::interruptForPolicyChangeError): Ditto.
        (WebFrameLoaderClient::cannotShowMIMETypeError): Ditto.
        (WebFrameLoaderClient::fileDoesNotExistError): Ditto.
        (WebFrameLoaderClient::willUseArchive): Ditto.
        (WebFrameLoaderClient::setTitle): Ditto.
        (WebFrameLoaderClient::actionDictionary): Ditto.
        (WebFrameLoaderClient::createFrame): Ditto.
        (WebFrameLoaderClient::objectContentType): Ditto.
        (WebFrameLoaderClient::createPlugin): Ditto.
        (WebFrameLoaderClient::createJavaAppletWidget): Ditto.
        * WebView/WebDataSource.mm:
        (-[WebDataSource _URL]): Ditto.
        (-[WebDataSource _initWithDocumentLoader:]): Ditto.
        (-[WebDataSource unreachableURL]): Ditto.
        * WebView/WebHTMLView.mm:
        (-[WebHTMLView namesOfPromisedFilesDroppedAtDestination:]): Ditto.

WebKit/win:

        - updated for WebCore KURL changes

        * MarshallingHelpers.cpp:
        (MarshallingHelpers::BSTRToKURL): Removed deprecatedString call.
        (MarshallingHelpers::KURLToBSTR): Tweaked for efficiency.
        * WebContextMenuClient.cpp:
        (WebContextMenuClient::searchWithGoogle): Updated for KURL changes.
        * WebDataSource.cpp:
        (WebDataSource::unreachableURL): Ditto.
        * WebDownload.cpp:
        (WebDownload::init): Ditto.
        (WebDownload::initWithRequest): Ditto.
        * WebFrame.cpp:
        (WebFrame::loadData): Ditto.
        (WebFrame::loadURLIntoChild): Ditto.
        (WebFrame::objectContentType): Ditto.
        * WebResource.cpp:
        (WebResource::initWithData): Ditto.
        * WebURLResponse.cpp:
        (WebURLResponse::createInstance): Ditto.
        (WebURLResponse::initWithURL): Ditto.
        * WebView.cpp:
        (WebView::userAgentForURL): Ditto.
        (WebView::copyURL): Ditto.
        (WebView::notifyPreferencesChanged): Ditto.

WebKit/wx:

        * WebView.cpp: Removed use of DeprecatedString to keep this compiling.



git-svn-id: http://svn.webkit.org/repository/webkit/trunk@30243 268f45cc-cd09-0410-ab3c-d52691b4dbfc
parent b58ae543
This diff is collapsed.
......@@ -359,6 +359,7 @@ __ZN7WebCore21WindowsLatin1EncodingEv
__ZN7WebCore21findEventWithKeyStateEPNS_5EventE
__ZN7WebCore21isBackForwardLoadTypeENS_13FrameLoadTypeE
__ZN7WebCore21reportThreadViolationEPKc
__ZN7WebCore24decodeURLEscapeSequencesERKNS_6StringE
__ZN7WebCore24notifyHistoryItemChangedE
__ZN7WebCore26CSSMutableStyleDeclarationC1Ev
__ZN7WebCore26NetscapePlugInStreamLoader6createEPNS_5FrameEPNS_32NetscapePlugInStreamLoaderClientE
......@@ -371,9 +372,8 @@ __ZN7WebCore4FontC1ERKNS_16FontPlatformDataEb
__ZN7WebCore4FontC1Ev
__ZN7WebCore4FontD1Ev
__ZN7WebCore4FontaSERKS0_
__ZN7WebCore4KURL13decode_stringERKNS_16DeprecatedStringE
__ZN7WebCore4KURLC1EP5NSURL
__ZN7WebCore4KURLC1ERKNS_16DeprecatedStringE
__ZN7WebCore4KURLC1ERKNS_6StringE
__ZN7WebCore4KURLC1Ev
__ZN7WebCore4Node17stopIgnoringLeaksEv
__ZN7WebCore4Node18startIgnoringLeaksEv
......@@ -458,7 +458,7 @@ __ZN7WebCore6WidgetC1EP6NSView
__ZN7WebCore6WidgetC1Ev
__ZN7WebCore7IntSizeC1ERK7_NSSize
__ZN7WebCore7nsColorERKNS_5ColorE
__ZN7WebCore8Document11completeURLERKNS_16DeprecatedStringE
__ZN7WebCore8Document11completeURLERKNS_6StringE
__ZN7WebCore8Document13removeMarkersENS_14DocumentMarker10MarkerTypeE
__ZN7WebCore8Document14setFocusedNodeEN3WTF10PassRefPtrINS_4NodeEEE
__ZN7WebCore8Document4bodyEv
......@@ -538,7 +538,6 @@ __ZN7WebCore9TimerBaseC2Ev
__ZN7WebCore9TimerBaseD2Ev
__ZN7WebCore9pageCacheEv
__ZN7WebCoreeqERKNS_19ResourceRequestBaseES2_
__ZN7WebCoreeqERKNS_4KURLES2_
__ZNK7WebCore11CachedImage5imageEv
__ZNK7WebCore11ContextMenu19platformDescriptionEv
__ZNK7WebCore11FrameLoader10isCompleteEv
......@@ -636,7 +635,7 @@ __ZNK7WebCore4Font16cachePrimaryFontEv
__ZNK7WebCore4KURL17lastPathComponentEv
__ZNK7WebCore4KURL4hostEv
__ZNK7WebCore4KURL4pathEv
__ZNK7WebCore4KURL8getNSURLEv
__ZNK7WebCore4KURLcvP5NSURLEv
__ZNK7WebCore4Page34inLowQualityImageInterpolationModeEv
__ZNK7WebCore5Frame10isFrameSetEv
__ZNK7WebCore5Frame12eventHandlerEv
......
/*
* Copyright (C) 2007 Apple Inc. All rights reserved.
* Copyright (C) 2007, 2008 Apple Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
......@@ -29,34 +29,31 @@
#include "config.h"
#include "JSAttr.h"
#include "Attr.h"
#include "Document.h"
#include "ExceptionCode.h"
#include "HTMLFrameElementBase.h"
#include "HTMLNames.h"
#include "PlatformString.h"
#include "kjs_binding.h"
#include "kjs_dom.h"
using namespace KJS;
namespace WebCore {
using namespace HTMLNames;
void JSAttr::setValue(KJS::ExecState* exec, KJS::JSValue* value)
void JSAttr::setValue(ExecState* exec, JSValue* value)
{
Attr* imp = static_cast<Attr*>(impl());
String attrValue = valueToStringWithNullCheck(exec, value);
Element* ownerElement = imp->ownerElement();
if (ownerElement && (ownerElement->hasTagName(iframeTag) || ownerElement->hasTagName(frameTag)) && equalIgnoringCase(imp->name(), "src") && attrValue.startsWith("javascript:", false)) {
HTMLFrameElementBase* frame = static_cast<HTMLFrameElementBase*>(ownerElement);
if (!checkNodeSecurity(exec, frame->contentDocument()))
return;
if (ownerElement && (ownerElement->hasTagName(iframeTag) || ownerElement->hasTagName(frameTag))) {
if (equalIgnoringCase(imp->name(), "src") && protocolIs(attrValue, "javascript")) {
if (!checkNodeSecurity(exec, static_cast<HTMLFrameElementBase*>(ownerElement)->contentDocument()))
return;
}
}
ExceptionCode ec = 0;
imp->setValue(attrValue, ec);
KJS::setDOMException(exec, ec);
setDOMException(exec, ec);
}
} // namespace WebCore
/*
* Copyright (C) 2007 Apple Inc. All rights reserved.
* Copyright (C) 2007, 2008 Apple Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
......@@ -33,7 +33,7 @@
namespace WebCore {
class JSAudioConstructor : public KJS::DOMObject {
class JSAudioConstructor : public DOMObject {
public:
JSAudioConstructor(KJS::ExecState*, Document*);
virtual bool implementsConstruct() const;
......
/*
* Copyright (C) 2007 Apple Inc. All rights reserved.
* Copyright (C) 2007, 2008 Apple Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
......@@ -31,7 +31,6 @@
#include "CSSImportRule.h"
#include "CSSMediaRule.h"
#include "CSSPageRule.h"
#include "CSSRule.h"
#include "CSSStyleRule.h"
#include "JSCSSCharsetRule.h"
#include "JSCSSFontFaceRule.h"
......@@ -39,16 +38,17 @@
#include "JSCSSMediaRule.h"
#include "JSCSSPageRule.h"
#include "JSCSSStyleRule.h"
#include "kjs_binding.h"
using namespace KJS;
namespace WebCore {
KJS::JSValue* toJS(KJS::ExecState* exec, CSSRule* rule)
JSValue* toJS(ExecState* exec, CSSRule* rule)
{
if (!rule)
return KJS::jsNull();
return jsNull();
KJS::DOMObject* ret = KJS::ScriptInterpreter::getDOMObject(rule);
DOMObject* ret = ScriptInterpreter::getDOMObject(rule);
if (ret)
return ret;
......@@ -77,7 +77,7 @@ KJS::JSValue* toJS(KJS::ExecState* exec, CSSRule* rule)
break;
}
KJS::ScriptInterpreter::putDOMObject(rule, ret);
ScriptInterpreter::putDOMObject(rule, ret);
return ret;
}
......
/*
* Copyright (C) 2007 Apple Inc. All rights reserved.
* Copyright (C) 2007, 2008 Apple Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
......@@ -27,11 +27,9 @@
#include "JSCSSValue.h"
#include "CSSPrimitiveValue.h"
#include "CSSValue.h"
#include "CSSValueList.h"
#include "JSCSSPrimitiveValue.h"
#include "JSCSSValueList.h"
#include "kjs_binding.h"
#if ENABLE(SVG)
#include "JSSVGColor.h"
......@@ -40,14 +38,16 @@
#include "SVGPaint.h"
#endif
using namespace KJS;
namespace WebCore {
KJS::JSValue* toJS(KJS::ExecState* exec, CSSValue* value)
JSValue* toJS(ExecState* exec, CSSValue* value)
{
if (!value)
return KJS::jsNull();
return jsNull();
KJS::DOMObject* ret = KJS::ScriptInterpreter::getDOMObject(value);
DOMObject* ret = ScriptInterpreter::getDOMObject(value);
if (ret)
return ret;
......@@ -65,7 +65,7 @@ KJS::JSValue* toJS(KJS::ExecState* exec, CSSValue* value)
else
ret = new JSCSSValue(JSCSSValuePrototype::self(exec), value);
KJS::ScriptInterpreter::putDOMObject(value, ret);
ScriptInterpreter::putDOMObject(value, ret);
return ret;
}
......
......@@ -21,14 +21,12 @@
#include "JSDocument.h"
#include "DOMWindow.h"
#include "Document.h"
#include "Frame.h"
#include "FrameLoader.h"
#include "HTMLDocument.h"
#include "JSDOMWindow.h"
#include "JSHTMLDocument.h"
#include "JSLocation.h"
#include "kjs_binding.h"
#include "kjs_proxy.h"
#if ENABLE(SVG)
......@@ -36,10 +34,10 @@
#include "SVGDocument.h"
#endif
namespace WebCore {
using namespace KJS;
namespace WebCore {
void JSDocument::mark()
{
JSEventTargetNode::mark();
......@@ -52,7 +50,7 @@ JSValue* JSDocument::location(ExecState* exec) const
if (!frame)
return jsNull();
KJS::Window* win = KJS::Window::retrieveWindow(frame);
Window* win = Window::retrieveWindow(frame);
ASSERT(win);
return win->location();
}
......@@ -69,7 +67,7 @@ void JSDocument::setLocation(ExecState* exec, JSValue* value)
// not the target frame.
Frame* activeFrame = static_cast<JSDOMWindow*>(exec->dynamicGlobalObject())->impl()->frame();
if (activeFrame)
str = activeFrame->document()->completeURL(str);
str = activeFrame->document()->completeURL(str).string();
bool userGesture = activeFrame->scriptProxy()->processingUserGesture();
frame->loader()->scheduleLocationChange(str, activeFrame->loader()->outgoingReferrer(), false, userGesture);
......@@ -96,7 +94,7 @@ JSValue* toJS(ExecState* exec, Document* doc)
// Make sure the document is kept around by the window object, and works right with the
// back/forward cache.
if (doc->frame())
KJS::Window::retrieveWindow(doc->frame())->putDirect("document", ret, DontDelete|ReadOnly);
Window::retrieveWindow(doc->frame())->putDirect("document", ret, DontDelete|ReadOnly);
else {
size_t nodeCount = 0;
for (Node* n = doc; n; n = n->traverseNextNode())
......
/*
* Copyright (C) 2007 Apple Inc. All rights reserved.
* Copyright (C) 2007, 2008 Apple Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
......@@ -30,23 +30,19 @@
#include "config.h"
#include "JSElement.h"
#include "Attr.h"
#include "Document.h"
#include "Element.h"
#include "ExceptionCode.h"
#include "HTMLFrameElementBase.h"
#include "HTMLNames.h"
#include "PlatformString.h"
#include "kjs_binding.h"
#include "kjs_dom.h"
using namespace KJS;
namespace WebCore {
using namespace HTMLNames;
static inline bool allowSettingSrcToJavascriptURL(KJS::ExecState* exec, Element* element, String name, String value)
static inline bool allowSettingSrcToJavascriptURL(ExecState* exec, Element* element, const String& name, const String& value)
{
if ((element->hasTagName(iframeTag) || element->hasTagName(frameTag)) && equalIgnoringCase(name, "src") && value.startsWith("javascript:", false)) {
if ((element->hasTagName(iframeTag) || element->hasTagName(frameTag)) && equalIgnoringCase(name, "src") && protocolIs(value, "javascript")) {
HTMLFrameElementBase* frame = static_cast<HTMLFrameElementBase*>(element);
if (!checkNodeSecurity(exec, frame->contentDocument()))
return false;
......@@ -54,7 +50,7 @@ static inline bool allowSettingSrcToJavascriptURL(KJS::ExecState* exec, Element*
return true;
}
KJS::JSValue* JSElement::setAttribute(KJS::ExecState* exec, const KJS::List& args)
JSValue* JSElement::setAttribute(ExecState* exec, const List& args)
{
ExceptionCode ec = 0;
String name = args[0]->toString(exec);
......@@ -62,33 +58,33 @@ KJS::JSValue* JSElement::setAttribute(KJS::ExecState* exec, const KJS::List& arg
Element* imp = impl();
if (!allowSettingSrcToJavascriptURL(exec, imp, name, value))
return KJS::jsUndefined();
return jsUndefined();
imp->setAttribute(name, value, ec);
KJS::setDOMException(exec, ec);
return KJS::jsUndefined();
setDOMException(exec, ec);
return jsUndefined();
}
KJS::JSValue* JSElement::setAttributeNode(KJS::ExecState* exec, const KJS::List& args)
JSValue* JSElement::setAttributeNode(ExecState* exec, const List& args)
{
ExceptionCode ec = 0;
bool newAttrOk;
Attr* newAttr = toAttr(args[0], newAttrOk);
if (!newAttrOk) {
setDOMException(exec, TYPE_MISMATCH_ERR);
return KJS::jsUndefined();
return jsUndefined();
}
Element* imp = impl();
if (!allowSettingSrcToJavascriptURL(exec, imp, newAttr->name(), newAttr->value()))
return KJS::jsUndefined();
return jsUndefined();
KJS::JSValue* result = toJS(exec, WTF::getPtr(imp->setAttributeNode(newAttr, ec)));
KJS::setDOMException(exec, ec);
JSValue* result = toJS(exec, WTF::getPtr(imp->setAttributeNode(newAttr, ec)));
setDOMException(exec, ec);
return result;
}
KJS::JSValue* JSElement::setAttributeNS(KJS::ExecState* exec, const KJS::List& args)
JSValue* JSElement::setAttributeNS(ExecState* exec, const List& args)
{
ExceptionCode ec = 0;
String namespaceURI = valueToStringWithNullCheck(exec, args[0]);
......@@ -97,29 +93,29 @@ KJS::JSValue* JSElement::setAttributeNS(KJS::ExecState* exec, const KJS::List& a
Element* imp = impl();
if (!allowSettingSrcToJavascriptURL(exec, imp, qualifiedName, value))
return KJS::jsUndefined();
return jsUndefined();
imp->setAttributeNS(namespaceURI, qualifiedName, value, ec);
KJS::setDOMException(exec, ec);
return KJS::jsUndefined();
setDOMException(exec, ec);
return jsUndefined();
}
KJS::JSValue* JSElement::setAttributeNodeNS(KJS::ExecState* exec, const KJS::List& args)
JSValue* JSElement::setAttributeNodeNS(ExecState* exec, const List& args)
{
ExceptionCode ec = 0;
bool newAttrOk;
Attr* newAttr = toAttr(args[0], newAttrOk);
if (!newAttrOk) {
KJS::setDOMException(exec, TYPE_MISMATCH_ERR);
return KJS::jsUndefined();
setDOMException(exec, TYPE_MISMATCH_ERR);
return jsUndefined();
}
Element* imp = impl();
if (!allowSettingSrcToJavascriptURL(exec, imp, newAttr->name(), newAttr->value()))
return KJS::jsUndefined();
return jsUndefined();
KJS::JSValue* result = toJS(exec, WTF::getPtr(imp->setAttributeNodeNS(newAttr, ec)));
KJS::setDOMException(exec, ec);
JSValue* result = toJS(exec, WTF::getPtr(imp->setAttributeNodeNS(newAttr, ec)));
setDOMException(exec, ec);
return result;
}
......
/*
* Copyright (C) 2007 Apple Inc. All rights reserved.
* Copyright (C) 2007, 2008 Apple Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
......@@ -29,27 +29,25 @@
#include "config.h"
#include "JSHTMLFrameElement.h"
#include "Document.h"
#include "HTMLFrameElement.h"
#include "PlatformString.h"
#include "kjs_binding.h"
#include "kjs_dom.h"
using namespace KJS;
namespace WebCore {
static inline bool allowSettingJavascriptURL(KJS::ExecState* exec, HTMLFrameElement* imp, String value)
static inline bool allowSettingJavascriptURL(ExecState* exec, HTMLFrameElement* imp, const String& value)
{
if (value.startsWith("javascript:", false)) {
if (protocolIs(value, "javascript")) {
if (!checkNodeSecurity(exec, imp->contentDocument()))
return false;
}
return true;
}
void JSHTMLFrameElement::setSrc(KJS::ExecState* exec, KJS::JSValue* value)
void JSHTMLFrameElement::setSrc(ExecState* exec, JSValue* value)
{
HTMLFrameElement* imp = static_cast<HTMLFrameElement*>(impl());
String srcValue = KJS::valueToStringWithNullCheck(exec, value);
String srcValue = valueToStringWithNullCheck(exec, value);
if (!allowSettingJavascriptURL(exec, imp, srcValue))
return;
......@@ -58,10 +56,10 @@ void JSHTMLFrameElement::setSrc(KJS::ExecState* exec, KJS::JSValue* value)
return;
}
void JSHTMLFrameElement::setLocation(KJS::ExecState* exec, KJS::JSValue* value)
void JSHTMLFrameElement::setLocation(ExecState* exec, JSValue* value)
{
HTMLFrameElement* imp = static_cast<HTMLFrameElement*>(impl());
String locationValue = KJS::valueToStringWithNullCheck(exec, value);
String locationValue = valueToStringWithNullCheck(exec, value);
if (!allowSettingJavascriptURL(exec, imp, locationValue))
return;
......
/*
* Copyright (C) 2007 Apple Inc. All rights reserved.
* Copyright (C) 2007, 2008 Apple Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
......@@ -29,25 +29,24 @@
#include "config.h"
#include "JSHTMLIFrameElement.h"
#include "Document.h"
#include "HTMLIFrameElement.h"
#include "PlatformString.h"
#include "kjs_binding.h"
#include "kjs_dom.h"
using namespace KJS;
namespace WebCore {
void JSHTMLIFrameElement::setSrc(KJS::ExecState* exec, KJS::JSValue* value)
void JSHTMLIFrameElement::setSrc(ExecState* exec, JSValue* value)
{
HTMLIFrameElement* imp = static_cast<HTMLIFrameElement*>(impl());
String srcValue = KJS::valueToStringWithNullCheck(exec, value);
if (srcValue.startsWith("javascript:", false)) {
String srcValue = valueToStringWithNullCheck(exec, value);
if (protocolIs(srcValue, "javascript")) {
if (!checkNodeSecurity(exec, imp->contentDocument()))
return;
}
imp->setSrc(srcValue);
return;
}
} // namespace WebCore
/*
* Copyright (C) 2006, 2007 Apple Inc. All rights reserved.
* Copyright (C) 2006, 2007, 2008 Apple Inc. All rights reserved.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
......@@ -25,13 +25,13 @@
#include "JSHTMLOptionElement.h"
#include "Text.h"
namespace WebCore {
using namespace KJS;
JSHTMLOptionElementConstructor::JSHTMLOptionElementConstructor(ExecState* exec, Document* d)
: KJS::DOMObject(exec->lexicalGlobalObject()->objectPrototype())
, m_doc(d)
namespace WebCore {
JSHTMLOptionElementConstructor::JSHTMLOptionElementConstructor(ExecState* exec, Document* document)
: DOMObject(exec->lexicalGlobalObject()->objectPrototype())
, m_document(document)
{
putDirect(exec->propertyNames().length, jsNumber(4), ReadOnly|DontDelete|DontEnum);
}
......@@ -43,26 +43,28 @@ bool JSHTMLOptionElementConstructor::implementsConstruct() const
JSObject* JSHTMLOptionElementConstructor::construct(ExecState* exec, const List& args)
{
int exception = 0;
RefPtr<Element> el(m_doc->createElement("option", exception));
HTMLOptionElement* opt = 0;
if (el) {
opt = static_cast<HTMLOptionElement*>(el.get());
int sz = args.size();
RefPtr<Text> text = m_doc->createTextNode("");
opt->appendChild(text, exception);
if (exception == 0 && sz > 0)
text->setData(args[0]->toString(exec), exception);
if (exception == 0 && sz > 1)
opt->setValue(args[1]->toString(exec));
if (exception == 0 && sz > 2)
opt->setDefaultSelected(args[2]->toBoolean(exec));
if (exception == 0 && sz > 3)
opt->setSelected(args[3]->toBoolean(exec));
ExceptionCode ec = 0;
RefPtr<HTMLOptionElement> element = static_pointer_cast<HTMLOptionElement>(m_document->createElement("option", ec));
if (element) {
RefPtr<Text> text = m_document->createTextNode("");
if (!args[0]->isUndefined())
text->setData(args[0]->toString(exec), ec);
if (ec == 0)
element->appendChild(text.release(), ec);
if (ec == 0 && !args[1]->isUndefined())
element->setValue(args[1]->toString(exec));
if (ec == 0)
element->setDefaultSelected(args[2]->toBoolean(exec));
if (ec == 0)