New issue
Advanced search Search tips

Issue 752126 link

Starred by 1 user

Issue metadata

Status: Fixed
Owner:
Closed: Aug 2017
Cc:
Components:
EstimatedDays: ----
NextAction: ----
OS: ----
Pri: 3
Type: Bug



Sign in to add a comment

onerror handler receives incorrect arguments if it was first set as another event attribute listener

Project Member Reported by jbroman@chromium.org, Aug 3 2017

Issue description

e.g.

window.onerror = window.onclick = function() { console.log(arguments.length); }

In Firefox, creating an error yields "5". In Chrome, it yields "1" (because the V8EventHandler created by the onclick setter doesn't support onerror arguments).
 
Status: Started (was: Assigned)
A fix for this is reasonably simple after a refactor I was planning on doing for other reasons.
Project Member

Comment 2 by bugdroid1@chromium.org, Aug 5 2017

The following revision refers to this bug:
  https://chromium.googlesource.com/chromium/src.git/+/1e6d71fdd942a4603a64792591a1a0d79b5bd7e6

commit 1e6d71fdd942a4603a64792591a1a0d79b5bd7e6
Author: Jeremy Roman <jbroman@chromium.org>
Date: Sat Aug 05 01:41:40 2017

V8EventListenerHelper: Replace GetOrEmpty with GetOrUndefined.

The latter only needs to do property lookup once rather than twice.
Undefined can easily be distinguished from a v8::External anyhow.

Bug:  752126 
Change-Id: Id2094d3768ec8e0c7e2567e9fefc32e8a5900e7b
Reviewed-on: https://chromium-review.googlesource.com/600253
Reviewed-by: Kentaro Hara <haraken@chromium.org>
Reviewed-by: Yuki Shiino <yukishiino@chromium.org>
Commit-Queue: Jeremy Roman <jbroman@chromium.org>
Cr-Commit-Position: refs/heads/master@{#492210}
[modify] https://crrev.com/1e6d71fdd942a4603a64792591a1a0d79b5bd7e6/third_party/WebKit/Source/bindings/core/v8/V8EventListenerHelper.cpp

Project Member

Comment 3 by bugdroid1@chromium.org, Aug 5 2017

The following revision refers to this bug:
  https://chromium.googlesource.com/chromium/src.git/+/f700e0686e782130068be8396e0bf75c2026c85b

commit f700e0686e782130068be8396e0bf75c2026c85b
Author: Jeremy Roman <jbroman@chromium.org>
Date: Sat Aug 05 05:01:48 2017

Correct window.onerror (and self.onerror) handling.

If the handler is a function previously used as an attribute event listener,
then the full set of 5 parameters isn't currently being used. Correct this
by treating it as a separate type.

Bug:  752126 
Change-Id: I3701bbdc86810bc4990857bbe6b637a0befcdacd
Reviewed-on: https://chromium-review.googlesource.com/600109
Reviewed-by: Kentaro Hara <haraken@chromium.org>
Commit-Queue: Jeremy Roman <jbroman@chromium.org>
Cr-Commit-Position: refs/heads/master@{#492230}
[add] https://crrev.com/f700e0686e782130068be8396e0bf75c2026c85b/third_party/WebKit/LayoutTests/fast/events/window-onerror-common-handler.html
[modify] https://crrev.com/f700e0686e782130068be8396e0bf75c2026c85b/third_party/WebKit/Source/bindings/core/v8/V8EventListenerHelper.cpp
[modify] https://crrev.com/f700e0686e782130068be8396e0bf75c2026c85b/third_party/WebKit/Source/bindings/core/v8/V8EventListenerHelper.h
[modify] https://crrev.com/f700e0686e782130068be8396e0bf75c2026c85b/third_party/WebKit/Source/platform/bindings/V8PrivateProperty.h

Status: Fixed (was: Started)

Sign in to add a comment