From b2823cbd8da9c86f37c2f883d5324279ead08310 Mon Sep 17 00:00:00 2001 From: kkapsner Date: Sun, 13 Nov 2016 14:55:42 +0100 Subject: [PATCH] Added internal type handling for getContext. Fixes #86 --- lib/modifiedAPI.js | 23 ++++++++++++++++++----- 1 file changed, 18 insertions(+), 5 deletions(-) diff --git a/lib/modifiedAPI.js b/lib/modifiedAPI.js index 874c8ea..ef5a314 100644 --- a/lib/modifiedAPI.js +++ b/lib/modifiedAPI.js @@ -79,11 +79,24 @@ exports.changedFunctions = { getContext: { getStatus: function(obj, status){ - return { - mode: hasType(status, "block")? "block": "fake", - type: status.type, - active: true - }; + if (hasType(status, "internal")){ + return { + mode: "allow", + type: status.type, + active: false + } + } + else if (hasType(status, "context") || hasType(status, "input")){ + return { + mode: (status.mode === "block")? "block": "fake", + type: status.type, + active: true + }; + } + else { + status.active = false; + return status; + } }, object: "HTMLCanvasElement", fakeGenerator: function(prefs, notify){