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

enter image description here

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:

  1. Answer a question.
  2. Click "Edit" on your own answer
  3. Make a change
  4. Click "Save Edit"
  5. 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.


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:

u[0]])},{sliding:!0});r.keyup(k);i.find("#title,.wmd-input,#tagnames,.edit-comment").keydown(function(b){if(!0===b.ctrlKey&&13==b.keyCode)return s.submit(),!1;if(27==b.keyCode)return a(),j(d),!1});s.submit(function(){var a=$(this).serialize();a.fkey=StackExchange.options.user.fkey;StackExchange.navPrevention&&StackExchange.navPrevention.stop();o.parent().addSpinner();StackExchange.helpers.disableSubmitButton(s);$.ajax({type:"POST",dataType:"json",data:a,url:s[0].action,success:function(a){if(a.success){var c=

  • 2
    Which browser are you using? – Rory Jun 5 '12 at 15:35
  • @Rory sorry, just added to question – vcsjones Jun 5 '12 at 15:35
  • 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. – user102937 Jun 5 '12 at 15:42
  • @RobertHarvey Sorry if I am not making myself clear. Please see my edits. – vcsjones Jun 5 '12 at 15:44
  • 1
    I cannot reproduce this. Anyone? – balpha Jun 5 '12 at 15:52
  • @balpha no repro for me.... – Naftali aka Neal Jun 5 '12 at 15:56
  • @balpha Not happening on Meta, just on SO main site for me. – vcsjones Jun 5 '12 at 15:56
  • The script-loading probably borked during that particular page load or something. (But do scripts ever break partially?) – BoltClock's a Unicorn Jun 5 '12 at 17:05
  • 1
    @balpha No repro for me either... – Dynamic Jun 5 '12 at 20:08
  • @balpha it came back: meta.stackexchange.com/questions/140673/… – Marc Gravell Jul 21 '12 at 19:06
  • 1
    Possibly related: github.com/github/gollum/issues/414 (but if so, makes this a beta browser issue). – Shog9 Jul 21 '12 at 21:46
  • 2
    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. – bmike Jul 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 Larson Jul 25 '12 at 15:47
  • 2
    I'd try to help by debugging during the break-on-error, but I can't (grrr…) – Phrogz Jul 25 '12 at 16:11
  • 1
    @Phrogz Hmm, in the console, if you attempt to do "".fkey = "test", do you get a similar exception? – Tim Stone Jul 25 '12 at 17:31

Tim Stone hit the nail on the head with this comment:

@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:

  1. It's unnecessary, because the fkey is already included in the serialization, since it's a hidden input element of the form.
  2. It's useless, because it doesn't do anything – you can't add properties to a string.
  3. 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.

Fixed in the next build, and cheers to Jason Salaz for his debugging help.

  • 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 Stone Jul 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
  • Right, right. Oh, JavaScript... – Tim Stone Jul 27 '12 at 12:45

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .