Merge m-c to m-i
authorPhil Ringnalda <philringnalda@gmail.com>
Sun, 05 May 2013 12:17:07 -0700
changeset 141846 334e63a273cbbe23ed26a144a4c6d9a48e65a5b9
parent 141845 075119674e7b9d96291622f194479f2b728ce7be (current diff)
parent 141796 b47de8314e7f1d6fcf0e8ed8e41aadadfeb0baa5 (diff)
child 141847 b109e2dbf03bd4d06cfcfb1a74cec884808e35eb
push id2579
push userakeybl@mozilla.com
push dateMon, 24 Jun 2013 18:52:47 +0000
treeherdermozilla-beta@b69b7de8a05a [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
milestone23.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Merge m-c to m-i
content/base/src/nsDocument.cpp
content/html/content/src/HTMLMediaElement.cpp
dom/base/nsDOMClassInfo.cpp
dom/bindings/Codegen.py
dom/bindings/DOMJSProxyHandler.cpp
js/src/jsfriendapi.h
js/xpconnect/src/XPCJSID.cpp
js/xpconnect/wrappers/XrayWrapper.cpp
--- a/content/base/src/nsDocument.cpp
+++ b/content/base/src/nsDocument.cpp
@@ -2240,19 +2240,17 @@ nsDocument::ResetStylesheetsToURI(nsIURI
     // Remove this sheet from all style sets
     nsCOMPtr<nsIPresShell> shell = GetShell();
     if (shell) {
       shell->StyleSet()->
         RemoveStyleSheet(nsStyleSet::eStyleAttrSheet, mStyleAttrStyleSheet);
     }
     mStyleAttrStyleSheet->Reset(aURI);
   } else {
-    mStyleAttrStyleSheet = new nsHTMLCSSStyleSheet();
-    nsresult rv = mStyleAttrStyleSheet->Init(aURI, this);
-    NS_ENSURE_SUCCESS(rv, rv);
+    mStyleAttrStyleSheet = new nsHTMLCSSStyleSheet(aURI, this);
   }
 
   // The loop over style sets below will handle putting this sheet
   // into style sets as needed.
   mStyleAttrStyleSheet->SetOwningDocument(this);
 
   // Now set up our style sets
   nsCOMPtr<nsIPresShell> shell = GetShell();
--- a/content/events/src/nsDOMKeyboardEvent.cpp
+++ b/content/events/src/nsDOMKeyboardEvent.cpp
@@ -129,25 +129,16 @@ nsDOMKeyboardEvent::KeyCode()
   case NS_KEY_UP:
   case NS_KEY_PRESS:
   case NS_KEY_DOWN:
     return static_cast<nsKeyEvent*>(mEvent)->keyCode;
   }
   return 0;
 }
 
-/* virtual */
-nsresult
-nsDOMKeyboardEvent::Which(uint32_t* aWhich)
-{
-  NS_ENSURE_ARG_POINTER(aWhich);
-  *aWhich = Which();
-  return NS_OK;
-}
-
 uint32_t
 nsDOMKeyboardEvent::Which()
 {
   switch (mEvent->message) {
     case NS_KEY_UP:
     case NS_KEY_DOWN:
       return KeyCode();
     case NS_KEY_PRESS:
--- a/content/events/src/nsDOMKeyboardEvent.h
+++ b/content/events/src/nsDOMKeyboardEvent.h
@@ -71,16 +71,12 @@ public:
                     bool aShiftKey, bool aMetaKey,
                     uint32_t aKeyCode, uint32_t aCharCode,
                     mozilla::ErrorResult& aRv)
   {
     aRv = InitKeyEvent(aType, aCanBubble, aCancelable, aView,
                        aCtrlKey, aAltKey, aShiftKey,aMetaKey,
                        aKeyCode, aCharCode);
   }
-
-protected:
-  // Specific implementation for a keyboard event.
-  virtual nsresult Which(uint32_t* aWhich);
 };
 
 
 #endif // nsDOMKeyboardEvent_h__
--- a/content/events/src/nsDOMMouseEvent.cpp
+++ b/content/events/src/nsDOMMouseEvent.cpp
@@ -442,27 +442,16 @@ nsDOMMouseEvent::GetModifierState(const 
                                   bool* aState)
 {
   NS_ENSURE_ARG_POINTER(aState);
 
   *aState = GetModifierState(aKey);
   return NS_OK;
 }
 
-/* virtual */
-nsresult
-nsDOMMouseEvent::Which(uint32_t* aWhich)
-{
-  NS_ENSURE_ARG_POINTER(aWhich);
-  uint16_t button;
-  (void) GetButton(&button);
-  *aWhich = button + 1;
-  return NS_OK;
-}
-
 NS_IMETHODIMP
 nsDOMMouseEvent::GetMozPressure(float* aPressure)
 {
   NS_ENSURE_ARG_POINTER(aPressure);
   *aPressure = MozPressure();
   return NS_OK;
 }
 
--- a/content/events/src/nsDOMMouseEvent.h
+++ b/content/events/src/nsDOMMouseEvent.h
@@ -35,19 +35,17 @@ public:
   }
 
   virtual nsresult InitFromCtor(const nsAString& aType,
                                 JSContext* aCx, JS::Value* aVal);
 
   // Web IDL binding methods
   virtual uint32_t Which() MOZ_OVERRIDE
   {
-    uint32_t w = 0;
-    Which(&w);
-    return w;
+    return Button() + 1;
   }
 
   int32_t ScreenX();
   int32_t ScreenY();
   int32_t ClientX();
   int32_t ClientY();
   bool CtrlKey()
   {
@@ -118,19 +116,16 @@ public:
     aRv = InitNSMouseEvent(aType, aCanBubble, aCancelable,
                            aView, aDetail, aScreenX, aScreenY,
                            aClientX, aClientY, aCtrlKey, aAltKey,
                            aShiftKey, aMetaKey, aButton,
                            aRelatedTarget, aPressure, aInputSource);
   }
 
 protected:
