message: test: Provide test coverage for rAF callback context preservation
diff: @@ -64,7 +64,8 @@ describe("wrapped built-ins", function() {
  });
  });
  - it("should capture exceptions inside requestAnimationFrame", function() {
  + describe("requestAnimationFrame", function() {
  + it("should capture exceptions inside callback", function() {
  // needs to be visible or requestAnimationFrame won't ever fire
  sandbox.style.display = "block";
  @@ -78,6 +79,60 @@ describe("wrapped built-ins", function() {
  });
  });
  + it("wrapped callback should preserve correct context - window (not-bound)", function() {
  + // needs to be visible or requestAnimationFrame won't ever fire
  + sandbox.style.display = "block";
  + return runInSandbox(sandbox, { manual: true }, function() {
  + requestAnimationFrame(function() {
  + window.capturedCtx = this;
  + window.finalizeManualTest();
  + });
  + }).then(function(summary) {
  + assert.strictEqual(summary.window.capturedCtx, summary.window);
  + delete summary.window.capturedCtx;
  + });
  + });
  +
  + it("wrapped callback should preserve correct context - class bound method", function() {
  + // needs to be visible or requestAnimationFrame won't ever fire
  + sandbox.style.display = "block";
  + return runInSandbox(sandbox, { manual: true }, function() {
  + // TypeScript-transpiled class syntax
  + var Foo = (function() {
  + function Foo() {
  + var _this = this;
  + this.magicNumber = 42;
  + this.getThis = function() {
  + window.capturedCtx = _this;
  + window.finalizeManualTest();
  + };
  + }
  + return Foo;
  + })();
  + var foo = new Foo();
  + requestAnimationFrame(foo.getThis);
  + }).then(function(summary) {
  + assert.strictEqual(summary.window.capturedCtx.magicNumber, 42);
  + delete summary.window.capturedCtx;
  + });
  + });
  +
  + it("wrapped callback should preserve correct context - `bind` bound method", function() {
  + // needs to be visible or requestAnimationFrame won't ever fire
  + sandbox.style.display = "block";
  + return runInSandbox(sandbox, { manual: true }, function() {
  + function foo() {
  + window.capturedCtx = this;
  + window.finalizeManualTest();
  + }
  + requestAnimationFrame(foo.bind({ magicNumber: 42 }));
  + }).then(function(summary) {
  + assert.strictEqual(summary.window.capturedCtx.magicNumber, 42);
  + delete summary.window.capturedCtx;
  + });
  + });
  + });
  +
  it("should capture exceptions from XMLHttpRequest event handlers (e.g. onreadystatechange)", function() {
  return runInSandbox(sandbox, { manual: true }, function() {
  var xhr = new XMLHttpRequest();
  