Skip to content

Commit c5cfe7b

Browse files
committed
Use PRUnichar for Gecko < 29, char16_t otherwise.
See https://bugzilla.mozilla.org/show_bug.cgi?id=927728
1 parent 0e428d7 commit c5cfe7b

File tree

5 files changed

+110
-0
lines changed

5 files changed

+110
-0
lines changed

cpp/webdriver-firefox/native_ime.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,11 @@ NS_IMETHODIMP nsNativeIME::ImeGetActiveEngine(nsAString &activeEngine)
9393
LOG(DEBUG) << "Active engine:" << engine;
9494
std::wstring wengine(engine.begin(), engine.end());
9595
// We know that PRUnichar* is wchar_t*. see comment in sendKeys
96+
#ifdef WEBDRIVER_LEGACY_GECKO
9697
activeEngine.Assign((const PRUnichar*) wengine.c_str(), wengine.length());
98+
#else
99+
activeEngine.Assign((const nsAString::char_type*) wengine.c_str(), wengine.length());
100+
#endif // WEBDRIVER_LEGACY_GECKO
97101
tryToCloseImeLib(handler, lib);
98102
return NS_OK;
99103
}

cpp/webdriver-firefox/native_keyboard.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,11 @@ nsNativeKeyboard::~nsNativeKeyboard()
5353

