Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(196)

Issue 2492623002: Implementation for feature policy - vibrate. (Closed)

Created:
4 years, 1 month ago by lunalu1
Modified:
3 years, 11 months ago
CC:
blink-reviews, chromium-reviews, igrigorik, mlamouri+watch-blink_chromium.org, mvanouwerkerk+watch_chromium.org, raymes
Target Ref:
refs/pending/heads/master
Project:
chromium
Visibility:
Public.

Description

Implementation for feature policy - vibrate. Disable Navigator.vibrate() unless enabled through feature policy. Added tests with runtime flag is on Also modified IsFeatureEnabledInFrame for the case EnableForSelf, should only be enabled when with same origin. BUG=623682 Committed: https://crrev.com/11eca67f18be0dfbfcb1703a21abb454e5f85b05 Cr-Commit-Position: refs/heads/master@{#434423}

Patch Set 1 : Initial check in #

Patch Set 2 : Added runtime flag check for FeaturePolicy #

Patch Set 3 : Added virtual test when runtime flag FeaturePolicy is turned on #

Total comments: 3

Patch Set 4 : Codereview update #

Total comments: 2

Patch Set 5 : Added layout tests for vibrate with runtime flag turned on #

Total comments: 15

Patch Set 6 : Codereview update -- added layout tests #

Total comments: 1

Patch Set 7 : Update layout test result #

Total comments: 2
Unified diffs Side-by-side diffs Delta from patch set Stats (+233 lines, -7 lines) Patch
M third_party/WebKit/LayoutTests/VirtualTestSuites View 1 2 3 4 5 1 chunk +5 lines, -0 lines 0 comments Download
A third_party/WebKit/LayoutTests/http/tests/feature-policy/resources/feature-policy-vibrate-disabled.html View 1 2 3 4 5 1 chunk +11 lines, -0 lines 0 comments Download
A third_party/WebKit/LayoutTests/http/tests/feature-policy/resources/feature-policy-vibrate-enabled.html View 1 2 3 4 5 1 chunk +11 lines, -0 lines 0 comments Download
A third_party/WebKit/LayoutTests/http/tests/feature-policy/vibrate-disabled.php View 1 2 3 4 5 6 1 chunk +28 lines, -0 lines 0 comments Download
A third_party/WebKit/LayoutTests/http/tests/feature-policy/vibrate-disabled-expected.txt View 1 2 3 4 5 6 1 chunk +17 lines, -0 lines 0 comments Download
A third_party/WebKit/LayoutTests/http/tests/feature-policy/vibrate-enabledforall.php View 1 2 3 4 5 6 1 chunk +28 lines, -0 lines 0 comments Download
A third_party/WebKit/LayoutTests/http/tests/feature-policy/vibrate-enabledforall-expected.txt View 1 2 3 4 5 6 1 chunk +17 lines, -0 lines 0 comments Download
A third_party/WebKit/LayoutTests/http/tests/feature-policy/vibrate-enabledforself.php View 1 2 3 4 5 6 1 chunk +28 lines, -0 lines 0 comments Download
A third_party/WebKit/LayoutTests/http/tests/feature-policy/vibrate-enabledforself-expected.txt View 1 2 3 4 5 6 1 chunk +17 lines, -0 lines 0 comments Download
A third_party/WebKit/LayoutTests/virtual/feature-policy/http/tests/feature-policy/README.txt View 1 2 1 chunk +1 line, -0 lines 0 comments Download
A third_party/WebKit/LayoutTests/virtual/feature-policy/http/tests/feature-policy/vibrate-disabled-expected.txt View 1 2 3 4 5 6 1 chunk +18 lines, -0 lines 0 comments Download
A third_party/WebKit/LayoutTests/virtual/feature-policy/http/tests/feature-policy/vibrate-enabledforall-expected.txt View 1 2 3 4 5 6 1 chunk +17 lines, -0 lines 0 comments Download
A third_party/WebKit/LayoutTests/virtual/feature-policy/http/tests/feature-policy/vibrate-enabledforself-expected.txt View 1 2 3 4 5 6 1 chunk +17 lines, -0 lines 0 comments Download
A third_party/WebKit/LayoutTests/virtual/feature-policy/http/tests/feature-policy/vibrate_in_cross_origin_iframe_blocked-expected.txt View 1 2 3 1 chunk +2 lines, -0 lines 0 comments Download
M third_party/WebKit/Source/bindings/core/v8/ConditionalFeatures.cpp View 1 2 3 4 5 1 chunk +3 lines, -1 line 1 comment Download
M third_party/WebKit/Source/modules/vibration/NavigatorVibration.cpp View 1 2 3 4 2 chunks +13 lines, -6 lines 1 comment Download

