• Zufeng Wang's avatar
    Make message_pipe ignore postMessages with no type · 802e0e2d
    Zufeng Wang authored
    If you go to a app that uses message pipe (e.g. the inner frame of
    media_app) and run:
    window.parent.postMessage('something', '*')
    You get an error: "Uncaught TypeError: Cannot read property 'substr' of
    undefined"
    
    This happens because message pipe intercepts all postMessages and tries
    to handle them.
    
    This CL makes message pipe ignore messages where event.data.type isn't a
    string.
    
    This change is to help with migrating help app to use message pipe -- to
    prevent the existing postMessages from causing errors.
    http://crrev.com/c/2405044
    
    Bug: b/166043485
    Change-Id: Ia66259bd4de542d628228282503c1d00a51d3e10
    Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2413650
    Commit-Queue: Zufeng Wang <zufeng@google.com>
    Reviewed-by: default avatarTrent Apted <tapted@chromium.org>
    Cr-Commit-Position: refs/heads/master@{#808781}
    802e0e2d
message_pipe.js 13.6 KB