New issue
Advanced search Search tips
Note: Color blocks (like or ) mean that a user may not be available. Tooltip shows the reason.

Issue 767598 link

Starred by 3 users

Issue metadata

Status: Fixed
Owner:
Last visit > 30 days ago
Closed: Nov 2017
Cc:
Components:
EstimatedDays: ----
NextAction: ----
OS: Mac
Pri: 2
Type: Bug



Sign in to add a comment

MacOS 10.13 color picker crashes browser if input tag is hidden

Reported by kevin...@gmail.com, Sep 21 2017

Issue description

UserAgent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_12_6) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/61.0.3163.91 Safari/537.36

Steps to reproduce the problem:
Install MacOS 10.13 GM. Click the color box to open the color picker. Select any color. Click the "Toggle" button to hide the div containing the input tag. Select any other color in the still open color picker. Usually (but not always) the browser will crash.

This has been reproduced in 61.0.3163.91 and 63.0.3213.0. Unable to reproduce in MacOS 10.12.

What is the expected behavior?

What went wrong?
Crash at "Performing @selector(didChooseColor:) from sender NSColorPanel 0x7fdd74fe3250". 

Did this work before? N/A 

Does this work in other browsers? Yes

Chrome version: 61.0.3163.91  Channel: stable
OS Version: OS X 10.13
Flash Version: Shockwave Flash 27.0 r0
 
color_picker_crash_demo.html
790 bytes View Download
cr.txt
104 KB View Download
Cc: shrike@chromium.org ccameron@chromium.org
Labels: Hotlist-HighSierra Needs-Triage-M61
Components: -Blink>Input Blink>Forms

Comment 3 by hdodda@chromium.org, Sep 22 2017

Cc: hdodda@chromium.org
Labels: Needs-Feedback
Tested the issue on Mac !0.13 High Sierra using latest stable M61 #61.0.3163.100 and unable to reproduce the issue.

Attached screencast for reference.

@kevinday-- Could you please check attaced screencast and try in latest chrome stable and update us with your observations, if we have missed any steps in reproducing the issue.

Thanks!
767598.mp4
448 KB View Download

Comment 4 by kevin...@gmail.com, Sep 22 2017

You kinda need to click twice on the "toggle" button. Once for the browser window to take focus back from the picker, then again to actually click it. What you did in the screencast didn't actually click the "toggle" button. When you actually click it, you'll see the div below the button disappear.
Project Member

Comment 5 by sheriffbot@chromium.org, Sep 22 2017

Labels: -Needs-Feedback
Thank you for providing more feedback. Adding requester "hdodda@chromium.org" to the cc list and removing "Needs-Feedback" label.

For more details visit https://www.chromium.org/issue-tracking/autotriage - Your friendly Sheriffbot

Comment 6 by shrike@chromium.org, Sep 22 2017

Cc: sdy@chromium.org
Labels: M-63
Status: Untriaged (was: Unconfirmed)
Confirmed the crash on 10.13. Symbolicated crash log attached.

It appears that the color_chooser_mac that set up the color panel is getting dealloced and the color panel still has it as its target.

The dealloc method says

- (void)dealloc {
  NSColorPanel* panel = [NSColorPanel sharedColorPanel];
  if ([panel delegate] == self) {
    [panel setDelegate:nil];
    [panel setTarget:nil];
    [panel setAction:nil];
  }

  [super dealloc];
}

If 10.13 clears or changes the delegate for some reason, that would cause this crash. 
crash.symbolicated.txt
117 KB View Download

Comment 7 by shrike@chromium.org, Sep 22 2017

Owner: shrike@chromium.org
Status: Assigned (was: Untriaged)
Confirmed that within -dealloc the delegate is set to nil, and that forcing the target to nil at that point prevents the crash. NSColorPanel has no public -target method but it does have a private __target method. Clearing the target on [panel __target] == self fixes the crasher.

Comment 8 by shrike@chromium.org, Sep 22 2017

Status: Started (was: Assigned)
Just ran into this too, 10.13 and can reproduce consistently (so can my colleague). Thanks for working on it.

https://jsfiddle.net/ta8j0u8u/
Project Member

Comment 10 by bugdroid1@chromium.org, Nov 18 2017

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

commit 6bc9a0797f03a5da66423e6a622c795bfdb5036a
Author: Jayson Adams <shrike@chromium.org>
Date: Sat Nov 18 00:56:41 2017

[Mac] Fix NSColorPanel crasher on macOS 10.13.

The ColorPanelCocoa sets itself as the target and delegate of the
NSColorPanel, and on dealloc it clears the NSColorPanel's target and
delegate settings if it sees that it is the delegate. On 10.13 it
appears that the NSColorPanel's delegate can get set to nil while
leaving the target intact, preventing -dealloc from clearing the
ColorPanelCocoa target and leading to a Zombie crash.

This cl uses a private method to check the NSColorPanel's target in
-dealloc and clear it if it's still the ColorPanelCocoa.

R=rsesek@chromium.org,avi@chromium.org

Bug:  767598 
Change-Id: I86557f3dadc65b8e0d455156457d960d8f45044e
Reviewed-on: https://chromium-review.googlesource.com/685394
Commit-Queue: Jayson Adams <shrike@chromium.org>
Reviewed-by: Avi Drissman <avi@chromium.org>
Reviewed-by: Robert Sesek <rsesek@chromium.org>
Cr-Commit-Position: refs/heads/master@{#517645}
[modify] https://crrev.com/6bc9a0797f03a5da66423e6a622c795bfdb5036a/chrome/browser/ui/BUILD.gn
[add] https://crrev.com/6bc9a0797f03a5da66423e6a622c795bfdb5036a/chrome/browser/ui/cocoa/color_chooser_mac.h
[modify] https://crrev.com/6bc9a0797f03a5da66423e6a622c795bfdb5036a/chrome/browser/ui/cocoa/color_chooser_mac.mm
[add] https://crrev.com/6bc9a0797f03a5da66423e6a622c795bfdb5036a/chrome/browser/ui/cocoa/color_panel_cocoa_unittest.mm
[modify] https://crrev.com/6bc9a0797f03a5da66423e6a622c795bfdb5036a/chrome/test/BUILD.gn

Status: Fixed (was: Started)

Comment 12 by phistuck@gmail.com, Nov 20 2017

Should you file a radar for this (as it sounds like a macOS issue, since private methods are not supposed to be used)?

Sign in to add a comment