Correctly trim notifications with special characters.

JSON.stringify escapes escaping chars. Notification.prototype.trim did not consider this anomaly. This commit precisely calculates the to be trimmed substring of notifications with special characters.