contextual menus not working in the webapp container

Bug #1323735 reported by Bill Filler
12
This bug affects 1 person
Affects Status Importance Assigned to Milestone
The Webapps-core project
Invalid
High
Unassigned
unity-webapps-qml
Fix Released
High
Olivier Tilloy
webbrowser-app
Fix Released
High
Olivier Tilloy
unity-webapps-qml (Ubuntu)
Fix Released
Undecided
Unassigned
webbrowser-app (Ubuntu)
Fix Released
High
Olivier Tilloy

Bug Description

- open twitter webapp and sign on
- go to home view that shows tweets from people you are following
- try and press and hold on any links in the tweets

Expected results:
- a popup menu is displayed with options to open link in new tab, copy link, etc

Actual results:
- no popup menu

Note, this works correctly if loading twitter in browser but just not from webapp

Tags: rtm14

Related branches

Bill Filler (bfiller)
Changed in webbrowser-app:
importance: Undecided → High
Changed in webapps-core:
importance: Undecided → High
Changed in webbrowser-app (Ubuntu):
importance: Undecided → High
tags: added: rtm14
Bill Filler (bfiller)
Changed in webbrowser-app:
assignee: nobody → Olivier Tilloy (osomon)
Changed in webbrowser-app (Ubuntu):
assignee: nobody → Olivier Tilloy (osomon)
Revision history for this message
Olivier Tilloy (osomon) wrote :

I did a bit of preliminary investigation, and I’m not even seeing the contextmenu event being emitted when using the webapp (as noted in the bug’s description, it works in the browser app).

On desktop, right click on a link on twitter.com in the container brings up the contextual menu, so the issue seems to be touch-specific.

Changed in webbrowser-app:
status: New → Confirmed
Changed in webbrowser-app (Ubuntu):
status: New → Confirmed
Revision history for this message
Olivier Tilloy (osomon) wrote :

It might be that twitter on touch inhibits the contextmenu event, in which case there wouldn’t be much we can do about it.

Revision history for this message
Olivier Tilloy (osomon) wrote :

Scratch the previous comment, if it was the case then it wouldn’t work in the plain webbrowser-app, but it does.

Note that the gmail webapp is affected too, so it looks like the issue might be in the webapp-container.

Revision history for this message
Olivier Tilloy (osomon) wrote :

I can confirm that the issue is not specific to a given webapp, it seems to be in the container itself.
Tested by launching webapp-container directly on the device with any URL as a parameter, and verified that no contextual menu ever shows.

Revision history for this message
Olivier Tilloy (osomon) wrote :

The contextmenu event is received on the javascript side, but the message it sends to the webview (using oxide.sendMessage(…)) doesn’t seem to get through.

Olivier Tilloy (osomon)
summary: - popup menus not working on twitter webapp
+ contextual menus not working in the webapp container
Revision history for this message
Olivier Tilloy (osomon) wrote :

The scroll event (confirmed to be received on the JS side) that also triggers a call to oxide.sendMessage(…) doesn’t get through either, so there is a condition that makes oxide.sendMessage() fail when ran in the context of webapp-container.

Revision history for this message
Olivier Tilloy (osomon) wrote :

Also tested with a sample QML app (confined) that instantiates a WebView and defines custom contextualActions, and the context menu shows up as expected, so the issue seems restricted to webapp-container only.

Revision history for this message
Olivier Tilloy (osomon) wrote :

I found the culprit: UnityWebAppsUtils.js (from the unity-webapps-qml package) does this:

        var script = 'import com.canonical.Oxide 1.0 as Oxide; ' +
                ' Oxide.ScriptMessageHandler { msgId: "UnityWebappApi-Message"; contexts: ["' +
                this._WEBAPPS_USER_SCRIPT_CONTEXT +
                '"]; ' +
                '}';
        var messageHandler = Qt.createQmlObject(script, this.webview);
        messageHandler.callback = handler;
        this.webview.messageHandlers = [ messageHandler ];

So it effectively overrides the webview’s existing message handlers.

Olivier Tilloy (osomon)
Changed in unity-webapps-qml:
assignee: nobody → Alexandre Abreu (abreu-alexandre)
importance: Undecided → High
status: New → Confirmed
Olivier Tilloy (osomon)
Changed in unity-webapps-qml:
assignee: Alexandre Abreu (abreu-alexandre) → Olivier Tilloy (osomon)
status: Confirmed → In Progress
Bill Filler (bfiller)
Changed in webbrowser-app:
milestone: none → feature-freeze
Revision history for this message
Launchpad Janitor (janitor) wrote :

This bug was fixed in the package unity-webapps-qml - 0.1+14.10.20140620-0ubuntu1

---------------
unity-webapps-qml (0.1+14.10.20140620-0ubuntu1) utopic; urgency=low

  [ Ubuntu daily release ]
  * New rebuild forced

  [ Olivier Tilloy ]
  * Do not override existing message handlers. Oxide has this nice
    feature that it automatically attaches the instantiated message
    handler to the webview anyway, so this line was useless. (LP:
    #1323735)
 -- Ubuntu daily release <email address hidden> Fri, 20 Jun 2014 09:37:13 +0000

Changed in unity-webapps-qml (Ubuntu):
status: New → Fix Released
Olivier Tilloy (osomon)
Changed in webbrowser-app:
status: Confirmed → Fix Released
Changed in webbrowser-app (Ubuntu):
status: Confirmed → Fix Released
Changed in unity-webapps-qml:
status: In Progress → Fix Released
Changed in webapps-core:
status: New → Invalid
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Duplicates of this bug

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.