Fixed crash with "Allow js to disable context menu" option.

See f6de3bd5a01b6f9468b0dcf32744a879e811c255
Properly returning page to its original state after rendering preview.

See #663