Skip to content

Commit 00f113f

Browse files
author
Koen Deforche
committed
Severa changes:
- fix XSS vulnerability caused by leading space - fix nested popup widget cancelling as well as not correctly calling render() of stubbed WCompositeWidget (#3242) - make WStandardItemModel robust against header data requests outside geometry (#2408) - added missing icon files (#2312) - fixed setting text later on checkbox (#2293) - fix tooltip not showing when wrapped inside a button (#2256) - allow non-modal dialog to raise to front using titlebar click (#2167) - document limitation of WDialog::exec() + non-event thread (#976)
1 parent 7a82136 commit 00f113f

19 files changed

+110
-62
lines changed
8.57 KB
Loading
12.5 KB
Loading

src/Wt/WAbstractToggleButton

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -140,7 +140,7 @@ private:
140140

141141
WText::RichText text_;
142142

143-
bool stateChanged_, textChanged_;
143+
bool naked_, stateChanged_, textChanged_;
144144
CheckState prevState_;
145145

146146
void undoSetChecked();

src/Wt/WAbstractToggleButton.C

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ const char *WAbstractToggleButton::UNCHECKED_SIGNAL = "M_unchecked";
1919
WAbstractToggleButton::WAbstractToggleButton(WContainerWidget *parent)
2020
: WFormWidget(parent),
2121
state_(Unchecked),
22+
naked_(true),
2223
stateChanged_(false),
2324
textChanged_(false)
2425
{
@@ -29,6 +30,7 @@ WAbstractToggleButton::WAbstractToggleButton(const WString& text,
2930
WContainerWidget *parent)
3031
: WFormWidget(parent),
3132
state_(Unchecked),
33+
naked_(false),
3234
stateChanged_(false),
3335
textChanged_(false)
3436
{
@@ -298,7 +300,7 @@ void WAbstractToggleButton::updateDom(DomElement& element, bool all)
298300

299301
DomElementType WAbstractToggleButton::domElementType() const
300302
{
301-
if (!text_.text.empty())
303+
if (!naked_)
302304
return DomElement_LABEL;
303305
else
304306
return DomElement_INPUT;

src/Wt/WCompositeWidget.C

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -538,7 +538,8 @@ void WCompositeWidget::getSDomChanges(std::vector<DomElement *>& result,
538538
WApplication *app)
539539
{
540540
if (needsToBeRendered())
541-
render(impl_->isRendered() ? RenderUpdate : RenderFull);
541+
render(impl_->isRendered() || !WWebWidget::canOptimizeUpdates()
542+
? RenderUpdate : RenderFull);
542543

543544
impl_->getSDomChanges(result, app);
544545
}

src/Wt/WDialog

Lines changed: 13 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -45,15 +45,19 @@ class DialogCover;
4545
* will be connected to accept(), and in some cases a Cancel button to
4646
* reject(). This solution has the drawback that it is not scalable to
4747
* many concurrent sessions, since for every session with a recursive
48-
* event loop, a thread is locked until exec() returns. A thread that is
49-
* locked by a recursive event loop cannot be used to process requests
50-
* from another sessions. When all threads in the threadpool are locked in
51-
* recursive event loops, the server will be unresponsive to requests
52-
* from any other session. In practical terms, this means you must not
53-
* use exec(), unless your application will never be used by more
54-
* concurrent users than the amount of threads in your threadpool (like on
55-
* some intranets or extranets). \if java This functionality is only
56-
* available on Servlet 3.0 compatible servlet containers. \endif
48+
* event loop, a thread is locked until exec() returns. A thread that
49+
* is locked by a recursive event loop cannot be used to process
50+
* requests from another sessions. When all threads in the threadpool
51+
* are locked in recursive event loops, the server will be
52+
* unresponsive to requests from any other session. In practical
53+
* terms, this means you must not use exec(), unless your application
54+
* will never be used by more concurrent users than the amount of
55+
* threads in your threadpool (like on some intranets or
56+
* extranets). Using exec() is not supported from outside the regular
57+
* event loop (i.e. when taking a lock on a session using
58+
* WApplication::getUpdateLock() or by posting an event using
59+
* WServer::post()). \if java This functionality is only available on
60+
* Servlet 3.0 compatible servlet containers. \endif
5761
*
5862
* Use \link setModal() setModal(false)\endlink to create a non-modal
5963
* dialog. A non-modal dialog does not block the underlying user interface:

src/Wt/WDialog.C

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -396,6 +396,10 @@ void WDialog::render(WFlags<RenderFlag> flags)
396396
impl_->bindEmpty("center-script");
397397
}
398398

399+
if (!isModal())
400+
titleBar()->clicked()
401+
.connect("jQuery.data(" + jsRef() + ", 'obj').bringToFront");
402+
399403
if ( (flags & RenderFull) && autoFocus_)
400404
impl_->setFirstFocus();
401405

src/Wt/WInteractWidget.C

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,12 @@ WInteractWidget::~WInteractWidget()
5858
void WInteractWidget::setPopup(bool popup)
5959
{
6060
if (popup) {
61-
clicked().connect("function(o,e) { $(document).trigger('click', e); }");
61+
clicked().connect
62+
("function(o,e) { "
63+
WT_CLASS ".WPopupWidget.popupClicked = o;"
64+
"$(document).trigger('click', e);"
65+
WT_CLASS ".WPopupWidget.popupClicked = null;"
66+
"}");
6267
clicked().preventPropagation();
6368
}
6469

src/Wt/WMessageBox

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,8 +35,8 @@ class WText;
3535
* The synchronous use of a messagebox involves the use of the static
3636
* show() method, which blocks the current thread until the user has
3737
* processed the messabebox. Since this uses the WDialog::exec(), it
38-
* suffers from the same scalability issues. See documentation of
39-
* WDialog for more details.
38+
* suffers from the same scalability issues as well as
39+
* limitations. See documentation of WDialog for more details.
4040
*
4141
* \if cpp
4242
* Example code (using the exec() method, not recommended):

src/Wt/WPopupWidget.C

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -123,6 +123,7 @@ void WPopupWidget::defineJS()
123123
LOAD_JAVASCRIPT(app, "js/WPopupWidget.js", "WPopupWidget", wtjs1);
124124

125125
WStringStream jsObj;
126+
126127
jsObj << "new " WT_CLASS ".WPopupWidget("
127128
<< app->javaScriptClass() << ',' << jsRef() << ','
128129
<< transient_ << ',' << autoHideDelay_ << ','

0 commit comments

Comments
 (0)