Skip to content

Commit

Permalink
Backed out changeset 061b9318815b (bug 846906) for accidentally remov…
Browse files Browse the repository at this point in the history
…ing mach.
  • Loading branch information
rvandermeulen committed Apr 4, 2013
1 parent c66ca5e commit 82d09e2
Show file tree
Hide file tree
Showing 6 changed files with 52 additions and 243 deletions.
1 change: 0 additions & 1 deletion docshell/test/chrome/Makefile.in
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,6 @@ MOCHITEST_CHROME_FILES = \
test_private_hidden_window.html \
docshell_helpers.js \
generic.html \
test_bug846906.xul \
$(NULL)

ifneq ($(MOZ_WIDGET_TOOLKIT),gtk2)
Expand Down
78 changes: 0 additions & 78 deletions docshell/test/chrome/test_bug846906.xul

This file was deleted.

51 changes: 51 additions & 0 deletions mach
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
#!/usr/bin/env python
# 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/.

from __future__ import print_function, unicode_literals

import os
import sys

def ancestors(path):
while path:
yield path
(path, child) = os.path.split(path)
if child == "":
break

def load_mach(topsrcdir):
sys.path[0:0] = [os.path.join(topsrcdir, "build")]
import mach_bootstrap
return mach_bootstrap.bootstrap(topsrcdir)

# Check whether the current directory is within a mach src or obj dir.
for dir_path in ancestors(os.getcwd()):
# If we find a "mozinfo.json" file, we are in the objdir.
mozinfo_path = os.path.join(dir_path, "mozinfo.json")
if os.path.isfile(mozinfo_path):
import json
info = json.load(open(mozinfo_path))
if "mozconfig" in info and "MOZCONFIG" not in os.environ:
# If the MOZCONFIG environment variable is not already set, set it
# to the value from mozinfo.json. This will tell the build system
# to look for a config file at the path in $MOZCONFIG rather than
# its default locations.
#
# Note: subprocess requires native strings in os.environ Python
# 2.7.2 and earlier on Windows.
os.environ[b"MOZCONFIG"] = str(info["mozconfig"])

if "topsrcdir" in info:
# Continue searching for mach_bootstrap in the source directory.
dir_path = info["topsrcdir"]

# If we find the mach bootstrap module, we are in the srcdir.
mach_path = os.path.join(dir_path, "build/mach_bootstrap.py")
if os.path.isfile(mach_path):
mach = load_mach(dir_path)
sys.exit(mach.run(sys.argv[1:]))

