dom/base/test/test_orientation_sandbox_no_lock.html
author Nicholas Nethercote <nnethercote@mozilla.com>
Mon, 05 Oct 2015 16:59:32 -0700
changeset 301715 3897da20e42dec0bcf73987af1eaac4f8ce950b8
parent 292631 be65c38abed995c7975383836c87df21ac02bcc7
child 376939 7b434711753b98a87603453caaa0945791ffe12b
permissions -rw-r--r--
Bug 1211324 (part 3) - Remove GraphicsFilter::FILTER_FAST and replace it with FILTER_BEST. r=mattwoodrow. This may sound like an odd change but it's what the current code effectively already does due to the way ToFilter() and ThebesFilter() are defined.

<!DOCTYPE html>
<meta charset="utf-8">
<title>Test for ScreenOrientation API</title>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="orientationcommon.js"></script>
<div id="log"></div>
<iframe sandbox="allow-scripts" id="frame"></iframe>
<script>
async_test(function(t) {
  var originalOrientation = screen.orientation.type;
  var alternateOrientation = originalOrientation == "portrait-primary" ?
    "landscape-primary" : "portrait-primary";

  var orientationChanges = [];
  window.screen.orientation.onchange = function() {
    orientationChanges.push(screen.orientation.type);
  };

  window.addEventListener("message", function(event) {
    t.step(function() {
      assert_equals(event.data, "error");
      assert_array_equals(orientationChanges, []);
      t.done();
    });
  }, false);

  var frame = document.getElementById("frame");
  frame.src = "http://example.com/tests/dom/base/test/file_lock_orientation.html";

  frame.onload = function() {
    assert_array_equals(orientationChanges, []);
    frame.contentWindow.postMessage(alternateOrientation, "*");
  };
}, "Test orientation lock from within a frame without sandbox permission.");
</script>