diff options
Diffstat (limited to 'WebCore/bindings/js/JSMessageChannelConstructor.cpp')
-rw-r--r-- | WebCore/bindings/js/JSMessageChannelConstructor.cpp | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/WebCore/bindings/js/JSMessageChannelConstructor.cpp b/WebCore/bindings/js/JSMessageChannelConstructor.cpp index 8da9f6d..54ffb18 100644 --- a/WebCore/bindings/js/JSMessageChannelConstructor.cpp +++ b/WebCore/bindings/js/JSMessageChannelConstructor.cpp @@ -70,7 +70,11 @@ ConstructType JSMessageChannelConstructor::getConstructData(ConstructData& const JSObject* JSMessageChannelConstructor::construct(ExecState* exec, JSObject* constructor, const ArgList&) { - return asObject(toJS(exec, MessageChannel::create(static_cast<JSMessageChannelConstructor*>(constructor)->scriptExecutionContext()))); + ScriptExecutionContext* context = static_cast<JSMessageChannelConstructor*>(constructor)->scriptExecutionContext(); + if (!context) + return throwError(exec, ReferenceError, "MessageChannel constructor associated document is unavailable"); + + return asObject(toJS(exec, MessageChannel::create(context))); } void JSMessageChannelConstructor::mark() |