Fix `document.context` being undefined

Also, add the `options` definition and add a special case for expiry date being -1 (seemed necessary on Chrome Canary but possibly redundant).