Backed out changeset d989914e47e2 (bug 1218594) for possible conflicts with another push
authorCarsten "Tomcat" Book <cbook@mozilla.com>
Fri, 30 Oct 2015 15:38:01 +0100
changeset 306304 0b7dbe691d1ce21da74a566b083623dde81e79d9
parent 306303 543101125b0d0b3c6e6e243112a14468955940a9
child 306305 b3a64c90e34f10601f2cae91afc2294adc6fb10a
push id1040
push userraliiev@mozilla.com
push dateMon, 29 Feb 2016 17:11:22 +0000
treeherdermozilla-release@8c3167321162 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
bugs1218594
milestone45.0a1
backs outd989914e47e227efb248c7d8fe707b52149eaed7
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
Backed out changeset d989914e47e2 (bug 1218594) for possible conflicts with another push
dom/ipc/PBrowser.ipdl
dom/ipc/TabChild.cpp
dom/ipc/TabParent.cpp
dom/ipc/TabParent.h
embedding/components/windowwatcher/nsWindowWatcher.cpp
--- a/dom/ipc/PBrowser.ipdl
+++ b/dom/ipc/PBrowser.ipdl
@@ -165,20 +165,20 @@ parent:
 
     Event(RemoteDOMEvent aEvent);
 
     sync CreateWindow(PBrowser aNewTab,
                       uint32_t aChromeFlags,
                       bool aCalledFromJS,
                       bool aPositionSpecified,
                       bool aSizeSpecified,
-                      nsCString aURI,
+                      nsString aURI,
                       nsString aName,
                       nsCString aFeatures,
-                      nsCString aBaseURI)
+                      nsString aBaseURI)
       returns (nsresult rv,
                bool windowOpened,
                FrameScriptInfo[] frameScripts,
                nsCString urlToLoad);
 
     sync SyncMessage(nsString aMessage, ClonedMessageData aData,
                      CpowEntry[] aCpows, Principal aPrincipal)
       returns (StructuredCloneData[] retval);
