Backed out changeset d0b883c071e0 (bug 946646) for B2G mochitest-9 orange.
authorRyan VanderMeulen <ryanvm@gmail.com>
Mon, 06 Jan 2014 12:52:35 -0500
changeset 162223 ae5d2e7db3777ca8763971f15b2f7d2cb98ef696
parent 162222 b62a81ca06f85c2d4ce7c38a86163178975f246e
child 162224 f12cd1181e07a0c2b93bd54008e6abb826085755
push idunknown
push userunknown
push dateunknown
bugs946646
milestone29.0a1
backs outd0b883c071e09951a50c2ff703b7152bc046718e
Backed out changeset d0b883c071e0 (bug 946646) for B2G mochitest-9 orange.
widget/gonk/moz.build
widget/gonk/nsClipboard.cpp
widget/gonk/nsClipboard.h
widget/gonk/nsWidgetFactory.cpp
--- a/widget/gonk/moz.build
+++ b/widget/gonk/moz.build
@@ -46,17 +46,16 @@ SOURCES += ['libui/' + src for src in [
 SOURCES += [
     'Framebuffer.cpp',
     'GfxInfo.cpp',
     'GonkMemoryPressureMonitoring.cpp',
     'GonkPermission.cpp',
     'HwcComposer2D.cpp',
     'HwcUtils.cpp',
     'nsAppShell.cpp',
-    'nsClipboard.cpp',
     'nsIdleServiceGonk.cpp',
     'nsLookAndFeel.cpp',
     'nsWidgetFactory.cpp',
     'nsWindow.cpp',
     'OrientationObserver.cpp',
     'ParentProcessController.cpp',
     'ProcessOrientation.cpp'
 ]
deleted file mode 100644
--- a/widget/gonk/nsClipboard.cpp
+++ /dev/null
@@ -1,139 +0,0 @@
-/* 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/. */
-
-#include "mozilla/dom/ContentChild.h"
-#include "nsClipboard.h"
-#include "nsISupportsPrimitives.h"
-#include "nsCOMPtr.h"
-#include "nsComponentManagerUtils.h"
-#include "nsXULAppAPI.h"
-
-using namespace mozilla;
-using mozilla::dom::ContentChild;
-
-#define LOG_TAG "Clipboard"
-#define LOGI(args...) __android_log_print(ANDROID_LOG_INFO, LOG_TAG, ## args)
-#define LOGE(args...) __android_log_print(ANDROID_LOG_ERROR, LOG_TAG, ## args)
-
-NS_IMPL_ISUPPORTS1(nsClipboard, nsIClipboard)
-
-nsClipboard::nsClipboard()
-{
-}
-
-NS_IMETHODIMP
-nsClipboard::SetData(nsITransferable *aTransferable,
-                     nsIClipboardOwner *anOwner, int32_t aWhichClipboard)
-{
-  if (aWhichClipboard != kGlobalClipboard) {
-    return NS_ERROR_NOT_IMPLEMENTED;
-  }
-
-  nsCOMPtr<nsISupports> tmp;
-  uint32_t len;
-  nsresult rv  = aTransferable->GetTransferData(kUnicodeMime, getter_AddRefs(tmp),
-                                                &len);
-  if (NS_WARN_IF(NS_FAILED(rv))) {
-    return rv;
-  }
-  nsCOMPtr<nsISupportsString> supportsString = do_QueryInterface(tmp);
-  // No support for non-text data
-  if (NS_WARN_IF(!supportsString)) {
-    LOGE("No support for non-text data. See bug 952456.");
-    return NS_ERROR_NOT_IMPLEMENTED;
-  }
-  nsAutoString buffer;
-  supportsString->GetData(buffer);
-
-  if (XRE_GetProcessType() == GeckoProcessType_Default) {
-    mClipboard = buffer;
-  } else {
-    bool isPrivateData = false;
-    aTransferable->GetIsPrivateData(&isPrivateData);
-    ContentChild::GetSingleton()->SendSetClipboardText(buffer, isPrivateData,
-                                                       aWhichClipboard);
-  }
-
-  return NS_OK;
-}
-
-NS_IMETHODIMP
-nsClipboard::GetData(nsITransferable *aTransferable, int32_t aWhichClipboard)
-{
-  if (aWhichClipboard != kGlobalClipboard) {
-    return NS_ERROR_NOT_IMPLEMENTED;
-  }
-
-  nsAutoString buffer;
-  if (XRE_GetProcessType() == GeckoProcessType_Default) {
-    buffer = mClipboard;
-  } else {
-    ContentChild::GetSingleton()->SendGetClipboardText(aWhichClipboard, &buffer);
-  }
-
-  nsresult rv;
-  nsCOMPtr<nsISupportsString> dataWrapper =
-    do_CreateInstance(NS_SUPPORTS_STRING_CONTRACTID, &rv);
-  if (NS_WARN_IF(NS_FAILED(rv))) {
-    return rv;
-  }
-
-  rv = dataWrapper->SetData(buffer);
-  if (NS_WARN_IF(NS_FAILED(rv))) {
-    return rv;
-  }
-
-  // If our data flavor has already been added, this will fail. But we don't care
-  aTransferable->AddDataFlavor(kUnicodeMime);
-
-  nsCOMPtr<nsISupports> nsisupportsDataWrapper =
-    do_QueryInterface(dataWrapper);
-  rv = aTransferable->SetTransferData(kUnicodeMime, nsisupportsDataWrapper,
-                                      buffer.Length() * sizeof(PRUnichar));
-  if (NS_WARN_IF(NS_FAILED(rv))) {
-    return rv;
-  }
-
-  return NS_OK;
-}
-
-NS_IMETHODIMP
-nsClipboard::EmptyClipboard(int32_t aWhichClipboard)
-{
-  if (aWhichClipboard != kGlobalClipboard) {
-    return NS_ERROR_NOT_IMPLEMENTED;
-  }
-  if (XRE_GetProcessType() == GeckoProcessType_Default) {
-    mClipboard.Truncate(0);
-  } else {
-    ContentChild::GetSingleton()->SendEmptyClipboard();
-  }
-
-  return NS_OK;
-}
-
-NS_IMETHODIMP
-nsClipboard::HasDataMatchingFlavors(const char **aFlavorList,
-                                    uint32_t aLength, int32_t aWhichClipboard,
-                                    bool *aHasText)
-{
-  *aHasText = false;
-  if (aWhichClipboard != kGlobalClipboard) {
-    return NS_ERROR_NOT_IMPLEMENTED;
-  }
-  if (XRE_GetProcessType() == GeckoProcessType_Default) {
-    *aHasText = !mClipboard.IsEmpty();
-  } else {
-    ContentChild::GetSingleton()->SendClipboardHasText(aHasText);
-  }
-  return NS_OK;
-}
-
-NS_IMETHODIMP
-nsClipboard::SupportsSelectionClipboard(bool *aIsSupported)
-{
-  *aIsSupported = false;
-  return NS_OK;
-}
-
deleted file mode 100644
--- a/widget/gonk/nsClipboard.h
+++ /dev/null
@@ -1,21 +0,0 @@
-/* -*- Mode: c++; c-basic-offset: 4; tab-width: 20; indent-tabs-mode: nil; -*-
- * 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/. */
-
-#ifndef nsClipbard_h__
-#define nsClipbard_h__
-
-#include "nsIClipboard.h"
-
-class nsClipboard MOZ_FINAL : public nsIClipboard
-{
-  nsAutoString mClipboard;
-public:
-  NS_DECL_ISUPPORTS
-  NS_DECL_NSICLIPBOARD
-
-  nsClipboard();
-};
-
-#endif
--- a/widget/gonk/nsWidgetFactory.cpp
+++ b/widget/gonk/nsWidgetFactory.cpp
@@ -23,18 +23,16 @@
 #include "nsAppShell.h"
 
 #include "nsWindow.h"
 #include "nsLookAndFeel.h"
 #include "nsAppShellSingleton.h"
 #include "nsScreenManagerGonk.h"
 #include "nsIdleServiceGonk.h"
 #include "nsTransferable.h"
-#include "nsClipboard.h"
-#include "nsClipboardHelper.h"
 
 #include "nsHTMLFormatConverter.h"
 #include "nsXULAppAPI.h"
 
 #include "PuppetWidget.h"
 
 using namespace mozilla::widget;
 
@@ -49,29 +47,25 @@ NS_GENERIC_FACTORY_CONSTRUCTOR_INIT(GfxI
 }
 
 NS_GENERIC_FACTORY_CONSTRUCTOR(nsWindow)
 NS_GENERIC_FACTORY_CONSTRUCTOR(nsScreenManagerGonk)
 NS_GENERIC_FACTORY_CONSTRUCTOR(PuppetScreenManager)
 NS_GENERIC_FACTORY_CONSTRUCTOR(nsHTMLFormatConverter)
 NS_GENERIC_FACTORY_SINGLETON_CONSTRUCTOR(nsIdleServiceGonk, nsIdleServiceGonk::GetInstance)
 NS_GENERIC_FACTORY_CONSTRUCTOR(nsTransferable)
-NS_GENERIC_FACTORY_CONSTRUCTOR(nsClipboard)
-NS_GENERIC_FACTORY_CONSTRUCTOR(nsClipboardHelper)
 
 NS_DEFINE_NAMED_CID(NS_APPSHELL_CID);
 NS_DEFINE_NAMED_CID(NS_WINDOW_CID);
 NS_DEFINE_NAMED_CID(NS_CHILD_CID);
 NS_DEFINE_NAMED_CID(NS_SCREENMANAGER_CID);
 NS_DEFINE_NAMED_CID(NS_HTMLFORMATCONVERTER_CID);
 NS_DEFINE_NAMED_CID(NS_IDLE_SERVICE_CID);
 NS_DEFINE_NAMED_CID(NS_TRANSFERABLE_CID);
 NS_DEFINE_NAMED_CID(NS_GFXINFO_CID);
-NS_DEFINE_NAMED_CID(NS_CLIPBOARD_CID);
-NS_DEFINE_NAMED_CID(NS_CLIPBOARDHELPER_CID);
 
 static nsresult
 ScreenManagerConstructor(nsISupports *aOuter, REFNSIID aIID, void **aResult)
 {
     return (XRE_GetProcessType() == GeckoProcessType_Default) ?
         nsScreenManagerGonkConstructor(aOuter, aIID, aResult) :
         PuppetScreenManagerConstructor(aOuter, aIID, aResult);
 }
@@ -80,32 +74,28 @@ static const mozilla::Module::CIDEntry k
     { &kNS_WINDOW_CID, false, nullptr, nsWindowConstructor },
     { &kNS_CHILD_CID, false, nullptr, nsWindowConstructor },
     { &kNS_APPSHELL_CID, false, nullptr, nsAppShellConstructor },
     { &kNS_SCREENMANAGER_CID, false, nullptr, ScreenManagerConstructor },
     { &kNS_HTMLFORMATCONVERTER_CID, false, nullptr, nsHTMLFormatConverterConstructor },
     { &kNS_IDLE_SERVICE_CID, false, nullptr, nsIdleServiceGonkConstructor },
     { &kNS_TRANSFERABLE_CID, false, nullptr, nsTransferableConstructor },
     { &kNS_GFXINFO_CID, false, nullptr, mozilla::widget::GfxInfoConstructor },
-    { &kNS_CLIPBOARD_CID, false, nullptr, nsClipboardConstructor },
-    { &kNS_CLIPBOARDHELPER_CID, false, nullptr, nsClipboardHelperConstructor },
     { nullptr }
 };
 
 static const mozilla::Module::ContractIDEntry kWidgetContracts[] = {
     { "@mozilla.org/widgets/window/gonk;1", &kNS_WINDOW_CID },
     { "@mozilla.org/widgets/child_window/gonk;1", &kNS_CHILD_CID },
     { "@mozilla.org/widget/appshell/gonk;1", &kNS_APPSHELL_CID },
     { "@mozilla.org/gfx/screenmanager;1", &kNS_SCREENMANAGER_CID },
     { "@mozilla.org/widget/htmlformatconverter;1", &kNS_HTMLFORMATCONVERTER_CID },
     { "@mozilla.org/widget/idleservice;1", &kNS_IDLE_SERVICE_CID },
     { "@mozilla.org/widget/transferable;1", &kNS_TRANSFERABLE_CID },
     { "@mozilla.org/gfx/info;1", &kNS_GFXINFO_CID },
-    { "@mozilla.org/widget/clipboard;1", &kNS_CLIPBOARD_CID },
-    { "@mozilla.org/widget/clipboardhelper;1", &kNS_CLIPBOARDHELPER_CID },
     { nullptr }
 };
 
 static void
 nsWidgetGonkModuleDtor()
 {
     nsLookAndFeel::Shutdown();
     nsAppShellShutdown();