-  // Specific implementation for a mouse event.
-  virtual nsresult Which(uint32_t* aWhich);
-
   nsresult InitMouseEvent(const nsAString& aType,
                           bool aCanBubble,
                           bool aCancelable,
                           nsIDOMWindow* aView,
                           int32_t aDetail,
                           int32_t aScreenX,
                           int32_t aScreenY,
                           int32_t aClientX,
--- a/content/events/src/nsDOMUIEvent.cpp
+++ b/content/events/src/nsDOMUIEvent.cpp
@@ -248,17 +248,19 @@ nsDOMUIEvent::GetPageY(int32_t* aPageY)
                                         mClientPoint).y;
   }
   return NS_OK;
 }
 
 NS_IMETHODIMP
 nsDOMUIEvent::GetWhich(uint32_t* aWhich)
 {
-  return Which(aWhich);
+  NS_ENSURE_ARG_POINTER(aWhich);
+  *aWhich = Which();
+  return NS_OK;
 }
 
 already_AddRefed<nsINode>
 nsDOMUIEvent::GetRangeParent()
 {
   nsIFrame* targetFrame = nullptr;
 
   if (mPresContext) {
--- a/content/events/src/nsDOMUIEvent.h
+++ b/content/events/src/nsDOMUIEvent.h
@@ -130,19 +130,21 @@ public:
   {
     int32_t y;
     GetPageY(&y);
     return y;
   }
 
   virtual uint32_t Which()
   {
-    uint32_t w;
-    GetWhich(&w);
-    return w;
+    MOZ_ASSERT(mEvent->eventStructType != NS_KEY_EVENT,
+               "Key events should override Which()");
+    MOZ_ASSERT(mEvent->eventStructType != NS_MOUSE_EVENT,
+               "Mouse events should override Which()");
+    return 0;
   }
 
   already_AddRefed<nsINode> GetRangeParent();
 
   int32_t RangeOffset()
   {
     int32_t offset;
     GetRangeOffset(&offset);
@@ -163,25 +165,16 @@ public:
 
 protected:
   // Internal helper functions
   nsIntPoint GetClientPoint();
   nsIntPoint GetMovementPoint();
   nsIntPoint GetLayerPoint();
   nsIntPoint GetPagePoint();
 
-  // Allow specializations.
-  virtual nsresult Which(uint32_t* aWhich)
-  {
-    NS_ENSURE_ARG_POINTER(aWhich);
-    // Usually we never reach here, as this is reimplemented for mouse and keyboard events.
-    *aWhich = 0;
-    return NS_OK;
-  }
-
   nsCOMPtr<nsIDOMWindow> mView;
   int32_t mDetail;
   nsIntPoint mClientPoint;
   // Screenpoint is mEvent->refPoint.
   nsIntPoint mLayerPoint;
   nsIntPoint mPagePoint;
   nsIntPoint mMovementPoint;
   bool mIsPointerLocked;
--- a/content/html/content/src/HTMLMediaElement.cpp
+++ b/content/html/content/src/HTMLMediaElement.cpp
@@ -3247,26 +3247,20 @@ void HTMLMediaElement::SuspendOrResumeEl
       }
     }
   }
 }
 
 void HTMLMediaElement::NotifyOwnerDocumentActivityChanged()
 {
   nsIDocument* ownerDoc = OwnerDoc();
-  if (UseAudioChannelService()) {
-    nsCOMPtr<nsIDOMDocument> domDoc = do_QueryInterface(OwnerDoc());
-    if (domDoc) {
-      bool hidden = false;
-      domDoc->GetHidden(&hidden);
-      // SetVisibilityState will update mChannelSuspended via the CanPlayChanged callback.
-      if (mPlayingThroughTheAudioChannel && mAudioChannelAgent) {
-        mAudioChannelAgent->SetVisibilityState(!hidden);
-      }
-    }
+  // SetVisibilityState will update mChannelSuspended via the CanPlayChanged callback.
+  if (UseAudioChannelService() && mPlayingThroughTheAudioChannel &&
+      mAudioChannelAgent) {
+    mAudioChannelAgent->SetVisibilityState(!ownerDoc->Hidden());
   }
   bool suspendEvents = !ownerDoc->IsActive() || !ownerDoc->IsVisible();
   bool pauseElement = suspendEvents || mChannelSuspended;
 
   SuspendOrResumeElement(pauseElement, suspendEvents);
 
   AddRemoveSelfReference();
 }
@@ -3724,23 +3718,17 @@ void HTMLMediaElement::UpdateAudioChanne
     if (!mAudioChannelAgent) {
       nsresult rv;
       mAudioChannelAgent = do_CreateInstance("@mozilla.org/audiochannelagent;1", &rv);
       if (!mAudioChannelAgent) {
         return;
       }
       // Use a weak ref so the audio channel agent can't leak |this|.
       mAudioChannelAgent->InitWithWeakCallback(mAudioChannelType, this);
-
-      nsCOMPtr<nsIDOMDocument> domDoc = do_QueryInterface(OwnerDoc());
-      if (domDoc) {
-        bool hidden = false;
-        domDoc->GetHidden(&hidden);
-        mAudioChannelAgent->SetVisibilityState(!hidden);
-      }
+      mAudioChannelAgent->SetVisibilityState(!OwnerDoc()->Hidden());
     }
 
     if (mPlayingThroughTheAudioChannel) {
       bool canPlay;
       mAudioChannelAgent->StartPlaying(&canPlay);
       mPaused.SetCanPlay(canPlay);
     } else {
       mAudioChannelAgent->StopPlaying();
--- a/dom/base/Navigator.cpp
+++ b/dom/base/Navigator.cpp
@@ -807,19 +807,17 @@ Navigator::Vibrate(const JS::Value& aPat
     // shutdown.
     ClearOnShutdown(&gVibrateWindowListener);
   }
   else {
     gVibrateWindowListener->RemoveListener();
   }
   gVibrateWindowListener = new VibrateWindowListener(win, doc);
 
-  nsCOMPtr<nsIDOMWindow> domWindow =
-    do_QueryInterface(static_cast<nsIDOMWindow*>(win));
-  hal::Vibrate(pattern, domWindow);
+  hal::Vibrate(pattern, win);
   return NS_OK;
 }
 
 //*****************************************************************************
 //    Navigator::nsIDOMClientInformation
 //*****************************************************************************
 
 NS_IMETHODIMP
--- a/dom/base/nsDOMClassInfo.cpp
+++ b/dom/base/nsDOMClassInfo.cpp
@@ -1057,17 +1057,17 @@ static const JSClass *sObjectClass = nul
 static void
 FindObjectClass(JSContext* cx, JSObject* aGlobalObject)
 {
   NS_ASSERTION(!sObjectClass,
                "Double set of sObjectClass");
   JS::Rooted<JSObject*> obj(cx), proto(cx, aGlobalObject);
   do {
     obj = proto;
-    js::GetObjectProto(cx, obj, proto.address());
+    js::GetObjectProto(cx, obj, &proto);
   } while (proto);
 
   sObjectClass = js::GetObjectJSClass(obj);
 }
 
 static void
 PrintWarningOnConsole(JSContext *cx, const char *stringBundleProperty)
 {
@@ -3115,26 +3115,28 @@ nsWindowSH::GlobalScopePolluterGetProper
   return JS_TRUE;
 }
 
 // Gets a subframe.
 static JSBool
 ChildWindowGetter(JSContext *cx, JSHandleObject obj, JSHandleId id,
                   JSMutableHandleValue vp)
 {
+  MOZ_ASSERT(JSID_IS_STRING(id));
   // Grab the native DOM window.
   vp.setUndefined();
   nsCOMPtr<nsISupports> winSupports =
     do_QueryInterface(nsDOMClassInfo::XPConnect()->GetNativeOfWrapper(cx, obj));
   if (!winSupports)
     return true;
   nsGlobalWindow *win = nsGlobalWindow::FromSupports(winSupports);
 
   // Find the child, if it exists.
-  nsCOMPtr<nsIDOMWindow> child = win->GetChildWindow(id);
+  nsDependentJSString name(id);
+  nsCOMPtr<nsIDOMWindow> child = win->GetChildWindow(name);
   if (!child)
     return true;
 
   // Wrap the child for JS.
   JS::Rooted<JS::Value> v(cx);
   nsresult rv = WrapNative(cx, JS_GetGlobalForScopeChain(cx), child,
                            /* aAllowWrapping = */ true, v.address());
   NS_ENSURE_SUCCESS(rv, false);
@@ -3168,17 +3170,18 @@ nsWindowSH::GlobalScopePolluterNewResolv
   // Grab the DOM window.
   JSObject *global = JS_GetGlobalForObject(cx, obj);
   nsISupports *globalNative = xpc->GetNativeOfWrapper(cx, global);
   nsCOMPtr<nsPIDOMWindow> piWin = do_QueryInterface(globalNative);
   MOZ_ASSERT(piWin);
   nsGlobalWindow* win = static_cast<nsGlobalWindow*>(piWin.get());
 
   if (win->GetLength() > 0) {
-    nsCOMPtr<nsIDOMWindow> child_win = win->GetChildWindow(id);
+    nsDependentJSString name(id);
+    nsCOMPtr<nsIDOMWindow> child_win = win->GetChildWindow(name);
     if (child_win) {
       // We found a subframe of the right name, so define the property
       // on the GSP. This property is a read-only accessor. Shadowing via
       // |var foo| in global scope is still allowed, since |var| only looks
       // up |own| properties. But unqualified shadowing will fail, per-spec.
       if (!JS_DefinePropertyById(cx, obj, id, JS::UndefinedValue(),
                                  ChildWindowGetter, JS_StrictPropertyStub,
                                  JSPROP_SHARED | JSPROP_ENUMERATE))
@@ -5160,17 +5163,17 @@ nsWindowSH::NewResolve(nsIXPConnectWrapp
   // defined on our prototype chain. This way we can access this
   // expando w/o ever getting back into XPConnect.
   if (flags & JSRESOLVE_ASSIGNING) {
     JS::Rooted<JSObject*> realObj(cx);
     wrapper->GetJSObject(realObj.address());
 
     if (obj == realObj) {
       JS::Rooted<JSObject*> proto(cx);
-      if (!js::GetObjectProto(cx, obj, proto.address())) {
+      if (!js::GetObjectProto(cx, obj, &proto)) {
           *_retval = JS_FALSE;
           return NS_OK;
       }
       if (proto) {
         JS::Rooted<JSObject*> pobj(cx);
         jsval val;
 
         if (!::JS_LookupPropertyWithFlagsById(cx, proto, id, flags,
@@ -6335,26 +6338,28 @@ nsHTMLDocumentSH::DocumentAllGetProperty
   // document.all.item and .namedItem get their value in the
   // newResolve hook, so nothing to do for those properties here. And
   // we need to return early to prevent <div id="item"> from shadowing
   // document.all.item(), etc.
   if (sItem_id == id || sNamedItem_id == id) {
     return JS_TRUE;
   }
 
+  JS::Rooted<JSObject*> proto(cx);
   while (js::GetObjectJSClass(obj) != &sHTMLDocumentAllClass) {
-    if (!js::GetObjectProto(cx, obj, obj.address())) {
+    if (!js::GetObjectProto(cx, obj, &proto)) {
       return JS_FALSE;
     }
 
-    if (!obj) {
+    if (!proto) {
       NS_ERROR("The JS engine lies!");
-
       return JS_TRUE;
     }
+
+    obj = proto;
   }
 
   nsHTMLDocument *doc = GetDocument(obj);
   nsISupports *result;
   nsWrapperCache *cache;
   nsresult rv = NS_OK;
 
   if (JSID_IS_STRING(id)) {
--- a/dom/base/nsGlobalWindow.cpp
+++ b/dom/base/nsGlobalWindow.cpp
@@ -948,22 +948,21 @@ nsChromeOuterWindowProxy::className(JSCo
 
     return "ChromeWindow";
 }
 
 nsChromeOuterWindowProxy
 nsChromeOuterWindowProxy::singleton;
 
 static JSObject*
-NewOuterWindowProxy(JSContext *cx, JSObject *aParent, bool isChrome)
-{
-  JS::Rooted<JSObject*> parent(cx, aParent);
+NewOuterWindowProxy(JSContext *cx, JS::Handle<JSObject*> parent, bool isChrome)
+{
   JSAutoCompartment ac(cx, parent);
   JS::Rooted<JSObject*> proto(cx);
-  if (!js::GetObjectProto(cx, parent, proto.address()))
+  if (!js::GetObjectProto(cx, parent, &proto))
     return nullptr;
 
   JSObject *obj = js::Wrapper::New(cx, parent, proto, parent,
                                    isChrome ? &nsChromeOuterWindowProxy::singleton
                                             : &nsOuterWindowProxy::singleton);
 
   NS_ASSERTION(js::GetObjectClass(obj)->ext.innerObject, "bad class");
   return obj;
@@ -2016,18 +2015,18 @@ WindowStateHolder::~WindowStateHolder()
 
 NS_IMPL_ISUPPORTS1(WindowStateHolder, WindowStateHolder)
 
 nsresult
 nsGlobalWindow::CreateOuterObject(nsGlobalWindow* aNewInner)
 {
   AutoPushJSContext cx(mContext->GetNativeContext());
 
-  JSObject* outer = NewOuterWindowProxy(cx, aNewInner->FastGetGlobalJSObject(),
-                                        IsChromeWindow());
+  JS::Rooted<JSObject*> global(cx, aNewInner->FastGetGlobalJSObject());
+  JSObject* outer = NewOuterWindowProxy(cx, global, IsChromeWindow());
   if (!outer) {
     return NS_ERROR_FAILURE;
   }
 
   js::SetProxyExtra(outer, 0, js::PrivateValue(ToSupports(this)));
 
   return SetOuterObject(cx, outer);
 }
@@ -2355,18 +2354,19 @@ nsGlobalWindow::SetNewDocument(nsIDocume
 
     if (!mJSObject) {
       CreateOuterObject(newInnerWindow);
       mContext->DidInitializeContext();
 
       mJSObject = mContext->GetNativeGlobal();
       SetWrapper(mJSObject);
     } else {
-      JSObject *outerObject = NewOuterWindowProxy(cx, xpc_UnmarkGrayObject(newInnerWindow->mJSObject),
-                                                  thisChrome);
+      JS::Rooted<JSObject*> global(cx,
+        xpc_UnmarkGrayObject(newInnerWindow->mJSObject));
+      JSObject* outerObject = NewOuterWindowProxy(cx, global, thisChrome);
       if (!outerObject) {
         NS_ERROR("out of memory");
         return NS_ERROR_FAILURE;
       }
 
       js::SetProxyExtra(mJSObject, 0, js::PrivateValue(NULL));
 
       outerObject = xpc::TransplantObject(cx, mJSObject, outerObject);
@@ -3513,17 +3513,18 @@ nsGlobalWindow::GetTopImpl(nsIDOMWindow*
 
 NS_IMETHODIMP
 nsGlobalWindow::GetContent(nsIDOMWindow** aContent)
 {
   FORWARD_TO_OUTER(GetContent, (aContent), NS_ERROR_NOT_INITIALIZED);
   *aContent = nullptr;
 
   // First check for a named frame named "content"
-  nsCOMPtr<nsIDOMWindow> domWindow = GetChildWindow(nsDOMClassInfo::sContent_id);
+  nsCOMPtr<nsIDOMWindow> domWindow =
+    GetChildWindow(NS_LITERAL_STRING("content"));
   if (domWindow) {
     domWindow.forget(aContent);
     return NS_OK;
   }
 
   // If we're contained in <iframe mozbrowser> or <iframe mozapp>, then
   // GetContent is the same as window.top.
   if (mDocShell && mDocShell->GetIsInBrowserOrApp()) {
@@ -4795,25 +4796,23 @@ nsGlobalWindow::GetLength()
 NS_IMETHODIMP
 nsGlobalWindow::GetLength(uint32_t* aLength)
 {
   *aLength = GetLength();
   return NS_OK;
 }
 
 already_AddRefed<nsIDOMWindow>
-nsGlobalWindow::GetChildWindow(jsid aName)
-{
-  const jschar *chars = JS_GetInternedStringChars(JSID_TO_STRING(aName));
-
+nsGlobalWindow::GetChildWindow(const nsAString& aName)
+{
   nsCOMPtr<nsIDocShellTreeNode> dsn(do_QueryInterface(GetDocShell()));
   NS_ENSURE_TRUE(dsn, nullptr);
 
   nsCOMPtr<nsIDocShellTreeItem> child;
-  dsn->FindChildWithName(reinterpret_cast<const PRUnichar*>(chars),
+  dsn->FindChildWithName(PromiseFlatString(aName).get(),
                          false, true, nullptr, nullptr,
                          getter_AddRefs(child));
 
   nsCOMPtr<nsIDOMWindow> child_win(do_GetInterface(child));
   return child_win.forget();
 }
 
 bool
--- a/dom/base/nsGlobalWindow.h
+++ b/dom/base/nsGlobalWindow.h
@@ -454,17 +454,17 @@ public:
     nsCOMPtr<nsIDOMWindow> top;
     GetScriptableTop(getter_AddRefs(top));
     if (top) {
       return static_cast<nsGlobalWindow *>(top.get());
     }
     return nullptr;
   }
 
-  already_AddRefed<nsIDOMWindow> GetChildWindow(jsid aName);
+  already_AddRefed<nsIDOMWindow> GetChildWindow(const nsAString& aName);
 
   // Returns true if dialogs need to be prevented from appearings for this
   // window. beingAbused returns whether dialogs are being abused.
   bool DialogsAreBlocked(bool *aBeingAbused);
 
   // Returns true if we've reached the state in this top level window where we
   // ask the user if further dialogs should be blocked. This method must only
   // be called on the scriptable top inner window.
--- a/dom/bindings/BindingUtils.cpp
+++ b/dom/bindings/BindingUtils.cpp
@@ -1234,17 +1234,17 @@ NativePropertyHooks sWorkerNativePropert
 };
 
 bool
 GetPropertyOnPrototype(JSContext* cx, JS::Handle<JSObject*> proxy,
                        JS::Handle<jsid> id, bool* found,
                        JS::Value* vp)
 {
   JS::Rooted<JSObject*> proto(cx);
-  if (!js::GetObjectProto(cx, proxy, proto.address())) {
+  if (!js::GetObjectProto(cx, proxy, &proto)) {
     return false;
   }
   if (!proto) {
     *found = false;
     return true;
   }
 
   JSBool hasProp;
--- a/dom/bindings/Codegen.py
+++ b/dom/bindings/Codegen.py
@@ -7031,17 +7031,17 @@ if (expando) {
 }
 """
 
         return """MOZ_ASSERT(!xpc::WrapperFactory::IsXrayWrapper(proxy),
              "Should not have a XrayWrapper here");
 
 """ + get + """
 JS::Rooted<JSObject*> proto(cx);
-if (!js::GetObjectProto(cx, proxy, proto.address())) {
+if (!js::GetObjectProto(cx, proxy, &proto)) {
   return false;
 }
 if (proto) {
   JSBool isPresent;
   if (!JS_GetElementIfPresent(cx, proto, index, proxy, vp.address(), &isPresent)) {
     return false;
   }
   *present = isPresent;
--- a/dom/bindings/DOMJSProxyHandler.cpp
+++ b/dom/bindings/DOMJSProxyHandler.cpp
@@ -163,17 +163,17 @@ DOMProxyHandler::getPropertyDescriptor(J
   if (!getOwnPropertyDescriptor(cx, proxy, id, desc, flags)) {
     return false;
   }
   if (desc->obj) {
     return true;
   }
 
   JS::Rooted<JSObject*> proto(cx);
-  if (!js::GetObjectProto(cx, proxy, proto.address())) {
+  if (!js::GetObjectProto(cx, proxy, &proto)) {
     return false;
   }
   if (!proto) {
     desc->obj = NULL;
     return true;
   }
 
   return JS_GetPropertyDescriptorById(cx, proto, id, 0, desc);
@@ -244,17 +244,17 @@ DOMProxyHandler::has(JSContext* cx, JS::
   if (*bp) {
     // We have the property ourselves; no need to worry about our prototype
     // chain.
     return true;
   }
 
   // OK, now we have to look at the proto
   JS::Rooted<JSObject*> proto(cx);
-  if (!js::GetObjectProto(cx, proxy, proto.address())) {
+  if (!js::GetObjectProto(cx, proxy, &proto)) {
     return false;
   }
   if (!proto) {
     return true;
   }
   JSBool protoHasProp;
   bool ok = JS_HasPropertyById(cx, proto, id, &protoHasProp);
   if (ok) {
--- a/hal/Hal.cpp
+++ b/hal/Hal.cpp
@@ -84,27 +84,25 @@ InSandbox()
 
 void
 AssertMainProcess()
 {
   MOZ_ASSERT(GeckoProcessType_Default == XRE_GetProcessType());
 }
 
 bool
-WindowIsActive(nsIDOMWindow *window)
+WindowIsActive(nsIDOMWindow* aWindow)
 {
+  nsCOMPtr<nsPIDOMWindow> window = do_QueryInterface(aWindow);
   NS_ENSURE_TRUE(window, false);
 
-  nsCOMPtr<nsIDOMDocument> doc;
-  window->GetDocument(getter_AddRefs(doc));
-  NS_ENSURE_TRUE(doc, false);
+  nsIDocument* document = window->GetDoc();
+  NS_ENSURE_TRUE(document, false);
 
-  bool hidden = true;
-  doc->GetHidden(&hidden);
-  return !hidden;
+  return !document->Hidden();
 }
 
 StaticAutoPtr<WindowIdentifier::IDArrayType> gLastIDToVibrate;
 
 void InitLastIDToVibrate()
 {
   gLastIDToVibrate = new WindowIdentifier::IDArrayType();
   ClearOnShutdown(&gLastIDToVibrate);
--- a/js/ipc/ObjectWrapperParent.cpp
+++ b/js/ipc/ObjectWrapperParent.cpp
@@ -11,16 +11,17 @@
 #include "mozilla/jsipc/CPOWTypes.h"
 #include "mozilla/unused.h"
 #include "nsJSUtils.h"
 
 #include "jsutil.h"
 #include "jsfriendapi.h"
 
 using namespace mozilla::jsipc;
+using namespace JS;
 
 namespace {
 
     // Only need one reserved slot because the ObjectWrapperParent* is
     // stored in the private slot.
     static const unsigned sFlagsSlot = 0;
     static const unsigned sNumSlots = 1;
     static const unsigned CPOW_FLAG_RESOLVING = 1 << 0;
@@ -173,21 +174,23 @@ ObjectWrapperParent::GetJSObject(JSConte
             JS_SetPrivate(mObj, (void*)this);
             JS_SetReservedSlot(mObj, sFlagsSlot, JSVAL_ZERO);
         }
     }
     return mObj;
 }
 
 static ObjectWrapperParent*
-Unwrap(JSContext* cx, JSObject* obj)
+Unwrap(JSContext* cx, JSObject* objArg)
 {
+    RootedObject obj(cx, objArg), proto(cx);
     while (js::GetObjectClass(obj) != &ObjectWrapperParent::sCPOW_JSClass) {
-        if (!js::GetObjectProto(cx, obj, &obj) || !obj)
+        if (!js::GetObjectProto(cx, obj, &proto) || !proto)
             return NULL;
+        obj = proto;
     }
 
     ObjectWrapperParent* self =
         static_cast<ObjectWrapperParent*>(JS_GetPrivate(obj));
 
     NS_ASSERTION(!self || self->GetJSObjectOrNull() == obj,
                  "Wrapper and wrapped object disagree?");
     
--- a/js/public/CallArgs.h
+++ b/js/public/CallArgs.h
@@ -87,17 +87,17 @@ namespace JS {
  * part of the CallReceiver interface.  We will likely add them at some point.
  * Until then, you should probably continue using |vp| directly for these two
  * cases.
  *
  * CallReceiver is exposed publicly and used internally.  Not all parts of its
  * public interface are meant to be used by embedders!  See inline comments to
  * for details.
  */
-class CallReceiver
+class MOZ_STACK_CLASS CallReceiver
 {
   protected:
 #ifdef DEBUG
     mutable bool usedRval_;
     void setUsedRval() const { usedRval_ = true; }
     void clearUsedRval() const { usedRval_ = false; }
 #else
     void setUsedRval() const {}
@@ -228,17 +228,17 @@ CallReceiverFromVp(Value *vp)
  *       args.rval().set(JS::NumberValue(args.length() * args[0].toNumber()));
  *       return true;
  *   }
  *
  * CallArgs is exposed publicly and used internally.  Not all parts of its
  * public interface are meant to be used by embedders!  See inline comments to
  * for details.
  */
-class CallArgs : public CallReceiver
+class MOZ_STACK_CLASS CallArgs : public CallReceiver
 {
   protected:
     unsigned argc_;
 
     friend CallArgs CallArgsFromVp(unsigned argc, Value *vp);
     friend CallArgs CallArgsFromSp(unsigned argc, Value *sp);
 
     static CallArgs create(unsigned argc, Value *argv) {
--- a/js/src/jsatom.cpp
+++ b/js/src/jsatom.cpp
@@ -229,47 +229,46 @@ enum OwnCharsBehavior
 
 /*
  * When the jschars reside in a freshly allocated buffer the memory can be used
  * as a new JSAtom's storage without copying. The contract is that the caller no
  * longer owns the memory and this method is responsible for freeing the memory.
  */
 JS_ALWAYS_INLINE
 static JSAtom *
-AtomizeAndTakeOwnership(JSContext *cx, const jschar *tbchars, size_t length,
-                           InternBehavior ib)
+AtomizeAndTakeOwnership(JSContext *cx, jschar *tbchars, size_t length, InternBehavior ib)
 {
     JS_ASSERT(tbchars[length] == 0);
 
     if (JSAtom *s = cx->runtime->staticStrings.lookup(tbchars, length)) {
-        js_free((void*)tbchars);
+        js_free(tbchars);
         return s;
     }
 
     /*
      * If a GC occurs at js_NewStringCopy then |p| will still have the correct
      * hash, allowing us to avoid rehashing it. Even though the hash is
      * unchanged, we need to re-lookup the table position because a last-ditch
      * GC will potentially free some table entries.
      */
     AtomSet& atoms = cx->runtime->atoms;
     AtomSet::AddPtr p = atoms.lookupForAdd(AtomHasher::Lookup(tbchars, length));
     SkipRoot skipHash(cx, &p); /* Prevent the hash from being poisoned. */
     if (p) {
         JSAtom *atom = p->asPtr();
         p->setTagged(bool(ib));
-        js_free((void*)tbchars);
+        js_free(tbchars);
         return atom;
     }
 
     AutoEnterAtomsCompartment ac(cx);
 
-    JSFlatString *flat = js_NewString<CanGC>(cx, const_cast<jschar*>(tbchars), length);
+    JSFlatString *flat = js_NewString<CanGC>(cx, tbchars, length);
     if (!flat) {
-        js_free((void*)tbchars);
+        js_free(tbchars);
         return NULL;
     }
 
     JSAtom *atom = flat->morphAtomizedStringIntoAtom();
 
     if (!atoms.relookupOrAdd(p, AtomHasher::Lookup(tbchars, length),
                              AtomStateEntry(atom, bool(ib)))) {
         JS_ReportOutOfMemory(cx); /* SystemAllocPolicy does not report OOM. */
--- a/js/src/jsfriendapi.h
+++ b/js/src/jsfriendapi.h
@@ -461,27 +461,27 @@ InitClassWithReserved(JSContext *cx, JSO
 
 JS_FRIEND_API(const Value &)
 GetFunctionNativeReserved(JSObject *fun, size_t which);
 
 JS_FRIEND_API(void)
 SetFunctionNativeReserved(JSObject *fun, size_t which, const Value &val);
 
 inline bool
-GetObjectProto(JSContext *cx, JSObject *obj, JSObject **proto)
+GetObjectProto(JSContext *cx, JS::Handle<JSObject*> obj, JS::MutableHandle<JSObject*> proto)
 {
     js::Class *clasp = GetObjectClass(obj);
     if (clasp == &js::ObjectProxyClass ||
         clasp == &js::OuterWindowProxyClass ||
         clasp == &js::FunctionProxyClass)
     {
-        return JS_GetPrototype(cx, obj, proto);
+        return JS_GetPrototype(cx, obj, proto.address());
     }
 
-    *proto = reinterpret_cast<const shadow::Object*>(obj)->type->proto;
+    proto.set(reinterpret_cast<const shadow::Object*>(obj.get())->type->proto);
     return true;
 }
 
 inline void *
 GetObjectPrivate(JSObject *obj)
 {
     const shadow::Object *nobj = reinterpret_cast<const shadow::Object*>(obj);
     void **addr = reinterpret_cast<void**>(&nobj->fixedSlots()[nobj->numFixedSlots()]);
--- a/js/src/vm/Stack.h
+++ b/js/src/vm/Stack.h
@@ -165,17 +165,17 @@ namespace ion {
 
 /*
  * For calls to natives, the InvokeArgsGuard object provides a record of the
  * call for the debugger's callstack. For this to work, the InvokeArgsGuard
  * record needs to know when the call is actually active (because the
  * InvokeArgsGuard can be pushed long before and popped long after the actual
  * call, during which time many stack-observing things can happen).
  */
-class CallArgsList : public JS::CallArgs
+class MOZ_STACK_CLASS CallArgsList : public JS::CallArgs
 {
     friend class StackSegment;
     CallArgsList *prev_;
     bool active_;
   protected:
     CallArgsList() : prev_(NULL), active_(false) {}
   public:
     friend CallArgsList CallArgsListFromVp(unsigned, Value *, CallArgsList *);
--- a/js/xpconnect/src/XPCJSID.cpp
+++ b/js/xpconnect/src/XPCJSID.cpp
@@ -1,11 +1,11 @@
-/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*-
- *
- * This Source Code Form is subject to the terms of the Mozilla Public
+/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/* vim: set ts=8 sts=4 et sw=4 tw=99: */
+/* This Source Code Form is subject to the terms of the Mozilla Public
  * License, v. 2.0. If a copy of the MPL was not distributed with this
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 /* An xpcom implementation of the JavaScript nsIID and nsCID objects. */
 
 #include "xpcprivate.h"
 #include "mozilla/dom/DOMJSClass.h"
 #include "mozilla/dom/BindingUtils.h"
@@ -471,23 +471,25 @@ nsJSIID::Enumerate(nsIXPConnectWrappedNa
  *
  * This static method handles both complexities, returning either an XPCWN, a
  * slim wrapper, a DOM object, or null. The object may well be cross-compartment
  * from |cx|.
  */
 static JSObject *
 FindObjectForHasInstance(JSContext *cx, HandleObject objArg)
 {
-    RootedObject obj(cx, objArg);
-    while (obj && !IS_WRAPPER_CLASS(js::GetObjectClass(obj)) && !IsDOMObject(obj))
-    {
-        if (js::IsWrapper(obj))
+    RootedObject obj(cx, objArg), proto(cx);
+    while (obj && !IS_WRAPPER_CLASS(js::GetObjectClass(obj)) && !IsDOMObject(obj)) {
+        if (js::IsWrapper(obj)) {
             obj = js::CheckedUnwrap(obj, /* stopAtOuter = */ false);
-        else if (!js::GetObjectProto(cx, obj, obj.address()))
+            continue;
+        }
+        if (!js::GetObjectProto(cx, obj, &proto))
             return nullptr;
+        obj = proto;
     }
     return obj;
 }
 
 
 /* bool hasInstance (in nsIXPConnectWrappedNative wrapper, in JSContextPtr cx, in JSObjectPtr obj, in jsval val, out bool bp); */
 NS_IMETHODIMP
 nsJSIID::HasInstance(nsIXPConnectWrappedNative *wrapper,
--- a/js/xpconnect/wrappers/WrapperFactory.cpp
+++ b/js/xpconnect/wrappers/WrapperFactory.cpp
@@ -65,17 +65,17 @@ WrapperFactory::CreateXrayWaiver(JSConte
 {
     // The caller is required to have already done a lookup.
     // NB: This implictly performs the assertions of GetXrayWaiver.
     MOZ_ASSERT(!GetXrayWaiver(obj));
     XPCWrappedNativeScope *scope = GetObjectScope(obj);
 
     // Get a waiver for the proto.
     RootedObject proto(cx);
-    if (!js::GetObjectProto(cx, obj, proto.address()))
+    if (!js::GetObjectProto(cx, obj, &proto))
         return nullptr;
     if (proto && !(proto = WaiveXray(cx, proto)))
         return nullptr;
 
     // Create the waiver.
     JSAutoCompartment ac(cx, obj);
     if (!JS_WrapObject(cx, proto.address()))
         return nullptr;
@@ -457,17 +457,17 @@ WrapperFactory::Rewrap(JSContext *cx, Ha
     // The prototype chain of COW(obj) looks lke this:
     //
     // COW(obj) => COW(foo) => COW(bar) => contentWin.StandardClass.prototype
     if (wrapper == &ChromeObjectWrapper::singleton) {
         JSProtoKey key = JSProto_Null;
         {
             JSAutoCompartment ac(cx, obj);
             RootedObject unwrappedProto(cx);
-            if (!js::GetObjectProto(cx, obj, unwrappedProto.address()))
+            if (!js::GetObjectProto(cx, obj, &unwrappedProto))
                 return NULL;
             if (unwrappedProto && IsCrossCompartmentWrapper(unwrappedProto))
                 unwrappedProto = Wrapper::wrappedObject(unwrappedProto);
             if (unwrappedProto) {
                 JSAutoCompartment ac2(cx, unwrappedProto);
                 key = JS_IdentifyClassPrototype(cx, unwrappedProto);
             }
         }
--- a/js/xpconnect/wrappers/XrayWrapper.cpp
+++ b/js/xpconnect/wrappers/XrayWrapper.cpp
@@ -1588,17 +1588,18 @@ XrayWrapper<Base, Traits>::getPropertyDe
     // Scope Polluter and thus the resulting properties are non-|own|. However,
     // we're set up (above) to cache (on the holder) anything that comes out of
     // resolveNativeProperty, which we don't want for something dynamic like
     // named access. So we just handle it separately here.
     nsGlobalWindow *win;
     if (!desc->obj && Traits::Type == XrayForWrappedNative && JSID_IS_STRING(id) &&
         (win = static_cast<nsGlobalWindow*>(As<nsPIDOMWindow>(wrapper))))
     {
-        nsCOMPtr<nsIDOMWindow> childDOMWin = win->GetChildWindow(id);
+        nsDependentJSString name(id);
+        nsCOMPtr<nsIDOMWindow> childDOMWin = win->GetChildWindow(name);
         if (childDOMWin) {
             nsGlobalWindow *cwin = static_cast<nsGlobalWindow*>(childDOMWin.get());
             JSObject *childObj = cwin->FastGetGlobalJSObject();
             if (MOZ_UNLIKELY(!childObj))
                 return xpc::Throw(cx, NS_ERROR_FAILURE);
             mozilla::dom::FillPropertyDescriptor(desc, wrapper,
                                                  ObjectValue(*childObj),
                                                  /* readOnly = */ true);
--- a/layout/style/nsHTMLCSSStyleSheet.cpp
+++ b/layout/style/nsHTMLCSSStyleSheet.cpp
@@ -34,19 +34,23 @@ ClearAttrCache(const nsAString& aKey, Mi
   aValue->mValue.mCSSStyleRule->SetHTMLCSSStyleSheet(nullptr);
   aValue->mValue.mCached = 0;
 
   return PL_DHASH_REMOVE;
 }
 
 } // anonymous namespace
 
-nsHTMLCSSStyleSheet::nsHTMLCSSStyleSheet()
-  : mDocument(nullptr)
+nsHTMLCSSStyleSheet::nsHTMLCSSStyleSheet(nsIURI* aURL, nsIDocument* aDocument)
+  : mURL(aURL)
+  , mDocument(aDocument) // not refcounted!
 {
+  MOZ_ASSERT(aURL);
+  MOZ_ASSERT(aDocument);
+  mCachedStyleAttrs.Init();
 }
 
 nsHTMLCSSStyleSheet::~nsHTMLCSSStyleSheet()
 {
   // We may go away before all of our cached style attributes do,
   // so clean up any that are left.
   mCachedStyleAttrs.Enumerate(ClearAttrCache, nullptr);
 }
@@ -97,32 +101,16 @@ nsHTMLCSSStyleSheet::RulesMatching(AnonB
 
 #ifdef MOZ_XUL
 /* virtual */ void
 nsHTMLCSSStyleSheet::RulesMatching(XULTreeRuleProcessorData* aData)
 {
 }
 #endif
 
-nsresult
-nsHTMLCSSStyleSheet::Init(nsIURI* aURL, nsIDocument* aDocument)
-{
-  NS_PRECONDITION(aURL && aDocument, "null ptr");
-  if (! aURL || ! aDocument)
-    return NS_ERROR_NULL_POINTER;
-
-  if (mURL || mDocument)
-    return NS_ERROR_ALREADY_INITIALIZED;
-
-  mDocument = aDocument; // not refcounted!
-  mURL = aURL;
-  mCachedStyleAttrs.Init();
-  return NS_OK;
-}
-
 // Test if style is dependent on content state
 /* virtual */ nsRestyleHint
 nsHTMLCSSStyleSheet::HasStateDependentStyle(StateRuleProcessorData* aData)
 {
   return nsRestyleHint(0);
 }
 
 /* virtual */ bool
--- a/layout/style/nsHTMLCSSStyleSheet.h
+++ b/layout/style/nsHTMLCSSStyleSheet.h
@@ -15,24 +15,24 @@
 #include "nsCOMPtr.h"
 #include "nsDataHashtable.h"
 #include "nsIStyleSheet.h"
 #include "nsIStyleRuleProcessor.h"
 
 struct MiscContainer;
 
 class nsHTMLCSSStyleSheet MOZ_FINAL : public nsIStyleSheet,
-                                      public nsIStyleRuleProcessor {
+                                      public nsIStyleRuleProcessor
+{
 public:
-  nsHTMLCSSStyleSheet();
+  nsHTMLCSSStyleSheet(nsIURI* aURL, nsIDocument* aDocument);
   ~nsHTMLCSSStyleSheet();
 
   NS_DECL_ISUPPORTS
 
-  nsresult Init(nsIURI* aURL, nsIDocument* aDocument);
   void Reset(nsIURI* aURL);
 
   // nsIStyleSheet
   virtual nsIURI* GetSheetURI() const;
   virtual nsIURI* GetBaseURI() const MOZ_OVERRIDE;
   virtual void GetTitle(nsString& aTitle) const MOZ_OVERRIDE;
   virtual void GetType(nsString& aType) const MOZ_OVERRIDE;
   virtual bool HasRules() const MOZ_OVERRIDE;
--- a/services/healthreport/healthreport-prefs.js
+++ b/services/healthreport/healthreport-prefs.js
@@ -1,15 +1,15 @@
 #filter substitution
 /* This Source Code Form is subject to the terms of the Mozilla Public
  * License, v. 2.0. If a copy of the MPL was not distributed with this
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 pref("datareporting.healthreport.currentDaySubmissionFailureCount", 0);
-pref("datareporting.healthreport.documentServerURI", "https://data.mozilla.com/");
+pref("datareporting.healthreport.documentServerURI", "https://fhr.data.mozilla.com/");
 pref("datareporting.healthreport.documentServerNamespace", "metrics");
 pref("datareporting.healthreport.infoURL", "https://www.mozilla.org/legal/privacy/firefox.html#health-report");
 pref("datareporting.healthreport.logging.consoleEnabled", true);
 pref("datareporting.healthreport.logging.consoleLevel", "Warn");
 pref("datareporting.healthreport.logging.dumpEnabled", false);
 pref("datareporting.healthreport.logging.dumpLevel", "Debug");
 pref("datareporting.healthreport.lastDataSubmissionFailureTime", "0");
 pref("datareporting.healthreport.lastDataSubmissionRequestedTime", "0");
--- a/testing/mochitest/android.json
+++ b/testing/mochitest/android.json
@@ -3,17 +3,16 @@
 "excludetests": {
  "content/base/test/test_bug590812.html": "bug 687032",
  "content/base/test/test_CSP.html": "TIMED_OUT",
  "content/base/test/test_CSP_frameancestors.html": "",
  "content/base/test/test_CSP_inlinescript.html": "",
  "content/base/test/test_CrossSiteXHR.html": "",
  "content/base/test/test_CrossSiteXHR_cache.html": "",
  "content/base/test/test_CrossSiteXHR_origin.html": "",
- "content/base/test/test_DOMException.html": "",
  "content/base/test/test_bug166235.html": "",
  "content/base/test/test_bug338583.html": "",
  "content/base/test/test_bug466080.html": "",
  "content/base/test/test_bug503481.html": "TIMED_OUT",
  "content/base/test/test_bug503481b.html": "TIMED_OUT",
  "content/base/test/test_bug505783.html": "TIMED_OUT",
  "content/base/test/test_copypaste.html": "",
  "content/base/test/test_csp_redirects.html": "TIMED_OUT",
@@ -190,23 +189,19 @@
  "dom/tests/mochitest/bugs/test_bug504862.html": "RANDOM",
  "dom/tests/mochitest/bugs/test_bug597809.html": "",
  "dom/tests/mochitest/bugs/test_bug61098.html": "",
  "dom/tests/mochitest/bugs/test_bug641552.html": "",
  "dom/tests/mochitest/bugs/test_devicemotion_multiple_listeners.html": "bug 775227",
  "dom/tests/mochitest/bugs/test_resize_move_windows.html": "Windows can't change size and position on Android",
  "dom/tests/mochitest/bugs/test_sizetocontent_clamp.html": "Windows can't change size on Android",
  "dom/tests/mochitest/bugs/test_window_bar.html": "",
- "dom/tests/mochitest/dom-level2-core/test_documentimportnode03.html": "",
- "dom/tests/mochitest/dom-level2-core/test_documentimportnode04.html": "",
- "dom/tests/mochitest/dom-level2-core/test_documentimportnode21.html": "",
  "dom/tests/mochitest/general/test_497898.html": "",
  "dom/tests/mochitest/general/test_focusrings.xul": "TIMED_OUT",
  "dom/tests/mochitest/general/test_vibrator.html": "CRASH_SUTAGENT",
- "dom/tests/mochitest/general/test_windowProperties.html": "",
  "dom/tests/mochitest/geolocation/test_allowCurrent.html": "TIMED_OUT",
  "dom/tests/mochitest/geolocation/test_allowWatch.html": "TIMED_OUT",
  "dom/tests/mochitest/geolocation/test_cachedPosition.html": "TIMED_OUT",
  "dom/tests/mochitest/geolocation/test_clearWatch.html": "TIMED_OUT",
  "dom/tests/mochitest/geolocation/test_manyCurrentConcurrent.html": "TIMED_OUT",
  "dom/tests/mochitest/geolocation/test_manyCurrentSerial.html": "TIMED_OUT",
  "dom/tests/mochitest/geolocation/test_manyWatchConcurrent.html": "TIMED_OUT",
  "dom/tests/mochitest/geolocation/test_manyWatchSerial.html": "TIMED_OUT",