Sat, 03 Jan 2015 20:18:00 +0100
Conditionally enable double key logic according to:
private browsing mode or privacy.thirdparty.isolate preference and
implement in GetCookieStringCommon and FindCookie where it counts...
With some reservations of how to convince FindCookie users to test
condition and pass a nullptr when disabling double key logic.
1 /* This Source Code Form is subject to the terms of the Mozilla Public
2 * License, v. 2.0. If a copy of the MPL was not distributed with this
3 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
5 package org.mozilla.gecko;
6 import android.database.Cursor;
8 public interface Actions {
10 /** Special keys supported by sendSpecialKey() */
11 public enum SpecialKey {
12 DOWN, UP, LEFT, RIGHT, ENTER, MENU, BACK
13 }
15 public interface EventExpecter {
16 /** Blocks until the event has been received. Subsequent calls will return immediately. */
17 public void blockForEvent();
18 public void blockForEvent(long millis, boolean failOnTimeout);
20 /** Blocks until the event has been received and returns data associated with the event. */
21 public String blockForEventData();
23 /**
24 * Blocks until the event has been received, or until the timeout has been exceeded.
25 * Returns the data associated with the event, if applicable.
26 */
27 public String blockForEventDataWithTimeout(long millis);
29 /** Polls to see if the event has been received. Once this returns true, subsequent calls will also return true. */
30 public boolean eventReceived();
32 /** Stop listening for events. */
33 public void unregisterListener();
34 }
36 public interface RepeatedEventExpecter extends EventExpecter {
37 /** Blocks until at least one event has been received, and no events have been received in the last <code>millis</code> milliseconds. */
38 public void blockUntilClear(long millis);
39 }
41 /**
42 * Sends an event to Gecko.
43 *
44 * @param geckoEvent The geckoEvent JSONObject's type
45 */
46 void sendGeckoEvent(String geckoEvent, String data);
48 /**
49 * Sends a preferences get event to Gecko.
50 *
51 * @param requestId The id of this request.
52 * @param prefNames The preferences being requested.
53 */
54 void sendPreferencesGetEvent(int requestId, String[] prefNames);
56 /**
57 * Sends a preferences observe event to Gecko.
58 *
59 * @param requestId The id of this request.
60 * @param prefNames The preferences being requested.
61 */
62 void sendPreferencesObserveEvent(int requestId, String[] prefNames);
64 /**
65 * Sends a preferences remove observers event to Gecko.
66 *
67 * @param requestId The id of this request.
68 */
69 void sendPreferencesRemoveObserversEvent(int requestid);
71 /**
72 * Listens for a gecko event to be sent from the Gecko instance.
73 * The returned object can be used to test if the event has been
74 * received. Note that only one event is listened for.
75 *
76 * @param geckoEvent The geckoEvent JSONObject's type
77 */
78 RepeatedEventExpecter expectGeckoEvent(String geckoEvent);
80 /**
81 * Listens for a paint event. Note that calling expectPaint() will
82 * invalidate the event expecters returned from any previous calls
83 * to expectPaint(); calling any methods on those invalidated objects
84 * will result in undefined behaviour.
85 */
86 RepeatedEventExpecter expectPaint();
88 /**
89 * Send a string to the application
90 *
91 * @param keysToSend The string to send
92 */
93 void sendKeys(String keysToSend);
95 /**
96 * Send a special keycode to the element
97 *
98 * @param key The special key to send
99 */
100 void sendSpecialKey(SpecialKey key);
101 void sendKeyCode(int keyCode);
103 void drag(int startingX, int endingX, int startingY, int endingY);
105 /**
106 * Run a sql query on the specified database
107 */
108 public Cursor querySql(String dbPath, String sql);
109 }