Skip to content

Commit

Permalink
fix WFileUpload JS error in certain conditions
Browse files Browse the repository at this point in the history
  • Loading branch information
Koen Deforche committed Jan 1, 2016
1 parent 946a943 commit d6daeb8
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 4 deletions.
2 changes: 0 additions & 2 deletions src/Wt/WFileUpload
Original file line number Diff line number Diff line change
Expand Up @@ -356,9 +356,7 @@ protected:
private:
void handleFileTooLarge(::int64_t fileSize);


void onUploaded();
::int64_t tooLargeSize_;

virtual void setFormData(const FormData& formData);
void setFiles(const std::vector<Http::UploadedFile>& files);
Expand Down
7 changes: 5 additions & 2 deletions src/Wt/WFileUpload.C
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,8 @@ protected:
} else if (request.tooLarge()) {
LOG_DEBUG("Resource handleRequest(): signaling file-too-large");

// FIXME this should use postMessage() all the same

std::string s = boost::lexical_cast<std::string>(request.tooLarge());
o << fileUpload_->fileTooLarge().createCall(s);
}
Expand Down Expand Up @@ -445,8 +447,9 @@ DomElement *WFileUpload::createDomElement(WApplication *app)

std::stringstream s;

doJavaScript("var f = function(event) {"
"""if (" + jsRef() + ".action.indexOf(event.origin) === 0) {"
doJavaScript("var a" + id() + "=" + jsRef() + ".action;"
"var f = function(event) {"
"""if (a" + id() + ".indexOf(event.origin) === 0) {"
"" "var data = JSON.parse(event.data);"
"" "if (data.fu == '" + id() + "')"
+ app->javaScriptClass()
Expand Down
2 changes: 2 additions & 0 deletions src/Wt/WPopupWidget.C
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,8 @@ WPopupWidget::WPopupWidget(WWidget *impl, WObject *parent)

jsHidden_.connect(this, &WWidget::hide);
jsShown_.connect(this, &WWidget::show);

WApplication::instance()->internalPathChanged().connect(this, &WWidget::hide);
}

WPopupWidget::~WPopupWidget()
Expand Down

0 comments on commit d6daeb8

Please sign in to comment.