~moblin/xulrunner/xulrunner-headless-1.9.2

« back to all changes in this revision

Viewing changes to debian/patches/lp401055_bz499498_debug_bandaid.patch

  • Committer: Michael Terry
  • Date: 2009-09-29 18:25:37 UTC
  • Revision ID: michael.terry@canonical.com-20090929182537-pkj6hf8qsotya3vi
   * New upstream snapshot
   * debian/patches/remove-global-local-storage.patch: remove globalStorage
     and localStorage properties from the DOM so clients correctly detect that
     we don't support DOM storage.  From Fedora Moblin packaging.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
diff -r f677422fdf56 widget/src/xremoteclient/XRemoteClient.cpp
 
2
--- a/widget/src/xremoteclient/XRemoteClient.cpp        Thu May 14 16:17:53 2009 +0200
 
3
+++ b/widget/src/xremoteclient/XRemoteClient.cpp        Wed Jul 22 11:47:30 2009 +0200
 
4
@@ -88,6 +88,9 @@
 
5
 
 
6
 static PRLogModuleInfo *sRemoteLm = NULL;
 
7
 
 
8
+static void trap_errors (const char* trap_name);
 
9
+static int untrap_error(PRBool log_as_error, PRBool always_log);
 
10
+
 
11
 XRemoteClient::XRemoteClient()
 
