Commit graph

14 commits

Author SHA1 Message Date
Michael Gratton
0ae633d88f Update existing tests to work with ValaUnit 2020-06-30 17:31:07 +10:00
Michael James Gratton
cbe6e0ba9b Revert "Merge branch 'mjog/558-webkit-shared-process' into 'mainline'"
Revert merge request GNOME/geary!374 for now since the shared process
model breaks old-style WebProcess message handler IPC.

This can be un-reverted when out JS is ported to the new Messages API
that is landing in WebKitGTK 2.28.

This reverts commit e4a5b85698, reversing
changes made to 66f6525480.
2020-02-13 12:56:52 +11:00
Michael Gratton
ceb9c9764a Rename ClientWebView to Components.WebView per code style 2019-11-26 14:26:03 +11:00
Michael Gratton
2a0de1ce41 Remove Util.Webkit namespace and functions
After the JSC migration they were all a bunch of simple inline
one-liners, so were just making the code more complex than it needed to
be.
2019-07-21 10:46:42 +10:00
Michael Gratton
da6ac828bd Move Geary.JS package into client as Util.JS
The only reason it was in the engine was so it could be used by both
the client and the web extension, without worrying about the
webkit2gtk and webkit2gtk_web_extension packages conflicting. However
it didn't really belong there, and added a dependency for the engine
on javascriptcoregtk which doesn't belong. So this fixes all that.
2019-07-21 10:00:32 +10:00
Michael Gratton
6f1834d696 Port JavaScript code from JS to JSC APIs
JSC is WebKitGTK's supported API going forward and is more
straight-forward than the old JS API, so this simplifies the code and
removes a number of deprecated calls.
2019-07-21 09:01:58 +10:00
Michael Gratton
f14b16fe7a Move WebKitUtil namespace to Util.WebKit 2019-07-20 09:13:43 +10:00
Jonathan Haas
bfe504fed3 Make sure we match the whole link text as URL and not only some part. Add some symbols to be invalid in domains. Add 3 tests. 2019-04-27 11:52:51 +02:00
Michael Gratton
a6c1962e47 Apply custom user CSS to composer web view as well as to conversations
This allows people with dark themes to apply style to the cmoposer's
body editor as well as to conversation bodies. Note that this CSS does
not get sent, so WYSIWYG will break if people choose to do this.

Also renames the user CSS file from user-message.css to user-style.css,
but still looks for the old name for now.

Fixes https://bugzilla.gnome.org/show_bug.cgi?id=714129
2019-02-28 18:34:28 +11:00
Michael Gratton
0f554d2371 Fix select-quoting not preserving newlines in some cases
If the common ancestor of the quoted text is the plain-text-message DIV
itself, the isDescendant test fails and the style to preserve new lines
is not maintained. This adds a non-strict check to isDescendant and
enables that when checking the common ancestor node and a test case for
it.
2019-02-02 15:07:41 +11:00
Michael Gratton
c83f07a9f1 Minor tweaks for ConversationPageState.isDescendantOf
Use uppercase since that is what the DOM for HTML defaults to, use
nodeName rather than tagName for cases when there the check is false and
ancestor is the document element, add unit tests.
2019-02-02 15:07:41 +11:00
Michael James Gratton
50f73ff252 Allow test fixtures and test methods to throw errors by default.
* test/testcase.vala (TestCase): Add a generic throws clause to both
  TestMethod and set_up and tear_down, update subclasses.
2018-04-07 09:41:18 +10:00
Michael James Gratton
355e4d37c1 Make ClientWebView-based tests execute a bit faster.
* test/client/components/client-web-view-test.vala: New explicit tests
  for init'ing the WebContext and loading default resources.

* test/client/components/client-web-view-test-case.vala:
  Init the WebContext and load resources in the constructor rather than
  fixture setup, so it only happens once per suite, not once per
  test. Update subclasses to do same.

* test/client/composer/composer-web-view-test.vala: Add an explicit test
  for loading ComposerWebView resources.
2017-02-01 00:41:45 +11:00
Michael James Gratton
2b5f94da7d Reenable basic deceptive link highlighting.
* bindings/vapi/javascriptcore-4.0.vapi (Object::get_property): Fix
  return type.

* src/client/conversation-viewer/conversation-message.vala (GtkTemplate):
  Hook up to new deceptive_link_clicked signal, remove old DOM-based
  implementation.

* src/client/conversation-viewer/conversation-web-view.vala
  (ConversationWebView): Add new deceptive_link_clicked signal and
  DeceptiveText enum, listen for deceptiveLinkClicked JS message and fire
  signal when received.

* src/client/util/util-webkit.vala (WebKitUtil): Add to_object util function.

* src/engine/util/util-js.vala (Geary.JS): Add to_object and get_property
  util functions.

* ui/conversation-web-view.js (ConversationPageState) Listen for link
  clicks, check for deceptive text and send message if found. Add unit
  tests for deceptive text check.

* test/js/composer-page-state-test.vala: Move ::run_javascript to parent
  class so new ConversationPageStateTest class can use it, adapt call
  sites to different parent signature.
2017-02-01 00:41:44 +11:00