Whenever I edit my own answer, and click Save Edits, I get the dialog confirming that I want to leave the page:

It should just save my edits as I am trying to save them, not cancel them.

This is happening for me on Safari 5.1 / OSX. EDIT: Safari 6.0 now consistently reproduces this problem.

Steps to reproduce:

Answer a question.

Click "Edit" on your own answer

Make a change

Click "Save Edit"

Get alert asking if it's OK to Leave the page.

I'm not trying to leave the page, I am trying to save an edit to an answer I made.

EDIT:

It seems that I am getting a JavaScript error along with this behavior:

Type issue
Attempted to assign to readonly property.

On line 171 of full.js.

Edit: As of Safari 6.0 on July 25th it's line 178 of the minified full.js. This will impact anyone that applies security updates to Lion or installs Mountain Lion after today as Safari 6.0 ships for both OS:

Web pages really don't work the way you describe. There are some programs like Microsoft Access applications that save when you move off a record, but those are Client/Server applications. Most web pages require you to POST, which generally means pushing a button.
–
Robert HarveyJun 5 '12 at 15:42

@RobertHarvey Sorry if I am not making myself clear. Please see my edits.
–
vcsjonesJun 5 '12 at 15:44

I've never seen this error on Safari 5.1. It is easily reproducable on any Mountain Lion build of Safari as well as Safari 6 for Lion. Whether the causes of this are the same is uncertain - but with the release of Safari 6 for Lion and Mountain Lion, users are going to see a lot of this dialog as they update.
–
bmikeJul 25 '12 at 15:00

3

@balpha - I saw this before on Safari 5.1 in Lion, but only with the moderator display onscreen. On Safari 6.0 in Mountain Lion, this happens every time I try to make an edit, and as bmike said this seems to be pretty reproducible for other Mountain Lion users. With Mountain Lion rolling out today, I imagine more people will be encountering this.
–
Brad LarsonJul 25 '12 at 15:47

1

I'd try to help by debugging during the break-on-error, but I can't (grrr…)
–
PhrogzJul 25 '12 at 16:11

1 Answer
1

@Phrogz Should just be a normal string, since it comes from serialize()...though it looks like the code is mistakenly assuming it's an object.(emph. mine)

We were assigning fkey (the XSRF token) as a property to a string (the serialization of the edit form). This has three issues:

It's unnecessary, because the fkey is already included in the serialization, since it's a hidden input element of the form.

It's useless, because it doesn't do anything – you can't add properties to a string.

As you witnessed, it now breaks in Safari with strict mode. It's arguable whether it should (according to the definition of strict mode), but it does make a certain amount of sense; the purpose of strict mode is to cause things to fail loudly instead of silently.

Oh, that actually was it? I realised after the fact that my asking them to test the bare statement in the console was silly since it wouldn't have been evaluated in strict mode, heh, but didn't even think to check if the property actually took in non-strict mode. I was thrown a bit by the fact that the specification says string objects are extensible, but I suppose that isn't actually applicable for this case. Well, good that it's fixed!
–
Tim StoneJul 27 '12 at 12:00

@TimStone: String objects aren't strings though, nor the other way around. JavaScript the good parts: Not one of them.
–
balpha♦Jul 27 '12 at 12:42