12
 {
 
13
   mDisplay = 0;
 
14
@@ -273,10 +276,14 @@
 
15
   unsigned char *data;
 
16
   Window innerWindow;
 
17
 
 
18
+  trap_errors("XRemoteClient::CheckWindow");
 
19
   XGetWindowProperty(mDisplay, aWindow, mMozWMStateAtom,
 
20
                     0, 0, False, AnyPropertyType,
 
21
                     &type, &format, &nitems, &bytesafter, &data);
 
22
 
 
23
+  if (untrap_error(PR_TRUE, PR_TRUE))
 
24
+    return 0;
 
25
+
 
26
   if (type) {
 
27
     XFree(data);
 
28
     return aWindow;
 
29
@@ -466,6 +473,7 @@
 
30
   Window root2, parent, *kids;
 
31
   unsigned int nkids;
 
32
 
 
33
+  trap_errors("XRemoteClient::FindBestWindow - XQueryTree");
 
34
   // Get a list of the children of the root window, walk the list
 
35
   // looking for the best window that fits the criteria.
 
36
   if (!XQueryTree(mDisplay, root, &root2, &parent, &kids, &nkids)) {
 
37
@@ -473,6 +481,8 @@
 
38
            ("XQueryTree failed in XRemoteClient::FindBestWindow"));
 
39
     return 0;
 
40
   }
 
41
+  if (untrap_error(PR_TRUE, PR_TRUE))
 
42
+    return 0;
 
43
 
 
44
   if (!(kids && nkids)) {
 
45
     PR_LOG(sRemoteLm, PR_LOG_DEBUG, ("root window has no children"));
 
46
@@ -492,12 +502,17 @@
 
47
     // find the inner window with WM_STATE on it
 
48
     w = CheckWindow(w);
 
49
 
 
50
+    trap_errors("XRemoteClient::FindBestWindow - XGetWindowProperty 1");
 
51
+
 
52
     int status = XGetWindowProperty(mDisplay, w, mMozVersionAtom,
 
53
                                     0, (65536 / sizeof (long)),
 
54
                                     False, XA_STRING,
 
55
                                     &type, &format, &nitems, &bytesafter,
 
56
                                     &data_return);
 
57
 
 
58
+    if (untrap_error(PR_TRUE, PR_TRUE))
 
59
+      continue;
 
60
+
 
61
     if (!data_return)
 
62
       continue;
 
63
 
 
64
@@ -517,11 +532,14 @@
 
65
     // pass in a program name and this window doesn't support that
 
66
     // protocol, we don't include it in our list.
 
67
     if (aProgram && strcmp(aProgram, "any")) {
 
68
+        trap_errors("XRemoteClient::FindBestWindow - XGetWindowProperty 2");
 
69
         status = XGetWindowProperty(mDisplay, w, mMozProgramAtom,
 
70
                                     0, (65536 / sizeof(long)),
 
71
                                     False, XA_STRING,
 
72
                                     &type, &format, &nitems, &bytesafter,
 
73
                                     &data_return);
 
74
+        if (untrap_error(PR_TRUE, PR_FALSE))
 
75
+          continue;
 
76
         
 
77
         // If the return name is not the same as what someone passed in,
 
78
         // we don't want this window.
 
79
@@ -552,11 +570,14 @@
 
80
     }
 
81
 
 
82
     if (username) {
 
83
+        trap_errors("XRemoteClient::FindBestWindow - XGetWindowProperty 3");
 
84
         status = XGetWindowProperty(mDisplay, w, mMozUserAtom,
 
85
                                     0, (65536 / sizeof(long)),
 
86
                                     False, XA_STRING,
 
87
                                     &type, &format, &nitems, &bytesafter,
 
88
                                     &data_return);
 
89
+        if (untrap_error(PR_TRUE, PR_FALSE))
 
90
+          continue;
 
91
 
 
92
         // if there's a username compare it with what we have
 
93
         if (data_return) {
 
94
@@ -574,11 +595,14 @@
 
95
     // there is, then we need to make sure it matches what someone
 
96
     // passed in.
 
97
     if (aProfile) {
 
98
+        trap_errors("XRemoteClient::FindBestWindow - XGetWindowProperty 4");
 
99
         status = XGetWindowProperty(mDisplay, w, mMozProfileAtom,
 
100
                                     0, (65536 / sizeof(long)),
 
101
                                     False, XA_STRING,
 
102
                                     &type, &format, &nitems, &bytesafter,
 
103
                                     &data_return);
 
104
+        if (untrap_error(PR_TRUE, PR_FALSE))
 
105
+          continue;
 
106
 
 
107
         // If there's a profile compare it with what we have
 
108
         if (data_return) {
 
109
@@ -616,6 +640,7 @@
 
110
   unsigned long nitems, bytes_after;
 
111
   unsigned char *data = 0;
 
112
 
 
113
+  trap_errors("XRemoteClient::FreeLock");
 
114
   result = XGetWindowProperty(mDisplay, aWindow, mMozLockAtom,
 
115
                               0, (65536 / sizeof(long)),
 
116
                               True, /* atomic delete after */
 
117
@@ -623,6 +648,9 @@
 
118
                               &actual_type, &actual_format,
 
119
                               &nitems, &bytes_after,
 
120
                               &data);
 
121
+  if (untrap_error(PR_TRUE, PR_FALSE))
 
122
+    return NS_ERROR_FAILURE;
 
123
+
 
124
   if (result != Success) {
 
125
       PR_LOG(sRemoteLm, PR_LOG_DEBUG,
 
126
              ("unable to read and delete " MOZILLA_LOCK_PROP
 
127
@@ -888,3 +916,36 @@
 
128
 
 
129
   return accepted;
 
130
 }
 
131
+
 
132
+static int trapped_error_code = 0;
 
133
+static int (*old_error_handler) (Display *, XErrorEvent *);
 
134
+static const char* trap_name = nsnull;
 
135
+
 
136
+static int
 
137
+error_handler(Display *display, XErrorEvent *error)
 
138
+{
 
139
+  trapped_error_code = error->error_code;
 
140
+  return 0;
 
141
+}
 
142
+
 
143
+static void
 
144
+trap_errors (const char *name)
 
145
+{
 
146
+  trapped_error_code =0;
 
147
+  trap_name = name;
 
148
+  old_error_handler = XSetErrorHandler(error_handler);
 
149
+}
 
150
+
 
151
+static int         
 
152
+untrap_error(PRBool log_as_error, PRBool always_log)
 
153
+{
 
154
+  XSetErrorHandler(old_error_handler);
 
155
+  if((trapped_error_code && log_as_error) || always_log) {
 
156
+    printf ("XRemoteClient Error - [%s] Get X Window Error = %d\n", trap_name, trapped_error_code);
 
157
+    PR_LOG(sRemoteLm, PR_LOG_ERROR,
 
158
+           ("[%s] Get X Window Error = %d", trap_name, trapped_error_code));
 
159
+  }
 
160
+  trap_name = nsnull;
 
161
+  return trapped_error_code;
 
162
+}
 
163
+