A good solution would be to remove an invalid item, and the function should silently try to remove the invalid item, but still allow passage. For some reason, even when you have the green key, but try to remove an invalid item, it still doesn't let you through, despite apparently returning false (passable).
Additionally it doesn't support injection there, so while "player.removeItem('greenKey'); player.additem('greenKey');" should work, it says "TypeError: undefined is not a function".
Basically, this let's you delete the green item once. After that, it makes sure that return true is never reached (because of the 1==1), so next passages through green are allowed. Kinda liked the sneaky (''); myself :P