diff options
author | Feng Qian <fqian@google.com> | 2009-06-17 12:12:20 -0700 |
---|---|---|
committer | Feng Qian <fqian@google.com> | 2009-06-17 12:12:20 -0700 |
commit | 5f1ab04193ad0130ca8204aadaceae083aca9881 (patch) | |
tree | 5a92cd389e2cfe7fb67197ce14b38469462379f8 /WebCore/bindings/js/JSImageConstructor.cpp | |
parent | 194315e5a908cc8ed67d597010544803eef1ac59 (diff) | |
download | external_webkit-5f1ab04193ad0130ca8204aadaceae083aca9881.zip external_webkit-5f1ab04193ad0130ca8204aadaceae083aca9881.tar.gz external_webkit-5f1ab04193ad0130ca8204aadaceae083aca9881.tar.bz2 |
Get WebKit r44544.
Diffstat (limited to 'WebCore/bindings/js/JSImageConstructor.cpp')
-rw-r--r-- | WebCore/bindings/js/JSImageConstructor.cpp | 15 |
1 files changed, 9 insertions, 6 deletions
diff --git a/WebCore/bindings/js/JSImageConstructor.cpp b/WebCore/bindings/js/JSImageConstructor.cpp index aa44c73..4a27bb4 100644 --- a/WebCore/bindings/js/JSImageConstructor.cpp +++ b/WebCore/bindings/js/JSImageConstructor.cpp @@ -34,13 +34,14 @@ ASSERT_CLASS_FITS_IN_CELL(JSImageConstructor); const ClassInfo JSImageConstructor::s_info = { "ImageConstructor", 0, 0, 0 }; -JSImageConstructor::JSImageConstructor(ExecState* exec, ScriptExecutionContext* context) +JSImageConstructor::JSImageConstructor(ExecState* exec, JSDOMGlobalObject* globalObject) : DOMObject(JSImageConstructor::createStructure(exec->lexicalGlobalObject()->objectPrototype())) - , m_globalObject(toJSDOMGlobalObject(context)) + , m_globalObject(globalObject) { - ASSERT(context->isDocument()); + ASSERT(globalObject->scriptExecutionContext()); + ASSERT(globalObject->scriptExecutionContext()->isDocument()); - putDirect(exec->propertyNames().prototype, JSHTMLImageElementPrototype::self(exec), None); + putDirect(exec->propertyNames().prototype, JSHTMLImageElementPrototype::self(exec, exec->lexicalGlobalObject()), None); } Document* JSImageConstructor::document() const @@ -56,14 +57,16 @@ static JSObject* constructImage(ExecState* exec, JSObject* constructor, const Ar int height = 0; if (args.size() > 0) { widthSet = true; - width = args.at(exec, 0).toInt32(exec); + width = args.at(0).toInt32(exec); } if (args.size() > 1) { heightSet = true; - height = args.at(exec, 1).toInt32(exec); + height = args.at(1).toInt32(exec); } Document* document = static_cast<JSImageConstructor*>(constructor)->document(); + if (!document) + return throwError(exec, ReferenceError, "Image constructor associated document is unavailable"); // Calling toJS on the document causes the JS document wrapper to be // added to the window object. This is done to ensure that JSDocument::mark |