Bug 184981 - window.postMessage() / focus() / blur() throw a TypeError when called on a RemoteDOMWindow
Summary: window.postMessage() / focus() / blur() throw a TypeError when called on a Re...
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: DOM (show other bugs)
Version: WebKit Nightly Build
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Chris Dumez
URL:
Keywords: InRadar
Depends on:
Blocks: 184996
  Show dependency treegraph
 
Reported: 2018-04-25 10:52 PDT by Chris Dumez
Modified: 2018-04-25 17:56 PDT (History)
10 users (show)

See Also:


Attachments
Patch (8.67 KB, patch)
2018-04-25 10:57 PDT, Chris Dumez
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Chris Dumez 2018-04-25 10:52:55 PDT
window.postMessage() / focus() / blur() throw a TypeError when called on a RemoteDOMWindow, complaining that |this| is not a Window.
Comment 1 Chris Dumez 2018-04-25 10:57:58 PDT
Created attachment 338757 [details]
Patch
Comment 2 Sam Weinig 2018-04-25 17:29:00 PDT
Comment on attachment 338757 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=338757&action=review

> Source/WebCore/bindings/js/JSDOMWindowCustom.cpp:111
> -        slot.setCustom(thisObject, static_cast<unsigned>(JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::DontEnum), windowType == DOMWindowType::Remote ? nonCachingStaticFunctionGetter<jsDOMWindowInstanceFunctionClose, 0> : nonCachingStaticFunctionGetter<jsDOMWindowInstanceFunctionClose, 0>);
> +        slot.setCustom(thisObject, static_cast<unsigned>(JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::DontEnum), windowType == DOMWindowType::Remote ? nonCachingStaticFunctionGetter<jsRemoteDOMWindowInstanceFunctionClose, 0> : nonCachingStaticFunctionGetter<jsDOMWindowInstanceFunctionClose, 0>);
>          return true;
>      }
>      if (propertyName == builtinNames.focusPublicName()) {
> -        slot.setCustom(thisObject, static_cast<unsigned>(JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::DontEnum), windowType == DOMWindowType::Remote ? nonCachingStaticFunctionGetter<jsDOMWindowInstanceFunctionFocus, 0> : nonCachingStaticFunctionGetter<jsDOMWindowInstanceFunctionFocus, 0>);
> +        slot.setCustom(thisObject, static_cast<unsigned>(JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::DontEnum), windowType == DOMWindowType::Remote ? nonCachingStaticFunctionGetter<jsRemoteDOMWindowInstanceFunctionFocus, 0> : nonCachingStaticFunctionGetter<jsDOMWindowInstanceFunctionFocus, 0>);
>          return true;
>      }
>      if (propertyName == builtinNames.postMessagePublicName()) {
> -        slot.setCustom(thisObject, static_cast<unsigned>(JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::DontEnum), windowType == DOMWindowType::Remote ? nonCachingStaticFunctionGetter<jsDOMWindowInstanceFunctionPostMessage, 0> : nonCachingStaticFunctionGetter<jsDOMWindowInstanceFunctionPostMessage, 2>);
> +        slot.setCustom(thisObject, static_cast<unsigned>(JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::DontEnum), windowType == DOMWindowType::Remote ? nonCachingStaticFunctionGetter<jsRemoteDOMWindowInstanceFunctionPostMessage, 0> : nonCachingStaticFunctionGetter<jsDOMWindowInstanceFunctionPostMessage, 2>);

It really bums me out that JSRemoteDOMWindow is referenced in this JSDOMWindow specific file.  I think we should think about moving this to a more neutral location at some point.
Comment 3 WebKit Commit Bot 2018-04-25 17:55:54 PDT
Comment on attachment 338757 [details]
Patch

Clearing flags on attachment: 338757

Committed r231037: <https://trac.webkit.org/changeset/231037>
Comment 4 WebKit Commit Bot 2018-04-25 17:55:56 PDT
All reviewed patches have been landed.  Closing bug.
Comment 5 Radar WebKit Bug Importer 2018-04-25 17:56:20 PDT
<rdar://problem/39742647>