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

Issue 618976 link

Starred by 1 user

Issue metadata

Status: Fixed
Owner:
Closed: Jun 2016
Cc:
EstimatedDays: ----
NextAction: ----
OS: Linux , Windows , Mac
Pri: 2
Type: Bug-Regression



Sign in to add a comment

Parsing of IntersectionObservers' "rootMargin" member is inconsistent

Reported by que....@gmail.com, Jun 10 2016

Issue description

UserAgent: Mozilla/5.0 (Windows NT 6.1; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/53.0.2763.0 Safari/537.36

Steps to reproduce the problem:
1. Open console.
2. Execute following code:

(function () {
    let obsrever = new IntersectionObserver(() => {}, {
        rootMargin: '10px 80px 0px 60px 5px 10px'
    });

    return obsrever.rootMargin;
})();

What is the expected behavior?
An exception is thrown, because due to the spec (http://rawgit.com/WICG/IntersectionObserver/master/index.html#parse-a-root-margin) number of tokens
can't be greater than 4.

What went wrong?
Resulting value of 'rootMargin' is '10px 80px 0px 60px'.
Anything that goes after the fourth token is ignored, i.e. you can even set '10px 80px 0px 60px FOO BAR' which will be considered as a valid value.

Did this work before? No 

Chrome version: 53.0.2763.0  Channel: dev
OS Version: 6.1 (Windows 7, Windows Server 2008 R2)
Flash Version: Shockwave Flash 22.0 r0

Also, I don't know if that's a thing but you can provide an array like ['1px 1px'] and it will be casted to string.
 
Arrays are casted to strings is a consistent behavior:

> document.body.style.margin = ["1px","2px"]
> console.log(document.body.style.margin) // "1px 2px"


Comment 2 by que....@gmail.com, Jun 10 2016

Ehm, there is probably a typo in ["1px","2px"] because toString conversion
will give you a string with comma separated values: "1px,2px".

Besides the value of margin will remain empty.
Cc: rnimmagadda@chromium.org
Labels: Needs-Feedback
Unable to repro this issue on Windows 7 for Google Chrome Dev Version - 53.0.2763.0 

Screen-recording is attached.

@que.etc: Could you please perform the steps mentioned beneath and let us know your observations.

1. Re-test the same on a clean profile [chrome://settings -> Add Person]

Thank you.
618976.mp4
737 KB View Download

Comment 4 by que....@gmail.com, Jun 14 2016

Maybe I've got you wrong, but I see just the describe issue: value is "10px 80px 0px 60px" while the expected behavior is a thrown exception.

Stpe 3 in http://rawgit.com/WICG/IntersectionObserver/master/index.html#parse-a-root-margin
If the length of tokens is 0 or greater than 4, return failure.

I mean that it should throw an exception instead of ignoring the rest of tokens, isn't it?
@que.etc: Could you please let us know if this is the output you were expecting. (Pic attached)
Screen Shot 2016-06-14 at 4.41.32 PM.png
24.9 KB View Download

Comment 6 by que....@gmail.com, Jun 14 2016

@rnimmagadda: Yeah, something like that. Or maybe a range error with information about the maximum number of tokens.
Project Member

Comment 7 by sheriffbot@chromium.org, Jun 14 2016

Labels: -Needs-Feedback Needs-Review
Owner: rnimmagadda@chromium.org
Thank you for providing more feedback. Adding requester "rnimmagadda@chromium.org" for another review and adding "Needs-Review" label for tracking.

For more details visit https://www.chromium.org/issue-tracking/autotriage - Your friendly Sheriffbot
Cc: ojan@chromium.org
Labels: -Type-Bug -Needs-Review M-52 OS-Linux OS-Mac Type-Bug-Regression
Owner: szager@chromium.org
Status: Assigned (was: Unconfirmed)
======================================

Good Build:

51.0.2700.0      Base Position: 385057


Bad Build:

51.0.2702.0      Base Position: 385602

======================================

Able to repro this issue on Windows 7, MAC (10.11.5) & Ubuntu Trusty (14.04) for the Google Chrome Stable Version - 51.0.2704.84

This is a regression issue broken in M51, below mentioned is the bisect info:

CHANGELOG URL: https://chromium.googlesource.com/chromium/src/+log/7b7b6a937cec0bd9b8e30091493001dc3db2a0a6..7af31b5cfd45ea5e9646b835645c0e493a0c879c

Suspecting Commit: 87fe5caf2ab2113388c6928c0f769525ba366d7e

Review URL: https://codereview.chromium.org/1861753002

@szager: Could you please look into the issue, and if it has nothing to do with your changes and if possible please do assign it to the concerned owner.

Thank you.
Project Member

Comment 9 by sheriffbot@chromium.org, Jun 15 2016

Labels: -M-52 M-53 MovedFrom-52
Moving this nonessential bug to the next milestone.

For more details visit https://www.chromium.org/issue-tracking/autotriage - Your friendly Sheriffbot
Status: Fixed (was: Assigned)

Sign in to add a comment