5454
/* void SendKeys (in nsISupports aNode, in wstring value); */
5555
NS_IMETHODIMP nsNativeKeyboard::SendKeys(nsISupports *aNode,
56+
#ifdef WEBDRIVER_LEGACY_GECKO
5657
const PRUnichar *value,
58+
#else
59+
const char16_t *value,
60+
#endif // WEBDRIVER_LEGACY_GECKO
5761
bool releaseModifiers)
5862
{
5963
LOG(DEBUG) << "---------- Got to start of callback. aNode: " << aNode
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
#ifdef GECKO_100_COMPATIBILITY
22
#include "nsINativeKeyboard_g10.h"
33
#else
4+
#ifdef WEBDRIVER_LEGACY_GECKO
45
#include "nsINativeKeyboard_g16.h"
6+
#else
7+
#include "nsINativeKeyboard_g29.h"
8+
#endif
59
#endif
Lines changed: 95 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,95 @@
1+
/*
2+
* DO NOT EDIT. THIS FILE IS GENERATED FROM cpp/webdriver-firefox/nsINativeKeyboard.idl
3+
*/
4+
5+
#ifndef __gen_nsINativeKeyboard_h__
6+
#define __gen_nsINativeKeyboard_h__
7+
8+
9+
#ifndef __gen_nsISupports_h__
10+
#include "nsISupports.h"
11+
#endif
12+
13+
#ifndef __gen_nsISupportsPrimitives_h__
14+
#include "nsISupportsPrimitives.h"
15+
#endif
16+
17+
/* For IDL files that don't want to include root IDL files. */
18+
#ifndef NS_NO_VTABLE
19+
#define NS_NO_VTABLE
20+
#endif
21+
22+
/* starting interface: nsINativeKeyboard */
23+
#define NS_INATIVEKEYBOARD_IID_STR "50380a2d-ab4f-4b3f-9a27-cc7dbba07ee7"
24+
25+
#define NS_INATIVEKEYBOARD_IID \
26+
{0x50380a2d, 0xab4f, 0x4b3f, \
27+
{ 0x9a, 0x27, 0xcc, 0x7d, 0xbb, 0xa0, 0x7e, 0xe7 }}
28+
29+
class NS_NO_VTABLE nsINativeKeyboard : public nsISupports {
30+
public:
31+
32+
NS_DECLARE_STATIC_IID_ACCESSOR(NS_INATIVEKEYBOARD_IID)
33+
34+
/* void sendKeys (in nsISupports aNode, in wstring value, in boolean releaseModifiers); */
35+
NS_IMETHOD SendKeys(nsISupports *aNode, const char16_t * value, bool releaseModifiers) = 0;
36+
37+
};
38+
39+
NS_DEFINE_STATIC_IID_ACCESSOR(nsINativeKeyboard, NS_INATIVEKEYBOARD_IID)
40+
41+
/* Use this macro when declaring classes that implement this interface. */
42+
#define NS_DECL_NSINATIVEKEYBOARD \
43+
NS_IMETHOD SendKeys(nsISupports *aNode, const char16_t * value, bool releaseModifiers);
44+
45+
/* Use this macro to declare functions that forward the behavior of this interface to another object. */
46+
#define NS_FORWARD_NSINATIVEKEYBOARD(_to) \
47+
NS_IMETHOD SendKeys(nsISupports *aNode, const char16_t * value, bool releaseModifiers) { return _to SendKeys(aNode, value, releaseModifiers); }
48+
49+
/* Use this macro to declare functions that forward the behavior of this interface to another object in a safe way. */
50+
#define NS_FORWARD_SAFE_NSINATIVEKEYBOARD(_to) \
51+
NS_IMETHOD SendKeys(nsISupports *aNode, const char16_t * value, bool releaseModifiers) { return !_to ? NS_ERROR_NULL_POINTER : _to->SendKeys(aNode, value, releaseModifiers); }
52+
53+
#if 0
54+
/* Use the code below as a template for the implementation class for this interface. */
55+
56+
/* Header file */
57+
class nsNativeKeyboard : public nsINativeKeyboard
58+
{
59+
public:
60+
NS_DECL_ISUPPORTS
61+
NS_DECL_NSINATIVEKEYBOARD
62+
63+
nsNativeKeyboard();
64+
65+
private:
66+
~nsNativeKeyboard();
67+
68+
protected:
69+
/* additional members */
70+
};
71+
72+
/* Implementation file */
73+
NS_IMPL_ISUPPORTS1(nsNativeKeyboard, nsINativeKeyboard)
74+
75+
nsNativeKeyboard::nsNativeKeyboard()
76+
{
77+
/* member initializers and constructor code */
78+
}
79+
80+
nsNativeKeyboard::~nsNativeKeyboard()
81+
{
82+
/* destructor code */
83+
}
84+
85+
/* void sendKeys (in nsISupports aNode, in wstring value, in boolean releaseModifiers); */
86+
NS_IMETHODIMP nsNativeKeyboard::SendKeys(nsISupports *aNode, const char16_t * value, bool releaseModifiers)
87+
{
88+
return NS_ERROR_NOT_IMPLEMENTED;
89+
}
90+
91+
/* End of implementation class template. */
92+
#endif
93+
94+
95+
#endif /* __gen_nsINativeKeyboard_h__ */

rake-tasks/crazy_fun/mappings/gcc.rb

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -216,6 +216,9 @@ def handle(fun, dir, args)
216216
std = ""
217217
end
218218
base_compiler_args = "-Wall -fPIC -fshort-wchar -std=c++#{std} -Dunix -D__STDC_LIMIT_MACROS -I cpp/webdriver-interactions -I cpp/imehandler/common -I #{gecko_sdk}include -I #{gecko_sdk}include/nspr " + "`pkg-config gtk+-2.0 --cflags`"
219+
if (args[:geckoversion].to_i < 29)
220+
base_compiler_args += " -DWEBDRIVER_LEGACY_GECKO"
221+
end
219222
compiler_args = [args[:args], base_compiler_args].join " "
220223
if (args[:geckoversion].to_i < 22)
221224
linker_args = "-Wall -fshort-wchar -fno-rtti -fno-exceptions -shared -fPIC -L#{gecko_sdk}lib -L#{gecko_sdk}bin -Wl,-rpath-link,#{gecko_sdk}bin -l#{xpcom_lib} -lxpcom -lnspr4 -lrt `pkg-config gtk+-2.0 --libs`"

0 commit comments

Comments
 (0)