diff options
Diffstat (limited to 'WebCore/bindings')
47 files changed, 99 insertions, 963 deletions
diff --git a/WebCore/bindings/js/JSAudioConstructor.cpp b/WebCore/bindings/js/JSAudioConstructor.cpp index 174cc11..87a3880 100644 --- a/WebCore/bindings/js/JSAudioConstructor.cpp +++ b/WebCore/bindings/js/JSAudioConstructor.cpp @@ -34,7 +34,6 @@ #include "JSHTMLAudioElement.h" #include "ScriptExecutionContext.h" #include "Text.h" -#include <runtime/Error.h> using namespace JSC; diff --git a/WebCore/bindings/js/JSCSSRuleListCustom.cpp b/WebCore/bindings/js/JSCSSRuleListCustom.cpp deleted file mode 100644 index be3a9a2..0000000 --- a/WebCore/bindings/js/JSCSSRuleListCustom.cpp +++ /dev/null @@ -1,47 +0,0 @@ -/* - * Copyright (C) 2009 Apple Inc. All right reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY - * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR - * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR - * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY - * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#include "config.h" -#include "JSCSSRuleList.h" - -#include "CSSRuleList.h" - -using namespace JSC; - -namespace WebCore { - -void JSCSSRuleList::markChildren(MarkStack& markStack) -{ - Base::markChildren(markStack); - - CSSRuleList* list = impl(); - JSGlobalData& globalData = *Heap::heap(this)->globalData(); - - unsigned length = list->length(); - for (unsigned i = 0; i < length; ++i) - markDOMObjectWrapper(markStack, globalData, list->item(i)); -} - -} diff --git a/WebCore/bindings/js/JSCSSStyleDeclarationCustom.cpp b/WebCore/bindings/js/JSCSSStyleDeclarationCustom.cpp index 4a137d3..280ec93 100644 --- a/WebCore/bindings/js/JSCSSStyleDeclarationCustom.cpp +++ b/WebCore/bindings/js/JSCSSStyleDeclarationCustom.cpp @@ -1,5 +1,5 @@ /* - * Copyright (C) 2007, 2008, 2009 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,8 +27,8 @@ #include "JSCSSStyleDeclarationCustom.h" #include "AtomicString.h" -#include "CSSMutableStyleDeclaration.h" #include "CSSPrimitiveValue.h" +#include "CSSStyleDeclaration.h" #include "CSSValue.h" #include "PlatformString.h" #include <runtime/StringObjectThatMasqueradesAsUndefined.h> @@ -40,21 +40,6 @@ using namespace WTF; namespace WebCore { -void JSCSSStyleDeclaration::markChildren(MarkStack& markStack) -{ - Base::markChildren(markStack); - - CSSStyleDeclaration* declaration = impl(); - JSGlobalData& globalData = *Heap::heap(this)->globalData(); - - if (declaration->isMutableStyleDeclaration()) { - CSSMutableStyleDeclaration* mutableDeclaration = static_cast<CSSMutableStyleDeclaration*>(declaration); - CSSMutableStyleDeclaration::const_iterator end = mutableDeclaration->end(); - for (CSSMutableStyleDeclaration::const_iterator it = mutableDeclaration->begin(); it != end; ++it) - markDOMObjectWrapper(markStack, globalData, it->value()); - } -} - // Check for a CSS prefix. // Passed prefix is all lowercase. // First character of the prefix within the property name may be upper or lowercase. diff --git a/WebCore/bindings/js/JSDOMBinding.cpp b/WebCore/bindings/js/JSDOMBinding.cpp index 06492f9..566b986 100644 --- a/WebCore/bindings/js/JSDOMBinding.cpp +++ b/WebCore/bindings/js/JSDOMBinding.cpp @@ -28,7 +28,6 @@ #include "ExceptionCode.h" #include "Frame.h" #include "HTMLAudioElement.h" -#include "HTMLCanvasElement.h" #include "HTMLImageElement.h" #include "HTMLScriptElement.h" #include "HTMLNames.h" @@ -43,7 +42,6 @@ #include "RangeException.h" #include "ScriptController.h" #include "XMLHttpRequestException.h" -#include <runtime/JSFunction.h> #include <runtime/PrototypeFunction.h> #include <wtf/StdLibExtras.h> @@ -266,48 +264,18 @@ static inline bool isObservableThroughDOM(JSNode* jsNode) Node* node = jsNode->impl(); if (node->inDocument()) { - // If a node is in the document, and its wrapper has custom properties, + // 1. If a node is in the document, and its wrapper has custom properties, // the wrapper is observable because future access to the node through the // DOM must reflect those properties. if (jsNode->hasCustomProperties()) return true; - // If a node is in the document, and has event listeners, its wrapper is + // 2. If a node is in the document, and has event listeners, its wrapper is // observable because its wrapper is responsible for marking those event listeners. if (node->eventListeners().size()) return true; // Technically, we may overzealously mark a wrapper for a node that has only non-JS event listeners. Oh well. - - // If a node owns another object with a wrapper with custom properties, - // the wrapper must be treated as observable, because future access to - // those objects through the DOM must reflect those properties. - // FIXME: It would be better if this logic could be in the node next to - // the custom markChildren functions rather than here. - if (node->isElementNode()) { - if (NamedNodeMap* attributes = static_cast<Element*>(node)->attributeMap()) { - if (DOMObject* wrapper = getCachedDOMObjectWrapper(*jsNode->globalObject()->globalData(), attributes)) { - if (wrapper->hasCustomProperties()) - return true; - } - } - if (node->isStyledElement()) { - if (CSSMutableStyleDeclaration* style = static_cast<StyledElement*>(node)->inlineStyleDecl()) { - if (DOMObject* wrapper = getCachedDOMObjectWrapper(*jsNode->globalObject()->globalData(), style)) { - if (wrapper->hasCustomProperties()) - return true; - } - } - } - if (static_cast<Element*>(node)->hasTagName(canvasTag)) { - if (CanvasRenderingContext2D* context = static_cast<HTMLCanvasElement*>(node)->renderingContext2D()) { - if (DOMObject* wrapper = getCachedDOMObjectWrapper(*jsNode->globalObject()->globalData(), context)) { - if (wrapper->hasCustomProperties()) - return true; - } - } - } - } } else { - // If a wrapper is the last reference to an image or script element + // 3. If a wrapper is the last reference to an image or script element // that is loading but not in the document, the wrapper is observable // because it is the only thing keeping the image element alive, and if // the image element is destroyed, its load event will not fire. @@ -380,9 +348,6 @@ void updateDOMNodeDocument(Node* node, Document* oldDocument, Document* newDocum void markDOMObjectWrapper(MarkStack& markStack, JSGlobalData& globalData, void* object) { - // FIXME: This could be changed to only mark wrappers that are "observable" - // as markDOMNodesForDocument does, allowing us to collect more wrappers, - // but doing this correctly would be challenging. if (!object) return; DOMObject* wrapper = getCachedDOMObjectWrapper(globalData, object); diff --git a/WebCore/bindings/js/JSDOMBinding.h b/WebCore/bindings/js/JSDOMBinding.h index 5abd7a7..64cfc3a 100644 --- a/WebCore/bindings/js/JSDOMBinding.h +++ b/WebCore/bindings/js/JSDOMBinding.h @@ -26,6 +26,7 @@ #include "Document.h" // For DOMConstructorWithDocument #include <runtime/Completion.h> #include <runtime/Lookup.h> +#include <runtime/JSFunction.h> #include <wtf/Noncopyable.h> namespace JSC { @@ -60,7 +61,7 @@ namespace WebCore { #endif }; - // FIXME: This class should collapse into DOMObject once all DOMObjects are + // FIXME: This class should colapse into DOMObject once all DOMObjects are // updated to store a globalObject pointer. class DOMObjectWithGlobalPointer : public DOMObject { public: diff --git a/WebCore/bindings/js/JSDOMWindowCustom.cpp b/WebCore/bindings/js/JSDOMWindowCustom.cpp index 44a11e4..9798972 100644 --- a/WebCore/bindings/js/JSDOMWindowCustom.cpp +++ b/WebCore/bindings/js/JSDOMWindowCustom.cpp @@ -38,7 +38,6 @@ #include "JSDOMWindowShell.h" #include "JSEvent.h" #include "JSEventListener.h" -#include "JSEventSourceConstructor.h" #include "JSHTMLCollection.h" #include "JSHistory.h" #include "JSImageConstructor.h" @@ -55,7 +54,6 @@ #include "Location.h" #include "MediaPlayer.h" #include "MessagePort.h" -#include "NotificationCenter.h" #include "Page.h" #include "PlatformScreen.h" #include "RegisteredEventListener.h" @@ -63,8 +61,6 @@ #include "ScriptController.h" #include "Settings.h" #include "WindowFeatures.h" -#include <runtime/Error.h> -#include <runtime/JSFunction.h> #include <runtime/JSObject.h> #include <runtime/PrototypeFunction.h> @@ -428,13 +424,6 @@ JSValue JSDOMWindow::event(ExecState* exec) const return toJS(exec, event); } -#if ENABLE(EVENTSOURCE) -JSValue JSDOMWindow::eventSource(ExecState* exec) const -{ - return getDOMConstructor<JSEventSourceConstructor>(exec, this); -} -#endif - JSValue JSDOMWindow::image(ExecState* exec) const { return getDOMConstructor<JSImageConstructor>(exec, this); diff --git a/WebCore/bindings/js/JSDesktopNotificationsCustom.cpp b/WebCore/bindings/js/JSDesktopNotificationsCustom.cpp deleted file mode 100644 index fb34c7b..0000000 --- a/WebCore/bindings/js/JSDesktopNotificationsCustom.cpp +++ /dev/null @@ -1,90 +0,0 @@ -/* - * Copyright (C) 2009 Google Inc. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are - * met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following disclaimer - * in the documentation and/or other materials provided with the - * distribution. - * * Neither the name of Google Inc. nor the names of its - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#include "config.h" - -#if ENABLE(NOTIFICATIONS) - -#include "Document.h" -#include "JSCustomVoidCallback.h" -#include "JSEventListener.h" -#include "JSNotification.h" -#include "JSNotificationCenter.h" -#include "Notification.h" -#include "NotificationCenter.h" - -using namespace JSC; - -namespace WebCore { - -JSValue JSNotificationCenter::requestPermission(ExecState* exec, const ArgList& args) -{ - // Permission request is only valid from page context. - ScriptExecutionContext* context = impl()->context(); - if (context->isWorkerContext()) - return throwError(exec, SyntaxError); - - if (!args.at(0).isObject()) - return throwError(exec, TypeError); - - PassRefPtr<JSCustomVoidCallback> callback = JSCustomVoidCallback::create(args.at(0).getObject(), static_cast<Document*>(context)->frame()); - - impl()->requestPermission(callback); - return jsUndefined(); -} - -JSValue JSNotification::addEventListener(ExecState* exec, const ArgList& args) -{ - JSDOMGlobalObject* globalObject = toJSDOMGlobalObject(impl()->scriptExecutionContext()); - if (!globalObject) - return jsUndefined(); - - if (RefPtr<JSEventListener> listener = globalObject->findOrCreateJSEventListener(args.at(1))) - impl()->addEventListener(args.at(0).toString(exec), listener.release(), args.at(2).toBoolean(exec)); - - return jsUndefined(); -} - -JSValue JSNotification::removeEventListener(ExecState* exec, const ArgList& args) -{ - JSDOMGlobalObject* globalObject = toJSDOMGlobalObject(impl()->scriptExecutionContext()); - if (!globalObject) - return jsUndefined(); - - if (JSEventListener* listener = globalObject->findJSEventListener(args.at(1))) - impl()->removeEventListener(args.at(0).toString(exec), listener, args.at(2).toBoolean(exec)); - - return jsUndefined(); -} - - -} // namespace - -#endif // ENABLE(NOTIFICATIONS) diff --git a/WebCore/bindings/js/JSDocumentCustom.cpp b/WebCore/bindings/js/JSDocumentCustom.cpp index 25c0b00..39a1fc5 100644 --- a/WebCore/bindings/js/JSDocumentCustom.cpp +++ b/WebCore/bindings/js/JSDocumentCustom.cpp @@ -42,14 +42,8 @@ namespace WebCore { void JSDocument::markChildren(MarkStack& markStack) { JSNode::markChildren(markStack); - - Document* document = impl(); - JSGlobalData& globalData = *Heap::heap(this)->globalData(); - - markDOMNodesForDocument(markStack, document); - markActiveObjectsForContext(markStack, globalData, document); - markDOMObjectWrapper(markStack, globalData, document->implementation()); - markDOMObjectWrapper(markStack, globalData, document->styleSheets()); + markDOMNodesForDocument(markStack, impl()); + markActiveObjectsForContext(markStack, *Heap::heap(this)->globalData(), impl()); } JSValue JSDocument::location(ExecState* exec) const diff --git a/WebCore/bindings/js/JSElementCustom.cpp b/WebCore/bindings/js/JSElementCustom.cpp index c7b19e3..47793d0 100644 --- a/WebCore/bindings/js/JSElementCustom.cpp +++ b/WebCore/bindings/js/JSElementCustom.cpp @@ -1,5 +1,5 @@ /* - * Copyright (C) 2007, 2008, 2009 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 @@ -51,18 +51,6 @@ namespace WebCore { using namespace HTMLNames; -void JSElement::markChildren(MarkStack& markStack) -{ - Base::markChildren(markStack); - - Element* element = impl(); - JSGlobalData& globalData = *Heap::heap(this)->globalData(); - - markDOMObjectWrapper(markStack, globalData, element->attributeMap()); - if (element->isStyledElement()) - markDOMObjectWrapper(markStack, globalData, static_cast<StyledElement*>(element)->inlineStyleDecl()); -} - static inline bool allowSettingSrcToJavascriptURL(ExecState* exec, Element* element, const String& name, const String& value) { if ((element->hasTagName(iframeTag) || element->hasTagName(frameTag)) && equalIgnoringCase(name, "src") && protocolIsJavaScript(deprecatedParseURL(value))) { @@ -71,7 +59,7 @@ static inline bool allowSettingSrcToJavascriptURL(ExecState* exec, Element* elem return false; } return true; -} +} JSValue JSElement::setAttribute(ExecState* exec, const ArgList& args) { diff --git a/WebCore/bindings/js/JSEventSourceConstructor.cpp b/WebCore/bindings/js/JSEventSourceConstructor.cpp deleted file mode 100644 index c6e4825..0000000 --- a/WebCore/bindings/js/JSEventSourceConstructor.cpp +++ /dev/null @@ -1,91 +0,0 @@ -/* - * Copyright (C) 2009 Ericsson AB - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer - * in the documentation and/or other materials provided with the - * distribution. - * 3. Neither the name of Ericsson nor the names of its contributors - * may be used to endorse or promote products derived from this - * software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#include "config.h" - -#if ENABLE(EVENTSOURCE) - -#include "JSEventSourceConstructor.h" - -#include "EventSource.h" -#include "ExceptionCode.h" -#include "JSEventSource.h" -#include "ScriptExecutionContext.h" -#include <runtime/Error.h> - -using namespace JSC; - -namespace WebCore { - -ASSERT_CLASS_FITS_IN_CELL(JSEventSourceConstructor); - -const ClassInfo JSEventSourceConstructor::s_info = { "EventSourceContructor", 0, 0, 0 }; - -JSEventSourceConstructor::JSEventSourceConstructor(ExecState* exec, JSDOMGlobalObject* globalObject) - : DOMConstructorObject(JSEventSourceConstructor::createStructure(globalObject->objectPrototype()), globalObject) -{ - putDirect(exec->propertyNames().prototype, JSEventSourcePrototype::self(exec, globalObject), None); - putDirect(exec->propertyNames().length, jsNumber(exec, 1), ReadOnly|DontDelete|DontEnum); -} - -static JSObject* constructEventSource(ExecState* exec, JSObject* constructor, const ArgList& args) -{ - if (args.size() < 1) - return throwError(exec, SyntaxError, "Not enough arguments"); - - UString url = args.at(0).toString(exec); - if (exec->hadException()) - return 0; - - JSEventSourceConstructor* jsConstructor = static_cast<JSEventSourceConstructor*>(constructor); - ScriptExecutionContext* context = jsConstructor->scriptExecutionContext(); - if (!context) - return throwError(exec, ReferenceError, "EventSource constructor associated document is unavailable"); - - ExceptionCode ec = 0; - RefPtr<EventSource> eventSource = EventSource::create(url, context, ec); - if (ec) { - setDOMException(exec, ec); - return 0; - } - - return asObject(toJS(exec, jsConstructor->globalObject(), eventSource.release())); -} - -ConstructType JSEventSourceConstructor::getConstructData(ConstructData& constructData) -{ - constructData.native.function = constructEventSource; - return ConstructTypeHost; -} - -} // namespace WebCore - -#endif // ENABLE(EVENTSOURCE) diff --git a/WebCore/bindings/js/JSEventSourceConstructor.h b/WebCore/bindings/js/JSEventSourceConstructor.h deleted file mode 100644 index b2f3cb5..0000000 --- a/WebCore/bindings/js/JSEventSourceConstructor.h +++ /dev/null @@ -1,55 +0,0 @@ -/* - * Copyright (C) 2009 Ericsson AB - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer - * in the documentation and/or other materials provided with the - * distribution. - * 3. Neither the name of Ericsson nor the names of its contributors - * may be used to endorse or promote products derived from this - * software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#ifndef JSEventSourceConstructor_h -#define JSEventSourceConstructor_h - -#if ENABLE(EVENTSOURCE) - -#include "JSDOMBinding.h" - -namespace WebCore { - - class JSEventSourceConstructor : public DOMConstructorObject { - public: - JSEventSourceConstructor(JSC::ExecState*, JSDOMGlobalObject*); - static const JSC::ClassInfo s_info; - - private: - virtual JSC::ConstructType getConstructData(JSC::ConstructData&); - virtual const JSC::ClassInfo* classInfo() const { return &s_info; } - }; - -} // namespace WebCore - -#endif // ENABLE(EVENTSOURCE) - -#endif // JSEventSourceConstructor_h diff --git a/WebCore/bindings/js/JSEventSourceCustom.cpp b/WebCore/bindings/js/JSEventSourceCustom.cpp deleted file mode 100644 index d20ccd6..0000000 --- a/WebCore/bindings/js/JSEventSourceCustom.cpp +++ /dev/null @@ -1,89 +0,0 @@ -/* - * Copyright (C) 2009 Ericsson AB - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer - * in the documentation and/or other materials provided with the - * distribution. - * 3. Neither the name of Ericsson nor the names of its contributors - * may be used to endorse or promote products derived from this - * software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#include "config.h" - -#if ENABLE(EVENTSOURCE) - -#include "JSEventSource.h" - -#include "EventSource.h" -#include "JSDOMGlobalObject.h" -#include "JSEventListener.h" - -using namespace JSC; - -namespace WebCore { - -void JSEventSource::markChildren(MarkStack& markStack) -{ - DOMObject::markChildren(markStack); - - markIfNotNull(markStack, m_impl->onopen()); - markIfNotNull(markStack, m_impl->onmessage()); - markIfNotNull(markStack, m_impl->onerror()); - - typedef EventSource::EventListenersMap EventListenersMap; - typedef EventSource::ListenerVector ListenerVector; - EventListenersMap& eventListeners = m_impl->eventListeners(); - for (EventListenersMap::iterator mapIter = eventListeners.begin(); mapIter != eventListeners.end(); ++mapIter) { - for (ListenerVector::iterator vecIter = mapIter->second.begin(); vecIter != mapIter->second.end(); ++vecIter) - (*vecIter)->markJSFunction(markStack); - } -} - -JSValue JSEventSource::addEventListener(ExecState* exec, const ArgList& args) -{ - JSDOMGlobalObject* globalObject = toJSDOMGlobalObject(impl()->scriptExecutionContext()); - if (!globalObject) - return jsUndefined(); - RefPtr<JSEventListener> listener = globalObject->findOrCreateJSEventListener(args.at(1)); - if (!listener) - return jsUndefined(); - impl()->addEventListener(args.at(0).toString(exec), listener.release(), args.at(2).toBoolean(exec)); - return jsUndefined(); -} - -JSValue JSEventSource::removeEventListener(ExecState* exec, const ArgList& args) -{ - JSDOMGlobalObject* globalObject = toJSDOMGlobalObject(impl()->scriptExecutionContext()); - if (!globalObject) - return jsUndefined(); - JSEventListener* listener = globalObject->findJSEventListener(args.at(1)); - if (!listener) - return jsUndefined(); - impl()->removeEventListener(args.at(0).toString(exec), listener, args.at(2).toBoolean(exec)); - return jsUndefined(); -} - -} // namespace WebCore - -#endif // ENABLE(EVENTSOURCE) diff --git a/WebCore/bindings/js/JSEventTarget.cpp b/WebCore/bindings/js/JSEventTarget.cpp index 5825ee5..c34e10e 100644 --- a/WebCore/bindings/js/JSEventTarget.cpp +++ b/WebCore/bindings/js/JSEventTarget.cpp @@ -43,11 +43,6 @@ #include "XMLHttpRequest.h" #include "XMLHttpRequestUpload.h" -#if ENABLE(EVENTSOURCE) -#include "EventSource.h" -#include "JSEventSource.h" -#endif - #if ENABLE(OFFLINE_WEB_APPLICATIONS) #include "DOMApplicationCache.h" #include "JSDOMApplicationCache.h" @@ -65,11 +60,6 @@ #include "Worker.h" #endif -#if ENABLE(NOTIFICATIONS) -#include "JSNotification.h" -#include "Notification.h" -#endif - using namespace JSC; namespace WebCore { @@ -79,11 +69,6 @@ JSValue toJS(ExecState* exec, JSDOMGlobalObject* globalObject, EventTarget* targ if (!target) return jsNull(); -#if ENABLE(EVENTSOURCE) - if (EventSource* eventSource = target->toEventSource()) - return toJS(exec, globalObject, eventSource); -#endif - #if ENABLE(SVG) // SVGElementInstance supports both toSVGElementInstance and toNode since so much mouse handling code depends on toNode returning a valid node. if (SVGElementInstance* instance = target->toSVGElementInstance()) @@ -126,11 +111,6 @@ JSValue toJS(ExecState* exec, JSDOMGlobalObject* globalObject, EventTarget* targ return toJSDOMGlobalObject(workerContext); #endif -#if ENABLE(NOTIFICATIONS) - if (Notification* notification = target->toNotification()) - return toJS(exec, notification); -#endif - ASSERT_NOT_REACHED(); return jsNull(); } @@ -138,7 +118,7 @@ JSValue toJS(ExecState* exec, JSDOMGlobalObject* globalObject, EventTarget* targ EventTarget* toEventTarget(JSC::JSValue value) { #define CONVERT_TO_EVENT_TARGET(type) \ - if (value.inherits(&JS##type::s_info)) \ + if (value.isObject(&JS##type::s_info)) \ return static_cast<JS##type*>(asObject(value))->impl(); CONVERT_TO_EVENT_TARGET(Node) @@ -146,13 +126,9 @@ EventTarget* toEventTarget(JSC::JSValue value) CONVERT_TO_EVENT_TARGET(XMLHttpRequestUpload) CONVERT_TO_EVENT_TARGET(MessagePort) - if (value.inherits(&JSDOMWindowShell::s_info)) + if (value.isObject(&JSDOMWindowShell::s_info)) return static_cast<JSDOMWindowShell*>(asObject(value))->impl(); -#if ENABLE(EVENTSOURCE) - CONVERT_TO_EVENT_TARGET(EventSource) -#endif - #if ENABLE(OFFLINE_WEB_APPLICATIONS) CONVERT_TO_EVENT_TARGET(DOMApplicationCache) #endif @@ -171,10 +147,6 @@ EventTarget* toEventTarget(JSC::JSValue value) CONVERT_TO_EVENT_TARGET(SharedWorkerContext) #endif -#if ENABLE(NOTIFICATIONS) - CONVERT_TO_EVENT_TARGET(Notification) -#endif - return 0; } diff --git a/WebCore/bindings/js/JSGeolocationCustom.cpp b/WebCore/bindings/js/JSGeolocationCustom.cpp index cc0ba8b..6379a1c 100644 --- a/WebCore/bindings/js/JSGeolocationCustom.cpp +++ b/WebCore/bindings/js/JSGeolocationCustom.cpp @@ -34,7 +34,6 @@ #include "JSCustomPositionErrorCallback.h" #include "JSDOMWindow.h" #include "PositionOptions.h" -#include <runtime/InternalFunction.h> using namespace JSC; using namespace std; @@ -44,7 +43,7 @@ namespace WebCore { static PassRefPtr<PositionCallback> createPositionCallback(ExecState* exec, JSValue value) { // The spec specifies 'FunctionOnly' for this object. - if (!value.inherits(&InternalFunction::info)) { + if (!value.isObject(&InternalFunction::info)) { setDOMException(exec, TYPE_MISMATCH_ERR); return 0; } @@ -56,12 +55,12 @@ static PassRefPtr<PositionCallback> createPositionCallback(ExecState* exec, JSVa static PassRefPtr<PositionErrorCallback> createPositionErrorCallback(ExecState* exec, JSValue value) { - // Argument is optional (hence undefined is allowed), and null is allowed. + // Argument is optional (hence undefined is allowed), and null is allowed. if (value.isUndefinedOrNull()) return 0; // The spec specifies 'FunctionOnly' for this object. - if (!value.inherits(&InternalFunction::info)) { + if (!value.isObject(&InternalFunction::info)) { setDOMException(exec, TYPE_MISMATCH_ERR); return 0; } @@ -92,7 +91,7 @@ static PassRefPtr<PositionOptions> createPositionOptions(ExecState* exec, JSValu JSValue enableHighAccuracyValue = object->get(exec, Identifier(exec, "enableHighAccuracy")); if (exec->hadException()) return 0; - if (!enableHighAccuracyValue.isUndefined()) { + if(!enableHighAccuracyValue.isUndefined()) { options->setEnableHighAccuracy(enableHighAccuracyValue.toBoolean(exec)); if (exec->hadException()) return 0; diff --git a/WebCore/bindings/js/JSHTMLCanvasElementCustom.cpp b/WebCore/bindings/js/JSHTMLCanvasElementCustom.cpp deleted file mode 100644 index 921e243..0000000 --- a/WebCore/bindings/js/JSHTMLCanvasElementCustom.cpp +++ /dev/null @@ -1,45 +0,0 @@ -/* - * Copyright (C) 2009 Apple Inc. All right reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY - * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR - * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR - * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY - * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#include "config.h" -#include "JSHTMLCanvasElement.h" - -#include "HTMLCanvasElement.h" - -using namespace JSC; - -namespace WebCore { - -void JSHTMLCanvasElement::markChildren(MarkStack& markStack) -{ - Base::markChildren(markStack); - - HTMLCanvasElement* canvas = static_cast<HTMLCanvasElement*>(impl()); - JSGlobalData& globalData = *Heap::heap(this)->globalData(); - - markDOMObjectWrapper(markStack, globalData, canvas->renderingContext2D()); -} - -} diff --git a/WebCore/bindings/js/JSHTMLInputElementCustom.cpp b/WebCore/bindings/js/JSHTMLInputElementCustom.cpp index e5166ee..6b47622 100644 --- a/WebCore/bindings/js/JSHTMLInputElementCustom.cpp +++ b/WebCore/bindings/js/JSHTMLInputElementCustom.cpp @@ -29,7 +29,6 @@ #include "Document.h" #include "HTMLInputElement.h" #include "Settings.h" -#include <runtime/Error.h> using namespace JSC; diff --git a/WebCore/bindings/js/JSHistoryCustom.cpp b/WebCore/bindings/js/JSHistoryCustom.cpp index a11266d..a3b15e1 100644 --- a/WebCore/bindings/js/JSHistoryCustom.cpp +++ b/WebCore/bindings/js/JSHistoryCustom.cpp @@ -31,7 +31,6 @@ #include "Frame.h" #include "History.h" -#include <runtime/JSFunction.h> #include <runtime/PrototypeFunction.h> using namespace JSC; diff --git a/WebCore/bindings/js/JSImageConstructor.cpp b/WebCore/bindings/js/JSImageConstructor.cpp index 0f4a991..faaaf41 100644 --- a/WebCore/bindings/js/JSImageConstructor.cpp +++ b/WebCore/bindings/js/JSImageConstructor.cpp @@ -25,7 +25,6 @@ #include "JSHTMLImageElement.h" #include "JSNode.h" #include "ScriptExecutionContext.h" -#include <runtime/Error.h> using namespace JSC; diff --git a/WebCore/bindings/js/JSInspectorBackendCustom.cpp b/WebCore/bindings/js/JSInspectorBackendCustom.cpp index 30e6dc2..b2eb2d1 100644 --- a/WebCore/bindings/js/JSInspectorBackendCustom.cpp +++ b/WebCore/bindings/js/JSInspectorBackendCustom.cpp @@ -2,7 +2,6 @@ * Copyright (C) 2007, 2008 Apple Inc. All rights reserved. * Copyright (C) 2008 Matt Lilek <webkit@mattlilek.com> * Copyright (C) 2009 Google Inc. All rights reserved. - * Copyright (C) 2009 Joseph Pecoraro * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are @@ -35,8 +34,6 @@ #include "JSInspectorBackend.h" #include "Console.h" -#include "Cookie.h" -#include "CookieJar.h" #if ENABLE(DATABASE) #include "Database.h" #include "JSDatabase.h" @@ -54,10 +51,6 @@ #include "JSRange.h" #include "Node.h" #include "Page.h" -#if ENABLE(DOM_STORAGE) -#include "Storage.h" -#include "JSStorage.h" -#endif #include "TextIterator.h" #include "VisiblePosition.h" #include <runtime/JSArray.h> @@ -77,12 +70,21 @@ using namespace JSC; namespace WebCore { -JSValue JSInspectorBackend::highlightDOMNode(JSC::ExecState* exec, const JSC::ArgList& args) +JSValue JSInspectorBackend::highlightDOMNode(JSC::ExecState*, const JSC::ArgList& args) { if (args.size() < 1) return jsUndefined(); - impl()->highlight(args.at(0).toInt32(exec)); + JSQuarantinedObjectWrapper* wrapper = JSQuarantinedObjectWrapper::asWrapper(args.at(0)); + if (!wrapper) + return jsUndefined(); + + Node* node = toNode(wrapper->unwrappedObject()); + if (!node) + return jsUndefined(); + + impl()->highlight(node); + return jsUndefined(); } @@ -156,68 +158,6 @@ JSValue JSInspectorBackend::inspectedWindow(ExecState*, const ArgList&) return JSInspectedObjectWrapper::wrap(inspectedWindow->globalExec(), inspectedWindow); } -JSValue JSInspectorBackend::cookies(ExecState* exec, const ArgList&) -{ - InspectorController* ic = impl()->inspectorController(); - if (!ic) - return jsUndefined(); - - Document* document = ic->inspectedPage()->mainFrame()->document(); - Vector<Cookie> cookies; - bool isImplemented = getRawCookies(document, document->cookieURL(), cookies); - - if (!isImplemented) - return jsUndefined(); - - MarkedArgumentBuffer result; - Identifier nameIdentifier(exec, "name"); - Identifier valueIdentifier(exec, "value"); - Identifier domainIdentifier(exec, "domain"); - Identifier pathIdentifier(exec, "path"); - Identifier expiresIdentifier(exec, "expires"); - Identifier sizeIdentifier(exec, "size"); - Identifier httpOnlyIdentifier(exec, "httpOnly"); - Identifier secureIdentifier(exec, "secure"); - Identifier sessionIdentifier(exec, "session"); - - unsigned length = cookies.size(); - for (unsigned i = 0; i < length; ++i) { - const Cookie& cookie = cookies[i]; - JSObject* cookieObject = constructEmptyObject(exec); - cookieObject->putDirect(nameIdentifier, jsString(exec, cookie.name)); - cookieObject->putDirect(valueIdentifier, jsString(exec, cookie.value)); - cookieObject->putDirect(domainIdentifier, jsString(exec, cookie.domain)); - cookieObject->putDirect(pathIdentifier, jsString(exec, cookie.path)); - cookieObject->putDirect(expiresIdentifier, jsNumber(exec, cookie.expires)); - cookieObject->putDirect(sizeIdentifier, jsNumber(exec, cookie.name.length() + cookie.value.length())); - cookieObject->putDirect(httpOnlyIdentifier, jsBoolean(cookie.httpOnly)); - cookieObject->putDirect(secureIdentifier, jsBoolean(cookie.secure)); - cookieObject->putDirect(sessionIdentifier, jsBoolean(cookie.session)); - result.append(cookieObject); - } - - return constructArray(exec, result); -} - -JSValue JSInspectorBackend::deleteCookie(ExecState* exec, const ArgList& args) -{ - if (args.size() < 1) - return jsUndefined(); - - InspectorController* ic = impl()->inspectorController(); - if (!ic) - return jsUndefined(); - - String cookieName = args.at(0).toString(exec); - if (exec->hadException()) - return jsUndefined(); - - Document* document = ic->inspectedPage()->mainFrame()->document(); - WebCore::deleteCookie(document, document->cookieURL(), cookieName); - - return jsUndefined(); -} - JSValue JSInspectorBackend::setting(ExecState* exec, const ArgList& args) { if (args.size() < 1) @@ -340,107 +280,4 @@ JSValue JSInspectorBackend::profiles(JSC::ExecState* exec, const JSC::ArgList&) #endif -JSValue JSInspectorBackend::nodeForId(ExecState* exec, const ArgList& args) -{ - if (args.size() < 1) - return jsUndefined(); - - Node* node = impl()->nodeForId(args.at(0).toInt32(exec)); - if (!node) - return jsUndefined(); - - InspectorController* ic = impl()->inspectorController(); - if (!ic) - return jsUndefined(); - - JSLock lock(SilenceAssertionsOnly); - JSDOMWindow* inspectedWindow = toJSDOMWindow(ic->inspectedPage()->mainFrame()); - return JSInspectedObjectWrapper::wrap(inspectedWindow->globalExec(), toJS(exec, deprecatedGlobalObjectForPrototype(inspectedWindow->globalExec()), node)); -} - -JSValue JSInspectorBackend::idForNode(ExecState* exec, const ArgList& args) -{ - if (args.size() < 1) - return jsUndefined(); - - JSQuarantinedObjectWrapper* wrapper = JSQuarantinedObjectWrapper::asWrapper(args.at(0)); - if (!wrapper) - return jsUndefined(); - - Node* node = toNode(wrapper->unwrappedObject()); - if (node) - return jsNumber(exec, impl()->idForNode(node)); - return jsUndefined(); -} - -JSValue JSInspectorBackend::wrapObject(ExecState*, const ArgList& args) -{ - if (args.size() < 1) - return jsUndefined(); - - return impl()->wrapObject(ScriptValue(args.at(0))).jsValue(); -} - -JSValue JSInspectorBackend::unwrapObject(ExecState* exec, const ArgList& args) -{ - if (args.size() < 1) - return jsUndefined(); - - return impl()->unwrapObject(args.at(0).toString(exec)).jsValue(); -} - -JSValue JSInspectorBackend::pushNodePathToFrontend(ExecState* exec, const ArgList& args) -{ - if (args.size() < 2) - return jsUndefined(); - - JSQuarantinedObjectWrapper* wrapper = JSQuarantinedObjectWrapper::asWrapper(args.at(0)); - if (!wrapper) - return jsUndefined(); - - Node* node = toNode(wrapper->unwrappedObject()); - if (!node) - return jsUndefined(); - - bool selectInUI = args.at(1).toBoolean(exec); - return jsNumber(exec, impl()->pushNodePathToFrontend(node, selectInUI)); -} - -#if ENABLE(DATABASE) -JSValue JSInspectorBackend::selectDatabase(ExecState*, const ArgList& args) -{ - if (args.size() < 1) - return jsUndefined(); - - JSQuarantinedObjectWrapper* wrapper = JSQuarantinedObjectWrapper::asWrapper(args.at(0)); - if (!wrapper) - return jsUndefined(); - - Database* database = toDatabase(wrapper->unwrappedObject()); - if (database) - impl()->selectDatabase(database); - return jsUndefined(); -} -#endif - -#if ENABLE(DOM_STORAGE) -JSValue JSInspectorBackend::selectDOMStorage(ExecState*, const ArgList& args) -{ - if (args.size() < 1) - return jsUndefined(); - InspectorController* ic = impl()->inspectorController(); - if (!ic) - return jsUndefined(); - - JSQuarantinedObjectWrapper* wrapper = JSQuarantinedObjectWrapper::asWrapper(args.at(0)); - if (!wrapper) - return jsUndefined(); - - Storage* storage = toStorage(wrapper->unwrappedObject()); - if (storage) - impl()->selectDOMStorage(storage); - return jsUndefined(); -} -#endif - } // namespace WebCore diff --git a/WebCore/bindings/js/JSLazyEventListener.cpp b/WebCore/bindings/js/JSLazyEventListener.cpp index cf0ed44..7caff2b 100644 --- a/WebCore/bindings/js/JSLazyEventListener.cpp +++ b/WebCore/bindings/js/JSLazyEventListener.cpp @@ -23,7 +23,6 @@ #include "Frame.h" #include "JSNode.h" #include <runtime/FunctionConstructor.h> -#include <runtime/JSFunction.h> #include <runtime/JSLock.h> #include <wtf/RefCountedLeakCounter.h> diff --git a/WebCore/bindings/js/JSLocationCustom.cpp b/WebCore/bindings/js/JSLocationCustom.cpp index 0289bc0..d7d32f4 100644 --- a/WebCore/bindings/js/JSLocationCustom.cpp +++ b/WebCore/bindings/js/JSLocationCustom.cpp @@ -31,7 +31,6 @@ #include "KURL.h" #include "Location.h" #include "ScriptController.h" -#include <runtime/JSFunction.h> #include <runtime/PrototypeFunction.h> using namespace JSC; diff --git a/WebCore/bindings/js/JSMessageChannelConstructor.cpp b/WebCore/bindings/js/JSMessageChannelConstructor.cpp index 9721ba3..25a5cb2 100644 --- a/WebCore/bindings/js/JSMessageChannelConstructor.cpp +++ b/WebCore/bindings/js/JSMessageChannelConstructor.cpp @@ -30,7 +30,6 @@ #include "JSDocument.h" #include "JSMessageChannel.h" #include "MessageChannel.h" -#include <runtime/Error.h> using namespace JSC; diff --git a/WebCore/bindings/js/JSNodeFilterCustom.cpp b/WebCore/bindings/js/JSNodeFilterCustom.cpp index 2a99a93..09fd110 100644 --- a/WebCore/bindings/js/JSNodeFilterCustom.cpp +++ b/WebCore/bindings/js/JSNodeFilterCustom.cpp @@ -48,7 +48,7 @@ JSValue JSNodeFilter::acceptNode(ExecState* exec, const ArgList& args) PassRefPtr<NodeFilter> toNodeFilter(JSValue value) { - if (value.inherits(&JSNodeFilter::s_info)) + if (value.isObject(&JSNodeFilter::s_info)) return static_cast<JSNodeFilter*>(asObject(value))->impl(); return NodeFilter::create(JSNodeFilterCondition::create(value)); diff --git a/WebCore/bindings/js/JSOptionConstructor.cpp b/WebCore/bindings/js/JSOptionConstructor.cpp index 7da0666..2b8bd5d 100644 --- a/WebCore/bindings/js/JSOptionConstructor.cpp +++ b/WebCore/bindings/js/JSOptionConstructor.cpp @@ -25,7 +25,6 @@ #include "JSHTMLOptionElement.h" #include "ScriptExecutionContext.h" #include "Text.h" -#include <runtime/Error.h> using namespace JSC; diff --git a/WebCore/bindings/js/JSStyleSheetCustom.cpp b/WebCore/bindings/js/JSStyleSheetCustom.cpp index d711b6f..43249dc 100644 --- a/WebCore/bindings/js/JSStyleSheetCustom.cpp +++ b/WebCore/bindings/js/JSStyleSheetCustom.cpp @@ -56,19 +56,12 @@ void JSStyleSheet::markChildren(MarkStack& markStack) { Base::markChildren(markStack); - StyleSheet* sheet = impl(); - JSGlobalData& globalData = *Heap::heap(this)->globalData(); - - unsigned length = sheet->length(); - for (unsigned i = 0; i < length; ++i) - markDOMObjectWrapper(markStack, globalData, sheet->item(i)); - // This prevents us from having a style sheet with a dangling ownerNode pointer. // A better solution would be to handle this on the DOM side -- if the style sheet // is kept around, then we want the node to stay around too. One possibility would // be to make ref/deref on the style sheet ref/deref the node instead, but there's // a lot of disentangling of the CSS DOM objects that would need to happen first. - if (Node* ownerNode = sheet->ownerNode()) { + if (Node* ownerNode = impl()->ownerNode()) { if (JSNode* ownerNodeWrapper = getCachedDOMNodeWrapper(ownerNode->document(), ownerNode)) markStack.append(ownerNodeWrapper); } diff --git a/WebCore/bindings/js/JSStyleSheetListCustom.cpp b/WebCore/bindings/js/JSStyleSheetListCustom.cpp index 7bf9389..1da6418 100644 --- a/WebCore/bindings/js/JSStyleSheetListCustom.cpp +++ b/WebCore/bindings/js/JSStyleSheetListCustom.cpp @@ -1,5 +1,5 @@ /* - * Copyright (C) 2007, 2009 Apple Inc. All rights reserved. + * Copyright (C) 2007 Apple Inc. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -35,18 +35,6 @@ using namespace JSC; namespace WebCore { -void JSStyleSheetList::markChildren(MarkStack& markStack) -{ - Base::markChildren(markStack); - - StyleSheetList* list = impl(); - JSGlobalData& globalData = *Heap::heap(this)->globalData(); - - unsigned length = list->length(); - for (unsigned i = 0; i < length; ++i) - markDOMObjectWrapper(markStack, globalData, list->item(i)); -} - bool JSStyleSheetList::canGetItemsForName(ExecState*, StyleSheetList* styleSheetList, const Identifier& propertyName) { return styleSheetList->getNamedItem(propertyName); diff --git a/WebCore/bindings/js/JSWebSocketConstructor.cpp b/WebCore/bindings/js/JSWebSocketConstructor.cpp index 5b34765..ca2e104 100644 --- a/WebCore/bindings/js/JSWebSocketConstructor.cpp +++ b/WebCore/bindings/js/JSWebSocketConstructor.cpp @@ -37,7 +37,6 @@ #include "JSWebSocket.h" #include "ScriptExecutionContext.h" #include "WebSocket.h" -#include <runtime/Error.h> using namespace JSC; diff --git a/WebCore/bindings/js/JSWebSocketCustom.cpp b/WebCore/bindings/js/JSWebSocketCustom.cpp index 401b33d..3aa4b8b 100644 --- a/WebCore/bindings/js/JSWebSocketCustom.cpp +++ b/WebCore/bindings/js/JSWebSocketCustom.cpp @@ -38,7 +38,6 @@ #include "KURL.h" #include "WebSocket.h" #include "NotImplemented.h" -#include <runtime/Error.h> using namespace JSC; diff --git a/WebCore/bindings/js/JSWorkerConstructor.cpp b/WebCore/bindings/js/JSWorkerConstructor.cpp index 69c05e7..9943cfb 100644 --- a/WebCore/bindings/js/JSWorkerConstructor.cpp +++ b/WebCore/bindings/js/JSWorkerConstructor.cpp @@ -34,7 +34,6 @@ #include "JSDOMWindowCustom.h" #include "JSWorker.h" #include "Worker.h" -#include <runtime/Error.h> using namespace JSC; diff --git a/WebCore/bindings/js/JSWorkerContextCustom.cpp b/WebCore/bindings/js/JSWorkerContextCustom.cpp index 7ece7a0..919c81f 100644 --- a/WebCore/bindings/js/JSWorkerContextCustom.cpp +++ b/WebCore/bindings/js/JSWorkerContextCustom.cpp @@ -43,10 +43,6 @@ #include "WorkerNavigator.h" #include <interpreter/Interpreter.h> -#if ENABLE(EVENTSOURCE) -#include "JSEventSourceConstructor.h" -#endif - using namespace JSC; namespace WebCore { @@ -81,13 +77,6 @@ bool JSWorkerContext::getOwnPropertySlotDelegate(ExecState* exec, const Identifi return false; } -#if ENABLE(EVENTSOURCE) -JSValue JSWorkerContext::eventSource(ExecState* exec) const -{ - return getDOMConstructor<JSEventSourceConstructor>(exec, this); -} -#endif - JSValue JSWorkerContext::xmlHttpRequest(ExecState* exec) const { return getDOMConstructor<JSXMLHttpRequestConstructor>(exec, this); diff --git a/WebCore/bindings/js/JSXMLHttpRequestConstructor.cpp b/WebCore/bindings/js/JSXMLHttpRequestConstructor.cpp index 91fff9a..a644c9e 100644 --- a/WebCore/bindings/js/JSXMLHttpRequestConstructor.cpp +++ b/WebCore/bindings/js/JSXMLHttpRequestConstructor.cpp @@ -23,7 +23,6 @@ #include "JSXMLHttpRequest.h" #include "ScriptExecutionContext.h" #include "XMLHttpRequest.h" -#include <runtime/Error.h> using namespace JSC; diff --git a/WebCore/bindings/js/JSXMLHttpRequestCustom.cpp b/WebCore/bindings/js/JSXMLHttpRequestCustom.cpp index 95bc16e..a591fae 100644 --- a/WebCore/bindings/js/JSXMLHttpRequestCustom.cpp +++ b/WebCore/bindings/js/JSXMLHttpRequestCustom.cpp @@ -123,9 +123,9 @@ JSValue JSXMLHttpRequest::send(ExecState* exec, const ArgList& args) JSValue val = args.at(0); if (val.isUndefinedOrNull()) impl()->send(ec); - else if (val.inherits(&JSDocument::s_info)) + else if (val.isObject(&JSDocument::s_info)) impl()->send(toDocument(val), ec); - else if (val.inherits(&JSFile::s_info)) + else if (val.isObject(&JSFile::s_info)) impl()->send(toFile(val), ec); else impl()->send(val.toString(exec), ec); diff --git a/WebCore/bindings/js/JSXSLTProcessorCustom.cpp b/WebCore/bindings/js/JSXSLTProcessorCustom.cpp index 441bbc9..01e53a6 100644 --- a/WebCore/bindings/js/JSXSLTProcessorCustom.cpp +++ b/WebCore/bindings/js/JSXSLTProcessorCustom.cpp @@ -49,7 +49,7 @@ namespace WebCore { JSValue JSXSLTProcessor::importStylesheet(ExecState*, const ArgList& args) { JSValue nodeVal = args.at(0); - if (nodeVal.inherits(&JSNode::s_info)) { + if (nodeVal.isObject(&JSNode::s_info)) { JSNode* node = static_cast<JSNode*>(asObject(nodeVal)); impl()->importStylesheet(node->impl()); return jsUndefined(); @@ -62,7 +62,7 @@ JSValue JSXSLTProcessor::transformToFragment(ExecState* exec, const ArgList& arg { JSValue nodeVal = args.at(0); JSValue docVal = args.at(1); - if (nodeVal.inherits(&JSNode::s_info) && docVal.inherits(&JSDocument::s_info)) { + if (nodeVal.isObject(&JSNode::s_info) && docVal.isObject(&JSDocument::s_info)) { WebCore::Node* node = static_cast<JSNode*>(asObject(nodeVal))->impl(); Document* doc = static_cast<Document*>(static_cast<JSDocument*>(asObject(docVal))->impl()); return toJS(exec, impl()->transformToFragment(node, doc).get()); @@ -74,7 +74,7 @@ JSValue JSXSLTProcessor::transformToFragment(ExecState* exec, const ArgList& arg JSValue JSXSLTProcessor::transformToDocument(ExecState* exec, const ArgList& args) { JSValue nodeVal = args.at(0); - if (nodeVal.inherits(&JSNode::s_info)) { + if (nodeVal.isObject(&JSNode::s_info)) { JSNode* node = static_cast<JSNode*>(asObject(nodeVal)); RefPtr<Document> resultDocument = impl()->transformToDocument(node->impl()); if (resultDocument) diff --git a/WebCore/bindings/js/ScriptControllerHaiku.cpp b/WebCore/bindings/js/ScriptControllerHaiku.cpp index 3fe471d..b573b97 100644 --- a/WebCore/bindings/js/ScriptControllerHaiku.cpp +++ b/WebCore/bindings/js/ScriptControllerHaiku.cpp @@ -28,8 +28,8 @@ #include "ScriptController.h" #include "PluginView.h" -#include "runtime.h" #include "runtime_root.h" +#include "runtime.h" namespace WebCore { diff --git a/WebCore/bindings/js/ScriptObjectQuarantine.cpp b/WebCore/bindings/js/ScriptObjectQuarantine.cpp index f96f89e..89553ef 100644 --- a/WebCore/bindings/js/ScriptObjectQuarantine.cpp +++ b/WebCore/bindings/js/ScriptObjectQuarantine.cpp @@ -38,7 +38,6 @@ #include "JSNode.h" #include "ScriptObject.h" #include "ScriptValue.h" -#include "Storage.h" #include <runtime/JSLock.h> @@ -81,11 +80,10 @@ bool getQuarantinedScriptObject(Database* database, ScriptObject& quarantinedObj #endif #if ENABLE(DOM_STORAGE) -bool getQuarantinedScriptObject(Storage* storage, ScriptObject& quarantinedObject) +bool getQuarantinedScriptObject(Frame* frame, Storage* storage, ScriptObject& quarantinedObject) { - ASSERT(storage); - Frame* frame = storage->frame(); ASSERT(frame); + ASSERT(storage); JSDOMGlobalObject* globalObject = toJSDOMWindow(frame); ExecState* exec = globalObject->globalExec(); diff --git a/WebCore/bindings/js/ScriptObjectQuarantine.h b/WebCore/bindings/js/ScriptObjectQuarantine.h index df52379..d70acd7 100644 --- a/WebCore/bindings/js/ScriptObjectQuarantine.h +++ b/WebCore/bindings/js/ScriptObjectQuarantine.h @@ -37,6 +37,7 @@ namespace WebCore { class Database; class DOMWindow; + class Frame; class Node; class ScriptObject; class ScriptValue; @@ -48,7 +49,7 @@ namespace WebCore { bool getQuarantinedScriptObject(Database* database, ScriptObject& quarantinedObject); #endif #if ENABLE(DOM_STORAGE) - bool getQuarantinedScriptObject(Storage* storage, ScriptObject& quarantinedObject); + bool getQuarantinedScriptObject(Frame* frame, Storage* storage, ScriptObject& quarantinedObject); #endif bool getQuarantinedScriptObject(Node* node, ScriptObject& quarantinedObject); bool getQuarantinedScriptObject(DOMWindow* domWindow, ScriptObject& quarantinedObject); diff --git a/WebCore/bindings/js/ScriptValue.cpp b/WebCore/bindings/js/ScriptValue.cpp index 6eac102..d427cee 100644 --- a/WebCore/bindings/js/ScriptValue.cpp +++ b/WebCore/bindings/js/ScriptValue.cpp @@ -74,11 +74,4 @@ bool ScriptValue::isUndefined() const return m_value.get().isUndefined(); } -bool ScriptValue::isObject() const -{ - if (!m_value) - return false; - return m_value.get().isObject(); -} - } // namespace WebCore diff --git a/WebCore/bindings/js/ScriptValue.h b/WebCore/bindings/js/ScriptValue.h index 19bb693..209ce06 100644 --- a/WebCore/bindings/js/ScriptValue.h +++ b/WebCore/bindings/js/ScriptValue.h @@ -50,7 +50,6 @@ public: bool isEqual(ScriptState*, const ScriptValue&) const; bool isNull() const; bool isUndefined() const; - bool isObject() const; bool hasNoValue() const { return m_value == JSC::JSValue(); } private: diff --git a/WebCore/bindings/scripts/CodeGeneratorJS.pm b/WebCore/bindings/scripts/CodeGeneratorJS.pm index f6de50e..1918aef 100644 --- a/WebCore/bindings/scripts/CodeGeneratorJS.pm +++ b/WebCore/bindings/scripts/CodeGeneratorJS.pm @@ -667,12 +667,6 @@ sub GenerateHeader push(@headerContent, " static PassRefPtr<JSC::Structure> createStructure(JSC::JSValue prototype)\n" . " {\n" . - " return JSC::Structure::create(prototype, JSC::TypeInfo(JSC::ObjectType" . ($dataNode->extendedAttributes->{"CustomMarkFunction"} ? "" : ", JSC::HasDefaultMark") . "));\n" . - " }\n"); - } elsif ($dataNode->extendedAttributes->{"CustomMarkFunction"}) { - push(@headerContent, - " static PassRefPtr<JSC::Structure> createStructure(JSC::JSValue prototype)\n" . - " {\n" . " return JSC::Structure::create(prototype, JSC::TypeInfo(JSC::ObjectType));\n" . " }\n"); } @@ -1379,7 +1373,7 @@ sub GenerateImplementation push(@implContent, " if (!castedThisObj)\n"); push(@implContent, " return throwError(exec, TypeError);\n"); } else { - push(@implContent, " if (!thisValue.inherits(&${className}::s_info))\n"); + push(@implContent, " if (!thisValue.isObject(&${className}::s_info))\n"); push(@implContent, " return throwError(exec, TypeError);\n"); push(@implContent, " $className* castedThisObj = static_cast<$className*>(asObject(thisValue));\n"); } @@ -1543,7 +1537,7 @@ sub GenerateImplementation push(@implContent, "{\n"); - push(@implContent, " return value.inherits(&${className}::s_info) ? " . ($podType ? "($podType) *" : "") . "static_cast<$className*>(asObject(value))->impl() : "); + push(@implContent, " return value.isObject(&${className}::s_info) ? " . ($podType ? "($podType) *" : "") . "static_cast<$className*>(asObject(value))->impl() : "); if ($podType and $podType ne "float") { push(@implContent, "$podType();\n}\n"); } else { diff --git a/WebCore/bindings/scripts/CodeGeneratorV8.pm b/WebCore/bindings/scripts/CodeGeneratorV8.pm index 1eb3e85..439f368 100644 --- a/WebCore/bindings/scripts/CodeGeneratorV8.pm +++ b/WebCore/bindings/scripts/CodeGeneratorV8.pm @@ -975,24 +975,51 @@ sub GenerateBatchedAttributeData $setter = "V8Custom::v8${customAccessor}AccessorSetter"; } } - } else { - # Default Getter and Setter - $getter = "${interfaceName}Internal::${attrName}AttrGetter"; - $setter = "${interfaceName}Internal::${attrName}AttrSetter"; - # Custom Setter - if ($attrExt->{"CustomSetter"} || $attrExt->{"V8CustomSetter"} || $attrExt->{"Custom"} || $attrExt->{"V8Custom"}) { + # Custom Getter and Setter + } elsif ($attrExt->{"Custom"} || $attrExt->{"V8Custom"}) { + $getter = "V8Custom::v8${customAccessor}AccessorGetter"; + if ($interfaceName eq "WorkerContext" and $attrName eq "self") { + $setter = "0"; + $propAttr = "v8::ReadOnly"; + } else { $hasCustomSetter = 1; $setter = "V8Custom::v8${customAccessor}AccessorSetter"; } - # Custom Getter - if ($attrExt->{"CustomGetter"} || $attrExt->{"Custom"} || $attrExt->{"V8Custom"}) { - $getter = "V8Custom::v8${customAccessor}AccessorGetter"; + # Custom Setter + } elsif ($attrExt->{"CustomSetter"} || $attrExt->{"V8CustomSetter"}) { + $hasCustomSetter = 1; + $getter = "${interfaceName}Internal::${attrName}AttrGetter"; + $setter = "V8Custom::v8${customAccessor}AccessorSetter"; + + # Custom Getter + } elsif ($attrExt->{"CustomGetter"}) { + $getter = "V8Custom::v8${customAccessor}AccessorGetter"; + $setter = "${interfaceName}Internal::${attrName}AttrSetter"; + + # Replaceable + } elsif ($attrExt->{"Replaceable"}) { + # Replaceable accessor is put on instance template with ReadOnly attribute. + $getter = "${interfaceName}Internal::${attrName}AttrGetter"; + $setter = "0"; + + # Mark to avoid duplicate v8::ReadOnly flags in output. + $hasCustomSetter = 1; + + # Handle the special case of window.top being marked upstream as Replaceable. + # FIXME: Investigate why [Replaceable] is not marked as ReadOnly + # upstream and reach parity. + if (!($interfaceName eq "DOMWindow" and $attrName eq "top")) { + $propAttr .= "|v8::ReadOnly"; } + + # Normal + } else { + $getter = "${interfaceName}Internal::${attrName}AttrGetter"; + $setter = "${interfaceName}Internal::${attrName}AttrSetter"; } - # Replaceable if ($attrExt->{"Replaceable"} && !$hasCustomSetter) { $setter = "0"; $propAttr .= "|v8::ReadOnly"; @@ -1626,7 +1653,6 @@ sub IsRefPtrType return 1 if $type eq "Plugin"; return 1 if $type eq "ProcessingInstruction"; return 1 if $type eq "Range"; - return 1 if $type eq "RGBColor"; return 1 if $type eq "Text"; return 1 if $type eq "TextMetrics"; return 1 if $type eq "TimeRanges"; diff --git a/WebCore/bindings/v8/ScriptObjectQuarantine.cpp b/WebCore/bindings/v8/ScriptObjectQuarantine.cpp index c9f379b..053cf68 100644 --- a/WebCore/bindings/v8/ScriptObjectQuarantine.cpp +++ b/WebCore/bindings/v8/ScriptObjectQuarantine.cpp @@ -38,7 +38,6 @@ #include "Page.h" #include "ScriptObject.h" #include "ScriptValue.h" -#include "Storage.h" #include "V8Binding.h" #include "V8Proxy.h" @@ -62,11 +61,10 @@ bool getQuarantinedScriptObject(Database* database, ScriptObject& quarantinedObj return false; } -bool getQuarantinedScriptObject(Storage* storage, ScriptObject& quarantinedObject) +bool getQuarantinedScriptObject(Frame* frame, Storage* storage, ScriptObject& quarantinedObject) { - ASSERT(storage); - Frame* frame = storage->frame(); ASSERT(frame); + ASSERT(storage); #if ENABLE(DOM_STORAGE) v8::HandleScope handleScope; diff --git a/WebCore/bindings/v8/ScriptObjectQuarantine.h b/WebCore/bindings/v8/ScriptObjectQuarantine.h index 712dd9b..3b7ccff 100644 --- a/WebCore/bindings/v8/ScriptObjectQuarantine.h +++ b/WebCore/bindings/v8/ScriptObjectQuarantine.h @@ -42,6 +42,7 @@ namespace WebCore { class Database; class DOMWindow; + class Frame; class Node; class ScriptObject; class ScriptValue; @@ -50,7 +51,7 @@ namespace WebCore { ScriptValue quarantineValue(ScriptState*, const ScriptValue&); bool getQuarantinedScriptObject(Database* database, ScriptObject& quarantinedObject); - bool getQuarantinedScriptObject(Storage* storage, ScriptObject& quarantinedObject); + bool getQuarantinedScriptObject(Frame* frame, Storage* storage, ScriptObject& quarantinedObject); bool getQuarantinedScriptObject(Node* node, ScriptObject& quarantinedObject); bool getQuarantinedScriptObject(DOMWindow* domWindow, ScriptObject& quarantinedObject); diff --git a/WebCore/bindings/v8/ScriptValue.h b/WebCore/bindings/v8/ScriptValue.h index ddc3577..004851b 100644 --- a/WebCore/bindings/v8/ScriptValue.h +++ b/WebCore/bindings/v8/ScriptValue.h @@ -110,12 +110,7 @@ public: { return m_value->IsUndefined(); } - - bool isObject() const - { - return m_value->IsObject(); - } - + bool hasNoValue() const { return m_value.IsEmpty(); diff --git a/WebCore/bindings/v8/V8Binding.cpp b/WebCore/bindings/v8/V8Binding.cpp index c0367d5..c5d580a 100644 --- a/WebCore/bindings/v8/V8Binding.cpp +++ b/WebCore/bindings/v8/V8Binding.cpp @@ -154,12 +154,14 @@ AtomicString v8StringToAtomicWebCoreString(v8::Handle<v8::String> v8String) { WebCoreStringResource* stringResource = WebCoreStringResource::toStringResource(v8String); if (!stringResource) { - if (!v8String->CanMakeExternal()) - return v8StringToWebCoreString(v8String, DoNotExternalize, AtomicStringType); // If this string hasn't been externalized, we force it now. - v8StringToWebCoreString(v8String, Externalize, AtomicStringType); + String plain = v8StringToWebCoreString(v8String, Externalize, AtomicStringType); + // If the string is empty there's no room to cache an atomic + // string so we bail out. + if (plain.isEmpty()) + return plain; stringResource = WebCoreStringResource::toStringResource(v8String); - ASSERT(stringResource); + ASSERT(stringResource != NULL); } return stringResource->atomicString(); } diff --git a/WebCore/bindings/v8/custom/V8CustomBinding.h b/WebCore/bindings/v8/custom/V8CustomBinding.h index 945dcbb..80fed1d 100644 --- a/WebCore/bindings/v8/custom/V8CustomBinding.h +++ b/WebCore/bindings/v8/custom/V8CustomBinding.h @@ -218,7 +218,7 @@ namespace WebCore { DECLARE_PROPERTY_ACCESSOR(CanvasRenderingContext2DStrokeStyle); DECLARE_PROPERTY_ACCESSOR(CanvasRenderingContext2DFillStyle); - DECLARE_PROPERTY_ACCESSOR(DOMWindowEvent); + DECLARE_PROPERTY_ACCESSOR_GETTER(DOMWindowEvent); DECLARE_PROPERTY_ACCESSOR_GETTER(DOMWindowCrypto); DECLARE_PROPERTY_ACCESSOR_SETTER(DOMWindowLocation); DECLARE_PROPERTY_ACCESSOR_SETTER(DOMWindowOpener); @@ -402,23 +402,12 @@ namespace WebCore { DECLARE_CALLBACK(InspectorBackendSetting); DECLARE_CALLBACK(InspectorBackendInspectedWindow); DECLARE_CALLBACK(InspectorBackendSetSetting); - DECLARE_CALLBACK(InspectorBackendCookies); - DECLARE_CALLBACK(InspectorBackendDeleteCookie); DECLARE_CALLBACK(InspectorBackendCurrentCallFrame); DECLARE_CALLBACK(InspectorBackendDebuggerEnabled); DECLARE_CALLBACK(InspectorBackendPauseOnExceptions); DECLARE_CALLBACK(InspectorBackendProfilerEnabled); - DECLARE_CALLBACK(InspectorBackendNodeForId); - DECLARE_CALLBACK(InspectorBackendIdForNode); - DECLARE_CALLBACK(InspectorBackendWrapObject); - DECLARE_CALLBACK(InspectorBackendUnwrapObject); - DECLARE_CALLBACK(InspectorBackendPushNodePathToFrontend); #if ENABLE(DATABASE) DECLARE_CALLBACK(InspectorBackendDatabaseTableNames); - DECLARE_CALLBACK(InspectorBackendSelectDatabase); -#endif -#if ENABLE(DOM_STORAGE) - DECLARE_CALLBACK(InspectorBackendSelectDOMStorage); #endif DECLARE_CALLBACK(InspectorBackendWrapCallback); diff --git a/WebCore/bindings/v8/custom/V8DOMWindowCustom.cpp b/WebCore/bindings/v8/custom/V8DOMWindowCustom.cpp index 13d40bc..7d0b9e6 100644 --- a/WebCore/bindings/v8/custom/V8DOMWindowCustom.cpp +++ b/WebCore/bindings/v8/custom/V8DOMWindowCustom.cpp @@ -145,37 +145,14 @@ static v8::Handle<v8::Value> convertBase64(const String& str, bool encode) ACCESSOR_GETTER(DOMWindowEvent) { - v8::Handle<v8::Object> holder = V8DOMWrapper::lookupDOMWrapper(V8ClassIndex::DOMWINDOW, info.This()); - if (holder.IsEmpty()) - return v8::Undefined(); - - Frame* frame = V8DOMWrapper::convertToNativeObject<DOMWindow>(V8ClassIndex::DOMWINDOW, holder)->frame(); - if (!frame || !V8Proxy::canAccessFrame(frame, true)) - return v8::Undefined(); - - v8::Local<v8::Context> context = V8Proxy::context(frame); v8::Local<v8::String> eventSymbol = v8::String::NewSymbol("event"); + v8::Local<v8::Context> context = v8::Context::GetCurrent(); v8::Handle<v8::Value> jsEvent = context->Global()->GetHiddenValue(eventSymbol); if (jsEvent.IsEmpty()) return v8::Undefined(); return jsEvent; } -ACCESSOR_SETTER(DOMWindowEvent) -{ - v8::Handle<v8::Object> holder = V8DOMWrapper::lookupDOMWrapper(V8ClassIndex::DOMWINDOW, info.This()); - if (holder.IsEmpty()) - return; - - Frame* frame = V8DOMWrapper::convertToNativeObject<DOMWindow>(V8ClassIndex::DOMWINDOW, holder)->frame(); - if (!frame || !V8Proxy::canAccessFrame(frame, true)) - return; - - v8::Local<v8::Context> context = V8Proxy::context(frame); - v8::Local<v8::String> eventSymbol = v8::String::NewSymbol("event"); - context->Global()->SetHiddenValue(eventSymbol, value); -} - ACCESSOR_GETTER(DOMWindowCrypto) { // FIXME: Implement me. diff --git a/WebCore/bindings/v8/custom/V8InspectorBackendCustom.cpp b/WebCore/bindings/v8/custom/V8InspectorBackendCustom.cpp index cb9b3a9..2571df4 100644 --- a/WebCore/bindings/v8/custom/V8InspectorBackendCustom.cpp +++ b/WebCore/bindings/v8/custom/V8InspectorBackendCustom.cpp @@ -57,8 +57,13 @@ CALLBACK_FUNC_DECL(InspectorBackendHighlightDOMNode) if (args.Length() < 1) return v8::Undefined(); + Node* node = V8DOMWrapper::convertDOMWrapperToNode<Node>(v8::Handle<v8::Object>::Cast(args[0])); + if (!node) + return v8::Undefined(); + InspectorBackend* inspectorBackend = V8DOMWrapper::convertToNativeObject<InspectorBackend>(V8ClassIndex::INSPECTORBACKEND, args.Holder()); - inspectorBackend->highlight(args[0]->ToInt32()->Value()); + inspectorBackend->highlight(node); + return v8::Undefined(); } @@ -204,123 +209,10 @@ CALLBACK_FUNC_DECL(InspectorBackendSetSetting) return v8::Undefined(); } -CALLBACK_FUNC_DECL(InspectorBackendCookies) -{ - INC_STATS("InspectorBackend.cookies()"); - // FIXME: Not yet implemented. - return v8::Undefined(); -} - -CALLBACK_FUNC_DECL(InspectorBackendDeleteCookie) -{ - INC_STATS("InspectorBackend.deleteCookie()"); - // FIXME: Not yet implemented. (see WebCore/bindings/js/JSInspectorBackendCustom.cpp#deleteCookie) - return v8::Undefined(); -} - CALLBACK_FUNC_DECL(InspectorBackendWrapCallback) { INC_STATS("InspectorBackend.wrapCallback()"); return args[0]; } -CALLBACK_FUNC_DECL(InspectorBackendNodeForId) -{ - INC_STATS("InspectorBackend.nodeForId()"); - if (args.Length() < 1) - return v8::Undefined(); - - InspectorBackend* inspectorBackend = V8DOMWrapper::convertToNativeObject<InspectorBackend>(V8ClassIndex::INSPECTORBACKEND, args.Holder()); - - Node* node = inspectorBackend->nodeForId(args[0]->ToInt32()->Value()); - if (!node) - return v8::Undefined(); - - InspectorController* ic = inspectorBackend->inspectorController(); - if (!ic) - return v8::Undefined(); - - return V8DOMWrapper::convertToV8Object(V8ClassIndex::NODE, node); -} - -CALLBACK_FUNC_DECL(InspectorBackendIdForNode) -{ - INC_STATS("InspectorBackend.idForNode()"); - if (args.Length() < 1) - return v8::Undefined(); - - InspectorBackend* inspectorBackend = V8DOMWrapper::convertToNativeObject<InspectorBackend>(V8ClassIndex::INSPECTORBACKEND, args.Holder()); - Node* node = V8DOMWrapper::convertDOMWrapperToNode<Node>(v8::Handle<v8::Object>::Cast(args[0])); - if (node) - return v8::Number::New(inspectorBackend->idForNode(node)); - return v8::Undefined(); -} - -CALLBACK_FUNC_DECL(InspectorBackendWrapObject) -{ - INC_STATS("InspectorBackend.wrapObject()"); - if (args.Length() < 1) - return v8::Undefined(); - - InspectorBackend* inspectorBackend = V8DOMWrapper::convertToNativeObject<InspectorBackend>(V8ClassIndex::INSPECTORBACKEND, args.Holder()); - return inspectorBackend->wrapObject(ScriptValue(args[0])).v8Value(); -} - -CALLBACK_FUNC_DECL(InspectorBackendUnwrapObject) -{ - INC_STATS("InspectorBackend.unwrapObject()"); - if (args.Length() < 1) - return v8::Undefined(); - - InspectorBackend* inspectorBackend = V8DOMWrapper::convertToNativeObject<InspectorBackend>(V8ClassIndex::INSPECTORBACKEND, args.Holder()); - return inspectorBackend->unwrapObject(toWebCoreStringWithNullCheck(args[0])).v8Value(); -} - -CALLBACK_FUNC_DECL(InspectorBackendPushNodePathToFrontend) -{ - INC_STATS("InspectorBackend.pushNodePathToFrontend()"); - if (args.Length() < 2) - return v8::Undefined(); - - InspectorBackend* inspectorBackend = V8DOMWrapper::convertToNativeObject<InspectorBackend>(V8ClassIndex::INSPECTORBACKEND, args.Holder()); - Node* node = V8DOMWrapper::convertDOMWrapperToNode<Node>(v8::Handle<v8::Object>::Cast(args[0])); - bool selectInUI = args[1]->ToBoolean()->Value(); - if (node) - return v8::Number::New(inspectorBackend->pushNodePathToFrontend(node, selectInUI)); - - return v8::Undefined(); -} - -#if ENABLE(DATABASE) -CALLBACK_FUNC_DECL(InspectorBackendSelectDatabase) -{ - INC_STATS("InspectorBackend.selectDatabase()"); - if (args.Length() < 1) - return v8::Undefined(); - - InspectorBackend* inspectorBackend = V8DOMWrapper::convertToNativeObject<InspectorBackend>(V8ClassIndex::INSPECTORBACKEND, args.Holder()); - Database* database = V8DOMWrapper::convertToNativeObject<Database>(V8ClassIndex::DATABASE, v8::Handle<v8::Object>::Cast(args[0])); - if (database) - inspectorBackend->selectDatabase(database); - - return v8::Undefined(); -} -#endif - -#if ENABLE(DOM_STORAGE) -CALLBACK_FUNC_DECL(InspectorBackendSelectDOMStorage) -{ - INC_STATS("InspectorBackend.selectDOMStorage()"); - if (args.Length() < 1) - return v8::Undefined(); - - InspectorBackend* inspectorBackend = V8DOMWrapper::convertToNativeObject<InspectorBackend>(V8ClassIndex::INSPECTORBACKEND, args.Holder()); - Storage* storage = V8DOMWrapper::convertToNativeObject<Storage>(V8ClassIndex::STORAGE, v8::Handle<v8::Object>::Cast(args[0])); - if (storage) - inspectorBackend->selectDOMStorage(storage); - - return v8::Undefined(); -} -#endif - } // namespace WebCore |