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
1=== added file 'qt/tests/qmltests/crash/tst_bug1427828.html'
2--- qt/tests/qmltests/crash/tst_bug1427828.html 1970-01-01 00:00:00 +0000
3+++ qt/tests/qmltests/crash/tst_bug1427828.html 2015-03-03 20:04:33 +0000
4@@ -0,0 +1,5 @@
5+<html>
6+<body>
7+ <iframe src="about:blank"></iframe>
8+</body>
9+</html>
10
11=== added file 'qt/tests/qmltests/crash/tst_bug1427828.qml'
12--- qt/tests/qmltests/crash/tst_bug1427828.qml 1970-01-01 00:00:00 +0000
13+++ qt/tests/qmltests/crash/tst_bug1427828.qml 2015-03-03 20:04:33 +0000
14@@ -0,0 +1,33 @@
15+import QtQuick 2.0
16+import QtTest 1.0
17+import com.canonical.Oxide 1.0
18+import com.canonical.Oxide.Testing 1.0
19+
20+TestWebView {
21+ id: webView
22+ focus: true
23+ width: 200
24+ height: 200
25+
26+ TestCase {
27+ id: test
28+ name: "bug1427828"
29+ when: windowShown
30+
31+ function test_bug1427828() {
32+ webView.url = "http://testsuite/tst_bug1427828.html";
33+ verify(webView.waitForLoadSucceeded(),
34+ "Timed out waiting for successful load");
35+
36+ webView.rootFrame.childFrames[0].sendMessageNoReply(
37+ "oxide://testutils/", "DONT-RESPOND", {});
38+
39+ webView.rootFrame.sendMessageNoReply(
40+ "oxide://testutils/", "DONT-RESPOND", {});
41+
42+ webView.url = "about:blank";
43+ verify(webView.waitForLoadSucceeded(),
44+ "Timed out waiting for successful load");
45+ }
46+ }
47+}
48
49=== modified file 'shared/browser/oxide_web_frame.cc'
50--- shared/browser/oxide_web_frame.cc 2015-01-16 22:46:17 +0000
51+++ shared/browser/oxide_web_frame.cc 2015-03-03 20:04:33 +0000
52@@ -218,7 +218,10 @@
53 std::find(current_script_message_requests_.begin(),
54 current_script_message_requests_.end(),
55 req);
56- DCHECK(it != current_script_message_requests_.end());
57+ if (it == current_script_message_requests_.end()) {
58+ // can happen for non "persisted" requests e.g. SendMessageNoReply
59+ return;
60+ }
61
62 if (!destroyed_) {
63 current_script_message_requests_.erase(it);

Subscribers

People subscribed via source and target branches