print("Could not run mach: No mach source directory found")
sys.exit(1)
2 changes: 1 addition & 1 deletion widget/xpwidgets/PuppetWidget.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ InvalidateRegion(nsIWidget* aWidget, const nsIntRegion& aRegion)
/*static*/ already_AddRefed<nsIWidget>
nsIWidget::CreatePuppetWidget(TabChild* aTabChild)
{
NS_ABORT_IF_FALSE(!aTabChild || nsIWidget::UsePuppetWidgets(),
NS_ABORT_IF_FALSE(nsIWidget::UsePuppetWidgets(),
"PuppetWidgets not allowed in this configuration");

nsCOMPtr<nsIWidget> widget = new PuppetWidget(aTabChild);
Expand Down
3 changes: 0 additions & 3 deletions xpfe/appshell/public/nsIAppShellService.idl
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
#include "nsISupports.idl"

interface nsIXULWindow;
interface nsIWebNavigation;
interface nsIURI;
interface nsIDOMWindow;
interface nsIAppShell;
Expand Down Expand Up @@ -44,8 +43,6 @@ interface nsIAppShellService : nsISupports
in long aInitialWidth,
in long aInitialHeight);

nsIWebNavigation createWindowlessBrowser();

[noscript]
void createHiddenWindow();

Expand Down
160 changes: 0 additions & 160 deletions xpfe/appshell/src/nsAppShellService.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -46,10 +46,6 @@
#include "mozilla/Preferences.h"
#include "mozilla/StartupTimeline.h"

#include "nsEmbedCID.h"
#include "nsIWebBrowser.h"
#include "nsIDocShell.h"

using namespace mozilla;

// Default URL for the hidden window, can be overridden by a pref on Mac
Expand Down Expand Up @@ -207,162 +203,6 @@ nsAppShellService::CreateTopLevelWindow(nsIXULWindow *aParent,
return rv;
}

/*
* This class provides a stub implementation of nsIWebBrowserChrome2, as needed
* by nsAppShellService::CreateWindowlessBrowser
*/
class WebBrowserChrome2Stub : public nsIWebBrowserChrome2,
public nsIInterfaceRequestor {
public:
virtual ~WebBrowserChrome2Stub() {}
NS_DECL_ISUPPORTS
NS_DECL_NSIWEBBROWSERCHROME
NS_DECL_NSIWEBBROWSERCHROME2
NS_DECL_NSIINTERFACEREQUESTOR
};

NS_INTERFACE_MAP_BEGIN(WebBrowserChrome2Stub)
NS_INTERFACE_MAP_ENTRY_AMBIGUOUS(nsISupports, nsIWebBrowserChrome)
NS_INTERFACE_MAP_ENTRY(nsIWebBrowserChrome)
NS_INTERFACE_MAP_ENTRY(nsIWebBrowserChrome2)
NS_INTERFACE_MAP_ENTRY(nsIInterfaceRequestor)
NS_INTERFACE_MAP_END

NS_IMPL_ADDREF(WebBrowserChrome2Stub)
NS_IMPL_RELEASE(WebBrowserChrome2Stub)

NS_IMETHODIMP
WebBrowserChrome2Stub::SetStatus(uint32_t aStatusType, const PRUnichar* aStatus)
{
return NS_OK;
}

NS_IMETHODIMP
WebBrowserChrome2Stub::GetWebBrowser(nsIWebBrowser** aWebBrowser)
{
NS_NOTREACHED("WebBrowserChrome2Stub::GetWebBrowser is not supported");
return NS_ERROR_NOT_IMPLEMENTED;
}

NS_IMETHODIMP
WebBrowserChrome2Stub::SetWebBrowser(nsIWebBrowser* aWebBrowser)
{
NS_NOTREACHED("WebBrowserChrome2Stub::SetWebBrowser is not supported");
return NS_ERROR_NOT_IMPLEMENTED;
}

NS_IMETHODIMP
WebBrowserChrome2Stub::GetChromeFlags(uint32_t* aChromeFlags)
{
*aChromeFlags = 0;
return NS_OK;
}

NS_IMETHODIMP
WebBrowserChrome2Stub::SetChromeFlags(uint32_t aChromeFlags)
{
NS_NOTREACHED("WebBrowserChrome2Stub::SetChromeFlags is not supported");
return NS_ERROR_NOT_IMPLEMENTED;
}

NS_IMETHODIMP
WebBrowserChrome2Stub::DestroyBrowserWindow()
{
NS_NOTREACHED("WebBrowserChrome2Stub::DestroyBrowserWindow is not supported");
return NS_ERROR_NOT_IMPLEMENTED;
}

NS_IMETHODIMP
WebBrowserChrome2Stub::SizeBrowserTo(int32_t aCX, int32_t aCY)
{
NS_NOTREACHED("WebBrowserChrome2Stub::SizeBrowserTo is not supported");
return NS_ERROR_NOT_IMPLEMENTED;
}

NS_IMETHODIMP
WebBrowserChrome2Stub::ShowAsModal()
{
NS_NOTREACHED("WebBrowserChrome2Stub::ShowAsModal is not supported");
return NS_ERROR_NOT_IMPLEMENTED;
}

NS_IMETHODIMP
WebBrowserChrome2Stub::IsWindowModal(bool* aResult)
{
*aResult = false;
return NS_OK;
}

NS_IMETHODIMP
WebBrowserChrome2Stub::ExitModalEventLoop(nsresult aStatus)
{
NS_NOTREACHED("WebBrowserChrome2Stub::ExitModalEventLoop is not supported");
return NS_ERROR_NOT_IMPLEMENTED;
}

NS_IMETHODIMP
WebBrowserChrome2Stub::SetStatusWithContext(uint32_t aStatusType,
const nsAString& aStatusText,
nsISupports* aStatusContext)
{
return NS_OK;
}

NS_IMETHODIMP
WebBrowserChrome2Stub::GetInterface(const nsIID & aIID, void **aSink)
{
return QueryInterface(aIID, aSink);
}

NS_IMETHODIMP
nsAppShellService::CreateWindowlessBrowser(nsIWebNavigation **aResult)
{
/* First, we create an instance of nsWebBrowser. Instances of this class have
* an associated doc shell, which is what we're interested in.
*/
nsCOMPtr<nsIWebBrowser> browser = do_CreateInstance(NS_WEBBROWSER_CONTRACTID);
if (!browser) {
NS_ERROR("Couldn't create instance of nsWebBrowser!");
return NS_ERROR_FAILURE;
}

/* Next, we set the container window for our instance of nsWebBrowser. Since
* we don't actually have a window, we instead set the container window to be
* an instance of WebBrowserChrome2Stub, which provides a stub implementation
* of nsIWebBrowserChrome2.
*/
nsRefPtr<WebBrowserChrome2Stub> stub = new WebBrowserChrome2Stub();
if (!stub) {
NS_ERROR("Couldn't create instance of WebBrowserChrome2Stub!");
return NS_ERROR_FAILURE;
}
browser->SetContainerWindow(stub);

nsCOMPtr<nsIWebNavigation> navigation = do_QueryInterface(browser);

nsCOMPtr<nsIDocShellTreeItem> item = do_QueryInterface(navigation);
item->SetItemType(nsIDocShellTreeItem::typeContentWrapper);

/* A windowless web browser doesn't have an associated OS level window. To
* accomplish this, we initialize the window associated with our instance of
* nsWebBrowser with an instance of PuppetWidget, which provides a stub
* implementation of nsIWidget.
*/
nsCOMPtr<nsIWidget> widget = nsIWidget::CreatePuppetWidget(nullptr);
if (!widget) {
NS_ERROR("Couldn't create instance of PuppetWidget");
return NS_ERROR_FAILURE;
}
widget->Create(nullptr, 0, nsIntRect(nsIntPoint(0, 0), nsIntSize(0, 0)),
nullptr, nullptr);
nsCOMPtr<nsIBaseWindow> window = do_QueryInterface(navigation);
window->InitWindow(0, widget, 0, 0, 0, 0);
window->Create();

navigation.forget(aResult);
return NS_OK;
}

uint32_t
nsAppShellService::CalculateWindowZLevel(nsIXULWindow *aParent,
uint32_t aChromeMask)
Expand Down

0 comments on commit 82d09e2

Please sign in to comment.