Rule 63.4 of the NHL rulebook, introduced following the Florida Panthers
'Rat Trick':
Objects Thrown on the Ice – In the event that objects are thrown on the ice that interfere with the progress of the game, the Referee shall blow the whistle and stop the play and the puck shall be faced-off at a face-off spot in the zone nearest to the spot where play is stopped. When objects are thrown on the ice during a stoppage in play, including after the scoring of a goal, the Referee shall have announced over the public address system that any further occurrences will result in a bench minor penalty being assessed to the home Team. Articles thrown onto the ice following a special occasion (i.e. hat trick) will not result in a bench minor penalty being assessed. Refer also to Rule 53.6 when spectator interference occurs during a breakaway.
So it's a nearly 20 year old rule. Just most fanbases that do something like that by now have learned to do it at the end of a game, so it's not going to come up that often.