From f709decd9398c7519fd899ea8d7ca40cd8e4666f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20M=C3=BCllner?= Date: Wed, 23 Aug 2017 09:10:24 +0200 Subject: [PATCH 1/3] fix($$RAFProvider): prevent a JavaScript error in Firefox Firefox raises a Javascript Error "TypeError: 'requestAnimationFrame' called on an object that does not implement interface Window." with animated elements. This is because Window.requestAnimationFrame() is called without binding to a Window instance in the function which is returned from $$RAFProvider(). --- src/ng/raf.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/ng/raf.js b/src/ng/raf.js index ed0676631116..088f0be75967 100644 --- a/src/ng/raf.js +++ b/src/ng/raf.js @@ -13,9 +13,9 @@ function $$RAFProvider() { //rAF var rafSupported = !!requestAnimationFrame; var raf = rafSupported ? function(fn) { - var id = requestAnimationFrame(fn); + var id = requestAnimationFrame.bind($window, fn); return function() { - cancelAnimationFrame(id); + cancelAnimationFrame.bind($window, id); }; } : function(fn) { From 10e8e4886e129902e911b5687c2f8f39869cb9b0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20M=C3=BCllner?= Date: Wed, 23 Aug 2017 10:22:00 +0200 Subject: [PATCH 2/3] Address reviewer's comments --- src/ng/raf.js | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/src/ng/raf.js b/src/ng/raf.js index 088f0be75967..f0f37f8abbad 100644 --- a/src/ng/raf.js +++ b/src/ng/raf.js @@ -13,10 +13,8 @@ function $$RAFProvider() { //rAF var rafSupported = !!requestAnimationFrame; var raf = rafSupported ? function(fn) { - var id = requestAnimationFrame.bind($window, fn); - return function() { - cancelAnimationFrame.bind($window, id); - }; + var id = requestAnimationFrame.call($window, fn); + return cancelAnimationFrame.bind($window, id); } : function(fn) { var timer = $timeout(fn, 16.66, false); // 1000 / 60 = 16.666 From fa793489933a9f29aeb523ce062573849a3e989d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20M=C3=BCllner?= Date: Mon, 28 Aug 2017 15:32:31 +0200 Subject: [PATCH 3/3] Minimal example to showcase bug. --- test/extension/manifest.json | 15 +++++++++++++++ test/extension/test.js | 9 +++++++++ 2 files changed, 24 insertions(+) create mode 100644 test/extension/manifest.json create mode 100644 test/extension/test.js diff --git a/test/extension/manifest.json b/test/extension/manifest.json new file mode 100644 index 000000000000..6fd03c0594cd --- /dev/null +++ b/test/extension/manifest.json @@ -0,0 +1,15 @@ +{ + "description": "Test extension for angular.js", + "manifest_version": 2, + "name": "Angular test", + "version": "1.0", + "content_scripts": [ + { + "matches": ["https://www.google.ch/*"], + "js": [ + "angular.js", + "test.js"] + } + ] + +} diff --git a/test/extension/test.js b/test/extension/test.js new file mode 100644 index 000000000000..cb976ad7c661 --- /dev/null +++ b/test/extension/test.js @@ -0,0 +1,9 @@ +var html = document.querySelector('html'); +html.setAttribute('ng-app', ''); + +var buttonDiv = document.createElement('div'); +buttonDiv.setAttribute('ng-show', 'true'); +buttonDiv.innerHTML = 'Hello!'; + +var hplogo = document.getElementById('hplogo'); +hplogo.insertBefore(buttonDiv, hplogo.childNodes[0]);