3727: Are you sure popup if textbox is open.

theo.b******@gmai***** (Google Code) (Is this you? Claim this profile.)
What version are you running?
 2.1 alpha 0 (dev)

What's the URL of the page containing the problem?

What steps will reproduce the problem?
1. Click on a textfield and edit some text
2. Click publish
3. There is a "Are you sure you want to leave this page popup"

What is the expected output? What do you see instead?
I expect it to not have a popup.

What operating system are you using? What browser?
OSX 10.10.1 
Chrome Version 39.0.2171.95 (64-bit)
#1 david
  • +EasyFix
#2 yyo****@gmai***** (Google Code) (Is this you? Claim this profile.)
I will try this.
#3 yyo****@gmai***** (Google Code) (Is this you? Claim this profile.)
I solved another easyfix, and will stop working on it. It is intermittent bug, and it doesn't always happen.
#4 kvdgulik

Working on this now

#5 brennie
  • +kvdgulik
#6 brennie
  • -kvdgulik
#7 brennie
  • -EasyFix
#8 david

Haven't seen this for a while.

  • -New
#9 mconley

I have new STR for this and can reproduce on master:

  1. Create and publish a review request
  2. View the review request page, ensuring that you have edit rights to it
  3. Click on the "Review" button to create a review for yourself
  4. Click on Publish

When the "Review" button is clicked and the dialog is brought up, we initialize the RB.ReviewDialogView, which results in us incrementing the editCount on the reviewRequestEditor for the page, right here. It's not clear why we bump the edito count for the review request editor, and not some edit count on a review editor, but that's besides the point.

So at this stage, the editCount of the reviewRequestEditor is now 1.

It looks like if you have edit rights on a review request, when clicking "Publish" for the review, we enter this block.

There is an async function queue in there, and the one that sends the "publish"ing request to the API is this one. The saveFunc in the case of publishing the review is the RB.DraftReview publish method.

Note that there's a later function in the queue that is supposed to close the dialog.

That saveFunc method, on success, triggers the 'published' event, and here's where things go awry - the RB.ReviewablePageView is listening for both the 'destroy' and the 'published' event, and when it sees them, it triggers the page reload. That means that the async function that closes the review dialog (and decrements the editCount) never runs, which means that the onbeforeunload function defined in the RB.ReviewRequestEditorView will execute and show the dialog.

  • -Fixed
  • +mconley
#10 mconley

Interestingly, I can only reproduce this in Firefox.

#11 mconley

Christian has a fix! Deferring the page location switch lets the last async function run, which will close the dialog, which will decrement the editCount.

    hideAndReload: function() {
        var url = this.model.get('parentObject').get('reviewURL');

        this.hide(function() {
            _.defer(function() {
                window.location = url;
        }, this);
  • -mconley
#12 mconley

I'm going to try to drive this through this weekend (I like Christian's solution in comment 11, so I'll probably just put that up for review and try to get it landed).

  • -chipx86
#13 brennie

The patch for this fix has landed as commit a6501e7230fc845dd1da520982f68154ac30b2b0.

  • -New