1
0
Fork 0
mirror of https://github.com/thoughtbot/capybara-webkit synced 2023-03-27 23:22:28 -04:00

Null-terminate the embedded capybara.js resource string

This commit is contained in:
Jason Morrison 2011-02-26 14:22:38 -05:00
parent 3f519cd147
commit 2a7d49d503

View file

@ -7,7 +7,11 @@ WebPage::WebPage(QObject *parent) : QWebPage(parent) {
connect(mainFrame(), SIGNAL(javaScriptWindowObjectCleared()),
this, SLOT(injectJavascriptHelpers()));
QResource javascript(":/capybara.js");
m_capybaraJavascript = QString((const char *) javascript.data());
char * javascriptString = new char[javascript.size() + 1];
strcpy(javascriptString, (const char *)javascript.data());
javascriptString[javascript.size()] = 0;
m_capybaraJavascript = javascriptString;
delete javascriptString;
}
void WebPage::injectJavascriptHelpers() {