Playground no longer works in Firefox

Playground no longer works for me, the window stays gray. I'm not exactly sure when and why this happened, maybe it is due to tightened security in some Firefox update in the last week or so. In the console I set the following security error:

SecurityError: The operation is insecure. 80926032aeb3aae9d0ff.js:1

334 https://play.rust-lang.org/assets/80926032aeb3aae9d0ff.js:1:27328
i https://play.rust-lang.org/assets/80926032aeb3aae9d0ff.js:1:514
176 https://play.rust-lang.org/assets/80926032aeb3aae9d0ff.js:1:7657
i https://play.rust-lang.org/assets/80926032aeb3aae9d0ff.js:1:514
n https://play.rust-lang.org/assets/80926032aeb3aae9d0ff.js:1:387
<anonymous> https://play.rust-lang.org/assets/80926032aeb3aae9d0ff.js:1:3269
<anonymous> https://play.rust-lang.org/assets/80926032aeb3aae9d0ff.js:1:2

Hope this helps.

You should file a bug.

1 Like

Ok, done:
https://github.com/integer32llc/rust-playground/issues/431

1 Like

I don't understand why visiting some .js file under the playground domain should open a valid Rust playground instance?

As an aside, when I visit the playground with Firefox, I do not encounter any issue, even now.

I also cannot reproduce the issue, using Firefox 63.0.3 under Linux.

I use the same link https://play.rust-lang.org/ .
The .js links above occurred in the error message. I have no idea what they do, looks like some obfuscated code to me.

It turned out that cookies were the culprit.
Some change in playground causes cookies to be set, and by default that is forbidden in my Firefox.
Cookies are a privacy risk, and it is a nuisance to allow them, so please use them only when strictly necessary.

I may be wrong, but I think that the playground uses cookies to persist source code between sessions.

I still think it's a bug that the JS does not handle this gracefully.

I checked that it now works with cookies and storage blocked.
Thanks for fixing it so quickly!

Except now it's broken for people who have cookies enabled :unamused:

1 Like

Yep, still broken. I tried both, enabling and disabling cookies. Both do not work.

Doesn't work with chronium 70 too :confused:

2 Likes

Not obfuscated, minimized

As mentioned on the issue, the playground does not use cookies, but it does use local and session storage. Firefox (and maybe other browsers) treat local storage and session storage differently when very locked down. Specifically, window.localStorage exists, but calling methods on it will fail. window.sessionStorage straight up doesn't exist at all.

Yes, as well as all the configuration options:

The recent change that added session storage additionally stores the code and last-chosen build mode in session storage, allowing for per-tab code storage.

:sob:

(missing) null checks are the bane of my existence. I'm guiding the fix through CI now.

1 Like

The fix has been pushed; because the playground has stronger caching, you will either need to wait 24h or force a reload of the page.

4 Likes

Now that WASM is a thing, wouldn't it be feasible to just port the playground to Rust/WASM?

You are welcome to contribute a working solution.

I now have Emacs mode and Rust Edition 2018 set persistently, neat.
Thanks again for your hard work!

2 Likes

Hmm, that shouldn't be a persistent setting. It is based on the original URL though, so you could bookmark the playground with ?edition=2018.

I just assumed it would be persistent, but it isn't.

It seems you currently need to set beta or nightly, too, e.g. Rust Playground