author Balazs Engedy <engedy@chromium.org>
Wed, 06 Mar 2019 12:35:23 +0000
changeset 464661 e1b3b233b7b817ab02f5a8b04c59e1bc0074ec1a
parent 464361 testing/web-platform/tests/orientation-event/deviceorientationevent-init.html@66b1aba3fb4372ec47986e728b1da9b32dd3d368
child 464700 e0861be8d6c0fff8066fc5fe39e720dc55524122
permissions -rw-r--r--
Bug 1529080 [wpt PR 15398] - Restrict Device{Orientation|Motion}Events to secure origins., a=testonly Automatic update from web-platform-tests Restrict Device{Orientation|Motion}Events to secure origins. Registering event handlers to `devicemotion`, `deviceorientation`, and `deviceorientationabsolute` events is still possible, but the handlers will never be invoked in non-secure browsing contexts. The following, related, interfaces are marked as [SecureContext]: -- DeviceOrientationEvent, -- DeviceMotionEvent, -- DeviceMotionEventAcceleration, -- DeviceMotionEventRotationRate. The change is gated on RestrictDeviceSensorEventsToSecureContexts, which is disabled by default, so this CL is a no-op unless the base::Feature with the same name is manually enabled. Intent to remove: https://groups.google.com/a/chromium.org/forum/#!topic/blink-dev/5yqfAXibz1I Bug: 932078 Change-Id: I9baaafd1f4483f121feadc054650c4d510a2c88d TBR: haraken@chromium.org Reviewed-on: https://chromium-review.googlesource.com/c/1473992 Commit-Queue: Balazs Engedy <engedy@chromium.org> Reviewed-by: Reilly Grant <reillyg@chromium.org> Cr-Commit-Position: refs/heads/master@{#634620} -- wpt-commits: c401bb4fdb48c7536a96d25570242444f1b6b5f0 wpt-pr: 15398

<!DOCTYPE html>
    <title>DeviceOrientationEvent attributes must be initialized properly</title>
    <meta charset='utf-8'>
    <script src="/resources/testharness.js"></script>
    <script src="/resources/testharnessreport.js"></script>
    <p>DeviceOrientationEvent attributes must be initialized properly.</p>
    <div id="log"></div>
      test(function() {
        var evt = new DeviceOrientationEvent("foo");
        assert_equals(evt.type, "foo", "type is set to \"foo\"");
        assert_equals(evt.alpha, null, "alpha is set to null");
        assert_equals(evt.beta, null, "beta is set to null");
        assert_equals(evt.gamma, null, "gamma is set to null");
        assert_false(evt.absolute, "absolute is set to false");
      }, "User created event is initialized properly with default values");

      test(function() {
        var evt = new DeviceOrientationEvent("foo", {
          alpha: 56,
          beta: -56,
          gamma: 64,
          absolute: true
        assert_equals(evt.type, "foo", "type is set to \"foo\"");
        assert_equals(evt.alpha, 56, "alpha is set to 56");
        assert_equals(evt.beta, -56, "beta is set to -56");
        assert_equals(evt.gamma, 64, "gamma is set to 64");
        assert_true(evt.absolute, "absolute is set to true");
      }, "User created event is initialized properly using a dictionary");