Merge lp:~abreu-alexandre/oxide/fix-sendMessageNoReply-crash into lp:~oxide-developers/oxide/oxide.trunk

Proposed by Alexandre Abreu
Status: Merged
Merged at revision: 999
Proposed branch: lp:~abreu-alexandre/oxide/fix-sendMessageNoReply-crash
Merge into: lp:~oxide-developers/oxide/oxide.trunk
Diff against target: 63 lines (+42/-1)
3 files modified
qt/tests/qmltests/crash/tst_bug1427828.html (+5/-0)
qt/tests/qmltests/crash/tst_bug1427828.qml (+33/-0)
shared/browser/oxide_web_frame.cc (+4/-1)
To merge this branch: bzr merge lp:~abreu-alexandre/oxide/fix-sendMessageNoReply-crash
Reviewer Review Type Date Requested Status
Chris Coulson Approve
Review via email: mp+251648@code.launchpad.net

Description of the change

Fix sendMessageNoReply crash

To post a comment you must log in.
Revision history for this message
Chris Coulson (chrisccoulson) :
review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== added file 'qt/tests/qmltests/crash/tst_bug1427828.html'
--- qt/tests/qmltests/crash/tst_bug1427828.html 1970-01-01 00:00:00 +0000
+++ qt/tests/qmltests/crash/tst_bug1427828.html 2015-03-03 20:04:33 +0000
@@ -0,0 +1,5 @@
1<html>
2<body>
3 <iframe src="about:blank"></iframe>
4</body>
5</html>
06
=== added file 'qt/tests/qmltests/crash/tst_bug1427828.qml'
--- qt/tests/qmltests/crash/tst_bug1427828.qml 1970-01-01 00:00:00 +0000
+++ qt/tests/qmltests/crash/tst_bug1427828.qml 2015-03-03 20:04:33 +0000
@@ -0,0 +1,33 @@
1import QtQuick 2.0
2import QtTest 1.0
3import com.canonical.Oxide 1.0
4import com.canonical.Oxide.Testing 1.0
5
6TestWebView {
7 id: webView
8 focus: true
9 width: 200
10 height: 200
11
12 TestCase {
13 id: test
14 name: "bug1427828"
15 when: windowShown
16
17 function test_bug1427828() {
18 webView.url = "http://testsuite/tst_bug1427828.html";
19 verify(webView.waitForLoadSucceeded(),
20 "Timed out waiting for successful load");
21
22 webView.rootFrame.childFrames[0].sendMessageNoReply(
23 "oxide://testutils/", "DONT-RESPOND", {});
24
25 webView.rootFrame.sendMessageNoReply(
26 "oxide://testutils/", "DONT-RESPOND", {});
27
28 webView.url = "about:blank";
29 verify(webView.waitForLoadSucceeded(),
30 "Timed out waiting for successful load");
31 }
32 }
33}
034
=== modified file 'shared/browser/oxide_web_frame.cc'
--- shared/browser/oxide_web_frame.cc 2015-01-16 22:46:17 +0000
+++ shared/browser/oxide_web_frame.cc 2015-03-03 20:04:33 +0000
@@ -218,7 +218,10 @@
218 std::find(current_script_message_requests_.begin(),218 std::find(current_script_message_requests_.begin(),
219 current_script_message_requests_.end(),219 current_script_message_requests_.end(),
220 req);220 req);
221 DCHECK(it != current_script_message_requests_.end());221 if (it == current_script_message_requests_.end()) {
222 // can happen for non "persisted" requests e.g. SendMessageNoReply
223 return;
224 }
222225
223 if (!destroyed_) {226 if (!destroyed_) {
224 current_script_message_requests_.erase(it);227 current_script_message_requests_.erase(it);

Subscribers

People subscribed via source and target branches