Messages

Total messages: 122 (102 generated)
lunalu1
Hi Ian, Could you please take a look at this CL? Thanks
4 years, 1 month ago (2016-11-15 21:40:25 UTC) #20
iclelland
This is looking good, thanks! The test HTML file shouldn't be moved into the virtual ...
4 years, 1 month ago (2016-11-16 15:25:12 UTC) #21
iclelland
https://codereview.chromium.org/2492623002/diff/60001/third_party/WebKit/LayoutTests/virtual/feature-policy/http/tests/feature-policy/vibrate_in_cross_origin_iframe_blocked-expected.txt File third_party/WebKit/LayoutTests/virtual/feature-policy/http/tests/feature-policy/vibrate_in_cross_origin_iframe_blocked-expected.txt (right): https://codereview.chromium.org/2492623002/diff/60001/third_party/WebKit/LayoutTests/virtual/feature-policy/http/tests/feature-policy/vibrate_in_cross_origin_iframe_blocked-expected.txt#newcode2 third_party/WebKit/LayoutTests/virtual/feature-policy/http/tests/feature-policy/vibrate_in_cross_origin_iframe_blocked-expected.txt:2: this frame. You're going to want to un-wrap this ...
4 years, 1 month ago (2016-11-16 15:27:04 UTC) #22
lunalu1
Thanks. I made the changes based on your comments. Please take a look. https://codereview.chromium.org/2492623002/diff/60001/third_party/WebKit/LayoutTests/virtual/feature-policy/http/tests/feature-policy/vibrate_in_cross_origin_iframe_blocked-expected.txt File ...
4 years, 1 month ago (2016-11-16 16:24:25 UTC) #32
lunalu1
binlu@ FYI, we are removing cross-origin vibrate with navigator.vibrate() to feature-policy haraken@, could you please ...
4 years, 1 month ago (2016-11-16 20:51:33 UTC) #42
raymes
Cool and exciting! :) Do we want to add a test which verifies that enabling ...
4 years, 1 month ago (2016-11-16 23:21:08 UTC) #47
haraken
bindings/ and modules/ LGTM, but please wait for an approval of raymes or iclelland.
4 years, 1 month ago (2016-11-17 06:01:24 UTC) #48
lunalu1
Made the changes. Please take another look. Thanks https://codereview.chromium.org/2492623002/diff/160001/third_party/WebKit/Source/modules/vibration/NavigatorVibration.cpp File third_party/WebKit/Source/modules/vibration/NavigatorVibration.cpp (right): https://codereview.chromium.org/2492623002/diff/160001/third_party/WebKit/Source/modules/vibration/NavigatorVibration.cpp#newcode95 third_party/WebKit/Source/modules/vibration/NavigatorVibration.cpp:95: } ...
4 years, 1 month ago (2016-11-17 21:47:20 UTC) #59
iclelland
I've added some comments to the tests -- The code looks good, and I think ...
4 years, 1 month ago (2016-11-18 04:46:48 UTC) #62
raymes
lgtm I feel like we're going to want a really similar set of tests for ...
4 years, 1 month ago (2016-11-21 03:58:04 UTC) #63
iclelland
On 2016/11/21 03:58:04, raymes wrote: > lgtm > > I feel like we're going to ...
4 years, 1 month ago (2016-11-21 14:37:21 UTC) #64
iclelland
Looks like it's almost there -- the test expectation files just need some content now, ...
4 years, 1 month ago (2016-11-22 02:45:10 UTC) #73
lunalu1
Changes have been made. Please take another look :) Thanks https://codereview.chromium.org/2492623002/diff/200001/third_party/WebKit/LayoutTests/virtual/feature-policy/http/tests/feature-policy/resources/feature-policy-vibrate-disabled.html File third_party/WebKit/LayoutTests/virtual/feature-policy/http/tests/feature-policy/resources/feature-policy-vibrate-disabled.html (right): https://codereview.chromium.org/2492623002/diff/200001/third_party/WebKit/LayoutTests/virtual/feature-policy/http/tests/feature-policy/resources/feature-policy-vibrate-disabled.html#newcode2 ...
4 years, 1 month ago (2016-11-23 00:25:03 UTC) #98
iclelland
https://codereview.chromium.org/2492623002/diff/330001/third_party/WebKit/LayoutTests/http/tests/feature-policy/vibrate-disabled.php File third_party/WebKit/LayoutTests/http/tests/feature-policy/vibrate-disabled.php (right): https://codereview.chromium.org/2492623002/diff/330001/third_party/WebKit/LayoutTests/http/tests/feature-policy/vibrate-disabled.php#newcode24 third_party/WebKit/LayoutTests/http/tests/feature-policy/vibrate-disabled.php:24: <iframe id="f1" src="resources/feature-policy-vibrate-disabled.html"> The HTML spec says that these ...
4 years ago (2016-11-23 19:13:03 UTC) #101
lunalu1
Please take a final look before I land. Thanks
4 years ago (2016-11-24 22:05:32 UTC) #111
iclelland
LGTM -- the tests look good now, thanks!
4 years ago (2016-11-25 01:54:12 UTC) #112
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/v2/patch-status/codereview.chromium.org/2492623002/370001
4 years ago (2016-11-25 02:05:52 UTC) #115
commit-bot: I haz the power
Committed patchset #7 (id:370001)
4 years ago (2016-11-25 02:10:41 UTC) #118
commit-bot: I haz the power
Patchset 7 (id:??) landed as https://crrev.com/11eca67f18be0dfbfcb1703a21abb454e5f85b05 Cr-Commit-Position: refs/heads/master@{#434423}
4 years ago (2016-11-25 02:12:19 UTC) #120
ojan
3 years, 11 months ago (2017-01-19 01:34:30 UTC) #122
Message was sent while issue was closed.
https://codereview.chromium.org/2492623002/diff/370001/third_party/WebKit/Sou...
File third_party/WebKit/Source/bindings/core/v8/ConditionalFeatures.cpp (right):

