Skip to content

Commit

Permalink
[FIX] point_of_sale: prevent crashes on older iOS devices
Browse files Browse the repository at this point in the history
On older iOS devices (like the iPad 2) webkit would crash when clicking
on the closing button. Newer devices like the iPad Air 2 and iPad Mini 3
do not exhibit this behavior. This occurs on iOS 9.2.1 but I expect iOS
in general is affected by this. This affects both Safari and Chrome as
on iOS they both use the same rendering engine.

When the POS closes it searches the xml_id containing the action ID,
which seems to trigger the webkit crash. So instead we will use the
xml_id directly in the URL, that's simpler anyway and it avoids an
unnecessary RPC call. Functionally this means you won't get the 'Your
internet connection is probably down' message anymore, but it's useless
anyway, as after closing the popup the webpage is blocked anyway.

A log of the crash can sometimes be seen in the iOS diagnostics logs
which indicates com.apple.WebKit.WebContent crashing due to
EXC_BAD_ACCESS (SIGSEGV). This log is not always present, but that's not
unusual for out of memory issues on iOS [1]. Presumably the segmentation
fault is caused by iOS forcefully freeing memory being used by the
browser.

iOS manages memory in an unusual way. Plenty of developer reports are
available online which indicate this [2], but no official documentation
from Apple exists that specifies exact memory limit amounts.

[1] http://stackoverflow.com/questions/16400431/ios-app-crashes-with-no-error-and-no-crash-report
[2] http://stackoverflow.com/questions/16319486/ios-ipad-has-1gb-ram-why-is-my-app-killed-after-using-30mb

opw-668268
  • Loading branch information
jorenvo committed Mar 4, 2016
1 parent 14fdabb commit 7ec5db2
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 25 deletions.
14 changes: 0 additions & 14 deletions addons/point_of_sale/i18n/point_of_sale.pot
Original file line number Diff line number Diff line change
Expand Up @@ -1127,13 +1127,6 @@ msgstr ""
msgid "Could Not Read Image"
msgstr ""

#. module: point_of_sale
#. openerp-web
#: code:addons/point_of_sale/static/src/js/gui.js:342
#, python-format
msgid "Could not close the point of sale."
msgstr ""

#. module: point_of_sale
#. openerp-web
#: code:addons/point_of_sale/static/src/xml/pos.xml:328
Expand Down Expand Up @@ -4294,13 +4287,6 @@ msgstr ""
msgid "Your ending balance is too different from the theoretical cash closing (%.2f), the maximum allowed is: %.2f. You can contact your manager to force it."
msgstr ""

#. module: point_of_sale
#. openerp-web
#: code:addons/point_of_sale/static/src/js/gui.js:343
#, python-format
msgid "Your internet connection is probably down."
msgstr ""

#. module: point_of_sale
#. openerp-web
#: code:addons/point_of_sale/static/src/xml/pos.xml:1125
Expand Down
12 changes: 1 addition & 11 deletions addons/point_of_sale/static/src/js/gui.js
Original file line number Diff line number Diff line change
Expand Up @@ -335,17 +335,7 @@ var Gui = core.Class.extend({
this.chrome.loading_message(_t('Closing ...'));

this.pos.push_order().then(function(){
return new Model("ir.model.data").get_func("search_read")([['name', '=', 'action_client_pos_menu']], ['res_id'])
.pipe(function(res) {
window.location = '/web' + ((session.debug)? '?debug' : '') + '#action=' + res[0]['res_id'];
},function(err,event) {
event.preventDefault();
self.show_popup('error',{
'title': _t('Could not close the point of sale.'),
'body': _t('Your internet connection is probably down.'),
});
self.chrome.widget.close_button.renderElement();
});
window.location = '/web' + ((session.debug)? '?debug' : '') + '#action=point_of_sale.action_client_pos_menu';
});
},

Expand Down

0 comments on commit 7ec5db2

Please sign in to comment.