From cf96652cef6f8dc22e6e80fe3a5c577c396fa977 Mon Sep 17 00:00:00 2001 From: Masatoshi Kimura Date: Tue, 30 Jul 2013 10:02:28 -0400 Subject: [PATCH 1/9] Bug 898903 - Prevent env["PATH"] from becoming Unicode on Windows. r=jgriffin --- build/automation.py.in | 2 +- testing/mochitest/runtests.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/build/automation.py.in b/build/automation.py.in index f3d75590cbed..de158cfb76fe 100644 --- a/build/automation.py.in +++ b/build/automation.py.in @@ -734,7 +734,7 @@ user_pref("camino.use_system_proxy_settings", false); // Camino-only, harmless t ldLibraryPath = ldLibraryPath + ":" + env[envVar] env[envVar] = ldLibraryPath elif self.IS_WIN32: - env["PATH"] = env["PATH"] + ";" + ldLibraryPath + env["PATH"] = env["PATH"] + ";" + str(ldLibraryPath) if crashreporter: env['MOZ_CRASHREPORTER_NO_REPORT'] = '1' diff --git a/testing/mochitest/runtests.py b/testing/mochitest/runtests.py index b1660cc62257..807baba38262 100644 --- a/testing/mochitest/runtests.py +++ b/testing/mochitest/runtests.py @@ -70,7 +70,7 @@ class MochitestServer: env["ASAN_OPTIONS"] = "quarantine_size=1:redzone=32" if mozinfo.isWin: - env["PATH"] = env["PATH"] + ";" + self._xrePath + env["PATH"] = env["PATH"] + ";" + str(self._xrePath) args = ["-g", self._xrePath, "-v", "170", From 66e243dd754be8562e19f622525855d2fb19af6b Mon Sep 17 00:00:00 2001 From: Robert Bindar Date: Tue, 30 Jul 2013 10:02:54 -0400 Subject: [PATCH 2/9] Bug 890597 - Transport layer ping diagnostic tool. r=valentin.gosu --- dom/webidl/DummyBinding.webidl | 1 + dom/webidl/NetDashboard.webidl | 5 + netwerk/base/public/nsIDashboard.idl | 9 ++ netwerk/base/src/Dashboard.cpp | 168 ++++++++++++++++++++++++++- netwerk/base/src/Dashboard.h | 43 ++++++- netwerk/base/src/DashboardTypes.h | 5 + 6 files changed, 229 insertions(+), 2 deletions(-) diff --git a/dom/webidl/DummyBinding.webidl b/dom/webidl/DummyBinding.webidl index 7bdfbbe7dd3f..48fa8c941f53 100644 --- a/dom/webidl/DummyBinding.webidl +++ b/dom/webidl/DummyBinding.webidl @@ -16,6 +16,7 @@ interface DummyInterface { void funcHttpConnDict(optional HttpConnDict arg); void funcWebSocketDict(optional WebSocketDict arg); void funcDNSCacheDict(optional DNSCacheDict arg); + void funcConnStatusDict(optional ConnStatusDict arg); void frameRequestCallback(FrameRequestCallback arg); void idbObjectStoreParams(optional IDBObjectStoreParameters arg); void CameraPictureOptions(optional CameraPictureOptions arg); diff --git a/dom/webidl/NetDashboard.webidl b/dom/webidl/NetDashboard.webidl index 23f200bc7b7a..daf553918ef7 100644 --- a/dom/webidl/NetDashboard.webidl +++ b/dom/webidl/NetDashboard.webidl @@ -49,3 +49,8 @@ dictionary DNSCacheDict { sequence family; sequence expiration; }; + +dictionary ConnStatusDict { + DOMString status; +}; + diff --git a/netwerk/base/public/nsIDashboard.idl b/netwerk/base/public/nsIDashboard.idl index e04bc2a6e2a1..ac1bae613f38 100644 --- a/netwerk/base/public/nsIDashboard.idl +++ b/netwerk/base/public/nsIDashboard.idl @@ -35,6 +35,15 @@ interface nsIDashboard : nsISupports /* Arrays: hostname, family, hostaddr, expiration */ void requestDNSInfo(in NetDashboardCallback cb); + /* aProtocol: a transport layer protocol: + * ex: "ssl", "tcp", default is "tcp". + * aHost: the host's name + * aPort: the port which the connection will open on + * aTimeout: the timespan before the connection will be timed out */ + void requestConnection(in ACString aHost, in unsigned long aPort, + in string aProtocol, in unsigned long aTimeout, + in NetDashboardCallback cb); + /* When true, the service will log websocket events */ attribute boolean enableLogging; }; diff --git a/netwerk/base/src/Dashboard.cpp b/netwerk/base/src/Dashboard.cpp index b0f9e8a1c13a..0c86accc23a4 100644 --- a/netwerk/base/src/Dashboard.cpp +++ b/netwerk/base/src/Dashboard.cpp @@ -13,7 +13,8 @@ using mozilla::AutoSafeJSContext; namespace mozilla { namespace net { -NS_IMPL_ISUPPORTS2(Dashboard, nsIDashboard, nsIDashboardEventNotifier) +NS_IMPL_ISUPPORTS4(Dashboard, nsIDashboard, nsIDashboardEventNotifier, + nsITransportEventSink, nsITimerCallback) using mozilla::dom::Sequence; Dashboard::Dashboard() @@ -495,4 +496,169 @@ HttpConnInfo::SetHTTP2ProtocolVersion(uint8_t pv) protocolVersion.Assign(NS_LITERAL_STRING("spdy/3")); } +NS_IMETHODIMP +Dashboard::RequestConnection(const nsACString& aHost, uint32_t aPort, + const char *aProtocol, uint32_t aTimeout, + NetDashboardCallback* cb) +{ + nsresult rv; + mConn.cb = cb; + mConn.thread = NS_GetCurrentThread(); + + rv = TestNewConnection(aHost, aPort, aProtocol, aTimeout); + if (NS_FAILED(rv)) { + ConnStatus status; + CopyASCIItoUTF16(GetErrorString(rv), status.creationSts); + nsCOMPtr event = new DashConnStatusRunnable(this, status); + mConn.thread->Dispatch(event, NS_DISPATCH_NORMAL); + return rv; + } + + return NS_OK; +} + +nsresult +Dashboard::GetConnectionStatus(ConnStatus aStatus) +{ + AutoSafeJSContext cx; + + mozilla::dom::ConnStatusDict dict; + dict.mStatus.Construct(); + nsString &status = dict.mStatus.Value(); + status = aStatus.creationSts; + + JS::RootedValue val(cx); + if (!dict.ToObject(cx, JS::NullPtr(), &val)) { + mConn.cb = nullptr; + return NS_ERROR_FAILURE; + } + mConn.cb->OnDashboardDataAvailable(val); + + return NS_OK; +} + +nsresult +Dashboard::TestNewConnection(const nsACString& aHost, uint32_t aPort, + const char *aProtocol, uint32_t aTimeout) +{ + nsresult rv; + if (!aHost.Length() || !net_IsValidHostName(aHost)) + return NS_ERROR_UNKNOWN_HOST; + + if (aProtocol && NS_LITERAL_STRING("ssl").EqualsASCII(aProtocol)) + rv = gSocketTransportService->CreateTransport(&aProtocol, 1, aHost, + aPort, nullptr, + getter_AddRefs(mConn.socket)); + else + rv = gSocketTransportService->CreateTransport(nullptr, 0, aHost, + aPort, nullptr, + getter_AddRefs(mConn.socket)); + if (NS_FAILED(rv)) + return rv; + + rv = mConn.socket->SetEventSink(this, NS_GetCurrentThread()); + if (NS_FAILED(rv)) + return rv; + + rv = mConn.socket->OpenInputStream(nsITransport::OPEN_BLOCKING, 0, 0, + getter_AddRefs(mConn.streamIn)); + if (NS_FAILED(rv)) + return rv; + + StartTimer(aTimeout); + + return rv; +} + +NS_IMETHODIMP +Dashboard::OnTransportStatus(nsITransport *aTransport, nsresult aStatus, + uint64_t aProgress, uint64_t aProgressMax) +{ + if (aStatus == NS_NET_STATUS_CONNECTED_TO) + StopTimer(); + + ConnStatus status; + CopyASCIItoUTF16(GetErrorString(aStatus), status.creationSts); + nsCOMPtr event = new DashConnStatusRunnable(this, status); + mConn.thread->Dispatch(event, NS_DISPATCH_NORMAL); + + return NS_OK; +} + +NS_IMETHODIMP +Dashboard::Notify(nsITimer *timer) +{ + if (mConn.socket) { + mConn.socket->Close(NS_ERROR_ABORT); + mConn.socket = nullptr; + mConn.streamIn = nullptr; + } + + mConn.timer = nullptr; + + ConnStatus status; + status.creationSts.Assign(NS_LITERAL_STRING("NS_ERROR_NET_TIMEOUT")); + nsCOMPtr event = new DashConnStatusRunnable(this, status); + mConn.thread->Dispatch(event, NS_DISPATCH_NORMAL); + + return NS_OK; +} + +void +Dashboard::StartTimer(uint32_t aTimeout) +{ + if (!mConn.timer) + mConn.timer = do_CreateInstance("@mozilla.org/timer;1"); + mConn.timer->InitWithCallback(this, aTimeout * 1000, nsITimer::TYPE_ONE_SHOT); +} + +void +Dashboard::StopTimer() +{ + if (mConn.timer) { + mConn.timer->Cancel(); + mConn.timer = nullptr; + } +} + +typedef struct +{ + nsresult key; + const char *error; +} ErrorEntry; + +ErrorEntry errors[] = { + #define ERROR(key, val) {key, #key} + #include "ErrorList.h" + #undef ERROR +}; + +ErrorEntry socketTransportStatuses[] = { + #define ERROR(key, val) {key, #key} + ERROR(NS_NET_STATUS_RESOLVING_HOST, FAILURE(3)), + ERROR(NS_NET_STATUS_RESOLVED_HOST, FAILURE(11)), + ERROR(NS_NET_STATUS_CONNECTING_TO, FAILURE(7)), + ERROR(NS_NET_STATUS_CONNECTED_TO, FAILURE(4)), + ERROR(NS_NET_STATUS_SENDING_TO, FAILURE(5)), + ERROR(NS_NET_STATUS_WAITING_FOR, FAILURE(10)), + ERROR(NS_NET_STATUS_RECEIVING_FROM, FAILURE(6)), + #undef ERROR +}; + +const char * +Dashboard::GetErrorString(nsresult rv) +{ + int length = sizeof(socketTransportStatuses) / sizeof(ErrorEntry); + for (int i = 0;i < length;i++) + if (socketTransportStatuses[i].key == rv) + return socketTransportStatuses[i].error; + + length = sizeof(errors) / sizeof(ErrorEntry); + for (int i = 0;i < length;i++) + if (errors[i].key == rv) + return errors[i].error; + + return NULL; +} + } } // namespace mozilla::net diff --git a/netwerk/base/src/Dashboard.h b/netwerk/base/src/Dashboard.h index eeeb97f6a689..08c25394ffb9 100644 --- a/netwerk/base/src/Dashboard.h +++ b/netwerk/base/src/Dashboard.h @@ -15,32 +15,45 @@ #include "nsSocketTransport2.h" #include "mozilla/net/DashboardTypes.h" #include "nsHttp.h" +#include "nsITransport.h" +#include "nsITimer.h" namespace mozilla { namespace net { class Dashboard: public nsIDashboard, - public nsIDashboardEventNotifier + public nsIDashboardEventNotifier, + public nsITransportEventSink, + public nsITimerCallback { public: NS_DECL_THREADSAFE_ISUPPORTS NS_DECL_NSIDASHBOARD NS_DECL_NSIDASHBOARDEVENTNOTIFIER + NS_DECL_NSITRANSPORTEVENTSINK + NS_DECL_NSITIMERCALLBACK Dashboard(); + friend class DashConnStatusRunnable; + static const char *GetErrorString(nsresult rv); private: virtual ~Dashboard(); void GetSocketsDispatch(); void GetHttpDispatch(); void GetDnsInfoDispatch(); + void StartTimer(uint32_t aTimeout); + void StopTimer(); + nsresult TestNewConnection(const nsACString& aHost, uint32_t aPort, + const char *aProtocol, uint32_t aTimeout); /* Helper methods that pass the JSON to the callback function. */ nsresult GetSockets(); nsresult GetHttpConnections(); nsresult GetWebSocketConnections(); nsresult GetDNSCacheEntries(); + nsresult GetConnectionStatus(struct ConnStatus aStatus); private: struct SocketData @@ -106,13 +119,41 @@ private: nsIThread* thread; }; + struct ConnectionData + { + nsCOMPtr socket; + nsCOMPtr streamIn; + nsCOMPtr timer; + nsCOMPtr cb; + nsIThread* thread; + }; + bool mEnableLogging; struct SocketData mSock; struct HttpData mHttp; struct WebSocketData mWs; struct DnsData mDns; + struct ConnectionData mConn; +}; +class DashConnStatusRunnable: public nsRunnable +{ +public: + DashConnStatusRunnable(Dashboard * aDashboard, ConnStatus aStatus) + : mDashboard(aDashboard) + { + mStatus.creationSts = aStatus.creationSts; + } + + NS_IMETHODIMP Run() + { + return mDashboard->GetConnectionStatus(mStatus); + } + +private: + ConnStatus mStatus; + Dashboard * mDashboard; }; } } // namespace mozilla::net diff --git a/netwerk/base/src/DashboardTypes.h b/netwerk/base/src/DashboardTypes.h index 5045150f6e4e..e3506679d7c6 100644 --- a/netwerk/base/src/DashboardTypes.h +++ b/netwerk/base/src/DashboardTypes.h @@ -57,6 +57,11 @@ struct HttpRetParams bool ssl; }; +struct ConnStatus +{ + nsString creationSts; +}; + } } #endif // mozilla_net_DashboardTypes_h_ From e11e60ac6944429a1ce9a3537167e91b6cb58942 Mon Sep 17 00:00:00 2001 From: Martin Stransky Date: Tue, 30 Jul 2013 10:03:14 -0400 Subject: [PATCH 3/9] Bug 897404 - Port GTK2 to GTK3 - treeview rendering, expander fix. r=karlt --- widget/gtk2/gtk3drawing.c | 26 +++++++++++++++++++++----- 1 file changed, 21 insertions(+), 5 deletions(-) diff --git a/widget/gtk2/gtk3drawing.c b/widget/gtk2/gtk3drawing.c index 324d3ba7f188..c3ef8e207fec 100644 --- a/widget/gtk2/gtk3drawing.c +++ b/widget/gtk2/gtk3drawing.c @@ -1570,6 +1570,8 @@ moz_gtk_tree_header_sort_arrow_paint(cairo_t *cr, GdkRectangle* rect, return MOZ_GTK_SUCCESS; } +/* See gtk_expander_paint() for reference. + */ static gint moz_gtk_treeview_expander_paint(cairo_t *cr, GdkRectangle* rect, GtkWidgetState* state, @@ -1577,6 +1579,7 @@ moz_gtk_treeview_expander_paint(cairo_t *cr, GdkRectangle* rect, GtkTextDirection direction) { GtkStyleContext *style; + GtkStateFlags state_flags; ensure_tree_view_widget(); gtk_widget_set_direction(gTreeViewWidget, direction); @@ -1584,12 +1587,25 @@ moz_gtk_treeview_expander_paint(cairo_t *cr, GdkRectangle* rect, style = gtk_widget_get_style_context(gTreeViewWidget); gtk_style_context_save(style); gtk_style_context_add_class(style, GTK_STYLE_CLASS_EXPANDER); - /* Because the frame we get is of the entire treeview, we can't get the precise - * event state of one expander, thus rendering hover and active feedback useless. */ - gtk_style_context_set_state(style, GetStateFlagsFromGtkWidgetState(state)); + + state_flags = GetStateFlagsFromGtkWidgetState(state); + + /* GTK_STATE_FLAG_ACTIVE controls expanded/colapsed state rendering + * in gtk_render_expander() + */ + if (expander_state == GTK_EXPANDER_EXPANDED) + state_flags |= GTK_STATE_FLAG_ACTIVE; + else + state_flags &= ~(GTK_STATE_FLAG_ACTIVE); + + gtk_style_context_set_state(style, state_flags); + gtk_render_expander(style, cr, - rect->x + rect->width / 2, rect->y + rect->height / 2, - rect->width, rect->height); + rect->x, + rect->y, + rect->width, + rect->height); + gtk_style_context_restore(style); return MOZ_GTK_SUCCESS; } From b643e537308a09269cd5ba83456dfd702e2027fa Mon Sep 17 00:00:00 2001 From: Martin Stransky Date: Tue, 30 Jul 2013 10:03:44 -0400 Subject: [PATCH 4/9] Bug 899460 - Remove MOZ_GTK_EXPANDER. r=karlt --- widget/gtk2/gtk2drawing.c | 26 -------------------------- widget/gtk2/gtk3drawing.c | 27 --------------------------- widget/gtk2/gtkdrawing.h | 2 -- 3 files changed, 55 deletions(-) diff --git a/widget/gtk2/gtk2drawing.c b/widget/gtk2/gtk2drawing.c index 0c2076ea9650..7c8413d02c25 100644 --- a/widget/gtk2/gtk2drawing.c +++ b/widget/gtk2/gtk2drawing.c @@ -1765,27 +1765,6 @@ moz_gtk_treeview_expander_paint(GdkDrawable* drawable, GdkRectangle* rect, return MOZ_GTK_SUCCESS; } -static gint -moz_gtk_expander_paint(GdkDrawable* drawable, GdkRectangle* rect, - GdkRectangle* cliprect, GtkWidgetState* state, - GtkExpanderStyle expander_state, - GtkTextDirection direction) -{ - GtkStyle *style; - GtkStateType state_type = ConvertGtkState(state); - - ensure_expander_widget(); - gtk_widget_set_direction(gExpanderWidget, direction); - - style = gExpanderWidget->style; - - TSOffsetStyleGCs(style, rect->x, rect->y); - gtk_paint_expander(style, drawable, state_type, cliprect, gExpanderWidget, "expander", - rect->x + rect->width / 2, rect->y + rect->height / 2, expander_state); - - return MOZ_GTK_SUCCESS; -} - static gint moz_gtk_combo_box_paint(GdkDrawable* drawable, GdkRectangle* rect, GdkRectangle* cliprect, GtkWidgetState* state, @@ -2969,7 +2948,6 @@ moz_gtk_get_widget_border(GtkThemeWidgetType widget, gint* left, gint* top, case MOZ_GTK_PROGRESS_CHUNK: case MOZ_GTK_PROGRESS_CHUNK_INDETERMINATE: case MOZ_GTK_PROGRESS_CHUNK_VERTICAL_INDETERMINATE: - case MOZ_GTK_EXPANDER: case MOZ_GTK_TREEVIEW_EXPANDER: case MOZ_GTK_TOOLBAR_SEPARATOR: case MOZ_GTK_MENUSEPARATOR: @@ -3256,10 +3234,6 @@ moz_gtk_widget_paint(GtkThemeWidgetType widget, GdkDrawable* drawable, return moz_gtk_treeview_expander_paint(drawable, rect, cliprect, state, (GtkExpanderStyle) flags, direction); break; - case MOZ_GTK_EXPANDER: - return moz_gtk_expander_paint(drawable, rect, cliprect, state, - (GtkExpanderStyle) flags, direction); - break; case MOZ_GTK_ENTRY: ensure_entry_widget(); return moz_gtk_entry_paint(drawable, rect, cliprect, state, diff --git a/widget/gtk2/gtk3drawing.c b/widget/gtk2/gtk3drawing.c index c3ef8e207fec..57122df13195 100644 --- a/widget/gtk2/gtk3drawing.c +++ b/widget/gtk2/gtk3drawing.c @@ -1610,28 +1610,6 @@ moz_gtk_treeview_expander_paint(cairo_t *cr, GdkRectangle* rect, return MOZ_GTK_SUCCESS; } -static gint -moz_gtk_expander_paint(cairo_t *cr, GdkRectangle* rect, - GtkWidgetState* state, - GtkExpanderStyle expander_state, - GtkTextDirection direction) -{ - GtkStyleContext *style; - - ensure_expander_widget(); - gtk_widget_set_direction(gExpanderWidget, direction); - - style = gtk_widget_get_style_context(gExpanderWidget); - gtk_style_context_save(style); - gtk_style_context_add_class(style, GTK_STYLE_CLASS_EXPANDER); - gtk_style_context_set_state(style, GetStateFlagsFromGtkWidgetState(state)); - gtk_render_expander(style, cr, - rect->x + rect->width / 2, rect->y + rect->height / 2, - rect->width, rect->height); - gtk_style_context_restore(style); - return MOZ_GTK_SUCCESS; -} - /* See gtk_separator_draw() for reference. */ static gint @@ -2844,7 +2822,6 @@ moz_gtk_get_widget_border(GtkThemeWidgetType widget, gint* left, gint* top, case MOZ_GTK_PROGRESS_CHUNK: case MOZ_GTK_PROGRESS_CHUNK_INDETERMINATE: case MOZ_GTK_PROGRESS_CHUNK_VERTICAL_INDETERMINATE: - case MOZ_GTK_EXPANDER: case MOZ_GTK_TREEVIEW_EXPANDER: case MOZ_GTK_TOOLBAR_SEPARATOR: case MOZ_GTK_MENUSEPARATOR: @@ -3150,10 +3127,6 @@ moz_gtk_widget_paint(GtkThemeWidgetType widget, cairo_t *cr, return moz_gtk_treeview_expander_paint(cr, rect, state, (GtkExpanderStyle) flags, direction); break; - case MOZ_GTK_EXPANDER: - return moz_gtk_expander_paint(cr, rect, state, - (GtkExpanderStyle) flags, direction); - break; case MOZ_GTK_ENTRY: ensure_entry_widget(); return moz_gtk_entry_paint(cr, rect, state, diff --git a/widget/gtk2/gtkdrawing.h b/widget/gtk2/gtkdrawing.h index 6508d27cf56a..5d38574bd7ca 100644 --- a/widget/gtk2/gtkdrawing.h +++ b/widget/gtk2/gtkdrawing.h @@ -161,8 +161,6 @@ typedef enum { MOZ_GTK_TREE_HEADER_SORTARROW, /* Paints an expander for a GtkTreeView */ MOZ_GTK_TREEVIEW_EXPANDER, - /* Paints a GtkExpander */ - MOZ_GTK_EXPANDER, /* Paints the background of the menu bar. */ MOZ_GTK_MENUBAR, /* Paints the background of menus, context menus. */ From 7d6b47172c0d222c1e29076c9902e0fc31617a6e Mon Sep 17 00:00:00 2001 From: Mina Almasry Date: Tue, 30 Jul 2013 10:04:04 -0400 Subject: [PATCH 5/9] Bug 897185 - toJSON only deals with attributes whose types are serializable. r=bz Now jsonifiers only include serializable attributes in their returned object, as per spec. --- dom/bindings/Codegen.py | 2 +- dom/bindings/parser/WebIDL.py | 28 +++++++++++++++++++++++++ dom/bindings/test/TestBindingHeader.h | 6 ++++++ dom/bindings/test/TestCodeGen.webidl | 4 ++++ dom/bindings/test/TestExampleGen.webidl | 3 +++ dom/bindings/test/TestJSImplGen.webidl | 3 +++ 6 files changed, 45 insertions(+), 1 deletion(-) diff --git a/dom/bindings/Codegen.py b/dom/bindings/Codegen.py index 5b59068252d0..7f67a613bedf 100644 --- a/dom/bindings/Codegen.py +++ b/dom/bindings/Codegen.py @@ -5241,7 +5241,7 @@ class CGJsonifierMethod(CGSpecializedMethod): ' return false;\n' '}\n') for m in self.descriptor.interface.members: - if m.isAttr() and not m.isStatic(): + if m.isAttr() and not m.isStatic() and m.type.isSerializable(): ret += ('{ // scope for "temp"\n' ' JS::Rooted temp(cx);\n' ' if (!get_%s(cx, obj, self, JSJitGetterCallArgs(&temp))) {\n' diff --git a/dom/bindings/parser/WebIDL.py b/dom/bindings/parser/WebIDL.py index 6d0fbd8a5005..d4f31acd569f 100644 --- a/dom/bindings/parser/WebIDL.py +++ b/dom/bindings/parser/WebIDL.py @@ -1333,6 +1333,9 @@ class IDLType(IDLObject): # Should only call this on float types assert self.isFloat() + def isSerializable(self): + return False + def tag(self): assert False # Override me! @@ -1468,6 +1471,9 @@ class IDLNullableType(IDLType): def isUnion(self): return self.inner.isUnion() + def isSerializable(self): + return self.inner.isSerializable() + def tag(self): return self.inner.tag() @@ -1553,6 +1559,9 @@ class IDLSequenceType(IDLType): def isEnum(self): return False + def isSerializable(self): + return self.inner.isSerializable() + def includesRestrictedFloat(self): return self.inner.includesRestrictedFloat() @@ -1602,6 +1611,9 @@ class IDLUnionType(IDLType): def isUnion(self): return True + def isSerializable(self): + return all(m.isSerializable() for m in self.memberTypes) + def includesRestrictedFloat(self): return any(t.includesRestrictedFloat() for t in self.memberTypes) @@ -1932,6 +1944,19 @@ class IDLWrapperType(IDLType): def isEnum(self): return isinstance(self.inner, IDLEnum) + def isSerializable(self): + if self.isInterface(): + if self.inner.isExternal(): + return False + return any(m.isMethod() and m.isJsonifier() for m in self.inner.members) + elif self.isEnum(): + return True + elif self.isDictionary(): + return all(m.isSerializable() for m in self.inner.members) + else: + raise WebIDLError("IDLWrapperType wraps type %s that we don't know if " + "is serializable" % type(self.inner), [self.location]) + def resolveType(self, parentScope): assert isinstance(parentScope, IDLScope) self.inner.resolve(parentScope) @@ -2130,6 +2155,9 @@ class IDLBuiltinType(IDLType): return self._typeTag == IDLBuiltinType.Types.unrestricted_float or \ self._typeTag == IDLBuiltinType.Types.unrestricted_double + def isSerializable(self): + return self.isPrimitive() or self.isDOMString() or self.isDate() + def includesRestrictedFloat(self): return self.isFloat() and not self.isUnrestricted() diff --git a/dom/bindings/test/TestBindingHeader.h b/dom/bindings/test/TestBindingHeader.h index 0a247de67b13..2fa3edb0d042 100644 --- a/dom/bindings/test/TestBindingHeader.h +++ b/dom/bindings/test/TestBindingHeader.h @@ -608,6 +608,12 @@ public: TestInterface* PutForwardsAttr(); TestInterface* PutForwardsAttr2(); TestInterface* PutForwardsAttr3(); + JS::Value JsonifierShouldSkipThis(JSContext*); + void SetJsonifierShouldSkipThis(JSContext*, JS::Rooted&); + TestParentInterface* JsonifierShouldSkipThis2(); + void SetJsonifierShouldSkipThis2(TestParentInterface&); + TestCallbackInterface* JsonifierShouldSkipThis3(); + void SetJsonifierShouldSkipThis3(TestCallbackInterface&); void ThrowingMethod(ErrorResult& aRv); bool GetThrowingAttr(ErrorResult& aRv) const; void SetThrowingAttr(bool arg, ErrorResult& aRv); diff --git a/dom/bindings/test/TestCodeGen.webidl b/dom/bindings/test/TestCodeGen.webidl index 193aaf085fe8..fd2d6a2fbcfe 100644 --- a/dom/bindings/test/TestCodeGen.webidl +++ b/dom/bindings/test/TestCodeGen.webidl @@ -583,6 +583,10 @@ interface TestInterface { optional TestInterface? arg2 = null, optional Dict arg3, optional double arg4 = 5.0, optional float arg5); + + attribute any jsonifierShouldSkipThis; + attribute TestParentInterface jsonifierShouldSkipThis2; + attribute TestCallbackInterface jsonifierShouldSkipThis3; jsonifier; // If you add things here, add them to TestExampleGen and TestJSImplGen as well diff --git a/dom/bindings/test/TestExampleGen.webidl b/dom/bindings/test/TestExampleGen.webidl index ee75b70e48d3..1750eb5ed7b8 100644 --- a/dom/bindings/test/TestExampleGen.webidl +++ b/dom/bindings/test/TestExampleGen.webidl @@ -480,6 +480,9 @@ interface TestExampleInterface { optional TestInterface? arg2 = null, optional Dict arg3, optional double arg4 = 5.0, optional float arg5); + attribute any jsonifierShouldSkipThis; + attribute TestParentInterface jsonifierShouldSkipThis2; + attribute TestCallbackInterface jsonifierShouldSkipThis3; jsonifier; // If you add things here, add them to TestCodeGen and TestJSImplGen as well diff --git a/dom/bindings/test/TestJSImplGen.webidl b/dom/bindings/test/TestJSImplGen.webidl index 99b755492a97..4b58009e99e0 100644 --- a/dom/bindings/test/TestJSImplGen.webidl +++ b/dom/bindings/test/TestJSImplGen.webidl @@ -472,6 +472,9 @@ interface TestJSImplInterface { optional TestInterface? arg2 = null, optional Dict arg3, optional double arg4 = 5.0, optional float arg5); + attribute any jsonifierShouldSkipThis; + attribute TestParentInterface jsonifierShouldSkipThis2; + attribute TestCallbackInterface jsonifierShouldSkipThis3; jsonifier; // If you add things here, add them to TestCodeGen as well From 35bfdc49f6fa3ed84d6aa9b877923490f24b3a79 Mon Sep 17 00:00:00 2001 From: Ryan VanderMeulen Date: Tue, 30 Jul 2013 10:56:00 -0400 Subject: [PATCH 6/9] Backed out changeset e9530cf2baed (bug 890597) for Windows Werror bustage. --- dom/webidl/DummyBinding.webidl | 1 - dom/webidl/NetDashboard.webidl | 5 - netwerk/base/public/nsIDashboard.idl | 9 -- netwerk/base/src/Dashboard.cpp | 168 +-------------------------- netwerk/base/src/Dashboard.h | 43 +------ netwerk/base/src/DashboardTypes.h | 5 - 6 files changed, 2 insertions(+), 229 deletions(-) diff --git a/dom/webidl/DummyBinding.webidl b/dom/webidl/DummyBinding.webidl index 48fa8c941f53..7bdfbbe7dd3f 100644 --- a/dom/webidl/DummyBinding.webidl +++ b/dom/webidl/DummyBinding.webidl @@ -16,7 +16,6 @@ interface DummyInterface { void funcHttpConnDict(optional HttpConnDict arg); void funcWebSocketDict(optional WebSocketDict arg); void funcDNSCacheDict(optional DNSCacheDict arg); - void funcConnStatusDict(optional ConnStatusDict arg); void frameRequestCallback(FrameRequestCallback arg); void idbObjectStoreParams(optional IDBObjectStoreParameters arg); void CameraPictureOptions(optional CameraPictureOptions arg); diff --git a/dom/webidl/NetDashboard.webidl b/dom/webidl/NetDashboard.webidl index daf553918ef7..23f200bc7b7a 100644 --- a/dom/webidl/NetDashboard.webidl +++ b/dom/webidl/NetDashboard.webidl @@ -49,8 +49,3 @@ dictionary DNSCacheDict { sequence family; sequence expiration; }; - -dictionary ConnStatusDict { - DOMString status; -}; - diff --git a/netwerk/base/public/nsIDashboard.idl b/netwerk/base/public/nsIDashboard.idl index ac1bae613f38..e04bc2a6e2a1 100644 --- a/netwerk/base/public/nsIDashboard.idl +++ b/netwerk/base/public/nsIDashboard.idl @@ -35,15 +35,6 @@ interface nsIDashboard : nsISupports /* Arrays: hostname, family, hostaddr, expiration */ void requestDNSInfo(in NetDashboardCallback cb); - /* aProtocol: a transport layer protocol: - * ex: "ssl", "tcp", default is "tcp". - * aHost: the host's name - * aPort: the port which the connection will open on - * aTimeout: the timespan before the connection will be timed out */ - void requestConnection(in ACString aHost, in unsigned long aPort, - in string aProtocol, in unsigned long aTimeout, - in NetDashboardCallback cb); - /* When true, the service will log websocket events */ attribute boolean enableLogging; }; diff --git a/netwerk/base/src/Dashboard.cpp b/netwerk/base/src/Dashboard.cpp index 0c86accc23a4..b0f9e8a1c13a 100644 --- a/netwerk/base/src/Dashboard.cpp +++ b/netwerk/base/src/Dashboard.cpp @@ -13,8 +13,7 @@ using mozilla::AutoSafeJSContext; namespace mozilla { namespace net { -NS_IMPL_ISUPPORTS4(Dashboard, nsIDashboard, nsIDashboardEventNotifier, - nsITransportEventSink, nsITimerCallback) +NS_IMPL_ISUPPORTS2(Dashboard, nsIDashboard, nsIDashboardEventNotifier) using mozilla::dom::Sequence; Dashboard::Dashboard() @@ -496,169 +495,4 @@ HttpConnInfo::SetHTTP2ProtocolVersion(uint8_t pv) protocolVersion.Assign(NS_LITERAL_STRING("spdy/3")); } -NS_IMETHODIMP -Dashboard::RequestConnection(const nsACString& aHost, uint32_t aPort, - const char *aProtocol, uint32_t aTimeout, - NetDashboardCallback* cb) -{ - nsresult rv; - mConn.cb = cb; - mConn.thread = NS_GetCurrentThread(); - - rv = TestNewConnection(aHost, aPort, aProtocol, aTimeout); - if (NS_FAILED(rv)) { - ConnStatus status; - CopyASCIItoUTF16(GetErrorString(rv), status.creationSts); - nsCOMPtr event = new DashConnStatusRunnable(this, status); - mConn.thread->Dispatch(event, NS_DISPATCH_NORMAL); - return rv; - } - - return NS_OK; -} - -nsresult -Dashboard::GetConnectionStatus(ConnStatus aStatus) -{ - AutoSafeJSContext cx; - - mozilla::dom::ConnStatusDict dict; - dict.mStatus.Construct(); - nsString &status = dict.mStatus.Value(); - status = aStatus.creationSts; - - JS::RootedValue val(cx); - if (!dict.ToObject(cx, JS::NullPtr(), &val)) { - mConn.cb = nullptr; - return NS_ERROR_FAILURE; - } - mConn.cb->OnDashboardDataAvailable(val); - - return NS_OK; -} - -nsresult -Dashboard::TestNewConnection(const nsACString& aHost, uint32_t aPort, - const char *aProtocol, uint32_t aTimeout) -{ - nsresult rv; - if (!aHost.Length() || !net_IsValidHostName(aHost)) - return NS_ERROR_UNKNOWN_HOST; - - if (aProtocol && NS_LITERAL_STRING("ssl").EqualsASCII(aProtocol)) - rv = gSocketTransportService->CreateTransport(&aProtocol, 1, aHost, - aPort, nullptr, - getter_AddRefs(mConn.socket)); - else - rv = gSocketTransportService->CreateTransport(nullptr, 0, aHost, - aPort, nullptr, - getter_AddRefs(mConn.socket)); - if (NS_FAILED(rv)) - return rv; - - rv = mConn.socket->SetEventSink(this, NS_GetCurrentThread()); - if (NS_FAILED(rv)) - return rv; - - rv = mConn.socket->OpenInputStream(nsITransport::OPEN_BLOCKING, 0, 0, - getter_AddRefs(mConn.streamIn)); - if (NS_FAILED(rv)) - return rv; - - StartTimer(aTimeout); - - return rv; -} - -NS_IMETHODIMP -Dashboard::OnTransportStatus(nsITransport *aTransport, nsresult aStatus, - uint64_t aProgress, uint64_t aProgressMax) -{ - if (aStatus == NS_NET_STATUS_CONNECTED_TO) - StopTimer(); - - ConnStatus status; - CopyASCIItoUTF16(GetErrorString(aStatus), status.creationSts); - nsCOMPtr event = new DashConnStatusRunnable(this, status); - mConn.thread->Dispatch(event, NS_DISPATCH_NORMAL); - - return NS_OK; -} - -NS_IMETHODIMP -Dashboard::Notify(nsITimer *timer) -{ - if (mConn.socket) { - mConn.socket->Close(NS_ERROR_ABORT); - mConn.socket = nullptr; - mConn.streamIn = nullptr; - } - - mConn.timer = nullptr; - - ConnStatus status; - status.creationSts.Assign(NS_LITERAL_STRING("NS_ERROR_NET_TIMEOUT")); - nsCOMPtr event = new DashConnStatusRunnable(this, status); - mConn.thread->Dispatch(event, NS_DISPATCH_NORMAL); - - return NS_OK; -} - -void -Dashboard::StartTimer(uint32_t aTimeout) -{ - if (!mConn.timer) - mConn.timer = do_CreateInstance("@mozilla.org/timer;1"); - mConn.timer->InitWithCallback(this, aTimeout * 1000, nsITimer::TYPE_ONE_SHOT); -} - -void -Dashboard::StopTimer() -{ - if (mConn.timer) { - mConn.timer->Cancel(); - mConn.timer = nullptr; - } -} - -typedef struct -{ - nsresult key; - const char *error; -} ErrorEntry; - -ErrorEntry errors[] = { - #define ERROR(key, val) {key, #key} - #include "ErrorList.h" - #undef ERROR -}; - -ErrorEntry socketTransportStatuses[] = { - #define ERROR(key, val) {key, #key} - ERROR(NS_NET_STATUS_RESOLVING_HOST, FAILURE(3)), - ERROR(NS_NET_STATUS_RESOLVED_HOST, FAILURE(11)), - ERROR(NS_NET_STATUS_CONNECTING_TO, FAILURE(7)), - ERROR(NS_NET_STATUS_CONNECTED_TO, FAILURE(4)), - ERROR(NS_NET_STATUS_SENDING_TO, FAILURE(5)), - ERROR(NS_NET_STATUS_WAITING_FOR, FAILURE(10)), - ERROR(NS_NET_STATUS_RECEIVING_FROM, FAILURE(6)), - #undef ERROR -}; - -const char * -Dashboard::GetErrorString(nsresult rv) -{ - int length = sizeof(socketTransportStatuses) / sizeof(ErrorEntry); - for (int i = 0;i < length;i++) - if (socketTransportStatuses[i].key == rv) - return socketTransportStatuses[i].error; - - length = sizeof(errors) / sizeof(ErrorEntry); - for (int i = 0;i < length;i++) - if (errors[i].key == rv) - return errors[i].error; - - return NULL; -} - } } // namespace mozilla::net diff --git a/netwerk/base/src/Dashboard.h b/netwerk/base/src/Dashboard.h index 08c25394ffb9..eeeb97f6a689 100644 --- a/netwerk/base/src/Dashboard.h +++ b/netwerk/base/src/Dashboard.h @@ -15,45 +15,32 @@ #include "nsSocketTransport2.h" #include "mozilla/net/DashboardTypes.h" #include "nsHttp.h" -#include "nsITransport.h" -#include "nsITimer.h" namespace mozilla { namespace net { class Dashboard: public nsIDashboard, - public nsIDashboardEventNotifier, - public nsITransportEventSink, - public nsITimerCallback + public nsIDashboardEventNotifier { public: NS_DECL_THREADSAFE_ISUPPORTS NS_DECL_NSIDASHBOARD NS_DECL_NSIDASHBOARDEVENTNOTIFIER - NS_DECL_NSITRANSPORTEVENTSINK - NS_DECL_NSITIMERCALLBACK Dashboard(); - friend class DashConnStatusRunnable; - static const char *GetErrorString(nsresult rv); private: virtual ~Dashboard(); void GetSocketsDispatch(); void GetHttpDispatch(); void GetDnsInfoDispatch(); - void StartTimer(uint32_t aTimeout); - void StopTimer(); - nsresult TestNewConnection(const nsACString& aHost, uint32_t aPort, - const char *aProtocol, uint32_t aTimeout); /* Helper methods that pass the JSON to the callback function. */ nsresult GetSockets(); nsresult GetHttpConnections(); nsresult GetWebSocketConnections(); nsresult GetDNSCacheEntries(); - nsresult GetConnectionStatus(struct ConnStatus aStatus); private: struct SocketData @@ -119,41 +106,13 @@ private: nsIThread* thread; }; - struct ConnectionData - { - nsCOMPtr socket; - nsCOMPtr streamIn; - nsCOMPtr timer; - nsCOMPtr cb; - nsIThread* thread; - }; - bool mEnableLogging; struct SocketData mSock; struct HttpData mHttp; struct WebSocketData mWs; struct DnsData mDns; - struct ConnectionData mConn; -}; -class DashConnStatusRunnable: public nsRunnable -{ -public: - DashConnStatusRunnable(Dashboard * aDashboard, ConnStatus aStatus) - : mDashboard(aDashboard) - { - mStatus.creationSts = aStatus.creationSts; - } - - NS_IMETHODIMP Run() - { - return mDashboard->GetConnectionStatus(mStatus); - } - -private: - ConnStatus mStatus; - Dashboard * mDashboard; }; } } // namespace mozilla::net diff --git a/netwerk/base/src/DashboardTypes.h b/netwerk/base/src/DashboardTypes.h index e3506679d7c6..5045150f6e4e 100644 --- a/netwerk/base/src/DashboardTypes.h +++ b/netwerk/base/src/DashboardTypes.h @@ -57,11 +57,6 @@ struct HttpRetParams bool ssl; }; -struct ConnStatus -{ - nsString creationSts; -}; - } } #endif // mozilla_net_DashboardTypes_h_ From 512f5ba16147bbcfe0b5a2bd192b0a18f337789c Mon Sep 17 00:00:00 2001 From: Shane Caraveo Date: Tue, 30 Jul 2013 08:53:31 -0700 Subject: [PATCH 7/9] bug 899192 fix toolbar button test, r=markh --- .../base/content/test/social/browser_social_toolbar.js | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/browser/base/content/test/social/browser_social_toolbar.js b/browser/base/content/test/social/browser_social_toolbar.js index 2a648ade2667..e06e3a57fbfe 100644 --- a/browser/base/content/test/social/browser_social_toolbar.js +++ b/browser/base/content/test/social/browser_social_toolbar.js @@ -124,11 +124,14 @@ var tests = { let numIcons = Object.keys(Social.provider.ambientNotificationIcons).length; ok(numIcons == 3, "prevent adding more than 3 ambient notification icons"); - let statusIcon = document.getElementById("social-provider-button").nextSibling; + let mButton = document.getElementById("social-mark-button"); + let pButton = document.getElementById("social-provider-button"); waitForCondition(function() { - statusIcon = document.getElementById("social-provider-button").nextSibling; - return !!statusIcon; + // wait for a new button to be inserted inbetween the provider and mark + // button + return pButton.nextSibling != mButton; }, function () { + let statusIcon = pButton.nextSibling; let badge = statusIcon.getAttribute("badge"); is(badge, "42", "status value is correct"); // If there is a counter, the aria-label should reflect it. @@ -136,6 +139,7 @@ var tests = { ambience.counter = 0; Social.provider.setAmbientNotification(ambience); + statusIcon = pButton.nextSibling; badge = statusIcon.getAttribute("badge"); is(badge, "", "status value is correct"); // If there is no counter, the aria-label should be the same as the label From a1a6700c02eabeb2831e76cb69ccb2ab023c3065 Mon Sep 17 00:00:00 2001 From: Tim Taubert Date: Tue, 30 Jul 2013 09:38:12 -0700 Subject: [PATCH 8/9] Bug 899532 - Use whenDelayedStartupFinished() in browser_tab_dragdrop.js; r=gavin --- browser/base/content/test/browser_tab_dragdrop.js | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/browser/base/content/test/browser_tab_dragdrop.js b/browser/base/content/test/browser_tab_dragdrop.js index 973454df4014..04e4acdd7fa0 100644 --- a/browser/base/content/test/browser_tab_dragdrop.js +++ b/browser/base/content/test/browser_tab_dragdrop.js @@ -61,9 +61,7 @@ function test() executeSoon(function () { var win = gBrowser.replaceTabWithWindow(t); - win.addEventListener("load", function () { - win.removeEventListener("load", arguments.callee, true); - + whenDelayedStartupFinished(win, function () { // Verify that the original window now only has the initial tab left in it. is(gBrowser.tabs[0], tabs[0], "tab0"); is(gBrowser.getBrowserForTab(gBrowser.tabs[0]).contentWindow.location, "about:blank", "tab0 uri"); @@ -82,7 +80,7 @@ function test() }, false); win.gBrowser.goBack(); }); - }, true); + }); }); }, true); b.loadURI("about:blank"); @@ -111,10 +109,10 @@ function test() gBrowser.getBrowserForTab(tabs[i]).addEventListener("load", fn(waitForLoad,i), true); } - setLocation(1, "data:text/html,tab1tab1