Commit graph

14 commits

Author SHA1 Message Date
Michael James Gratton
473a0b8859 Fix some warnings showing up when compiling under Meson. 2017-12-12 15:56:31 +11:00
Michael James Gratton
ee76477366 Fix build on s390x/ppc64.
Patch courtesy of Gianfranco Costamagna.

https://bugzilla.gnome.org/show_bug.cgi?id=783882
2017-09-25 12:09:27 +10:00
Gautier Pelloux-Prayer
330f897f8c Fix compilation for clang. Bug 778046 2017-02-06 22:36:11 +11:00
Michael James Gratton
e06a73ebd6 Make web process extension console logging a bit less verbose. 2017-02-01 00:41:44 +11:00
Michael James Gratton
805a052f1f Don't send JS selectionChanged message unless param value has changed. 2017-02-01 00:41:44 +11:00
Michael James Gratton
70cbe4a046 Allow ClientWebView resources to be loaded via either cid or geary URLs.
* src/client/components/client-web-view.vala (ClientWebView): Rename
  members referring to inline resources to internal resources, update
  call sites.
  (ClientWebView::handle_cid_request,
   ClientWebView::handle_internal_request): Rework to use new common
   ::handle_internal_response method.

* src/client/web-process/web-process-extension.vala: Permit by default
  any geary, cid, or data URI request.
2017-02-01 00:41:44 +11:00
Michael James Gratton
57f10446a9 Use an internal URL scheme for displaying message bodies.
This makes debugging easier, since the URL will show up in the console,
Inspector and elsewhere, and the HTML message source, etc will appear in
the Inspector.

* src/client/components/client-web-view.vala
  (ClientWebView::init_web_context): Rehitser new internal scheme, hook
  it up to the new ::handle_internal_request handler for it.
  (ClientWebView::load_html): Keep a reference to the HTML body so it can
  be loaded via the URL scheme handler, make the second param optional
  and if null, use the new internal URL for the body part. Update call
  sites to avoid using the second param.

* src/client/web-process/web-process-extension.vala
  (GearyWebExtension::on_send_request): Allow requests for the
  internal URL scheme.
2017-02-01 00:41:43 +11:00
Michael James Gratton
772b874def Clean up JavaScriptCore VAPI, client and engine code.
* bindings/vapi/javascriptcore-4.0.vapi: Make JS objects match their JSC
  definitions: move JSValueFoo methods to JS.Value, etc. Update call
  sites.

* src/client/util/util-webkit.vala: Move WebKit-specific common methods
  from ClientWebView here. Update call sites.

* src/engine/util/util-js.vala: Move JSC-specific common methods from
  ClientWebView and ComposerPageStateTest here. Update call sites.

* src/client/web-process/web-process-extension.vala: Check for and handle
  exceptions when calling JS code.

* src/CMakeLists.txt: Add new source files, make WebKit VAPI generation
  and engine compilation depend on JSC.
2017-02-01 00:41:43 +11:00
Michael James Gratton
9ae52342f5 Add some WebView and WebProcess debugging. 2017-02-01 00:41:43 +11:00
Michael James Gratton
766d55e75d Reimplement selection_changed signal for WK2.
Add a "has_selection" param to avoid a second round-trip to the web
process to determine that.

* src/client/components/client-web-view.vala (ClientWebView): Add a
  selection_changed signal, register a JS message handler for the JS
  equivalent hook up firing the signal.

* src/client/web-process/web-process-extension.vala (GearyWebExtension):
  Send a JS selectionChanged message when the page's selection changes.

* src/client/composer/composer-widget.vala,
  src/client/conversation-viewer/conversation-email.vala,
  src/client/conversation-viewer/conversation-message.vala: Uncomment
  code that relied on the WK1 selection_changed signal, use signal param
  rather than DOM calls.

* ui/client-web-view.js: Implement sending the selectionChanged message.
2017-02-01 00:41:43 +11:00
Michael James Gratton
d002722a19 Re-implement remote image loading management for WebKit2.
* src/client/components/client-web-view.vala (ClientWebView): Register
  for new remoteImageLoadBlocked message from JS. Add new
  ::remote_image_load_blocked signal to notify when a remote image load
  was blocked. Add ::allow_remote_image_loading and ::load_remote_images
  methods to allow th app to manage image loading state.

* src/client/conversation-viewer/conversation-email.vala
  (ConversationEmail): Determine up front whether the message view should
  load remote images and flag that, rather than passing through the email
  flag and the contact store.

* src/client/conversation-viewer/conversation-message.vala
  (ConversationMessage): Rmeove contact_store and
  always_load_remote_images properties and related code, just let the
  parent email view advise whether remote images should be initially
  loaded and act accordingly. Look up to ClientWebView signal and methods
  to handle manual remote image loading management by the user. Remove
  some obsolete code.

* src/client/web-process/web-process-extension.vala (GearyWebExtension):
  Replace allow_prefix implementation for remote image management with
  explicit signalling to/from the application via JavaScript.

* ui/client-web-view.js: Add a new PageState object, add props and method
  to implement remote image loading management.

* ui/client-web-view-allow-remote-images.js: Monkeypatch to be used when
  remote images should be loaded by default.

* ui/CMakeLists.txt: Include new JS file.

* src/client/conversation-viewer/conversation-web-view.vala,
  src/client/web-process/util-conversation.vala,
  src/client/web-process/util-webkit.vala: Remove obsolete code.
2017-02-01 00:41:43 +11:00
Michael James Gratton
2117c23734 Implement web view resource loading policy for CID, data, & remote URLs.
* src/client/web-process/web-process-extension.vala
  (GearyWebExtension::GearyWebExtension): Set the allow_prefix here,
  since this is where we need to make the decision. Hook up to the
  page-created and subsequently the send-request signals.
  (GearyWebExtension::on_send_request): Always allow data and cid
  requests through, only allow remote requests through if they have the
  allow prefix.
  (random_string): Moved here from util-random so we can call it.

* src/client/components/client-web-view.vala
  (ClientWebView::allow_prefix): Keep this here for now, but its value
  still needs to be fetched from the extension.
  (ClientWebView::on_resource_load_started): Removed, the policy needs to
  be set in the extension to actually work.
2017-02-01 00:41:43 +11:00
Michael James Gratton
6d18b247c0 Properly build and load the web extension for ClientWebView.
* src/CMakeLists.txt: Pass the build dir through to the application so it
  can work out where to find the extension when running from the source
  tree. Build geary-static as reloacatable so we can link it with the
  extension. Actually link geary-static into the extension and install it.

* src/client/application/geary-application.vala
  (GearyApplication::get_web_extensions_dir): New method that determines
  where the web extension lib is to be found.

* src/client/application/geary-controller.vala
  (GearyController::open_async): Set the extension dir on the WebContext,
  and pass through logging config to the extension.

* src/client/web-process/web-process-extension.vala: Add a
  GearyWebExtension extension object, create it on init and init logging.
2017-02-01 00:41:43 +11:00
Michael James Gratton
d542dda48e Begin the WebKit2 port in earnest.
Replace StylishWebView with ClientWebView, to act as a common base class
for the composer, conversation and other uses of web views.

Introduce a ComposerWebView that replaces WebviewEditFixer and extends
ClientWebView, and adds (dummy for now) methods for ComposerWidget to
call. Simiarly, make ConversationWebView extend ClientWebView, add dummy
calls to support the conversation viewer classes. Move common code from
both into ClientWebView.

Add a web-process library, unused other than for compile-time checking,
and move all client functions and methods involving DOM objects into util
classes there.

Bug 728002
2017-02-01 00:41:43 +11:00