https://codereview.chromium.org/2492623002/diff/370001/third_party/WebKit/Sou...
third_party/WebKit/Source/bindings/core/v8/ConditionalFeatures.cpp:81:
!frame->isCrossOriginSubframe()));
Just to complicate things, it looks like we'll be loosening the vibrate
restrictions to disallow vibrate on subframes until the first user gesture in
that frame. So, I think this code will need to be a bit more complicated. I
think we might need EnabledForCrossOriginFramesAfterGesture or something. We'll
want the same thing for top-level-navigation by subframes. 

Whether we want to expose that to web devs via FeaturePolicy is a different
question. I would say no to start with. We can later consider it if we see
developer demand for it.

https://codereview.chromium.org/2492623002/diff/370001/third_party/WebKit/Sou...
File third_party/WebKit/Source/modules/vibration/NavigatorVibration.cpp (right):

https://codereview.chromium.org/2492623002/diff/370001/third_party/WebKit/Sou...
third_party/WebKit/Source/modules/vibration/NavigatorVibration.cpp:85:
frame->localDOMWindow()->printErrorMessage(
Should this print statement be part of FeaturePolicy itself, e.g. if the
top-level page disables something in a subframe and then that subframe uses it,
should we log to the console?

Powered by Google App Engine
This is Rietveld 408576698