After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 701264 - Disable search for file types that don't implement EvDocumentFind
Disable search for file types that don't implement EvDocumentFind
Status: RESOLVED FIXED
Product: gnome-documents
Classification: Core
Component: general
3.8.x
Other Linux
: Normal normal
: ---
Assigned To: GNOME documents maintainer(s)
GNOME documents maintainer(s)
Depends on:
Blocks:
 
 
Reported: 2013-05-30 11:52 UTC by Debarshi Ray
Modified: 2013-05-31 11:30 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
preview: Disable search if EvDocumentFind is not implemented (1.46 KB, patch)
2013-05-30 12:27 UTC, Debarshi Ray
committed Details | Review

Description Debarshi Ray 2013-05-30 11:52:44 UTC
XPS is an example (see attachment) of a file type that does not implement EvDocumentFind.

Try opening an XPS file in gnome-documents and start searching inside in the preview. It will crash after a while. The search functionaility is disabled in evince for such documents. See ev_window_setup_action_sensitivity in shell/ev-window.c for details.
Comment 1 Debarshi Ray 2013-05-30 11:54:22 UTC
My XPS is too big to be attached. So here it is: http://rishi.fedorapeople.org/crash.xps
Comment 2 Debarshi Ray 2013-05-30 12:27:12 UTC
Created attachment 245642 [details] [review]
preview: Disable search if EvDocumentFind is not implemented

Is there a better way to detect if an interface is implemented from GJS?
Comment 3 Cosimo Cecchi 2013-05-30 16:05:28 UTC
Review of attachment 245642 [details] [review]:

Looks good, with a minor comment below. Feel free to correct that and push to master.

::: src/preview.js
@@ +874,3 @@
+            evDoc.find_text();
+        } catch (e if e instanceof TypeError) {
+        try {

I would just set isFind = false for all the possible exceptions here - I don't think we have a more elegant way to do this unfortunately.
Comment 4 Debarshi Ray 2013-05-30 16:23:49 UTC
(In reply to comment #3)
> Review of attachment 245642 [details] [review]:
> 
> Looks good, with a minor comment below. Feel free to correct that and push to
> master.
> 
> ::: src/preview.js
> @@ +874,3 @@
> +            evDoc.find_text();
> +        } catch (e if e instanceof TypeError) {
> +        try {
> 
> I would just set isFind = false for all the possible exceptions here - I don't
> think we have a more elegant way to do this unfortunately.

The reason I separated out TypeError from other exceptions is that "evDoc.find_text()" will generate an exception even if EvDocumentFind is implemented because the method does not work with a "void" argument list. So a TypeError denotes that the method does not exist because the interface was not implemented.

Ofcourse I can construct a valid list of arguments, but I decided not to bother since we don't want to actually find anything.
Comment 5 Cosimo Cecchi 2013-05-30 16:39:33 UTC
Fair enough; let's get this in as is then. Thanks!