--- a/dom/ipc/TabChild.cpp
+++ b/dom/ipc/TabChild.cpp
@@ -1170,33 +1170,29 @@ TabChild::ProvideWindowCommon(nsIDOMWind
 
   context.opener() = this;
   unused << Manager()->SendPBrowserConstructor(
       // We release this ref in DeallocPBrowserChild
       RefPtr<TabChild>(newChild).forget().take(),
       tabId, IPCTabContext(context), aChromeFlags,
       cc->GetID(), cc->IsForApp(), cc->IsForBrowser());
 
-  nsAutoCString url;
+  nsAutoCString spec;
   if (aURI) {
-    aURI->GetSpec(url);
-  } else {
-    // We can't actually send a nullptr up as the URI, since IPDL doesn't let us
-    // send nullptr's for primitives. We indicate that the nsString for the URI
-    // should be converted to a nullptr by voiding the string.
-    url.SetIsVoid(true);
+    aURI->GetSpec(spec);
   }
 
+  NS_ConvertUTF8toUTF16 url(spec);
   nsString name(aName);
   nsAutoCString features(aFeatures);
   nsTArray<FrameScriptInfo> frameScripts;
   nsCString urlToLoad;
 
   if (aIframeMoz) {
-    newChild->SendBrowserFrameOpenWindow(this, NS_ConvertUTF8toUTF16(url), name,
+    newChild->SendBrowserFrameOpenWindow(this, url, name,
                                          NS_ConvertUTF8toUTF16(features),
                                          aWindowIsNew);
   } else {
     nsCOMPtr<nsPIDOMWindow> opener = do_QueryInterface(aOpener);
     nsCOMPtr<nsIDocument> doc = opener->GetDoc();
     nsCOMPtr<nsIURI> baseURI = doc->GetDocBaseURI();
     if (!baseURI) {
       NS_ERROR("nsIDocument didn't return a base URI");
@@ -1207,17 +1203,17 @@ TabChild::ProvideWindowCommon(nsIDOMWind
     baseURI->GetSpec(baseURIString);
 
     nsresult rv;
 
     if (!SendCreateWindow(newChild,
                           aChromeFlags, aCalledFromJS, aPositionSpecified,
                           aSizeSpecified, url,
                           name, features,
-                          baseURIString,
+                          NS_ConvertUTF8toUTF16(baseURIString),
                           &rv,
                           aWindowIsNew,
                           &frameScripts,
                           &urlToLoad)) {
       return NS_ERROR_NOT_AVAILABLE;
     }
 
     if (NS_FAILED(rv)) {
--- a/dom/ipc/TabParent.cpp
+++ b/dom/ipc/TabParent.cpp
@@ -784,20 +784,20 @@ FindMostRecentOpenWindow()
 }
 
 bool
 TabParent::RecvCreateWindow(PBrowserParent* aNewTab,
                             const uint32_t& aChromeFlags,
                             const bool& aCalledFromJS,
                             const bool& aPositionSpecified,
                             const bool& aSizeSpecified,
-                            const nsCString& aURI,
+                            const nsString& aURI,
                             const nsString& aName,
                             const nsCString& aFeatures,
-                            const nsCString& aBaseURI,
+                            const nsString& aBaseURI,
                             nsresult* aResult,
                             bool* aWindowIsNew,
                             InfallibleTArray<FrameScriptInfo>* aFrameScripts,
                             nsCString* aURLToLoad)
 {
   // We always expect to open a new window here. If we don't, it's an error.
   *aWindowIsNew = true;
 
@@ -868,17 +868,17 @@ TabParent::RecvCreateWindow(PBrowserPare
       return true;
     }
 
     bool isPrivate;
     nsCOMPtr<nsILoadContext> loadContext = GetLoadContext();
     loadContext->GetUsePrivateBrowsing(&isPrivate);
 
     nsCOMPtr<nsIOpenURIInFrameParams> params = new nsOpenURIInFrameParams();
-    params->SetReferrer(NS_ConvertUTF8toUTF16(aBaseURI));
+    params->SetReferrer(aBaseURI);
     params->SetIsPrivate(isPrivate);
 
     AutoUseNewTab aunt(newTab, aWindowIsNew, aURLToLoad);
 
     nsCOMPtr<nsIFrameLoaderOwner> frameLoaderOwner;
     browserDOMWin->OpenURIInFrame(nullptr, params,
                                   openLocation,
                                   nsIBrowserDOMWindow::OPEN_NEW,
@@ -901,37 +901,33 @@ TabParent::RecvCreateWindow(PBrowserPare
   *aResult = NS_NewURI(getter_AddRefs(baseURI), aBaseURI);
 
   if (NS_WARN_IF(NS_FAILED(*aResult)))
     return true;
 
   nsAutoCString finalURIString;
   if (!aURI.IsEmpty()) {
     nsCOMPtr<nsIURI> finalURI;
-    *aResult = NS_NewURI(getter_AddRefs(finalURI), aURI.get(), baseURI);
+    *aResult = NS_NewURI(getter_AddRefs(finalURI), NS_ConvertUTF16toUTF8(aURI).get(), baseURI);
 
     if (NS_WARN_IF(NS_FAILED(*aResult)))
       return true;
 
     finalURI->GetSpec(finalURIString);
   }
 
   nsCOMPtr<nsIDOMWindow> window;
 
   AutoUseNewTab aunt(newTab, aWindowIsNew, aURLToLoad);
 
-  // If nsWindowWatcher::OpenWindowInternal was passed a nullptr for the URI
-  // to open in the content process, we indicate that by sending up a voided
-  // nsString (since primitives are not nullable). If we detect the voided
-  // nsString, we know that we need to send OpenWindow2 a nullptr for the URI.
-  const char* uri = aURI.IsVoid() ? nullptr : finalURIString.get();
-  const char* name = aName.IsVoid() ? nullptr : NS_ConvertUTF16toUTF8(aName).get();
-  const char* features = aFeatures.IsVoid() ? nullptr : aFeatures.get();
-
-  *aResult = pwwatch->OpenWindow2(parent, uri, name, features, aCalledFromJS,
+  const char* features = aFeatures.Length() ? aFeatures.get() : nullptr;
+
+  *aResult = pwwatch->OpenWindow2(parent, finalURIString.get(),
+                                  NS_ConvertUTF16toUTF8(aName).get(),
+                                  features, aCalledFromJS,
                                   false, false, this, nullptr, getter_AddRefs(window));
 
   if (NS_WARN_IF(NS_FAILED(*aResult)))
     return true;
 
   *aResult = NS_ERROR_FAILURE;
 
   nsCOMPtr<nsPIDOMWindow> pwindow = do_QueryInterface(window);
--- a/dom/ipc/TabParent.h
+++ b/dom/ipc/TabParent.h
@@ -147,20 +147,20 @@ public:
                                             const nsString& aName,
                                             const nsString& aFeatures,
                                             bool* aOutWindowOpened) override;
     virtual bool RecvCreateWindow(PBrowserParent* aOpener,
                                   const uint32_t& aChromeFlags,
                                   const bool& aCalledFromJS,
                                   const bool& aPositionSpecified,
                                   const bool& aSizeSpecified,
-                                  const nsCString& aURI,
+                                  const nsString& aURI,
                                   const nsString& aName,
                                   const nsCString& aFeatures,
-                                  const nsCString& aBaseURI,
+                                  const nsString& aBaseURI,
                                   nsresult* aResult,
                                   bool* aWindowIsNew,
                                   InfallibleTArray<FrameScriptInfo>* aFrameScripts,
                                   nsCString* aURLToLoad) override;
     virtual bool RecvSyncMessage(const nsString& aMessage,
                                  const ClonedMessageData& aData,
                                  InfallibleTArray<CpowEntry>&& aCpows,
                                  const IPC::Principal& aPrincipal,
--- a/embedding/components/windowwatcher/nsWindowWatcher.cpp
+++ b/embedding/components/windowwatcher/nsWindowWatcher.cpp
@@ -490,42 +490,35 @@ nsWindowWatcher::OpenWindowInternal(nsID
 
   if (!nsContentUtils::IsSafeToRunScript()) {
     nsContentUtils::WarnScriptWasIgnored(nullptr);
     return NS_ERROR_FAILURE;
   }
 
   GetWindowTreeOwner(aParent, getter_AddRefs(parentTreeOwner));
 
-  // We expect TabParent to have provided us the absolute URI of the window
-  // we're to open, so there's no need to call URIfromURL (or more importantly,
-  // to check for a chrome URI, which cannot be opened from a remote tab).
-  if (aUrl && !openedFromRemoteTab) {
+  if (aUrl) {
     rv = URIfromURL(aUrl, aParent, getter_AddRefs(uriToLoad));
     if (NS_FAILED(rv)) {
       return rv;
     }
     uriToLoad->SchemeIs("chrome", &uriToLoadIsChrome);
   }
 
   bool nameSpecified = false;
   if (aName) {
     CopyUTF8toUTF16(aName, name);
     nameSpecified = true;
-  } else {
-    name.SetIsVoid(true);
   }
 
   bool featuresSpecified = false;
   if (aFeatures) {
     features.Assign(aFeatures);
     featuresSpecified = true;
     features.StripWhitespace();
-  } else {
-    features.SetIsVoid(true);
   }
 
   // We only want to check for existing named windows if:
   // a) We're the child process
   // b) We're the parent process, and aOpeningTab wasn't passed
   //    in.
   // This is because when using child processes, the parent process shouldn't
   // know or care about names - unless we're opening named windows from chrome.