зеркало из https://github.com/mozilla/gecko-dev.git
Merge last PGO-green changeset of mozilla-inbound to mozilla-central
This commit is contained in:
Коммит
ba2e9ea02d
|
@ -26,11 +26,21 @@
|
|||
#include "mozilla/dom/Element.h"
|
||||
|
||||
#include "nsIAccessibleRelation.h"
|
||||
#include "nsIDocShell.h"
|
||||
#include "nsIDocShellTreeItem.h"
|
||||
#include "nsIDocShellTreeNode.h"
|
||||
#include "nsIDocShellTreeOwner.h"
|
||||
#include "nsIDOMElement.h"
|
||||
#include "nsIDOMEventListener.h"
|
||||
#include "nsIDOMEventTarget.h"
|
||||
#include "nsIDOMHTMLAnchorElement.h"
|
||||
#include "nsIDOMHTMLImageElement.h"
|
||||
#include "nsIDOMHTMLInputElement.h"
|
||||
#include "nsIDOMHTMLSelectElement.h"
|
||||
#include "nsIDOMDataContainerEvent.h"
|
||||
#include "nsIDOMNSEvent.h"
|
||||
#include "nsIDOMXULMultSelectCntrlEl.h"
|
||||
#include "nsIDOMXULPopupElement.h"
|
||||
#include "nsIDocument.h"
|
||||
#include "nsEventListenerManager.h"
|
||||
#include "nsIFrame.h"
|
||||
|
@ -252,9 +262,9 @@ RootAccessible::DocumentActivated(DocAccessible* aDocument)
|
|||
NS_IMETHODIMP
|
||||
RootAccessible::HandleEvent(nsIDOMEvent* aDOMEvent)
|
||||
{
|
||||
MOZ_ASSERT(aDOMEvent);
|
||||
nsCOMPtr<nsIDOMNSEvent> DOMNSEvent(do_QueryInterface(aDOMEvent));
|
||||
nsCOMPtr<nsIDOMEventTarget> DOMEventTarget;
|
||||
aDOMEvent->GetOriginalTarget(getter_AddRefs(DOMEventTarget));
|
||||
DOMNSEvent->GetOriginalTarget(getter_AddRefs(DOMEventTarget));
|
||||
nsCOMPtr<nsINode> origTargetNode(do_QueryInterface(DOMEventTarget));
|
||||
if (!origTargetNode)
|
||||
return NS_OK;
|
||||
|
@ -289,9 +299,9 @@ RootAccessible::HandleEvent(nsIDOMEvent* aDOMEvent)
|
|||
void
|
||||
RootAccessible::ProcessDOMEvent(nsIDOMEvent* aDOMEvent)
|
||||
{
|
||||
MOZ_ASSERT(aDOMEvent);
|
||||
nsCOMPtr<nsIDOMNSEvent> DOMNSEvent(do_QueryInterface(aDOMEvent));
|
||||
nsCOMPtr<nsIDOMEventTarget> DOMEventTarget;
|
||||
aDOMEvent->GetOriginalTarget(getter_AddRefs(DOMEventTarget));
|
||||
DOMNSEvent->GetOriginalTarget(getter_AddRefs(DOMEventTarget));
|
||||
nsCOMPtr<nsINode> origTargetNode(do_QueryInterface(DOMEventTarget));
|
||||
|
||||
nsAutoString eventType;
|
||||
|
|
|
@ -1,8 +1,9 @@
|
|||
dnl
|
||||
dnl Local autoconf macros used with mozilla
|
||||
dnl The contents of this file are under the Public Domain.
|
||||
dnl
|
||||
dnl
|
||||
|
||||
builtin(include, build/autoconf/config.status.m4)dnl
|
||||
builtin(include, build/autoconf/toolchain.m4)dnl
|
||||
builtin(include, build/autoconf/ccache.m4)dnl
|
||||
builtin(include, build/autoconf/nspr.m4)dnl
|
||||
|
@ -22,6 +23,7 @@ builtin(include, build/autoconf/expandlibs.m4)dnl
|
|||
builtin(include, build/autoconf/arch.m4)dnl
|
||||
builtin(include, build/autoconf/android.m4)dnl
|
||||
builtin(include, build/autoconf/zlib.m4)dnl
|
||||
builtin(include, build/autoconf/linux.m4)dnl
|
||||
|
||||
MOZ_PROG_CHECKMSYS()
|
||||
|
||||
|
|
|
@ -25,6 +25,7 @@ fi
|
|||
|
||||
# Common makefiles used by everyone
|
||||
add_makefiles "
|
||||
mozilla-config.h
|
||||
Makefile
|
||||
build/Makefile
|
||||
build/pgo/Makefile
|
||||
|
@ -121,7 +122,6 @@ fi
|
|||
|
||||
if [ "$ENABLE_TESTS" ]; then
|
||||
add_makefiles "
|
||||
build/autoconf/test/Makefile
|
||||
config/makefiles/test/Makefile
|
||||
config/tests/makefiles/autodeps/Makefile
|
||||
config/tests/src-simple/Makefile
|
||||
|
|
|
@ -481,3 +481,6 @@ pref("javascript.options.mem.log", true);
|
|||
|
||||
// Increase mark slice time from 10ms to 30ms
|
||||
pref("javascript.options.mem.gc_incremental_slice_ms", 30);
|
||||
|
||||
// Show/Hide scrollbars when active/inactive
|
||||
pref("ui.showHideScrollbars", 1);
|
||||
|
|
|
@ -11,23 +11,19 @@ xul|window xul|scrollbar {
|
|||
}
|
||||
|
||||
html xul|scrollbar {
|
||||
display: block;
|
||||
}
|
||||
|
||||
xul|scrollbar[orient="vertical"] {
|
||||
-moz-appearance: none !important;
|
||||
position: relative;
|
||||
margin-left: -8px;
|
||||
min-width: 8px;
|
||||
max-width: 8px;
|
||||
background-color: transparent !important;
|
||||
background-image: none !important;
|
||||
border: 0px solid transparent !important;
|
||||
z-index: 2147483647;
|
||||
opacity: 1;
|
||||
}
|
||||
|
||||
xul|scrollbar[orient="vertical"]:-moz-locale-dir(rtl) {
|
||||
margin-left: 2px;
|
||||
margin-right: -10px;
|
||||
xul|scrollbar[orient="vertical"] {
|
||||
-moz-margin-start: -8px;
|
||||
min-width: 8px;
|
||||
max-width: 8px;
|
||||
}
|
||||
|
||||
xul|scrollbar[orient="vertical"] xul|thumb {
|
||||
|
@ -36,14 +32,9 @@ xul|scrollbar[orient="vertical"] xul|thumb {
|
|||
}
|
||||
|
||||
xul|scrollbar[orient="horizontal"] {
|
||||
-moz-appearance: none !important;
|
||||
position: relative;
|
||||
margin-top: -8px;
|
||||
min-height: 8px;
|
||||
max-height: 8px;
|
||||
margin-top: -8px;
|
||||
background-color: transparent !important;
|
||||
background-image: none !important;
|
||||
border: 0px solid transparent !important;
|
||||
}
|
||||
|
||||
xul|scrollbar[orient="horizontal"] xul|thumb {
|
||||
|
@ -51,9 +42,10 @@ xul|scrollbar[orient="horizontal"] xul|thumb {
|
|||
min-height: 6px !important;
|
||||
}
|
||||
|
||||
xul|scrollbox {
|
||||
overflow-y: scroll;
|
||||
overflow-x: scroll;
|
||||
xul|scrollbar:not([active="true"]),
|
||||
xul|scrollbar[disabled] {
|
||||
opacity: 0;
|
||||
-moz-transition: opacity 1s ease;
|
||||
}
|
||||
|
||||
xul|scrollbarbutton {
|
||||
|
|
|
@ -686,3 +686,7 @@ bin/components/@DLL_PREFIX@nkgnomevfs@DLL_SUFFIX@
|
|||
@BINPATH@/components/ActivitiesGlue.js
|
||||
@BINPATH@/components/ProcessGlobal.js
|
||||
@BINPATH@/components/ContentHandler.js
|
||||
|
||||
#ifdef XP_MACOSX
|
||||
@BINPATH@/@DLL_PREFIX@plugin_child_interpose@DLL_SUFFIX@
|
||||
#endif
|
||||
|
|
|
@ -406,6 +406,13 @@ var SocialSidebar = {
|
|||
return Services.prefs.getBoolPref("social.sidebar.open");
|
||||
},
|
||||
|
||||
dispatchEvent: function(aType, aDetail) {
|
||||
let sbrowser = document.getElementById("social-sidebar-browser");
|
||||
let evt = sbrowser.contentDocument.createEvent("CustomEvent");
|
||||
evt.initCustomEvent(aType, true, true, aDetail ? aDetail : {});
|
||||
sbrowser.contentDocument.documentElement.dispatchEvent(evt);
|
||||
},
|
||||
|
||||
updateSidebar: function SocialSidebar_updateSidebar() {
|
||||
// Hide the toggle menu item if the sidebar cannot appear
|
||||
let command = document.getElementById("Social:ToggleSidebar");
|
||||
|
@ -418,17 +425,29 @@ var SocialSidebar = {
|
|||
broadcaster.hidden = hideSidebar;
|
||||
command.setAttribute("checked", !hideSidebar);
|
||||
|
||||
// If the sidebar is hidden, unload its document
|
||||
// XXX this results in a poor UX, we should revisit
|
||||
let sbrowser = document.getElementById("social-sidebar-browser");
|
||||
if (broadcaster.hidden) {
|
||||
sbrowser.removeAttribute("origin");
|
||||
sbrowser.setAttribute("src", "about:blank");
|
||||
return;
|
||||
if (hideSidebar) {
|
||||
this.dispatchEvent("sidebarhide");
|
||||
// If we're disabled, unload the sidebar content
|
||||
if (!this.canShow) {
|
||||
sbrowser.removeAttribute("origin");
|
||||
sbrowser.setAttribute("src", "about:blank");
|
||||
}
|
||||
} else {
|
||||
// Make sure the right sidebar URL is loaded
|
||||
if (sbrowser.getAttribute("origin") != Social.provider.origin) {
|
||||
sbrowser.setAttribute("origin", Social.provider.origin);
|
||||
sbrowser.setAttribute("src", Social.provider.sidebarURL);
|
||||
sbrowser.addEventListener("load", function sidebarOnShow() {
|
||||
sbrowser.removeEventListener("load", sidebarOnShow);
|
||||
// let load finish, then fire our event
|
||||
setTimeout(function () {
|
||||
SocialSidebar.dispatchEvent("sidebarshow");
|
||||
}, 0);
|
||||
});
|
||||
} else {
|
||||
this.dispatchEvent("sidebarshow");
|
||||
}
|
||||
}
|
||||
|
||||
// Load the sidebar document
|
||||
sbrowser.setAttribute("origin", Social.provider.origin);
|
||||
sbrowser.setAttribute("src", Social.provider.sidebarURL);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -658,6 +658,7 @@
|
|||
<toolbaritem id="social-toolbar-button"
|
||||
class="toolbarbutton-1 chromeclass-toolbar-additional"
|
||||
removable="false"
|
||||
pack="center"
|
||||
title="&socialToolbar.title;"
|
||||
hidden="true">
|
||||
<hbox id="social-toolbar-button-box" class="social-statusarea-container">
|
||||
|
|
|
@ -67,13 +67,13 @@ function test_gestureListener(evt)
|
|||
is(evt.delta, test_expectedDelta,
|
||||
"evt.delta (" + evt.delta + ") does not match expected value");
|
||||
|
||||
is(evt.shiftKey, (test_expectedModifiers & Components.interfaces.nsIDOMEvent.SHIFT_MASK) != 0,
|
||||
is(evt.shiftKey, (test_expectedModifiers & Components.interfaces.nsIDOMNSEvent.SHIFT_MASK) != 0,
|
||||
"evt.shiftKey did not match expected value");
|
||||
is(evt.ctrlKey, (test_expectedModifiers & Components.interfaces.nsIDOMEvent.CONTROL_MASK) != 0,
|
||||
is(evt.ctrlKey, (test_expectedModifiers & Components.interfaces.nsIDOMNSEvent.CONTROL_MASK) != 0,
|
||||
"evt.ctrlKey did not match expected value");
|
||||
is(evt.altKey, (test_expectedModifiers & Components.interfaces.nsIDOMEvent.ALT_MASK) != 0,
|
||||
is(evt.altKey, (test_expectedModifiers & Components.interfaces.nsIDOMNSEvent.ALT_MASK) != 0,
|
||||
"evt.altKey did not match expected value");
|
||||
is(evt.metaKey, (test_expectedModifiers & Components.interfaces.nsIDOMEvent.META_MASK) != 0,
|
||||
is(evt.metaKey, (test_expectedModifiers & Components.interfaces.nsIDOMNSEvent.META_MASK) != 0,
|
||||
"evt.metaKey did not match expected value");
|
||||
|
||||
if (evt.type == "MozTapGesture") {
|
||||
|
@ -158,19 +158,19 @@ function test_TestEventListeners()
|
|||
e("MozEdgeUIGesture", 0, 0, 0);
|
||||
|
||||
// event.shiftKey
|
||||
let modifier = Components.interfaces.nsIDOMEvent.SHIFT_MASK;
|
||||
let modifier = Components.interfaces.nsIDOMNSEvent.SHIFT_MASK;
|
||||
e("MozSwipeGesture", SimpleGestureEvent.DIRECTION_RIGHT, 0, modifier);
|
||||
|
||||
// event.metaKey
|
||||
modifier = Components.interfaces.nsIDOMEvent.META_MASK;
|
||||
modifier = Components.interfaces.nsIDOMNSEvent.META_MASK;
|
||||
e("MozSwipeGesture", SimpleGestureEvent.DIRECTION_RIGHT, 0, modifier);
|
||||
|
||||
// event.altKey
|
||||
modifier = Components.interfaces.nsIDOMEvent.ALT_MASK;
|
||||
modifier = Components.interfaces.nsIDOMNSEvent.ALT_MASK;
|
||||
e("MozSwipeGesture", SimpleGestureEvent.DIRECTION_RIGHT, 0, modifier);
|
||||
|
||||
// event.ctrlKey
|
||||
modifier = Components.interfaces.nsIDOMEvent.CONTROL_MASK;
|
||||
modifier = Components.interfaces.nsIDOMNSEvent.CONTROL_MASK;
|
||||
e("MozSwipeGesture", SimpleGestureEvent.DIRECTION_RIGHT, 0, modifier);
|
||||
}
|
||||
|
||||
|
|
|
@ -15,9 +15,9 @@ function test() {
|
|||
|
||||
let manifest = { // normal provider
|
||||
name: "provider 1",
|
||||
origin: "https://example1.com",
|
||||
sidebarURL: "https://example1.com/sidebar.html",
|
||||
workerURL: "https://example1.com/worker.js",
|
||||
origin: "https://example.com",
|
||||
sidebarURL: "https://example.com/browser/browser/base/content/test/social_sidebar.html",
|
||||
workerURL: "https://example.com/browser/browser/base/content/test/social_worker.js",
|
||||
iconURL: "chrome://branding/content/icon48.png"
|
||||
};
|
||||
runSocialTestWithProvider(manifest, doTest);
|
||||
|
@ -29,24 +29,45 @@ function doTest() {
|
|||
|
||||
let command = document.getElementById("Social:ToggleSidebar");
|
||||
let sidebar = document.getElementById("social-sidebar-box");
|
||||
let browser = sidebar.firstChild;
|
||||
|
||||
// Check the the sidebar is initially visible, and loaded
|
||||
ok(!command.hidden, "sidebar toggle command should be visible");
|
||||
is(command.getAttribute("checked"), "true", "sidebar toggle command should be checked");
|
||||
ok(!sidebar.hidden, "sidebar itself should be visible");
|
||||
ok(Services.prefs.getBoolPref("social.sidebar.open"), "sidebar open pref should be true");
|
||||
is(sidebar.firstChild.getAttribute('src'), "https://example1.com/sidebar.html", "sidebar url should be set");
|
||||
function checkShown(shouldBeShown) {
|
||||
is(command.getAttribute("checked"), shouldBeShown ? "true" : "false",
|
||||
"toggle command should be " + (shouldBeShown ? "checked" : "unchecked"));
|
||||
is(sidebar.hidden, !shouldBeShown,
|
||||
"sidebar should be " + (shouldBeShown ? "visible" : "hidden"));
|
||||
is(Services.prefs.getBoolPref("social.sidebar.open"), shouldBeShown,
|
||||
"sidebar open pref should be " + shouldBeShown);
|
||||
if (shouldBeShown)
|
||||
is(browser.getAttribute('src'), Social.provider.sidebarURL, "sidebar url should be set");
|
||||
}
|
||||
|
||||
// Now toggle it!
|
||||
info("Toggling sidebar");
|
||||
// First check the the sidebar is initially visible, and loaded
|
||||
ok(!command.hidden, "toggle command should be visible");
|
||||
checkShown(true);
|
||||
|
||||
browser.addEventListener("sidebarhide", function sidebarhide() {
|
||||
browser.removeEventListener("sidebarhide", sidebarhide);
|
||||
|
||||
checkShown(false);
|
||||
|
||||
browser.addEventListener("sidebarshow", function sidebarshow() {
|
||||
browser.removeEventListener("sidebarshow", sidebarshow);
|
||||
|
||||
checkShown(true);
|
||||
|
||||
// Remove the test provider
|
||||
SocialService.removeProvider(Social.provider.origin, finish);
|
||||
});
|
||||
|
||||
// Toggle it back on
|
||||
info("Toggling sidebar back on");
|
||||
Social.toggleSidebar();
|
||||
});
|
||||
|
||||
// Now toggle it off
|
||||
info("Toggling sidebar off");
|
||||
Social.toggleSidebar();
|
||||
is(command.getAttribute("checked"), "false", "sidebar toggle command should not be checked");
|
||||
ok(sidebar.hidden, "sidebar itself should not be visible");
|
||||
ok(!Services.prefs.getBoolPref("social.sidebar.open"), "sidebar open pref should be false");
|
||||
is(sidebar.firstChild.getAttribute('src'), "about:blank", "sidebar url should not be set");
|
||||
|
||||
// Remove the test provider
|
||||
SocialService.removeProvider(Social.provider.origin, finish);
|
||||
}
|
||||
|
||||
// XXX test sidebar in popup
|
||||
|
|
|
@ -8,7 +8,6 @@ srcdir = @srcdir@
|
|||
VPATH = @srcdir@
|
||||
|
||||
include $(DEPTH)/config/autoconf.mk
|
||||
include $(topsrcdir)/config/config.mk
|
||||
|
||||
EXTRA_COMPONENTS = \
|
||||
nsSessionStore.manifest \
|
||||
|
@ -19,16 +18,24 @@ EXTRA_PP_COMPONENTS = \
|
|||
nsSessionStartup.js \
|
||||
$(NULL)
|
||||
|
||||
JS_MODULES_PATH := $(FINAL_TARGET)/modules/sessionstore
|
||||
libs::
|
||||
$(NSINSTALL) $(srcdir)/*.jsm $(FINAL_TARGET)/modules/sessionstore
|
||||
|
||||
EXTRA_JS_MODULES := \
|
||||
DocumentUtils.jsm \
|
||||
SessionStorage.jsm \
|
||||
XPathGenerator.jsm \
|
||||
$(NULL)
|
||||
|
||||
EXTRA_PP_JS_MODULES := \
|
||||
SS_EXTRA_PP_JS_MODULES = \
|
||||
SessionStore.jsm \
|
||||
$(NULL)
|
||||
|
||||
ifdef SS_EXTRA_PP_JS_MODULES
|
||||
libs:: $(SS_EXTRA_PP_JS_MODULES)
|
||||
ifndef NO_DIST_INSTALL
|
||||
$(EXIT_ON_ERROR) \
|
||||
$(NSINSTALL) -D $(FINAL_TARGET)/modules/sessionstore; \
|
||||
for i in $^; do \
|
||||
dest=$(FINAL_TARGET)/modules/sessionstore/`basename $$i`; \
|
||||
$(RM) -f $$dest; \
|
||||
$(PYTHON) $(topsrcdir)/config/Preprocessor.py $(DEFINES) $(ACDEFINES) $(XULPPFLAGS) $$i > $$dest; \
|
||||
done
|
||||
endif
|
||||
endif
|
||||
|
||||
include $(topsrcdir)/config/rules.mk
|
||||
|
|
|
@ -30,8 +30,4 @@ EXTRA_JS_MODULES += \
|
|||
$(NULL)
|
||||
endif
|
||||
|
||||
EXTRA_PP_JS_MODULES = \
|
||||
WebappsInstaller.jsm \
|
||||
$(NULL)
|
||||
|
||||
include $(topsrcdir)/config/rules.mk
|
||||
|
|
|
@ -11,7 +11,7 @@ let Cu = Components.utils;
|
|||
Cu.import("resource://gre/modules/Services.jsm");
|
||||
Cu.import("resource://gre/modules/XPCOMUtils.jsm");
|
||||
Cu.import("resource://gre/modules/Webapps.jsm");
|
||||
Cu.import("resource:///modules/WebappsInstaller.jsm");
|
||||
Cu.import("resource://gre/modules/WebappsInstaller.jsm");
|
||||
Cu.import("resource://gre/modules/WebappOSUtils.jsm");
|
||||
|
||||
let webappsUI = {
|
||||
|
|
|
@ -2632,3 +2632,120 @@ stack[anonid=browserStack][responsivemode] {
|
|||
background-image: -moz-linear-gradient(top, #B4211B, #8A1915);
|
||||
border-radius: 1px;
|
||||
}
|
||||
|
||||
#social-toolbar-button {
|
||||
-moz-appearance: toolbarbutton;
|
||||
}
|
||||
|
||||
/* favicon for the service */
|
||||
#social-provider-image {
|
||||
-moz-appearance: none;
|
||||
border: none;
|
||||
min-width: 20px;
|
||||
min-height: 20px;
|
||||
padding: 2px 5px;
|
||||
margin: 0;
|
||||
background: transparent;
|
||||
list-style-image: url("chrome://browser/skin/social/social.png");
|
||||
}
|
||||
|
||||
#social-provider-image > .button-box > .box-inherit > .button-icon {
|
||||
max-height: 16px;
|
||||
max-width: 16px;
|
||||
}
|
||||
|
||||
#social-provider-image > .button-box {
|
||||
padding: 0;
|
||||
margin: 0;
|
||||
background: transparent;
|
||||
border: none;
|
||||
}
|
||||
|
||||
#social-provider-image > .button-box > .button-menu-dropmarker {
|
||||
display: none;
|
||||
}
|
||||
|
||||
/* hbox that hold notification icons */
|
||||
#social-status-iconbox {
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
}
|
||||
|
||||
/* hbox that surrounds an image and its counter */
|
||||
.social-notification-icon-container {
|
||||
padding: 0;
|
||||
margin: 0;
|
||||
position: relative;
|
||||
}
|
||||
|
||||
/* notification counter box */
|
||||
.social-notification-icon-counter {
|
||||
background-color: rgb(240,61,37);
|
||||
border: 1px solid rgb(216,55,34);
|
||||
box-shadow: 0px 1px 0px rgba(0,39,121,0.77);
|
||||
padding-right: 1px;
|
||||
padding-left: 1px;
|
||||
color: white;
|
||||
font-size: 9px;
|
||||
font-weight: bold;
|
||||
position: absolute;
|
||||
right: -3px;
|
||||
top: -4px;
|
||||
z-index: 1;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
/* notification image */
|
||||
.social-notification-icon-image {
|
||||
padding: 2px;
|
||||
margin: 0;
|
||||
min-width: 20px;
|
||||
max-width: 32px;
|
||||
max-height: 20px;
|
||||
list-style-image: url("chrome://mozapps/skin/places/defaultFavicon.png");
|
||||
}
|
||||
|
||||
/* social toolbar provider menu */
|
||||
#social-statusarea-popup {
|
||||
margin-top: 0;
|
||||
margin-left: -12px;
|
||||
margin-right: -12px;
|
||||
}
|
||||
|
||||
#social-statusarea-user {
|
||||
border-bottom: 1px solid rgb(221,221,221);
|
||||
background-color: -moz-Dialog;
|
||||
color: -moz-dialogtext;
|
||||
position: relative;
|
||||
font: message-box;
|
||||
font-size: 12px;
|
||||
}
|
||||
|
||||
#social-statusarea-user-portrait {
|
||||
width: 32px;
|
||||
height: 32px;
|
||||
border-radius: 2px;
|
||||
margin: 10px;
|
||||
list-style-image: url("chrome://browser/skin/social/social.png");
|
||||
}
|
||||
|
||||
#social-statusarea-username {
|
||||
-moz-appearance: none;
|
||||
background: transparent;
|
||||
border: none;
|
||||
color: -moz-nativehyperlinktext;
|
||||
cursor: pointer;
|
||||
min-width: 0;
|
||||
margin: 0 6px;
|
||||
}
|
||||
#social-statusarea-username:hover {
|
||||
text-decoration: underline;
|
||||
}
|
||||
|
||||
#social-notification-panel {
|
||||
min-height: 100px;
|
||||
min-width: 100px;
|
||||
max-height: 600px;
|
||||
max-width: 400px;
|
||||
}
|
||||
|
||||
|
|
|
@ -0,0 +1,313 @@
|
|||
# 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/.
|
||||
|
||||
# Combined with build/autoconf/config.status.m4, ConfigStatus is an almost
|
||||
# drop-in replacement for autoconf 2.13's config.status, with features
|
||||
# borrowed from autoconf > 2.5, and additional features.
|
||||
|
||||
from __future__ import with_statement
|
||||
from optparse import OptionParser
|
||||
import sys, re, os, posixpath
|
||||
from StringIO import StringIO
|
||||
# Standalone js doesn't have virtualenv.
|
||||
sys.path.append(os.path.join(os.path.dirname(__file__), '..', 'config'))
|
||||
from Preprocessor import Preprocessor
|
||||
|
||||
# Basic logging facility
|
||||
verbose = False
|
||||
def log(string):
|
||||
if verbose:
|
||||
print >>sys.stderr, string
|
||||
|
||||
# We need relpath, but it is introduced in python 2.6
|
||||
# http://docs.python.org/library/os.path.html
|
||||
def my_relpath(path, start):
|
||||
"""
|
||||
Return a relative version of a path
|
||||
from /usr/lib/python2.6/posixpath.py
|
||||
"""
|
||||
|
||||
if not path:
|
||||
raise ValueError("no path specified")
|
||||
|
||||
start_list = os.path.abspath(start).split(os.path.sep)
|
||||
path_list = os.path.abspath(path).split(os.path.sep)
|
||||
|
||||
# Work out how much of the filepath is shared by start and path.
|
||||
i = len(os.path.commonprefix([start_list, path_list]))
|
||||
|
||||
rel_list = [os.path.pardir] * (len(start_list)-i) + path_list[i:]
|
||||
if not rel_list:
|
||||
return os.curdir
|
||||
return os.path.join(*rel_list)
|
||||
|
||||
relpath = getattr(os.path, "relpath", my_relpath)
|
||||
|
||||
def ensureParentDir(file):
|
||||
'''Ensures the directory parent to the given file exists'''
|
||||
dir = os.path.dirname(file)
|
||||
if dir and not os.path.exists(dir):
|
||||
try:
|
||||
os.makedirs(dir)
|
||||
except OSError, error:
|
||||
if error.errno != errno.EEXIST:
|
||||
raise
|
||||
|
||||
class FileAvoidWrite(StringIO):
|
||||
'''file-like object that buffers its output and only writes it to disk
|
||||
if the new contents are different from what the file may already contain.
|
||||
'''
|
||||
def __init__(self, filename):
|
||||
self.filename = filename
|
||||
StringIO.__init__(self)
|
||||
|
||||
def close(self):
|
||||
buf = self.getvalue()
|
||||
StringIO.close(self)
|
||||
try:
|
||||
file = open(self.filename, 'rU')
|
||||
except IOError:
|
||||
pass
|
||||
else:
|
||||
try:
|
||||
if file.read() == buf:
|
||||
log("%s is unchanged" % relpath(self.filename, os.curdir))
|
||||
return
|
||||
except IOError:
|
||||
pass
|
||||
finally:
|
||||
file.close()
|
||||
|
||||
log("creating %s" % relpath(self.filename, os.curdir))
|
||||
ensureParentDir(self.filename)
|
||||
with open(self.filename, 'w') as file:
|
||||
file.write(buf)
|
||||
|
||||
def __enter__(self):
|
||||
return self
|
||||
def __exit__(self, type, value, traceback):
|
||||
self.close()
|
||||
|
||||
def shell_escape(s):
|
||||
'''Escape some characters with a backslash, and double dollar signs.
|
||||
'''
|
||||
return re.sub('''([ \t`#$^&*(){}\\|;'"<>?\[\]])''', r'\\\1', str(s)).replace('$', '$$')
|
||||
|
||||
class ConfigEnvironment(object):
|
||||
'''A ConfigEnvironment is defined by a source directory and a build
|
||||
directory. It preprocesses files from the source directory and stores
|
||||
the result in the object directory.
|
||||
|
||||
There are two types of files: config files and config headers,
|
||||
each treated through a different member function.
|
||||
|
||||
Creating a ConfigEnvironment requires a few arguments:
|
||||
- topsrcdir and topobjdir are, respectively, the top source and
|
||||
the top object directory.
|
||||
- defines is a list of (name, value) tuples. In autoconf, these are
|
||||
set with AC_DEFINE and AC_DEFINE_UNQUOTED
|
||||
- non_global_defines are a list of names appearing in defines above
|
||||
that are not meant to be exported in ACDEFINES and ALLDEFINES (see
|
||||
below)
|
||||
- substs is a list of (name, value) tuples. In autoconf, these are
|
||||
set with AC_SUBST.
|
||||
|
||||
ConfigEnvironment automatically defines two additional substs variables
|
||||
from all the defines not appearing in non_global_defines:
|
||||
- ACDEFINES contains the defines in the form -DNAME=VALUE, for use on
|
||||
preprocessor command lines. The order in which defines were given
|
||||
when creating the ConfigEnvironment is preserved.
|
||||
- ALLDEFINES contains the defines in the form #define NAME VALUE, in
|
||||
sorted order, for use in config files, for an automatic listing of
|
||||
defines.
|
||||
|
||||
ConfigEnvironment expects a "top_srcdir" subst to be set with the top
|
||||
source directory, in msys format on windows. It is used to derive a
|
||||
"srcdir" subst when treating config files.
|
||||
'''
|
||||
|
||||
def __init__(self, topobjdir = '.', topsrcdir = '.',
|
||||
defines = [], non_global_defines = [], substs = []):
|
||||
self.defines = dict(defines)
|
||||
self.substs = dict(substs)
|
||||
self.topsrcdir = topsrcdir
|
||||
self.topobjdir = topobjdir
|
||||
global_defines = [name for name, value in defines if not name in non_global_defines]
|
||||
self.substs['ACDEFINES'] = ' '.join(["-D%s=%s" % (name, shell_escape(self.defines[name])) for name in global_defines])
|
||||
self.substs['ALLDEFINES'] = '\n'.join(sorted(["#define %s %s" % (name, self.defines[name]) for name in global_defines]))
|
||||
|
||||
def get_relative_srcdir(self, file):
|
||||
'''Returns the relative source directory for the given file, always
|
||||
using / as a path separator.
|
||||
'''
|
||||
assert(isinstance(file, basestring))
|
||||
dir = posixpath.dirname(relpath(file, self.topobjdir).replace(os.sep, '/'))
|
||||
if dir:
|
||||
return dir
|
||||
return '.'
|
||||
|
||||
def get_file_srcdir(self, file):
|
||||
'''Returns the srcdir for the given file, where srcdir is in msys
|
||||
format on windows, thus derived from top_srcdir.
|
||||
'''
|
||||
dir = self.get_relative_srcdir(file)
|
||||
return posixpath.normpath(posixpath.join(self.substs['top_srcdir'], dir))
|
||||
|
||||
def get_depth(self, file):
|
||||
'''Returns the DEPTH for the given file, that is, the path to the
|
||||
object directory relative to the directory containing the given file.
|
||||
Always uses / as a path separator.
|
||||
'''
|
||||
return relpath(self.topobjdir, os.path.dirname(file)).replace(os.sep, '/')
|
||||
|
||||
def get_input(self, file):
|
||||
'''Returns the input file path in the source tree that can be used
|
||||
to create the given config file or header.
|
||||
'''
|
||||
assert(isinstance(file, basestring))
|
||||
return os.path.normpath(os.path.join(self.topsrcdir, "%s.in" % relpath(file, self.topobjdir)))
|
||||
|
||||
def create_config_file(self, path):
|
||||
'''Creates the given config file. A config file is generated by
|
||||
taking the corresponding source file and replacing occurences of
|
||||
"@VAR@" by the value corresponding to "VAR" in the substs dict.
|
||||
|
||||
Additional substs are defined according to the file being treated:
|
||||
"srcdir" for its the path to its source directory
|
||||
"relativesrcdir" for its source directory relative to the top
|
||||
"DEPTH" for the path to the top object directory
|
||||
'''
|
||||
input = self.get_input(path)
|
||||
pp = Preprocessor()
|
||||
pp.context.update(self.substs)
|
||||
pp.context.update(srcdir = self.get_file_srcdir(path))
|
||||
pp.context.update(relativesrcdir = self.get_relative_srcdir(path))
|
||||
pp.context.update(DEPTH = self.get_depth(path))
|
||||
pp.do_filter('attemptSubstitution')
|
||||
pp.setMarker(None)
|
||||
with FileAvoidWrite(path) as pp.out:
|
||||
pp.do_include(input)
|
||||
|
||||
def create_config_header(self, path):
|
||||
'''Creates the given config header. A config header is generated by
|
||||
taking the corresponding source file and replacing some #define/#undef
|
||||
occurences:
|
||||
"#undef NAME" is turned into "#define NAME VALUE"
|
||||
"#define NAME" is unchanged
|
||||
"#define NAME ORIGINAL_VALUE" is turned into "#define NAME VALUE"
|
||||
"#undef UNKNOWN_NAME" is turned into "/* #undef UNKNOWN_NAME */"
|
||||
Whitespaces are preserved.
|
||||
'''
|
||||
with open(self.get_input(path), 'rU') as input:
|
||||
ensureParentDir(path)
|
||||
output = FileAvoidWrite(path)
|
||||
r = re.compile('^\s*#\s*(?P<cmd>[a-z]+)(?:\s+(?P<name>\S+)(?:\s+(?P<value>\S+))?)?', re.U)
|
||||
for l in input:
|
||||
m = r.match(l)
|
||||
if m:
|
||||
cmd = m.group('cmd')
|
||||
name = m.group('name')
|
||||
value = m.group('value')
|
||||
if name:
|
||||
if name in self.defines:
|
||||
if cmd == 'define' and value:
|
||||
l = l[:m.start('value')] + str(self.defines[name]) + l[m.end('value'):]
|
||||
elif cmd == 'undef':
|
||||
l = l[:m.start('cmd')] + 'define' + l[m.end('cmd'):m.end('name')] + ' ' + str(self.defines[name]) + l[m.end('name'):]
|
||||
elif cmd == 'undef':
|
||||
l = '/* ' + l[:m.end('name')] + ' */' + l[m.end('name'):]
|
||||
|
||||
output.write(l)
|
||||
output.close()
|
||||
|
||||
def config_status(topobjdir = '.', topsrcdir = '.',
|
||||
defines = [], non_global_defines = [], substs = [],
|
||||
files = [], headers = []):
|
||||
'''Main function, providing config.status functionality.
|
||||
|
||||
Contrary to config.status, it doesn't use CONFIG_FILES or CONFIG_HEADERS
|
||||
variables, but like config.status from autoconf 2.6, single files may be
|
||||
generated with the --file and --header options. Several such options can
|
||||
be given to generate several files at the same time.
|
||||
|
||||
Without the -n option, this program acts as config.status and considers
|
||||
the current directory as the top object directory, even when config.status
|
||||
is in a different directory. It will, however, treat the directory
|
||||
containing config.status as the top object directory with the -n option,
|
||||
while files given to the --file and --header arguments are considered
|
||||
relative to the current directory.
|
||||
|
||||
The --recheck option, like with the original config.status, runs configure
|
||||
again, with the options given in the "ac_configure_args" subst.
|
||||
|
||||
The options to this function are passed when creating the
|
||||
ConfigEnvironment, except for files and headers, which contain the list
|
||||
of files and headers to be generated by default. These lists, as well as
|
||||
the actual wrapper script around this function, are meant to be generated
|
||||
by configure. See build/autoconf/config.status.m4.
|
||||
|
||||
Unlike config.status behaviour with CONFIG_FILES and CONFIG_HEADERS,
|
||||
but like config.status behaviour with --file and --header, providing
|
||||
files or headers on the command line inhibits the default generation of
|
||||
files when given headers and headers when given files.
|
||||
|
||||
Unlike config.status, the FILE:TEMPLATE syntax is not supported for
|
||||
files and headers. The template is always the filename suffixed with
|
||||
'.in', in the corresponding directory under the top source directory.
|
||||
'''
|
||||
|
||||
if 'CONFIG_FILES' in os.environ:
|
||||
raise Exception, 'Using the CONFIG_FILES environment variable is not supported. Use --file instead.'
|
||||
if 'CONFIG_HEADERS' in os.environ:
|
||||
raise Exception, 'Using the CONFIG_HEADERS environment variable is not supported. Use --header instead.'
|
||||
|
||||
parser = OptionParser()
|
||||
parser.add_option('--recheck', dest='recheck', action='store_true',
|
||||
help='update config.status by reconfiguring in the same conditions')
|
||||
parser.add_option('--file', dest='files', metavar='FILE', action='append',
|
||||
help='instantiate the configuration file FILE')
|
||||
parser.add_option('--header', dest='headers', metavar='FILE', action='append',
|
||||
help='instantiate the configuration header FILE')
|
||||
parser.add_option('-v', '--verbose', dest='verbose', action='store_true',
|
||||
help='display verbose output')
|
||||
parser.add_option('-n', dest='not_topobjdir', action='store_true',
|
||||
help='do not consider current directory as top object directory')
|
||||
(options, args) = parser.parse_args()
|
||||
|
||||
# Without -n, the current directory is meant to be the top object directory
|
||||
if not options.not_topobjdir:
|
||||
topobjdir = '.'
|
||||
|
||||
env = ConfigEnvironment(topobjdir = topobjdir, topsrcdir = topsrcdir,
|
||||
defines = defines, non_global_defines = non_global_defines,
|
||||
substs = substs)
|
||||
|
||||
if options.recheck:
|
||||
# Execute configure from the top object directory
|
||||
if not os.path.isabs(topsrcdir):
|
||||
topsrcdir = relpath(topsrcdir, topobjdir)
|
||||
os.chdir(topobjdir)
|
||||
os.execlp('sh', 'sh', '-c', ' '.join([os.path.join(topsrcdir, 'configure'), env.substs['ac_configure_args'], '--no-create', '--no-recursion']))
|
||||
|
||||
if options.files:
|
||||
files = options.files
|
||||
headers = []
|
||||
if options.headers:
|
||||
headers = options.headers
|
||||
if not options.files:
|
||||
files = []
|
||||
# Default to display messages when giving --file or --headers on the
|
||||
# command line.
|
||||
if options.files or options.headers or options.verbose:
|
||||
global verbose
|
||||
verbose = True
|
||||
if not options.files and not options.headers:
|
||||
print >>sys.stderr, "creating config files and headers..."
|
||||
files = [os.path.join(topobjdir, f) for f in files]
|
||||
headers = [os.path.join(topobjdir, f) for f in headers]
|
||||
|
||||
for file in files:
|
||||
env.create_config_file(file)
|
||||
for header in headers:
|
||||
env.create_config_header(header)
|
|
@ -26,7 +26,6 @@ endif
|
|||
|
||||
DIRS += pgo
|
||||
|
||||
TEST_DIRS += autoconf/test
|
||||
ifeq (android,$(MOZ_WIDGET_TOOLKIT))
|
||||
TEST_DIRS += mobile/sutagent/android \
|
||||
mobile/sutagent/android/watcher \
|
||||
|
@ -263,4 +262,8 @@ libs:: $(topsrcdir)/tools/rb/fix-linux-stack.pl
|
|||
endif
|
||||
|
||||
GARBAGE += $(srcdir)/automationutils.pyc
|
||||
|
||||
# Test for ConfigStatus.py
|
||||
check::
|
||||
$(PYTHON) $(srcdir)/tests/unit-ConfigStatus.py
|
||||
endif # ENABLE_TESTS
|
||||
|
|
|
@ -1,170 +0,0 @@
|
|||
#! /usr/bin/env perl
|
||||
#
|
||||
# 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/.
|
||||
|
||||
# acoutput-fast.pl - Quickly create makefiles that are in a common format.
|
||||
#
|
||||
# Most of the makefiles in mozilla only refer to two configure variables:
|
||||
# @srcdir@
|
||||
# @top_srcdir@
|
||||
# However, configure does not know any better and it runs sed on each file
|
||||
# with over 150 replacement rules (slow as molasses).
|
||||
#
|
||||
# This script takes a list of makefiles as input. For example,
|
||||
#
|
||||
# echo $MAKEFILES | acoutput-fast.pl
|
||||
#
|
||||
# The script creates each Makefile that only references @srcdir@ and
|
||||
# @top_srcdir@. For other files, it lists them in a shell command that is
|
||||
# printed to stdout:
|
||||
#
|
||||
# CONFIG_FILES="unhandled_files..."; export CONFIG_FILES
|
||||
#
|
||||
# This command can be used to have config.status create the unhandled
|
||||
# files. For example,
|
||||
#
|
||||
# eval "echo $MAKEFILES | acoutput-fast.pl"
|
||||
# AC_OUTPUT($MAKEFILES)
|
||||
#
|
||||
# Send comments, improvements, bugs to Steve Lamm (slamm@netscape.com).
|
||||
|
||||
#use File::Basename;
|
||||
sub dirname {
|
||||
my $dir = $_[0];
|
||||
return '.' if not $dir =~ m%/%;
|
||||
$dir =~ s%/[^/][^/]*$%%;
|
||||
return $dir;
|
||||
}
|
||||
|
||||
# Create one directory. Assumes it doesn't already exist.
|
||||
# Will create parent(s) if needed.
|
||||
sub create_directory {
|
||||
my $dir = $_[0];
|
||||
my $parent = dirname($dir);
|
||||
create_directory($parent) if not -d $parent;
|
||||
mkdir "$dir",0777;
|
||||
}
|
||||
|
||||
# Create all the directories at once.
|
||||
# This can be much faster than calling mkdir() for each one.
|
||||
sub create_directories {
|
||||
my @makefiles = @_;
|
||||
my @dirs = ();
|
||||
my $ac_file;
|
||||
foreach $ac_file (@makefiles) {
|
||||
push @dirs, dirname($ac_file);
|
||||
}
|
||||
# Call mkdir with the directories sorted by subdir count (how many /'s)
|
||||
if (@dirs) {
|
||||
foreach $dir (@dirs) {
|
||||
if (not -d $dir) {
|
||||
print STDERR "Creating directory $dir\n";
|
||||
create_directory($dir);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
while($arg = shift) {
|
||||
if ($arg =~ /^--srcdir=/) {
|
||||
$ac_given_srcdir = (split /=/, $arg)[1];
|
||||
}
|
||||
if ($arg =~ /^--cygwin-srcdir/) {
|
||||
$ac_cygwin_srcdir = (split /=/, $arg)[1];
|
||||
}
|
||||
}
|
||||
|
||||
if (!$ac_given_srcdir) {
|
||||
$ac_given_srcdir = $0;
|
||||
$ac_given_srcdir =~ s|/?build/autoconf/.*$||;
|
||||
$ac_given_srcdir = '.' if $ac_given_srcdir eq '';
|
||||
}
|
||||
|
||||
if (!$ac_cygwin_srcdir) {
|
||||
$ac_cygwin_srcdir = $ac_given_srcdir;
|
||||
}
|
||||
|
||||
# Read list of makefiles from the stdin or,
|
||||
# from files listed on the command-line.
|
||||
#
|
||||
@makefiles=();
|
||||
push @makefiles, split while (<STDIN>);
|
||||
|
||||
# Create all the directories at once.
|
||||
# This can be much faster than calling mkdir() for each one.
|
||||
create_directories(@makefiles);
|
||||
|
||||
# Output the makefiles.
|
||||
#
|
||||
@unhandled=();
|
||||
foreach $ac_file (@makefiles) {
|
||||
if (not $ac_file =~ /Makefile$/ or $ac_file =~ /:/) {
|
||||
push @unhandled, $ac_file;
|
||||
next;
|
||||
}
|
||||
$ac_file_in = "$ac_given_srcdir/$ac_file.in";
|
||||
$ac_dir = dirname($ac_file);
|
||||
if ($ac_dir eq '.') {
|
||||
$ac_dir_suffix = '';
|
||||
$ac_dots = '';
|
||||
} else {
|
||||
$ac_dir_suffix = "/$ac_dir";
|
||||
$ac_dir_suffix =~ s%^/\./%/%;
|
||||
$ac_dots = $ac_dir_suffix;
|
||||
$ac_dots =~ s%/[^/]*%../%g;
|
||||
}
|
||||
if ($ac_given_srcdir eq '.') {
|
||||
$srcdir = '.';
|
||||
if ($ac_dots eq '') {
|
||||
$top_srcdir = '.'
|
||||
} else {
|
||||
$top_srcdir = $ac_dots;
|
||||
$top_srcdir =~ s%/$%%;
|
||||
}
|
||||
} elsif ($ac_cygwin_srcdir =~ m%^/% or $ac_cygwin_srcdir =~ m%^.:/%) {
|
||||
$srcdir = "$ac_cygwin_srcdir$ac_dir_suffix";
|
||||
$top_srcdir = "$ac_cygwin_srcdir";
|
||||
} else {
|
||||
$srcdir = "$ac_dots$ac_cygwin_srcdir$ac_dir_suffix";
|
||||
$top_srcdir = "$ac_dots$ac_cygwin_srcdir";
|
||||
}
|
||||
|
||||
if (-e $ac_file) {
|
||||
next if -M _ < -M $ac_file_in;
|
||||
print STDERR "updating $ac_file\n";
|
||||
} else {
|
||||
print STDERR "creating $ac_file\n";
|
||||
}
|
||||
|
||||
open (INFILE, "<$ac_file_in")
|
||||
or ( die "can't read $ac_file_in: No such file or directory\n");
|
||||
open (OUTFILE, ">$ac_file")
|
||||
or ( warn "Unable to create $ac_file\n" and next);
|
||||
|
||||
while (<INFILE>) {
|
||||
#if (/\@[_a-zA-Z]*\@.*\@[_a-zA-Z]*\@/) {
|
||||
# warn "Two defines on a line:$ac_file:$.:$_";
|
||||
# push @unhandled, $ac_file;
|
||||
# last;
|
||||
#}
|
||||
|
||||
s/\@srcdir\@/$srcdir/g;
|
||||
s/\@top_srcdir\@/$top_srcdir/g;
|
||||
|
||||
if (/\@[_a-zA-Z]*\@/) {
|
||||
warn "Unknown variable:$ac_file:$.:$_";
|
||||
push @unhandled, $ac_file;
|
||||
last;
|
||||
}
|
||||
print OUTFILE;
|
||||
}
|
||||
close INFILE;
|
||||
close OUTFILE;
|
||||
}
|
||||
|
||||
# Print the shell command to be evaluated by configure.
|
||||
#
|
||||
print "CONFIG_FILES=\"".join(' ', @unhandled)."\"; export CONFIG_FILES\n";
|
||||
|
|
@ -0,0 +1,167 @@
|
|||
dnl This Source Code Form is subject to the terms of the Mozilla Public
|
||||
dnl License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
dnl file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||
|
||||
dnl For use in AC_SUBST replacement
|
||||
define([MOZ_DIVERSION_SUBST], 11)
|
||||
|
||||
dnl Replace AC_SUBST to store values in a format suitable for python.
|
||||
dnl The necessary comma after the tuple can't be put here because it
|
||||
dnl can mess around with things like:
|
||||
dnl AC_SOMETHING(foo,AC_SUBST(),bar)
|
||||
define([AC_SUBST],
|
||||
[ifdef([AC_SUBST_$1], ,
|
||||
[define([AC_SUBST_$1], )dnl
|
||||
AC_DIVERT_PUSH(MOZ_DIVERSION_SUBST)dnl
|
||||
(''' $1 ''', r''' [$]$1 ''')
|
||||
AC_DIVERT_POP()dnl
|
||||
])])
|
||||
|
||||
dnl Wrap AC_DEFINE to store values in a format suitable for python.
|
||||
dnl autoconf's AC_DEFINE still needs to be used to fill confdefs.h,
|
||||
dnl which is #included during some compile checks.
|
||||
dnl The necessary comma after the tuple can't be put here because it
|
||||
dnl can mess around with things like:
|
||||
dnl AC_SOMETHING(foo,AC_DEFINE(),bar)
|
||||
define([_MOZ_AC_DEFINE], defn([AC_DEFINE]))
|
||||
define([AC_DEFINE],
|
||||
[cat >> confdefs.pytmp <<\EOF
|
||||
(''' $1 ''', ifelse($#, 2, [r''' $2 '''], $#, 3, [r''' $2 '''], ' 1 '))
|
||||
EOF
|
||||
ifelse($#, 2, _MOZ_AC_DEFINE([$1], [$2]), $#, 3, _MOZ_AC_DEFINE([$1], [$2], [$3]),_MOZ_AC_DEFINE([$1]))dnl
|
||||
])
|
||||
|
||||
dnl Wrap AC_DEFINE_UNQUOTED to store values in a format suitable for
|
||||
dnl python.
|
||||
define([_MOZ_AC_DEFINE_UNQUOTED], defn([AC_DEFINE_UNQUOTED]))
|
||||
define([AC_DEFINE_UNQUOTED],
|
||||
[cat >> confdefs.pytmp <<EOF
|
||||
(''' $1 ''', ifelse($#, 2, [r''' $2 '''], $#, 3, [r''' $2 '''], ' 1 '))
|
||||
EOF
|
||||
ifelse($#, 2, _MOZ_AC_DEFINE_UNQUOTED($1, $2), $#, 3, _MOZ_AC_DEFINE_UNQUOTED($1, $2, $3),_MOZ_AC_DEFINE_UNQUOTED($1))dnl
|
||||
])
|
||||
|
||||
dnl Replace AC_OUTPUT to create and call a python config.status
|
||||
define([AC_OUTPUT],
|
||||
[dnl Top source directory in Windows format (as opposed to msys format).
|
||||
WIN_TOP_SRC=
|
||||
case "$host_os" in
|
||||
mingw*)
|
||||
WIN_TOP_SRC=`cd $srcdir; pwd -W`
|
||||
;;
|
||||
esac
|
||||
AC_SUBST(WIN_TOP_SRC)
|
||||
|
||||
dnl Used in all Makefile.in files
|
||||
top_srcdir=$srcdir
|
||||
AC_SUBST(top_srcdir)
|
||||
|
||||
dnl Picked from autoconf 2.13
|
||||
trap '' 1 2 15
|
||||
AC_CACHE_SAVE
|
||||
|
||||
test "x$prefix" = xNONE && prefix=$ac_default_prefix
|
||||
# Let make expand exec_prefix.
|
||||
test "x$exec_prefix" = xNONE && exec_prefix='${prefix}'
|
||||
|
||||
trap 'rm -f $CONFIG_STATUS conftest*; exit 1' 1 2 15
|
||||
|
||||
: ${CONFIG_STATUS=./config.status}
|
||||
|
||||
dnl We're going to need [ ] for python syntax.
|
||||
changequote(<<<, >>>)dnl
|
||||
echo creating $CONFIG_STATUS
|
||||
|
||||
cat > $CONFIG_STATUS <<EOF
|
||||
#!${PYTHON}
|
||||
|
||||
import os, sys
|
||||
dnl topsrcdir is the top source directory in native form, as opposed to a
|
||||
dnl form suitable for make.
|
||||
topsrcdir = '''${WIN_TOP_SRC:-$srcdir}'''
|
||||
if not os.path.isabs(topsrcdir):
|
||||
topsrcdir = os.path.normpath(os.path.join(os.path.dirname(<<<__file__>>>), topsrcdir))
|
||||
dnl Don't rely on virtualenv here. Standalone js doesn't use it.
|
||||
sys.path.append(os.path.join(topsrcdir, 'build'))
|
||||
from ConfigStatus import config_status
|
||||
|
||||
args = {
|
||||
'topsrcdir': topsrcdir,
|
||||
'topobjdir': os.path.dirname(<<<__file__>>>),
|
||||
|
||||
dnl All defines and substs are stored with an additional space at the beginning
|
||||
dnl and at the end of the string, to avoid any problem with values starting or
|
||||
dnl ending with quotes.
|
||||
'defines': [(name[1:-1], value[1:-1]) for name, value in [
|
||||
EOF
|
||||
|
||||
dnl confdefs.pytmp contains AC_DEFINEs, in the expected format, but
|
||||
dnl lacks the final comma (see above).
|
||||
sed 's/$/,/' confdefs.pytmp >> $CONFIG_STATUS
|
||||
rm confdefs.pytmp confdefs.h
|
||||
|
||||
cat >> $CONFIG_STATUS <<\EOF
|
||||
] ],
|
||||
|
||||
'substs': [(name[1:-1], value[1:-1]) for name, value in [
|
||||
EOF
|
||||
|
||||
dnl The MOZ_DIVERSION_SUBST output diversion contains AC_SUBSTs, in the
|
||||
dnl expected format, but lacks the final comma (see above).
|
||||
sed 's/$/,/' >> $CONFIG_STATUS <<EOF
|
||||
undivert(MOZ_DIVERSION_SUBST)dnl
|
||||
EOF
|
||||
|
||||
cat >> $CONFIG_STATUS <<\EOF
|
||||
] ],
|
||||
|
||||
dnl List of files to apply AC_SUBSTs to. This is the list of files given
|
||||
dnl as an argument to AC_OUTPUT ($1)
|
||||
'files': [
|
||||
EOF
|
||||
|
||||
for out in $1; do
|
||||
echo " '$out'," >> $CONFIG_STATUS
|
||||
done
|
||||
|
||||
cat >> $CONFIG_STATUS <<\EOF
|
||||
],
|
||||
|
||||
dnl List of header files to apply AC_DEFINEs to. This is stored in the
|
||||
dnl AC_LIST_HEADER m4 macro by AC_CONFIG_HEADER.
|
||||
'headers': [
|
||||
EOF
|
||||
|
||||
ifdef(<<<AC_LIST_HEADER>>>, <<<
|
||||
HEADERS="AC_LIST_HEADER"
|
||||
for header in $HEADERS; do
|
||||
echo " '$header'," >> $CONFIG_STATUS
|
||||
done
|
||||
>>>)dnl
|
||||
|
||||
cat >> $CONFIG_STATUS <<\EOF
|
||||
],
|
||||
|
||||
dnl List of AC_DEFINEs that aren't to be exposed in ALLDEFINES
|
||||
'non_global_defines': [
|
||||
EOF
|
||||
|
||||
if test -n "$_NON_GLOBAL_ACDEFINES"; then
|
||||
for var in $_NON_GLOBAL_ACDEFINES; do
|
||||
echo " '$var'," >> $CONFIG_STATUS
|
||||
done
|
||||
fi
|
||||
|
||||
cat >> $CONFIG_STATUS <<\EOF
|
||||
]
|
||||
}
|
||||
|
||||
dnl Do the actual work
|
||||
config_status(**args)
|
||||
EOF
|
||||
changequote([, ])
|
||||
chmod +x $CONFIG_STATUS
|
||||
rm -fr confdefs* $ac_clean_files
|
||||
dnl Execute config.status, unless --no-create was passed to configure.
|
||||
test "$no_create" = yes || ${PYTHON} $CONFIG_STATUS || exit 1
|
||||
])
|
|
@ -0,0 +1,39 @@
|
|||
dnl This Source Code Form is subject to the terms of the Mozilla Public
|
||||
dnl License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
dnl file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||
|
||||
AC_DEFUN([MOZ_LINUX_PERF_EVENT],
|
||||
[
|
||||
|
||||
MOZ_ARG_WITH_STRING(linux-headers,
|
||||
[ --with-linux-headers=DIR
|
||||
location where the Linux kernel headers can be found],
|
||||
linux_headers=$withval)
|
||||
|
||||
LINUX_HEADERS_INCLUDES=
|
||||
|
||||
if test "$linux_headers"; then
|
||||
LINUX_HEADERS_INCLUDES="-I$linux_headers"
|
||||
fi
|
||||
|
||||
_SAVE_CFLAGS="$CFLAGS"
|
||||
CFLAGS="$CFLAGS $LINUX_HEADERS_INCLUDES"
|
||||
|
||||
dnl Performance measurement headers.
|
||||
MOZ_CHECK_HEADER(linux/perf_event.h,
|
||||
[AC_CACHE_CHECK(for perf_event_open system call,ac_cv_perf_event_open,
|
||||
[AC_TRY_COMPILE([#include <asm/unistd.h>],[return sizeof(__NR_perf_event_open);],
|
||||
ac_cv_perf_event_open=yes,
|
||||
ac_cv_perf_event_open=no)])])
|
||||
if test "$ac_cv_perf_event_open" = "yes"; then
|
||||
HAVE_LINUX_PERF_EVENT_H=1
|
||||
else
|
||||
HAVE_LINUX_PERF_EVENT_H=
|
||||
LINUX_HEADERS_INCLUDES=
|
||||
fi
|
||||
AC_SUBST(HAVE_LINUX_PERF_EVENT_H)
|
||||
AC_SUBST(LINUX_HEADERS_INCLUDES)
|
||||
|
||||
CFLAGS="$_SAVE_CFLAGS"
|
||||
|
||||
])
|
|
@ -1,444 +0,0 @@
|
|||
#!/usr/bin/env perl
|
||||
# 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/.
|
||||
|
||||
##----------------------------##
|
||||
##---] CORE/CPAN INCLUDES [---##
|
||||
##----------------------------##
|
||||
use strict;
|
||||
use warnings;
|
||||
use Getopt::Long;
|
||||
|
||||
use Benchmark;
|
||||
use Cwd;
|
||||
use File::Basename;
|
||||
use File::Copy;
|
||||
use File::Path qw{mkpath};
|
||||
|
||||
##-------------------##
|
||||
##---] EXPORTS [---##
|
||||
##-------------------##
|
||||
our $VERSION = qw(2.0);
|
||||
|
||||
##--------------------##
|
||||
##---] INCLUDES [---##
|
||||
##--------------------##
|
||||
|
||||
##############################################################
|
||||
# pymake: special case path handling for windows cmd shell.
|
||||
# if invoked by cmd.exe and msys-perl is in play
|
||||
# $0 may contain a drive letter
|
||||
# modules use-or-expect msys/unix paths
|
||||
# adjust $0 => C:/foo => /c/foo so string tests and
|
||||
# manipulation can by applied properly.
|
||||
##############################################################
|
||||
sub BEGIN
|
||||
{
|
||||
if ($^O eq 'msys' && $ENV{PATH} =~ m!\w:/!)
|
||||
{
|
||||
$0 =~ s!^(\w):!/$1!;
|
||||
}
|
||||
eval 'use FindBin';
|
||||
die $@ if ($@);
|
||||
}
|
||||
|
||||
use lib $FindBin::Bin;
|
||||
use makemakefile;
|
||||
|
||||
##-------------------##
|
||||
##---] GLOBALS [---##
|
||||
##-------------------##
|
||||
my %argv;
|
||||
|
||||
my $t0 = Benchmark->new();
|
||||
sub END
|
||||
{
|
||||
if ($argv{bench})
|
||||
{
|
||||
my $t1 = Benchmark->new();
|
||||
my $delta = timediff($t1, $t0);
|
||||
print STDERR timestr($delta), "\n";
|
||||
}
|
||||
}
|
||||
|
||||
##----------------##
|
||||
##---] MAIN [---##
|
||||
##----------------##
|
||||
umask 0;
|
||||
|
||||
my $debug = $argv{debug} || 0;
|
||||
|
||||
my $pwdcmd = ($^O eq 'msys') ? 'pwd -W' : 'pwd';
|
||||
|
||||
# Determine various tree path variables
|
||||
#
|
||||
my ($topsrcdir, $ptopsrcdir, $depth, @makefiles) = parse_arguments(@ARGV);
|
||||
|
||||
my $object_fullpath = `$pwdcmd`; # Cwd::getcwd()
|
||||
chdir $depth;
|
||||
my $object_root = `$pwdcmd`; # Cwd::getcwd()
|
||||
chomp $object_fullpath;
|
||||
chomp $object_root;
|
||||
|
||||
# $source_subdir is the path from the object root to where
|
||||
# 'make-makefile' was called. For example, if make-makefile was
|
||||
# called from "mozilla/gfx/src", then $source_subdir would be
|
||||
# "gfx/src/".
|
||||
my $source_subdir = "$object_fullpath/";
|
||||
my $quoted_object_root = quotemeta($object_root);
|
||||
$source_subdir =~ s|^$quoted_object_root/||;
|
||||
|
||||
# Prefix makefiles with $source_subdir so that paths
|
||||
# will be relative to the top of the object tree.
|
||||
#
|
||||
my $makefile;
|
||||
for $makefile (@makefiles) { # dead code ?
|
||||
$makefile = "$source_subdir$makefile";
|
||||
}
|
||||
|
||||
# Find the path to the source directory based on how 'make-makefile'
|
||||
# was invoked. The path is either relative to the object directory
|
||||
# or an absolute path.
|
||||
my $given_srcdir = find_srcdir($topsrcdir, $depth);
|
||||
my $pgiven_srcdir = find_srcdir($ptopsrcdir, $depth);
|
||||
|
||||
if ($debug) {
|
||||
warn "object_fullpath = $object_fullpath\n";
|
||||
warn "object_root = $object_root\n";
|
||||
warn "source_subdir = $source_subdir\n";
|
||||
warn "makefiles = @makefiles\n";
|
||||
warn "given_srcdir = $given_srcdir\n";
|
||||
}
|
||||
|
||||
my @errors;
|
||||
my @unhandled = update_makefiles_legacy($given_srcdir, $pgiven_srcdir, @makefiles);
|
||||
push(@errors, $@) if ($@);
|
||||
|
||||
run_config_status(@unhandled);
|
||||
push(@errors, $@) if ($@ && $argv{'no-warnings'});
|
||||
|
||||
exit scalar(@errors);
|
||||
|
||||
# end of Main
|
||||
############################################################
|
||||
|
||||
###########################################################################
|
||||
# find_depth: Pull the value of DEPTH out of a Makefile (or Makefile.in)
|
||||
###########################################################################
|
||||
sub find_depth {
|
||||
my $depth = '';
|
||||
open(MAKEFILE, "<$_[0]") || die "Unable to open $_[0]: $!\n";
|
||||
while (<MAKEFILE>) {
|
||||
next unless /^DEPTH\s*=\s*(\..*)/;
|
||||
$depth = $1;
|
||||
last;
|
||||
}
|
||||
close MAKEFILE;
|
||||
return $depth;
|
||||
}
|
||||
|
||||
###########################################################################
|
||||
## Intent: Parse command line arguments and assign values
|
||||
###########################################################################
|
||||
sub parse_arguments {
|
||||
my @args = @_;
|
||||
my @makefiles = ();
|
||||
|
||||
my @arglist = qw(badtokens! bench
|
||||
chdir=s
|
||||
debug
|
||||
depth|d=s
|
||||
enhanced
|
||||
obj=s top|t=s ptop|p=s
|
||||
src=s dst=s
|
||||
);
|
||||
unless(GetOptions(\%argv, @arglist))
|
||||
{
|
||||
my $script = join('/', $FindBin::RealBin, $FindBin::Script);
|
||||
system("perldoc $script </dev/null");
|
||||
exit
|
||||
}
|
||||
@args = @ARGV;
|
||||
|
||||
my $topsrcdir = $argv{top} || '';
|
||||
if (! $topsrcdir)
|
||||
{
|
||||
$topsrcdir = $argv{top} = getTopDir();
|
||||
}
|
||||
|
||||
my $ptopsrcdir ||= $argv{ptop} || $topsrcdir || '';
|
||||
|
||||
## Init --no- switch values
|
||||
foreach my $var (qw(badtokens exclusions warnings))
|
||||
{
|
||||
$argv{"no-${var}"} = $argv{$var} || 0;
|
||||
}
|
||||
# Propogate parsed arguments for module use [--debug, --verbose]
|
||||
while (my($k, $v) = each %argv)
|
||||
{
|
||||
$main::argv{$k} = $v;
|
||||
}
|
||||
|
||||
if ($argv{chdir})
|
||||
{
|
||||
chdir $argv{chdir} || die "chdir $argv{chdir} failed: $!";
|
||||
}
|
||||
|
||||
##############################################################
|
||||
## Arguments allowing make-makefile to be invoked from $topsrc
|
||||
##############################################################
|
||||
if (!$argv{top} || !$argv{obj})
|
||||
{
|
||||
}
|
||||
## Limit access to container makefiles for now
|
||||
elsif ($argv{enhanced})
|
||||
{
|
||||
my @errors;
|
||||
|
||||
## iterate over @ARGV to preserve original filename for 'unhandled'
|
||||
my @files = map{ getRelPath($_) } @ARGV;
|
||||
|
||||
my $top = getTopDir();
|
||||
my $obj = getObjDir();
|
||||
|
||||
mkdirr(map{ "$obj/$_" } @files);
|
||||
push(@errors, $@) if ($@); # legacy behavior: do not exit with status
|
||||
|
||||
my $exclude = join('/', $FindBin::RealBin, $FindBin::Script);
|
||||
$exclude .= '.excl'; # $argv{exclude}
|
||||
my %exclude = getExclusions($exclude);
|
||||
my @unhandled;
|
||||
foreach my $relpath (@files)
|
||||
{
|
||||
my $rel = join('/', $relpath, 'Makefile.in');
|
||||
my $mf = join('/', $top, $rel);
|
||||
next if ($exclude{$rel});
|
||||
print STDERR " ** relpath=[$relpath], mf=[$mf]\n" if ($main::argv{debug});
|
||||
|
||||
my $rc = updateMakefiles($relpath, {depth=>$depth, obj=>$obj, top=>$top});
|
||||
if ($@)
|
||||
{
|
||||
push(@errors, $@);
|
||||
}
|
||||
elsif ($rc eq 'badtokens')
|
||||
{
|
||||
push(@unhandled, $mf);
|
||||
}
|
||||
}
|
||||
|
||||
run_config_status(@unhandled);
|
||||
push(@errors, $@) if ($@ && $argv{'no-warnings'});
|
||||
exit scalar(@errors);
|
||||
}
|
||||
|
||||
|
||||
my $depth = $argv{depth} || '';
|
||||
if (! $depth)
|
||||
{
|
||||
foreach my $fyl (@args)
|
||||
{
|
||||
if (my $tmp = find_depth($fyl))
|
||||
{
|
||||
$depth = $tmp;
|
||||
last;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (! $depth) {
|
||||
# Use $(DEPTH) in the Makefile or Makefile.in to determine the depth
|
||||
if (-e "Makefile.in") {
|
||||
$depth = find_depth("Makefile.in");
|
||||
} elsif (-e "Makefile") {
|
||||
$depth = find_depth("Makefile");
|
||||
} elsif (-e "../Makefile") {
|
||||
$depth = "../".find_depth("../Makefile");
|
||||
$depth =~ s/\/\.$//;
|
||||
} else {
|
||||
warn "Unable to determine depth (e.g. ../..) to root of objdir tree.\n";
|
||||
die "No Makefile(.in) present. Try running with '-d <depth>'\n";
|
||||
}
|
||||
}
|
||||
|
||||
# Build the list of makefiles to generate
|
||||
#
|
||||
@makefiles = ();
|
||||
while (@args)
|
||||
{
|
||||
next unless my $makefile = shift @args;
|
||||
$makefile =~ s/\.in$//;
|
||||
$makefile =~ s/\/$//;
|
||||
$makefile =~ /Makefile$/
|
||||
or $makefile =~ /^\.\//
|
||||
or $makefile .= "/Makefile";
|
||||
push @makefiles, "$makefile";
|
||||
}
|
||||
@makefiles = "Makefile" unless @makefiles;
|
||||
|
||||
return ($topsrcdir, $ptopsrcdir, $depth, @makefiles);
|
||||
}
|
||||
|
||||
# Find the top of the source directory
|
||||
# (Assuming that the executable is in $top_srcdir/build/autoconf)
|
||||
sub find_srcdir {
|
||||
my ($ac_given_srcdir, $depth) = @_;
|
||||
|
||||
if ($debug) {
|
||||
print "ac_given_srcdir = $ac_given_srcdir\n";
|
||||
print "depth = $depth\n";
|
||||
}
|
||||
if ($ac_given_srcdir =~ /^\./ and $depth ne '.') {
|
||||
my $quoted_depth = quotemeta($depth);
|
||||
$ac_given_srcdir =~ s|^$quoted_depth/?||;
|
||||
}
|
||||
if ($debug) {
|
||||
print "ac_given_srcdir = $ac_given_srcdir\n";
|
||||
}
|
||||
$ac_given_srcdir = '.' if $ac_given_srcdir eq '';
|
||||
return $ac_given_srcdir;
|
||||
}
|
||||
|
||||
1;
|
||||
###########################################################################
|
||||
## perldoc
|
||||
###########################################################################
|
||||
__END__
|
||||
|
||||
=head1 NAME
|
||||
|
||||
make-makefile - Generate a Makefile from a F<Makefile.in> template
|
||||
|
||||
=head1 SYNOPSIS
|
||||
|
||||
make-makefile [--top t] [--obj o] [--depth d] foo/bar/Makefile.in tans/fans/Makefile foo/bar
|
||||
|
||||
=head1 DESCRIPTION
|
||||
|
||||
Given options and makefile path arguments determine path to the template
|
||||
F<Makefile.in> beneath a source directory and path to generated F<Makefile>
|
||||
beneath $MOZ_OBJDIR. DEPTH from destination directory to the 'root' will
|
||||
also be determined. F<Makefile.in> will be read in, template strings of the
|
||||
gorm @token@ will be replaced with derived values and a generated makefile
|
||||
will be written out as F<Makefile>.
|
||||
|
||||
Makefile DEPTH= can be determined in a few different ways:
|
||||
o The string C<DEPTH=../../..> may be embedded within F<Makefile.in>.
|
||||
o Search parent directories for F<Makefile.in> and use it to assign the child.
|
||||
|
||||
|
||||
=head2 Option List
|
||||
|
||||
=over 4
|
||||
|
||||
=item --chdir
|
||||
|
||||
Move to this directory before doing anything else
|
||||
|
||||
=item -d, --depth
|
||||
|
||||
Explicitly specify the relative path from directory containing Makefile.in
|
||||
to the top sandbox directory. memory/makefile, DEPTH=../.., js/src/config, DEPTH=..
|
||||
|
||||
=item --enhanced
|
||||
|
||||
Use alternate/simplified path construction when options --top and --obj are
|
||||
passed. This feature will be used by container makefiles to support makefile
|
||||
generation while cd'd into the sandbox top directory.
|
||||
|
||||
=item -t, --top
|
||||
|
||||
Path the root of a development sandbox.
|
||||
|
||||
=item --obj
|
||||
|
||||
Path to object directory where generated makefile will be written ($MOZ_OBJDIR).
|
||||
|
||||
=item --ptop
|
||||
|
||||
Print top source dir
|
||||
|
||||
=back
|
||||
|
||||
|
||||
=head2 Options List DEBUG
|
||||
|
||||
=over 4
|
||||
|
||||
=item --bench
|
||||
|
||||
Enable script benchmarking, report elapsed runtime.
|
||||
|
||||
=item --debug
|
||||
|
||||
Enable script debug mode.
|
||||
|
||||
=back
|
||||
|
||||
|
||||
=head2 Options List --NO-
|
||||
|
||||
=over 4
|
||||
|
||||
=item --no-badtokens (wip)
|
||||
|
||||
Handle unexpanded @token@ makefile tokens as an error condition.
|
||||
Do not rely on system(config.status) to externally supply values.
|
||||
|
||||
=item --no-excludes
|
||||
|
||||
Ignore file entries on the exclusion list, generate everything.
|
||||
|
||||
=item --no-warnings
|
||||
|
||||
Warnings are handled as an error condition.
|
||||
|
||||
=back
|
||||
|
||||
|
||||
=head2 Examples
|
||||
|
||||
=over 4
|
||||
|
||||
=item * make-makefile -t /mozilla/nightly -d . memory/mozalloc
|
||||
|
||||
cd $MOZ_OBJDIR;
|
||||
--top and --depth are explicitly set for generting memory/mozalloc/Makefile.
|
||||
|
||||
=item * make-makefile -t /mozilla/nightly -d ../../../.. html5lib_tree_construction/Makefile
|
||||
|
||||
cd $MOZ_OBJDIR/parser/htmlparser/tests/mochitest
|
||||
|
||||
--top and --depth are explicitly set for generting a makefile from within
|
||||
a subdirectory of $MOZ_OBJDIR
|
||||
|
||||
=item * make-makefile --top /mozilla/nightly --obj /mozilla/nightly/obj memory/mozalloc
|
||||
|
||||
With --top and --obj explicitly set generate $MOZ_OBJDIR/memory/mozalloc/Makefile
|
||||
while sitting in the sandbox root.
|
||||
|
||||
=back
|
||||
|
||||
|
||||
=head2 Work In Progress
|
||||
|
||||
=over 4
|
||||
|
||||
=item --no-badtokens
|
||||
|
||||
Fail on unexpanded @foo@ makefile tokens. Any tokens that can be expanded
|
||||
directly by make-makefile will avoid config.status shell overhead.
|
||||
|
||||
=item Depth from delta(--obj, --top)
|
||||
|
||||
If DEPTH= has not been embedded within a makefile the value could
|
||||
be set directly if --top and --obj are specified and the paths overlap.
|
||||
|
||||
=back
|
||||
|
||||
|
||||
=head1 SEE ALSO
|
||||
|
||||
L<config/rules.mk>
|
||||
|
||||
=cut
|
|
@ -1,9 +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/.
|
||||
|
||||
###########################################################################
|
||||
## Intent: Exclusion list for container make builds
|
||||
###########################################################################
|
||||
|
||||
# EOF
|
|
@ -1,711 +0,0 @@
|
|||
package makemakefile;
|
||||
|
||||
# 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/.
|
||||
|
||||
##----------------------------##
|
||||
##---] CORE/CPAN INCLUDES [---##
|
||||
##----------------------------##
|
||||
use strict;
|
||||
use warnings;
|
||||
# use feature 'state'; 5.10+ not available everywhere
|
||||
|
||||
##-------------------##
|
||||
##---] EXPORTS [---##
|
||||
##-------------------##
|
||||
our $VERSION = qw(2.0);
|
||||
use Exporter;
|
||||
our @ISA = qw(Exporter);
|
||||
our @EXPORT = qw(dirname_legacy
|
||||
getConfig getDepth getRelPath getObjDir getTopDir mkdirr
|
||||
getExclusions
|
||||
run_config_status
|
||||
updateMakefiles
|
||||
update_makefiles_legacy
|
||||
);
|
||||
|
||||
##--------------------##
|
||||
##---] INCLUDES [---##
|
||||
##--------------------##
|
||||
use Cwd;
|
||||
use Cwd qw{abs_path};
|
||||
use FindBin;
|
||||
use File::Basename;
|
||||
use File::Copy;
|
||||
|
||||
##-------------------##
|
||||
##---] GLOBALS [---##
|
||||
##-------------------##
|
||||
umask 0;
|
||||
my $cwd = Cwd::abs_path('.');
|
||||
my %argv;
|
||||
|
||||
|
||||
###########################################################################
|
||||
## Intent: Helper function, retrieve contents of a file with error checking
|
||||
## -----------------------------------------------------------------------
|
||||
## Args:
|
||||
## scalar path to input file
|
||||
## Returns:
|
||||
## array contents of the given file
|
||||
## $@ set on error
|
||||
###########################################################################
|
||||
sub cat
|
||||
{
|
||||
my $fyl = shift || '';
|
||||
$@ = '';
|
||||
my @data;
|
||||
|
||||
local *FYL;
|
||||
if (!open(FYL, $fyl))
|
||||
{
|
||||
$@ = "open($fyl) failed: $!";
|
||||
}
|
||||
else
|
||||
{
|
||||
@data = <FYL>;
|
||||
close(FYL);
|
||||
}
|
||||
return @data;
|
||||
} # cat
|
||||
|
||||
###########################################################################
|
||||
## Intent: Return directory path for a given argument
|
||||
## -----------------------------------------------------------------------
|
||||
## -----------------------------------------------------------------------
|
||||
## Todo:
|
||||
## o Check if function can be replaced by File::Basename::dirname()
|
||||
###########################################################################
|
||||
sub dirname_legacy
|
||||
{
|
||||
my $str = (@_ && defined($_[0])) ? shift : '';
|
||||
return $str =~ /(.*)\/.*/ ? "$1" : '.';
|
||||
}
|
||||
|
||||
###########################################################################
|
||||
## Intent: Given a list of makefile paths recursively create all
|
||||
## directories between file and the root
|
||||
## -----------------------------------------------------------------------
|
||||
## Args:
|
||||
## array A list of makefiles
|
||||
## fargs Function arguments
|
||||
## mode Filesystem mode used for directory creation
|
||||
## Returns:
|
||||
## $@ Set on error
|
||||
## 0 on success
|
||||
## -----------------------------------------------------------------------
|
||||
## Note:
|
||||
## Reporting directory creation can be enabled by the --verbose
|
||||
## command line argument.
|
||||
###########################################################################
|
||||
sub mkdirr
|
||||
{
|
||||
my %fargs = (@_ && ref($_[$#_])) ? %{ (pop) } : ();
|
||||
my $mode = $fargs{mode} || 0755;
|
||||
my $verbose = $main::argv{verbose} || 0;
|
||||
$@ = '' unless ($fargs{recursive});
|
||||
$fargs{recursive} = 1;
|
||||
|
||||
my @errors;
|
||||
push(@errors, $@) if ($@);
|
||||
foreach my $path (@_)
|
||||
{
|
||||
(my $dir = $path) =~ s%/?Makefile[^/]*$%%o;
|
||||
next unless (length($dir));
|
||||
next if (-e $dir);
|
||||
mkdirr( dirname($dir), \%fargs);
|
||||
eval{ File::Path::mkpath($dir, $verbose, 0755); };
|
||||
push(@errors, $@) if ($@);
|
||||
}
|
||||
$@ = join("\n", @errors);
|
||||
return $@ ? 0 : 1;
|
||||
} # mkdirr
|
||||
|
||||
###########################################################################
|
||||
## Intent: Read in configure values and return a hash of key/value pairs
|
||||
## -----------------------------------------------------------------------
|
||||
## Args:
|
||||
## fargs Function arguments
|
||||
## reset clear value storage and repopulate
|
||||
## Returns:
|
||||
## hash configure data to use for makefile substitutions
|
||||
## -----------------------------------------------------------------------
|
||||
## Todo: wrapper for reading config* and run_config_status
|
||||
###########################################################################
|
||||
my %_CONFIG_; # todo: state %config; w/5.10
|
||||
sub getConfig
|
||||
{
|
||||
my %fargs = (@_ && ref($_[$#_]) eq 'HASH') ? %{ (pop) } : ();
|
||||
if ($fargs{reset})
|
||||
{
|
||||
%_CONFIG_ = ();
|
||||
shift;
|
||||
}
|
||||
|
||||
#my $ac_file_in = "$ac_given_srcdir/${ac_file}.in";
|
||||
#my $ac_dir = dirname_legacy($ac_file);
|
||||
#my $ac_dots = '';
|
||||
#my $ac_dir_suffix = '';
|
||||
#my $srcdir = '.';
|
||||
#my $top_srcdir = '.';
|
||||
unless (%_CONFIG_)
|
||||
{
|
||||
while (@_)
|
||||
{
|
||||
my ($k, $v) = splice(@_, 0, 2);
|
||||
$_CONFIG_{$k} = $v;
|
||||
}
|
||||
}
|
||||
|
||||
return %_CONFIG_;
|
||||
} # getConfig
|
||||
|
||||
###########################################################################
|
||||
## Intent: Determine path depth between leaf and root directory.
|
||||
## o DEPTH= may be set by makefile content
|
||||
## o DEPTH= may be set by Makefile in a parent
|
||||
## o Manually determine by relpath form leaf to sandbox top
|
||||
## -----------------------------------------------------------------------
|
||||
## Args:
|
||||
## scalar Path to makefile or directory to determine DEPTH for
|
||||
## Returns:
|
||||
## scalar Relative path from leaf to root directory
|
||||
## -----------------------------------------------------------------------
|
||||
###########################################################################
|
||||
sub getDepth($)
|
||||
{
|
||||
my $fyl = shift || '';
|
||||
|
||||
my @path = split(m%/%o, $fyl);
|
||||
pop(@path) if ('Makefile' eq substr($path[$#path], 0, 8));
|
||||
my $depth;
|
||||
my @depth;
|
||||
|
||||
my $top = getTopDir();
|
||||
my @top = split(m%/%o, $top);
|
||||
my @pathNoTop = @path;
|
||||
splice(@pathNoTop, 0, scalar(@top));
|
||||
|
||||
SEARCH:
|
||||
while (@path)
|
||||
{
|
||||
## Search for a file containing DEPTH=../..
|
||||
foreach my $fyl ( qw{Makefile.in Makefile} )
|
||||
{
|
||||
my $path = join('/', @path, $fyl);
|
||||
local *FYL;
|
||||
if (!open(FYL, $path)) {} # NOP
|
||||
elsif (my @tmp = map{ /^\s*DEPTH\s*=\s*([\.\/]+)/o ? $1 : () } <FYL>)
|
||||
{
|
||||
$depth = join('/', @depth, shift @tmp);
|
||||
last SEARCH;
|
||||
}
|
||||
close(FYL);
|
||||
}
|
||||
pop @path;
|
||||
pop @pathNoTop;
|
||||
|
||||
if (0 == scalar(@pathNoTop))
|
||||
{
|
||||
$depth = join('/', @depth);
|
||||
last;
|
||||
}
|
||||
|
||||
## Construct path manually
|
||||
push(@depth, '..');
|
||||
}
|
||||
return $depth;
|
||||
} # getDepth
|
||||
|
||||
###########################################################################
|
||||
## Intent: Read in the exclusion file
|
||||
###########################################################################
|
||||
sub getExclusions
|
||||
{
|
||||
my $file = shift || '';
|
||||
|
||||
return () if ($main::argv{'no-exclusions'});
|
||||
|
||||
my %exclude;
|
||||
if ($file)
|
||||
{
|
||||
my @data = cat($file);
|
||||
foreach (@data)
|
||||
{
|
||||
next unless ($_);
|
||||
next if (/^\s*\#/o);
|
||||
next unless (m%/%);
|
||||
chomp;
|
||||
$exclude{$_}++;
|
||||
}
|
||||
}
|
||||
return %exclude;
|
||||
} # getExclusions
|
||||
|
||||
###########################################################################
|
||||
## Intent: Given the path to a makefile beneath either src or obj
|
||||
## derive the relative path prefix between makefile and root.
|
||||
###########################################################################
|
||||
sub getRelPath
|
||||
{
|
||||
my $path0 = shift;
|
||||
my $abspath;
|
||||
|
||||
# Determine type and orientation
|
||||
my $name = basename($path0);
|
||||
my $haveMF = ($name eq 'Makefile.in') ? 1
|
||||
: ($name eq 'Makefile') ? -1
|
||||
: 0
|
||||
;
|
||||
|
||||
####################################################
|
||||
## Prep work: form a relative path with ../ removed
|
||||
####################################################
|
||||
my $top = getTopDir();
|
||||
my $obj = getObjDir();
|
||||
## If the same Makefile will be created alongside Makefile.in
|
||||
my $topQM = quotemeta($top);
|
||||
my $objQM = quotemeta($obj);
|
||||
|
||||
if ('..' eq substr($path0, 0, 2))
|
||||
{
|
||||
my @cwd = split(m%/%, $cwd);
|
||||
my @pth = split(m%/%, $path0);
|
||||
while (@pth && $pth[0] eq '..')
|
||||
{
|
||||
pop(@cwd);
|
||||
shift @pth;
|
||||
}
|
||||
$path0 = join('/', @cwd, @pth);
|
||||
$abspath = $path0;
|
||||
}
|
||||
|
||||
if ('/' eq substr($path0, 0, 1))
|
||||
{
|
||||
$path0 =~ s%^$objQM\/?%%;
|
||||
$path0 =~ s%^$topQM\/?%%;
|
||||
}
|
||||
|
||||
#######################################################################
|
||||
## Build a list of directories to search. Input source will be one
|
||||
## of path to Makefile.in, path to Makefile, directory, file within
|
||||
## a directory or relative path from cwd.
|
||||
#######################################################################
|
||||
my @subdirs;
|
||||
my $path = (0 == $haveMF) ? $path0 : dirname($path0);
|
||||
push(@subdirs, $path); # containing directory
|
||||
push(@subdirs, dirname($path)) if (0 == $haveMF && -f $path); # Arg is file within a directory
|
||||
push(@subdirs, $cwd); # relative to pwd
|
||||
|
||||
# obj - path to generated makefile
|
||||
# top - path to Makefile.in source template
|
||||
my @prefixes = ('/' ne substr($path0, 0, 1))
|
||||
? (&getTopDir, &getObjDir)
|
||||
: ()
|
||||
;
|
||||
|
||||
ON_SAFARI:
|
||||
for my $prefix (@prefixes)
|
||||
{
|
||||
next unless ($prefix); # no command line not passed
|
||||
foreach my $subdir (@subdirs)
|
||||
{
|
||||
foreach my $mf ('Makefile.in', 'Makefile')
|
||||
{
|
||||
my $path = join('/', $prefix, $subdir, $mf);
|
||||
if (-e $path)
|
||||
{
|
||||
$name = $mf;
|
||||
$haveMF = ($mf eq 'Makefile.in') ? 1 : -1;
|
||||
$abspath = $path;
|
||||
last ON_SAFARI;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#######################################################################
|
||||
## Generated makefile does not yet exist or path is invalid.
|
||||
## Should this conditon be handled to detect non-existent Makefile.in:
|
||||
## Makefile.am => Makefile.in => Makefile but Makefile.in
|
||||
#######################################################################
|
||||
if (!$abspath && -1 == $haveMF && $obj)
|
||||
{
|
||||
$abspath = ('/' eq substr($path0, 0, 1))
|
||||
? $path0
|
||||
: join('/', $obj, $path0)
|
||||
;
|
||||
}
|
||||
|
||||
########################################################
|
||||
## If --top and/or --obj specified extract relative path
|
||||
########################################################
|
||||
my $relpath;
|
||||
if (! $abspath)
|
||||
{
|
||||
# Error, fall through
|
||||
}
|
||||
elsif (1 == $haveMF) # Makefile.in
|
||||
{
|
||||
## err w/o --top
|
||||
(my $tmp = $abspath) =~ s%^$topQM/?%%;
|
||||
$relpath = dirname($tmp) unless ($tmp eq $abspath);
|
||||
}
|
||||
elsif (-1 == $haveMF) # Makefile
|
||||
{
|
||||
## err w/o --obj
|
||||
(my $tmp = $abspath) =~ s%^$objQM/?%%;
|
||||
$relpath = dirname($tmp) unless ($tmp eq $abspath);
|
||||
}
|
||||
|
||||
$relpath ||= '';
|
||||
$relpath =~ s%/./%/%og; # filter ./
|
||||
|
||||
$@ = ($relpath) ? '' : "ERROR($path0): Unable to locate sources";
|
||||
return $relpath || '';
|
||||
} # getRelPath
|
||||
|
||||
###########################################################################
|
||||
## Intent: Determine sandbox root from script startup directory
|
||||
## -----------------------------------------------------------------------
|
||||
## Args:
|
||||
## _set_ optional, if passed use the given value as path
|
||||
## _reset_ clear cached directory path to reassign
|
||||
## Returns:
|
||||
## scalar - absolute path to the sandbox root directory
|
||||
## -----------------------------------------------------------------------
|
||||
###########################################################################
|
||||
my $gtd_dir;
|
||||
sub getTopDir
|
||||
{
|
||||
if (@_) # testing override
|
||||
{
|
||||
$gtd_dir = abs_path($_[1] || '.') if ($_[0] eq '_set_');
|
||||
$gtd_dir = '' if ($_[0] eq '_reset_');
|
||||
}
|
||||
|
||||
unless ($gtd_dir)
|
||||
{
|
||||
## Set by command line
|
||||
if ($main::argv{top})
|
||||
{
|
||||
$gtd_dir = $main::argv{top};
|
||||
}
|
||||
else
|
||||
{
|
||||
my $path = abs_path($FindBin::RealBin);
|
||||
my @path = split(m%/%o, $path);
|
||||
## --2 memory/mozalloc/Makefile.in
|
||||
## --3 was this for FindBin::Script ?
|
||||
splice(@path, -2);
|
||||
$gtd_dir = join('/', @path);
|
||||
}
|
||||
}
|
||||
return $gtd_dir;
|
||||
} # getTopDir
|
||||
|
||||
###########################################################################
|
||||
## Intent: Determine path to MOZ_OBJDIR/object directory
|
||||
## -----------------------------------------------------------------------
|
||||
## Args:
|
||||
## _set_ optional testing arg, if passed re-compute cached value
|
||||
## Returns:
|
||||
## scalar - absolute path to the sandbox object directory
|
||||
## -----------------------------------------------------------------------
|
||||
###########################################################################
|
||||
my $god_dir;
|
||||
sub getObjDir
|
||||
{
|
||||
if (@_) # testing override
|
||||
{
|
||||
if ($_[0] eq '_reset_')
|
||||
{
|
||||
$god_dir = '';
|
||||
shift;
|
||||
}
|
||||
elsif ($_[0] eq '_set_')
|
||||
{
|
||||
shift;
|
||||
my $path = $_[0] || '.';
|
||||
$god_dir = abs_path($path);
|
||||
shift;
|
||||
}
|
||||
}
|
||||
|
||||
## extract $obj from given path
|
||||
unless ($god_dir)
|
||||
{
|
||||
if ($main::argv{obj})
|
||||
{
|
||||
$god_dir = $main::argv{obj};
|
||||
}
|
||||
elsif (@_ && 'Makefile' eq substr($_, -8))
|
||||
{
|
||||
$god_dir = abs_path(shift);
|
||||
}
|
||||
else # assume we are sitting in moz_objdir
|
||||
{
|
||||
$god_dir = abs_path('.');
|
||||
}
|
||||
}
|
||||
|
||||
return $god_dir;
|
||||
} # getObjDir
|
||||
|
||||
###########################################################################
|
||||
## Intent: Generate Makefile from a given Makefile.in template
|
||||
## -----------------------------------------------------------------------
|
||||
## Args:
|
||||
## scalar Relative path to a directory containing a makefile
|
||||
## fargs Hash ref of function arguments.
|
||||
## obj Absolute path to MOZ_OBJ/a destination directory
|
||||
## top Absolute path to the sandbox root
|
||||
## Returns:
|
||||
## $@ Set on error
|
||||
## scalar
|
||||
## 1 True if the makefile was updated
|
||||
## 0 Otherwise
|
||||
## badtokens - If the makefile contains unexpandable @token@ strings
|
||||
## -----------------------------------------------------------------------
|
||||
###########################################################################
|
||||
sub updateMakefiles
|
||||
{
|
||||
my %fargs = (@_ && ref($_[$#_])) ? %{ (pop) } : ();
|
||||
local $_;
|
||||
$@ = '';
|
||||
|
||||
my $top = $fargs{top};
|
||||
my $obj = $fargs{obj};
|
||||
|
||||
my $relpath = shift || '';
|
||||
my $src = join('/', $top, $relpath, 'Makefile.in');
|
||||
my $depth = getDepth($src);
|
||||
|
||||
my @src = cat($src);
|
||||
return 0 if ($@);
|
||||
|
||||
my $dst = join('/', $obj, $relpath, 'Makefile');
|
||||
my @dst = cat($dst);
|
||||
$@ = '';
|
||||
|
||||
my $dstD = dirname($dst);
|
||||
mkdirr($dstD);
|
||||
return 0 if ($@);
|
||||
|
||||
my %data =
|
||||
( getConfig(),
|
||||
depth => $depth,
|
||||
srcdir => join('/', $top, $relpath),
|
||||
top_srcdir => $top,
|
||||
);
|
||||
|
||||
my $line = 0;
|
||||
my @data;
|
||||
while (scalar @src)
|
||||
{
|
||||
$line++;
|
||||
$_ = shift(@src);
|
||||
|
||||
## Expand embedded @foo@
|
||||
while (/\@[^\@\s\$]+\@/go)
|
||||
{
|
||||
my $end = pos($_);
|
||||
my $val = $&;
|
||||
my $len = length($val);
|
||||
$val =~ s/^\@\s*//o;
|
||||
$val =~ s/\s*\@$//o;
|
||||
|
||||
## Identify expansions to see if we can avoid shell overhead
|
||||
if (!defined $data{$val} && !$argv{'no-badtokens'})
|
||||
{
|
||||
if (1) # warnings
|
||||
{
|
||||
print STDERR "WARNING: token $val not defined\n";
|
||||
print STDERR " line $line, src: $src\n";
|
||||
}
|
||||
return 'badtokens';
|
||||
}
|
||||
|
||||
# Insert $(error txt) makefile macros for invalid tokens
|
||||
my $val1 = defined($data{$val})
|
||||
? $data{$val}
|
||||
: "\$(error $FindBin::Script: variable ${val} is undefined)"
|
||||
;
|
||||
substr($_, ($end-$len), $len, $val1);
|
||||
}
|
||||
push(@data, $_);
|
||||
}
|
||||
|
||||
if (("@data" eq "@dst") && scalar(@data))
|
||||
{
|
||||
print "Skipping up2date makefile: $dst\n" if ($argv{verbose});
|
||||
}
|
||||
else
|
||||
{
|
||||
my $action = (scalar @dst) ? 'Updating' : 'Creating';
|
||||
print "$action makefile: $dst\n";
|
||||
|
||||
my $tmp = join('.', $dst, "tmp_$$");
|
||||
if (!open(FYL, "> $tmp"))
|
||||
{
|
||||
$@ = "open($tmp) failed: $!";
|
||||
}
|
||||
else
|
||||
{
|
||||
print FYL @data;
|
||||
close(FYL);
|
||||
|
||||
## Install the new makefile
|
||||
File::Copy::move($tmp, $dst)
|
||||
|| ($@ = "move($tmp, $dst) failed: $!");
|
||||
}
|
||||
}
|
||||
|
||||
return $@ ? 0 : 1;
|
||||
} # updateMakefiles
|
||||
|
||||
# Output the makefiles.
|
||||
#
|
||||
sub update_makefiles_legacy {
|
||||
my ($ac_given_srcdir, $pac_given_srcdir, @makefiles) = @_;
|
||||
my $debug = $main::argv{debug} || 0;
|
||||
my $pwdcmd = ($^O eq 'msys') ? 'pwd -W' : 'pwd';
|
||||
my @unhandled=();
|
||||
|
||||
my @warn;
|
||||
|
||||
my $ac_file;
|
||||
foreach $ac_file (@makefiles) {
|
||||
my $ac_file_in = "$ac_given_srcdir/${ac_file}.in";
|
||||
my $ac_dir = dirname_legacy($ac_file);
|
||||
my $ac_dots = '';
|
||||
my $ac_dir_suffix = '';
|
||||
my $srcdir = '.';
|
||||
my $top_srcdir = '.';
|
||||
|
||||
# Determine $srcdir and $top_srcdir
|
||||
#
|
||||
if ($ac_dir ne '.') {
|
||||
$ac_dir_suffix = "/$ac_dir";
|
||||
$ac_dir_suffix =~ s%^/\./%/%;
|
||||
$ac_dots = $ac_dir_suffix;
|
||||
# Remove .. components from the provided dir suffix, and
|
||||
# also the forward path components they were reversing.
|
||||
my $backtracks = $ac_dots =~ s%\.\.(/|$)%%g;
|
||||
while ($backtracks--) {
|
||||
$ac_dots =~ s%/[^/]*%%;
|
||||
}
|
||||
$ac_dots =~ s%/[^/]*%../%g;
|
||||
}
|
||||
if ($ac_given_srcdir eq '.') {
|
||||
if ($ac_dots ne '') {
|
||||
$top_srcdir = $ac_dots;
|
||||
$top_srcdir =~ s%/$%%;
|
||||
}
|
||||
} elsif ($pac_given_srcdir =~ m%^/% or $pac_given_srcdir =~ m%^.:/%) {
|
||||
$srcdir = "$pac_given_srcdir$ac_dir_suffix";
|
||||
$top_srcdir = "$pac_given_srcdir";
|
||||
} else {
|
||||
if ($debug) {
|
||||
print "ac_dots = $ac_dots\n";
|
||||
print "ac_dir_suffix = $ac_dir_suffix\n";
|
||||
}
|
||||
$srcdir = "$ac_dots$ac_given_srcdir$ac_dir_suffix";
|
||||
$top_srcdir = "$ac_dots$ac_given_srcdir";
|
||||
}
|
||||
|
||||
if ($debug) {
|
||||
print "ac_dir = $ac_dir\n";
|
||||
print "ac_file = $ac_file\n";
|
||||
print "ac_file_in = $ac_file_in\n";
|
||||
print "srcdir = $srcdir\n";
|
||||
print "top_srcdir = $top_srcdir\n";
|
||||
print "cwd = " . `$pwdcmd` . "\n";
|
||||
}
|
||||
|
||||
# Copy the file and make substitutions.
|
||||
# @srcdir@ -> value of $srcdir
|
||||
# @top_srcdir@ -> value of $top_srcdir
|
||||
#
|
||||
if (-e $ac_file) {
|
||||
next if -M _ < -M $ac_file_in; # Next if Makefile is up-to-date.
|
||||
warn "updating $ac_file\n";
|
||||
} else {
|
||||
warn "creating $ac_file\n";
|
||||
}
|
||||
|
||||
mkdirr(dirname($ac_file));
|
||||
|
||||
open INFILE, "<$ac_file_in" or do {
|
||||
warn "$0: Cannot read $ac_file_in: No such file or directory\n";
|
||||
next;
|
||||
};
|
||||
open OUTFILE, ">$ac_file" or do {
|
||||
warn "$0: Unable to create $ac_file\n";
|
||||
next;
|
||||
};
|
||||
|
||||
while (<INFILE>) {
|
||||
s/\@srcdir\@/$srcdir/g;
|
||||
s/\@top_srcdir\@/$top_srcdir/g;
|
||||
|
||||
if (/\@[_a-zA-Z]*\@/) {
|
||||
#warn "Unknown variable:$ac_file:$.:$_";
|
||||
push @unhandled, $ac_file;
|
||||
last;
|
||||
}
|
||||
print OUTFILE;
|
||||
}
|
||||
close INFILE;
|
||||
close OUTFILE;
|
||||
}
|
||||
return @unhandled;
|
||||
} # update_makefiles_legacy
|
||||
|
||||
###########################################################################
|
||||
## Intent: Invoke config.status for unknown makefiles to create
|
||||
## directory hierarchy for the tree.
|
||||
## -----------------------------------------------------------------------
|
||||
## Args:
|
||||
## array an optional list of makefiles to process
|
||||
## Returns:
|
||||
## 0 on success
|
||||
## $# set on error
|
||||
## -----------------------------------------------------------------------
|
||||
## Note: Is this function needed anymore ? Undefined tokens should fail
|
||||
## at time of expansion rather than having to source config.status.
|
||||
## Also config.status could be parsed to define values and avoide the
|
||||
## shell overhead altogether.
|
||||
###########################################################################
|
||||
sub run_config_status {
|
||||
my @unhandled = @_;
|
||||
|
||||
# Run config.status with any unhandled files.
|
||||
#
|
||||
my @errors;
|
||||
if (@unhandled) {
|
||||
local $ENV{CONFIG_FILES}= join ' ', @unhandled;
|
||||
|
||||
my $conf = 'config.status';
|
||||
if (! -e $conf) # legacy behavior, warn rather than err
|
||||
{
|
||||
my $cwd = cwd();
|
||||
my $err = "$FindBin::Script ERROR: Config file $conf does not exist, cwd=$cwd";
|
||||
push(@errors, $err);
|
||||
}
|
||||
elsif (0 != system("./config.status"))
|
||||
{
|
||||
my $cwd = cwd();
|
||||
push(@errors, "config.status failed \$?=$?, \$!=$!, cwd: $cwd");
|
||||
}
|
||||
}
|
||||
$@ = join("\n", @errors);
|
||||
|
||||
## Legacy behavior: config.status problems are not fatal {yet}.
|
||||
## Display warning since caller will not be calling die.
|
||||
warn $@ if ($@ && $argv{'no-warnings'});
|
||||
return $@ ? 1 : 0;
|
||||
}
|
||||
|
||||
1;
|
|
@ -1,62 +0,0 @@
|
|||
# -*- makefile -*-
|
||||
#
|
||||
# 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/.
|
||||
|
||||
DEPTH = ../../..
|
||||
topsrcdir = @top_srcdir@
|
||||
srcdir = @srcdir@
|
||||
VPATH = @srcdir@
|
||||
|
||||
include $(DEPTH)/config/autoconf.mk
|
||||
include $(topsrcdir)/config/rules.mk
|
||||
|
||||
##################################################
|
||||
## Gather a list of tests, generate timestamp deps
|
||||
##################################################
|
||||
TS=.ts
|
||||
ifneq (,$(findstring check,$(MAKECMDGOALS)))
|
||||
allsrc = $(wildcard $(srcdir)/*)
|
||||
tests2run = $(notdir $(filter %.tpl,$(allsrc)))
|
||||
tests2run += $(notdir $(filter %.tpm,$(allsrc)))
|
||||
check_targets += $(addprefix $(TS)/,$(tests2run))
|
||||
endif
|
||||
|
||||
all_nop: # export, libs and tools are not needed
|
||||
|
||||
check:: $(TS) $(check_targets)
|
||||
|
||||
#############################################
|
||||
# Only invoke tests when sources have changed
|
||||
#############################################
|
||||
$(TS)/%: $(srcdir)/%
|
||||
$(PERL) $(srcdir)/runtest $<
|
||||
@touch $@
|
||||
|
||||
parent = $(patsubst %/,%,$(dir $(srcdir)))
|
||||
$(TS)/make-makefile.tpl: \
|
||||
$(srcdir)/make-makefile.tpl\
|
||||
$(parent)/makemakefile.pm\
|
||||
$(NULL)
|
||||
$(PERL) $(srcdir)/runtest $<
|
||||
@touch $@
|
||||
|
||||
$(TS)/makemakefile.tpm: \
|
||||
$(srcdir)/makemakefile.tpm \
|
||||
$(parent)/makemakefile.pm \
|
||||
$(NULL)
|
||||
$(PERL) $(srcdir)/runtest $<
|
||||
@touch $@
|
||||
|
||||
#####################################################
|
||||
## Extra dep needed to synchronize parallel execution
|
||||
#####################################################
|
||||
$(TS): $(TS)/.done
|
||||
$(TS)/.done:
|
||||
$(MKDIR) -p $(dir $@)
|
||||
touch $@
|
||||
|
||||
GARBAGE_DIRS += $(TS)
|
||||
|
||||
# EOF
|
|
@ -1,4 +0,0 @@
|
|||
jsautocfg.h: jscpucfg$(HOST_BIN_SUFFIX)
|
||||
@$(RM) $@ jsautocfg.tmp
|
||||
./jscpucfg > jsautocfg.tmp
|
||||
mv jsautocfg.tmp $@
|
|
@ -1,4 +0,0 @@
|
|||
jsautocfg.h: jscpucfg$(HOST_BIN_SUFFIX)
|
||||
@$(RM) $@ jsautocfg.tmp
|
||||
./jscpucfg > jsautocfg.tmp
|
||||
mv jsautocfg.tmp $@
|
|
@ -1,8 +0,0 @@
|
|||
###########################################################################
|
||||
## Intent: Exclusion list for container make builds
|
||||
###########################################################################
|
||||
|
||||
/dev/null
|
||||
/foo/bar
|
||||
/a/b/c
|
||||
/a/b/d
|
|
@ -1,436 +0,0 @@
|
|||
#!/usr/bin/env perl
|
||||
###########################################################################
|
||||
## Intent: Unit test to verify make-makefile.tpl
|
||||
###########################################################################
|
||||
|
||||
##----------------------------##
|
||||
##---] CORE/CPAN INCLUDES [---##
|
||||
##----------------------------##
|
||||
use strict;
|
||||
use warnings;
|
||||
#use feature 'state'; # 5.10+ not installed everywhere
|
||||
use Getopt::Long;
|
||||
|
||||
use Cwd;
|
||||
use Cwd qw{abs_path};
|
||||
use File::Basename;
|
||||
use File::Copy;
|
||||
use File::Path;
|
||||
use File::Temp qw{ tempdir };
|
||||
|
||||
use Test;
|
||||
sub BEGIN { plan tests => 4 };
|
||||
my @workdirs;
|
||||
sub END { system("/bin/rm -fr @workdirs"); } # cleanup behind interrupts
|
||||
|
||||
##-------------------##
|
||||
##---] EXPORTS [---##
|
||||
##-------------------##
|
||||
use FindBin;
|
||||
our $VERSION = qw(1.0);
|
||||
|
||||
##------------------##
|
||||
##---] INCLUDES [---##
|
||||
##------------------##
|
||||
use FindBin;
|
||||
use lib "$FindBin::RealBin/..";
|
||||
use makemakefile;
|
||||
|
||||
##-------------------##
|
||||
##---] GLOBALS [---##
|
||||
##-------------------##
|
||||
my %argv;
|
||||
|
||||
###########################################################################
|
||||
## Intent: Create a temp sandbox populated with sources
|
||||
## -----------------------------------------------------------------------
|
||||
## Args:
|
||||
## array a list of file paths to copy
|
||||
## Returns:
|
||||
## $@ set on error
|
||||
## scalar path to scratch sandbox
|
||||
## -----------------------------------------------------------------------
|
||||
###########################################################################
|
||||
my $root; # state $root not available
|
||||
sub createSandbox
|
||||
{
|
||||
my @errors;
|
||||
|
||||
unless ($root)
|
||||
{
|
||||
my @tmp = split(m%/%, $FindBin::RealBin);
|
||||
splice(@tmp, -3);
|
||||
$root = join('/', @tmp);
|
||||
}
|
||||
|
||||
my $work = tempdir();
|
||||
push(@workdirs, $work);
|
||||
my @dirs = map{ join('/', $work, dirname($_)) } @_;
|
||||
mkdirr(@dirs);
|
||||
push(@errors, "createSandbox: $@") if ($@);
|
||||
|
||||
foreach (@_)
|
||||
{
|
||||
## Copy sources into the temp source directory
|
||||
my $src = join('/', $root, $_);
|
||||
my $dst = join('/', $work, $_);
|
||||
unless (copy($src, $dst))
|
||||
{
|
||||
push(@errors, "copy($src, $dst) failed: $!");
|
||||
}
|
||||
}
|
||||
print STDERR "createSandbox: $work\n" if ($main::argv{debug});
|
||||
$@ = join('', map{ "$_\n" } @errors);
|
||||
$work;
|
||||
} # createSandbox
|
||||
|
||||
###########################################################################
|
||||
## Intent: wrapper to run the make-makefile command.
|
||||
## -----------------------------------------------------------------------
|
||||
## Args:
|
||||
## array command line arguments passed to make-makefile
|
||||
## Returns:
|
||||
## array command output
|
||||
## $@ set by shell exit status, empty string on success
|
||||
## $? command shell exit status
|
||||
###########################################################################
|
||||
my $mm; # state $mm not available
|
||||
sub makemakefile
|
||||
{
|
||||
my %fargs = (@_ && ref($_[$#_])) ? %{ (pop) } : ();
|
||||
$mm ||= join('/', dirname($FindBin::Bin), 'make-makefile'); # cmd in parent of test/
|
||||
my $cmd = join(' ', $mm, @_);
|
||||
print "RUNNING: $cmd\n" if ($fargs{debug});
|
||||
my @out = `$cmd 2>&1`;
|
||||
print STDERR map{ "out> $_" } @out if ($argv{verbose});
|
||||
$@ = (0 == $?) ? '' : "Command failed: $cmd\n@out";
|
||||
@out;
|
||||
} # makemakefile
|
||||
|
||||
###########################################################################
|
||||
## Intent: Helper function, display the contents of a given sandbox
|
||||
## -----------------------------------------------------------------------
|
||||
## Args:
|
||||
## scalar Path to sandbox
|
||||
## Returns:
|
||||
## none
|
||||
## -----------------------------------------------------------------------
|
||||
###########################################################################
|
||||
sub find_ls
|
||||
{
|
||||
my $path = shift || '';
|
||||
|
||||
# Assuming dot contributes to cryptic problems
|
||||
die "find_ls: a path is required" unless ($path);
|
||||
|
||||
my $cmd = "find $path -ls";
|
||||
print "\nRunning: $cmd\n";
|
||||
print '=' x 75, "\n";
|
||||
print `$cmd`;
|
||||
} # myls
|
||||
|
||||
###########################################################################
|
||||
## Intent: Verify make-makefile is able to digest paths and generate
|
||||
## makefiles when object directory is a child of top.
|
||||
###########################################################################
|
||||
sub check_makemakefile
|
||||
{
|
||||
my $work = createSandbox
|
||||
(
|
||||
'memory/mozalloc/Makefile.in',
|
||||
'toolkit/system/windowsproxy/Makefile.in',
|
||||
'toolkit/crashreporter/google-breakpad/src/client/Makefile.in',
|
||||
);
|
||||
|
||||
|
||||
my $workdir = createSandbox();
|
||||
my $top = $workdir;
|
||||
chdir $top;
|
||||
|
||||
my $objA = 'obj-arch-dir';
|
||||
my $obj = join('/', $top, $objA);
|
||||
|
||||
# getTopDir()
|
||||
local $main::argv{top} = $work;
|
||||
local $main::argv{obj} = $obj;
|
||||
getObjDir('_reset_');
|
||||
|
||||
my @root = split(m%/%, $FindBin::RealBin);
|
||||
splice(@root, -3);
|
||||
my $root = join('/', @root);
|
||||
my @args =
|
||||
(
|
||||
|
||||
[
|
||||
banner => "--top and --obj are impled, generate Makefile",
|
||||
rel => 'memory/mozalloc',
|
||||
cmd => join(' ',
|
||||
'--top', $top,
|
||||
'--obj', $obj,
|
||||
'memory/mozalloc/Makefile',
|
||||
),
|
||||
],
|
||||
|
||||
[
|
||||
banner => "--top and abs(obj) passed",
|
||||
rel => "toolkit/system/windowsproxy",
|
||||
cmd => join(' ',
|
||||
'--top', $top,
|
||||
"$obj/toolkit/system/windowsproxy/Makefile",
|
||||
),
|
||||
exp => "$obj/toolkit/system/windowsproxy/Makefile",
|
||||
skip => 1, #
|
||||
],
|
||||
|
||||
|
||||
[
|
||||
banner => "--obj and abs(top) passed",
|
||||
rel => "toolkit/crashreporter/google-breakpad/src/client",
|
||||
cmd => join(' ',
|
||||
'--obj', $obj,
|
||||
"$top/toolkit/crashreporter/google-breakpad/src/client/Makefile.in",
|
||||
),
|
||||
exp => "$top/toolkit/crashreporter/google-breakpad/src/client/Makefile.in",
|
||||
skip => 1, #
|
||||
],
|
||||
|
||||
);
|
||||
|
||||
foreach (@args)
|
||||
{
|
||||
my %rec = @{ $_ };
|
||||
next if ($rec{skip});
|
||||
next unless ($rec{rel});
|
||||
|
||||
my $srcR = join('/', $top, $rec{rel});
|
||||
my $dstR = join('/', $obj, $rec{rel});
|
||||
|
||||
my $src = join('/', $top, $rec{rel}, 'Makefile.in');
|
||||
my $dst = join('/', $obj, $rec{rel}, 'Makefile');
|
||||
|
||||
# Use distinct sources to avoid cleanup overhead between tests
|
||||
die "Test source already used: $dstR" if (-d $dstR);
|
||||
|
||||
## Copy sources into the temp source directory
|
||||
my $rootR = join('/', $root, $rec{rel});
|
||||
my $rootS = join('/', $root, $rec{rel}, 'Makefile.in');
|
||||
File::Path::mkpath($srcR, 0, 0700);
|
||||
copy($rootS, $src) or die "copy($rootS, $src) failed: $!";
|
||||
|
||||
die "source does not exist: $src" unless (-e $src);
|
||||
|
||||
######################
|
||||
## Generate and verify
|
||||
######################
|
||||
print STDERR "RUNNING: $rec{banner}\n" if ($argv{debug});
|
||||
my @errs;
|
||||
makemakefile('--enhanced', $rec{cmd}, {verbose=>1});
|
||||
if ($@)
|
||||
{
|
||||
push(@errs, "\$@ should not be set: $@\n");
|
||||
}
|
||||
elsif (! -e $dst)
|
||||
{
|
||||
push(@errs, "Generated makefile does not exist: $dst, banner: $rec{banner}\n");
|
||||
}
|
||||
|
||||
ok(scalar(@errs), 0, "Errors detected:\n" . join(" $_", @errs));
|
||||
find_ls($top) if (@errs);
|
||||
}
|
||||
|
||||
} # check_makemakefile
|
||||
|
||||
###########################################################################
|
||||
## Intent: Verify make-makefile is able to digest paths and generate
|
||||
## makefiles when top/MOZ_OBJDIR are not parent/child directories
|
||||
## ---------------------------------------------------------------------------
|
||||
## Args:
|
||||
## none
|
||||
## Returns:
|
||||
## none
|
||||
## ---------------------------------------------------------------------------
|
||||
###########################################################################
|
||||
sub check_makemakefile_distinct
|
||||
{
|
||||
my $workdir = createSandbox();
|
||||
# my $workdir = tempdir();
|
||||
|
||||
###############################################
|
||||
## Now update when top/obj are not parent/child
|
||||
###############################################
|
||||
my $top = join('/', $workdir, 'top');
|
||||
my $obj = join('/', $workdir, 'obj');
|
||||
|
||||
$main::argv{top} = $top;
|
||||
$main::argv{obj} = $obj; # test afterward, using undef ?
|
||||
|
||||
my @sbxroot = split(m%/%, $FindBin::RealBin);
|
||||
splice(@sbxroot, -2);
|
||||
my $sbxroot = join('/', @sbxroot);
|
||||
|
||||
## Copy in a makefile template to to convert
|
||||
File::Path::mkpath(["$top/memory/mozalloc"], 0, 0700);
|
||||
copy("$sbxroot/memory/mozalloc/Makefile.in", "$top/memory/mozalloc/Makefile.in");
|
||||
|
||||
|
||||
# work/memory/mozalloc/Makefile.in
|
||||
|
||||
my @args =
|
||||
(
|
||||
[
|
||||
banner => '--top and --obj are distinct [1]',
|
||||
cmd => "--obj $obj memory/mozalloc/Makefile",
|
||||
exp => "$obj/memory/mozalloc/Makefile",
|
||||
],
|
||||
|
||||
[
|
||||
banner => "--top and --obj are distinct [2]",
|
||||
cmd => "--top $top memory/mozalloc/Makefile.in",
|
||||
exp => "$obj/memory/mozalloc/Makefile",
|
||||
skip => 1, # test problem: top != obj
|
||||
],
|
||||
|
||||
[
|
||||
banner => "--top and --obj are distinct [3]",
|
||||
cmd => join(' ',
|
||||
"--top $top",
|
||||
"--obj $obj",
|
||||
"memory/mozalloc/Makefile.in",
|
||||
),
|
||||
exp => "$obj/memory/mozalloc/Makefile",
|
||||
skip => 1, # test problem: top != obj
|
||||
],
|
||||
);
|
||||
|
||||
|
||||
foreach (@args)
|
||||
{
|
||||
my %rec = @{ $_ };
|
||||
print STDERR "banner: $rec{banner}\n" if ($argv{debug});
|
||||
next if $rec{skip};
|
||||
|
||||
unlink $rec{exp};
|
||||
makemakefile('--enhanced', $rec{cmd});
|
||||
|
||||
my @errs;
|
||||
if ($@)
|
||||
{
|
||||
push(@errs, "\$@ should not be set: $@\n");
|
||||
}
|
||||
elsif (! -e $rec{exp})
|
||||
{
|
||||
push(@errs, "Makefile does not exist: $rec{exp}\n");
|
||||
}
|
||||
ok(scalar(@errs), 0, "Errors detected:\n" . join(" $_", @errs));
|
||||
}
|
||||
|
||||
} # check_makemakefile_distinct
|
||||
|
||||
###########################################################################
|
||||
## Intent: Verify legacy behavior, invoke make-makefile when cwd is
|
||||
## a subdirectory beneath MOZ_OBJDIR.
|
||||
## -----------------------------------------------------------------------
|
||||
## Args:
|
||||
## none
|
||||
## Returns:
|
||||
## none
|
||||
## -----------------------------------------------------------------------
|
||||
###########################################################################
|
||||
sub check_makemakefile_legacy
|
||||
{
|
||||
my $work = createSandbox
|
||||
(
|
||||
'memory/mozalloc/Makefile.in',
|
||||
'parser/htmlparser/tests/mochitest/html5lib_tree_construction/Makefile.in',
|
||||
);
|
||||
|
||||
my $obj = join('/', $work, 'obj');
|
||||
mkdir $obj;
|
||||
|
||||
my @args =
|
||||
(
|
||||
{
|
||||
banner => '-t path -d dot',
|
||||
cwd => $obj,
|
||||
cmd => "-t $work -d . memory/mozalloc/Makefile",
|
||||
exp => "$obj/memory/mozalloc/Makefile",
|
||||
skip => 0,
|
||||
},
|
||||
|
||||
{
|
||||
banner => '-t path -d relpath',
|
||||
cwd => join('/', $obj, 'parser/htmlparser/tests/mochitest'),
|
||||
cmd => "-t $work -d ../../../.. html5lib_tree_construction/Makefile",
|
||||
exp => "$obj/parser/htmlparser/tests/mochitest/html5lib_tree_construction/Makefile",
|
||||
skip => 0,
|
||||
},
|
||||
);
|
||||
|
||||
foreach (@args)
|
||||
{
|
||||
my %rec = %{ $_ };
|
||||
next if ($rec{skip});
|
||||
|
||||
## make-make while sitting in $objdir
|
||||
mkdirr($rec{cwd});
|
||||
chdir $rec{cwd} || die "chdir $rec{cwd} failed; $!";
|
||||
|
||||
makemakefile($rec{cmd});
|
||||
my @errs;
|
||||
if ($@)
|
||||
{
|
||||
push(@errs, "make-makefile $rec{cmd} failed: $@");
|
||||
}
|
||||
elsif (! -e $rec{exp})
|
||||
{
|
||||
push(@errs, "generated makefile does not exist: $rec{exp}");
|
||||
}
|
||||
ok(scalar(@errs), 0, "Errors detected: @errs");
|
||||
find_ls($work) if (@errs);
|
||||
}
|
||||
chdir $FindBin::RealBin;
|
||||
} # check_makemakefile_legacy
|
||||
|
||||
###########################################################################
|
||||
## Intent: Smoke tests for the unittests module
|
||||
###########################################################################
|
||||
sub smoke
|
||||
{
|
||||
print STDERR "Running test: smoke()\n" if ($argv{debug});
|
||||
} # smoke()
|
||||
|
||||
###########################################################################
|
||||
## Intent: Intitialize global test objects and consts
|
||||
###########################################################################
|
||||
sub init
|
||||
{
|
||||
print "Running: init()\n" if ($argv{debug});
|
||||
# testplan(24, 0);
|
||||
} # init()
|
||||
|
||||
##----------------##
|
||||
##---] MAIN [---##
|
||||
##----------------##
|
||||
unless(GetOptions(\%argv,
|
||||
qw(
|
||||
debug|d
|
||||
manual
|
||||
test=s@
|
||||
verbose
|
||||
)))
|
||||
{
|
||||
print "USAGE: $0\n";
|
||||
print " --debug Enable script debug mode\n";
|
||||
print " --manual Also run disabled tests\n";
|
||||
print " --smoke Run smoke tests then exit\n";
|
||||
print " --test Run a list of tests by function name\n";
|
||||
print " --verbose Enable script verbose mode\n";
|
||||
exit 1;
|
||||
}
|
||||
|
||||
init();
|
||||
smoke();
|
||||
|
||||
check_makemakefile();
|
||||
check_makemakefile_distinct();
|
||||
check_makemakefile_legacy();
|
|
@ -1,519 +0,0 @@
|
|||
#!/usr/bin/env perl
|
||||
###########################################################################
|
||||
## Intent: Unit test to verify the makemakefile.pm module
|
||||
###########################################################################
|
||||
|
||||
##----------------------------##
|
||||
##---] CORE/CPAN INCLUDES [---##
|
||||
##----------------------------##
|
||||
use strict;
|
||||
use warnings;
|
||||
#use feature 'state';
|
||||
use Getopt::Long;
|
||||
|
||||
use FindBin;
|
||||
use Cwd qw{abs_path};
|
||||
use File::Basename;
|
||||
use File::Compare;
|
||||
use File::Copy;
|
||||
use File::Temp qw{tempdir};
|
||||
|
||||
use Test;
|
||||
sub BEGIN { plan tests => 36 };
|
||||
my @workdirs;
|
||||
sub END { system("/bin/rm -fr @workdirs"); } # cleanup behind interrupts
|
||||
|
||||
##-------------------##
|
||||
##---] EXPORTS [---##
|
||||
##-------------------##
|
||||
our $VERSION = qw(1.0);
|
||||
|
||||
##------------------##
|
||||
##---] INCLUDES [---##
|
||||
##------------------##
|
||||
use FindBin;
|
||||
use lib "$FindBin::RealBin/..";
|
||||
use makemakefile;
|
||||
|
||||
##-------------------##
|
||||
##---] GLOBALS [---##
|
||||
##-------------------##
|
||||
my %argv;
|
||||
|
||||
###########################################################################
|
||||
## Intent: Create a temp sandbox populated with sources
|
||||
## -----------------------------------------------------------------------
|
||||
## Args:
|
||||
## array files to copy into the temporary sandbox
|
||||
## Returns:
|
||||
## $@ set on error
|
||||
## array
|
||||
## top - path to temp sandbox root
|
||||
## obj - path to temp sandbox moz_obj directory
|
||||
## -----------------------------------------------------------------------
|
||||
###########################################################################
|
||||
my $_root_; # state $root
|
||||
sub createSandbox
|
||||
{
|
||||
# state $root;
|
||||
my @errors;
|
||||
|
||||
unless ($_root_)
|
||||
{
|
||||
my @tmp = split(m%/%, $FindBin::RealBin);
|
||||
splice(@tmp, -3);
|
||||
$_root_ = join('/', @tmp);
|
||||
}
|
||||
|
||||
my $work = tempdir(CLEANUP=>1);
|
||||
push(@workdirs, $work);
|
||||
my @dirs = map{ join('/', $work, dirname($_)) } @_;
|
||||
mkdirr(@dirs);
|
||||
push(@errors, "createSandbox: $@") if ($@);
|
||||
|
||||
foreach (@_)
|
||||
{
|
||||
## Copy sources into the temp source directory
|
||||
my $src = join('/', $_root_, $_);
|
||||
my $dst = join('/', $work, $_);
|
||||
unless (copy($src, $dst))
|
||||
{
|
||||
push(@errors, "copy($src, $dst) failed: $!");
|
||||
}
|
||||
}
|
||||
print STDERR "createSandbox: $work\n" if ($main::argv{debug});
|
||||
$@ = join('', map{ "$_\n" } @errors);
|
||||
$work;
|
||||
} # createSandbox
|
||||
|
||||
###########################################################################
|
||||
## Intent: Verify legacy dirname function
|
||||
###########################################################################
|
||||
sub check_dirname_legacy
|
||||
{
|
||||
print "Running: check_dirname_legacy\n" if ($main::argv{debug});
|
||||
|
||||
foreach (
|
||||
['/dev/null', '/dev'],
|
||||
['/foo/bar/Makefile', '/foo/bar'],
|
||||
)
|
||||
{
|
||||
my ($src, $exp) = @{ $_ };
|
||||
my $dir = dirname_legacy($src);
|
||||
ok($dir, $exp, "dirname_legacy($src) failed");
|
||||
}
|
||||
|
||||
my $path = dirname_legacy(undef);
|
||||
ok($path ? 1 : 0, 1, "dirname('') should expand to cwd");
|
||||
} # check_dirname_legacy
|
||||
|
||||
###########################################################################
|
||||
## Intent: Verify topdir lookup function
|
||||
###########################################################################
|
||||
sub check_getTopDir
|
||||
{
|
||||
print "Running: check_getTopDir\n" if ($main::argv{debug});
|
||||
|
||||
my $path = getTopDir();
|
||||
|
||||
## Unit test is special, cmd not invoked from the same directory
|
||||
## as the makemakefile.pm module.
|
||||
ok($path ? 1 : 0, 1, "getTopDir failed");
|
||||
ok(-d $path ? 1 : 0, 1, "getTopDir: directory $path does not exist");
|
||||
ok($FindBin::RealBin =~ m%\Q$path/% ? 1 : 0, 1, 'Invalid topdir path');
|
||||
ok(-e "$path/client.mk" ? 1 : 0, 1, "client.mk not found in $path");
|
||||
} # check_getTopDir
|
||||
|
||||
###########################################################################
|
||||
## Intent: Verify objdir lookup function
|
||||
###########################################################################
|
||||
sub check_getObjDir
|
||||
{
|
||||
print "Running: check_getObjDir\n" if ($main::argv{debug});
|
||||
local $main::argv{obj} = '/bin';
|
||||
my $path = getObjDir('_reset_');
|
||||
ok($path ? 1 : 0, 1, "getObjDir failed");
|
||||
ok(-d $path ? 1 : 0, 1, "getObjDir: directory $path does not exist");
|
||||
|
||||
my $top = getTopDir();
|
||||
$main::argv{obj} = join('/', $top, 'browser'); # use existing path so file can be resolved
|
||||
my $obj = getObjDir('_reset_');
|
||||
ok($top ne $obj ? 1 : 0, 1, "top and object directory paths should not match");
|
||||
|
||||
## If we fail for /bin use here getObjDir() was not reset
|
||||
my $client = join('/', $obj, '..', 'client.mk');
|
||||
ok(-e $client ? 1 : 0, 1, "client.mk not found in parent of $path, $client");
|
||||
getObjDir('_set_'); # clear cached value and recompute
|
||||
|
||||
foreach my $file ("$top/memory/mozalloc/Makefile")
|
||||
{
|
||||
my $obj = getObjDir('_reset_', $file);
|
||||
ok($obj ne $file ? 1 : 0, 1, "getObjDir($file) failed")
|
||||
}
|
||||
} # check_getObjDir
|
||||
|
||||
###########################################################################
|
||||
## Intent: Verify rel-path-to-root/getdepth function
|
||||
###########################################################################
|
||||
sub check_getDepth
|
||||
{
|
||||
my @tmp = split(m%/%o, $FindBin::Bin);
|
||||
splice(@tmp, -3);
|
||||
my $root = abs_path( join('/', @tmp) );
|
||||
|
||||
my %data =
|
||||
(
|
||||
$root => '.',
|
||||
join('/', $root, 'netwerk/Makefile.in') => '..',
|
||||
|
||||
join('/', $root, 'browser/components/privatebrowsing/test/browser/Makefile.in') => '../../../../..',
|
||||
join('/', $root, 'browser/components/privatebrowsing/test/browser/') => '../../../../..',
|
||||
join('/', $root, 'browser/components/privatebrowsing/test/browser') => '../../../../..',
|
||||
join('/', $root, 'browser/components/privatebrowsing/test') => '../../../..',
|
||||
);
|
||||
|
||||
while (my($k, $v) = each %data)
|
||||
{
|
||||
my $depth = makemakefile::getDepth($k);
|
||||
ok($depth, $v, "getDepth($k) failed");
|
||||
}
|
||||
} # check_getDepth
|
||||
|
||||
###########################################################################
|
||||
## Intent: Verify reading the exclusion file
|
||||
###########################################################################
|
||||
sub check_getExclusions
|
||||
{
|
||||
my $cfg = join('/', $FindBin::RealBin, 'make-makefile.excl');
|
||||
my %excl = getExclusions($cfg);
|
||||
ok($@, '', '$@ should not be set');
|
||||
|
||||
my @excl = sort keys %excl;
|
||||
ok(scalar @excl, 4, "Exclusion file is invalid: \@excl=@excl");
|
||||
} # check_getExclusions
|
||||
|
||||
###########################################################################
|
||||
## Intent: Verify rel-path-to-root function
|
||||
## -----------------------------------------------------------------------
|
||||
## Args:
|
||||
## none
|
||||
## Returns:
|
||||
## none
|
||||
## -----------------------------------------------------------------------
|
||||
## Note:
|
||||
## String test only, top and obj paths are bogus for this test
|
||||
###########################################################################
|
||||
sub check_getRelPath
|
||||
{
|
||||
my @tmp = split(m%/%o, $FindBin::Bin);
|
||||
splice(@tmp, -3);
|
||||
my $root = abs_path( join('/', @tmp) );
|
||||
my $obj0 = 'obj-arch';
|
||||
my $obj = join('/', $root, $obj0);
|
||||
|
||||
local $main::argv{top} = $root;
|
||||
local $main::argv{obj} = $obj;
|
||||
getTopDir('_reset_');
|
||||
getObjDir('_set_', $obj);
|
||||
|
||||
## Cannot test relative paths with objdir beneath /tmp
|
||||
## Commented paths are needed for full test coverage
|
||||
## but are not currently supported by all module functions.
|
||||
my %data =
|
||||
(
|
||||
# Relative - path correct for build directory but
|
||||
'profile/dirserviceprovider/public/Makefile.in' => 'profile/dirserviceprovider/public',
|
||||
|
||||
join('/', $root, 'profile/dirserviceprovider/public/Makefile.in') => 'profile/dirserviceprovider/public',
|
||||
|
||||
# File search
|
||||
'profile/dirserviceprovider/public' => 'profile/dirserviceprovider/public',
|
||||
|
||||
# cwd + cleanup
|
||||
# '../../../profile/dirserviceprovider/public/Makefile.in' => 'profile/dirserviceprovider/public',
|
||||
# "../../../${obj0}/profile/dirserviceprovider/public/Makefile.in" => 'profile/dirserviceprovider/public',
|
||||
|
||||
## Special case: This could be handled but permutations of non-existent files, non-overlapping paths
|
||||
## and relative paths containing partial subdirectories will compilicate the logic. Wait until needed.
|
||||
## Relative path: $root + obj + subdir
|
||||
# "${obj0}/profile/dirserviceprovider/public/Makefile" => 'profile/dirserviceprovider/public',
|
||||
join('/', $obj, 'profile/dirserviceprovider/public/Makefile') => 'profile/dirserviceprovider/public',
|
||||
|
||||
# $RealBin, -d ../../..
|
||||
# top and obj not subdirectories of each other: /foo/x, /bar/y
|
||||
);
|
||||
|
||||
while (my($k, $v) = each %data)
|
||||
{
|
||||
my $dir = getRelPath($k);
|
||||
ok($@, '', '$@ should not be set');
|
||||
ok($dir, $v, "ERROR[$k]: exp[$v] != found=[$dir]");
|
||||
}
|
||||
|
||||
|
||||
my $top = '/tmp/foo';
|
||||
my $tmp = '/tmp/bar';
|
||||
local $main::argv{top} = $tmp;
|
||||
local $main::argv{obj} = $obj;
|
||||
|
||||
%data =
|
||||
(
|
||||
# "$top/profile/dirserviceprovider/public/Makefile.in" => 'profile/dirserviceprovider/public',
|
||||
"$obj/profile/dirserviceprovider/public/Makefile" => 'profile/dirserviceprovider/public',
|
||||
);
|
||||
|
||||
while (my($k, $v) = each %data)
|
||||
{
|
||||
my $dir = getRelPath($k);
|
||||
ok($dir, $v, "ERROR[$k]: exp[$v] != found=[$dir]");
|
||||
}
|
||||
} # check_getRelPath
|
||||
|
||||
###########################################################################
|
||||
## Intent: Verify rel-path-to-root directory creation
|
||||
###########################################################################
|
||||
sub check_mkdirr
|
||||
{
|
||||
if (-w '/bin') # cygwin may be writable
|
||||
{
|
||||
ok(1, 1, 'bogus test to maintain count');
|
||||
} else {
|
||||
mkdirr('/bin/invalid/Makefile');
|
||||
ok($@ ? 1 : 0, 1, '$@ should be set');
|
||||
}
|
||||
|
||||
my $work = createSandbox();
|
||||
my @paths = map{ join('/', $work, $_, 'Makefile.in') } qw (xyz/abc foo/bar a/b/c/d/e);
|
||||
mkdirr(@paths);
|
||||
ok($@ ? 1 : 0, 0, '$@ should not be set');
|
||||
|
||||
push(@paths, '/bin');
|
||||
|
||||
my @errors;
|
||||
foreach (@paths)
|
||||
{
|
||||
my $dir = dirname($_);
|
||||
next if (-d $dir);
|
||||
push(@errors, "mkdirr($dir) failed\n");
|
||||
}
|
||||
ok(scalar @errors, 0, "Errors detected: @errors");
|
||||
} # check_mkdirr
|
||||
|
||||
###########################################################################
|
||||
## Intent: Verify permutations for system("config.status")
|
||||
###########################################################################
|
||||
sub check_run_config_status
|
||||
{
|
||||
print STDERR "Running: check_run_config_status()\n"
|
||||
if ($main::argv{debug});
|
||||
|
||||
my $work = createSandbox();
|
||||
chdir $work;
|
||||
run_config_status();
|
||||
ok($@ ? 1 : 0, '$@ should be set, config.status does not exist');
|
||||
|
||||
my $cfg = join('/', $work, 'config.status');
|
||||
local *CFG;
|
||||
open(CFG, "> $cfg") && close(CFG);
|
||||
run_config_status();
|
||||
ok($@, qr/config.status failed/, '$@ should be set, config.status is not executabl');
|
||||
|
||||
open(CFG, "> $cfg");
|
||||
print CFG join("\n",
|
||||
'#!/bin/sh',
|
||||
'',
|
||||
'true',
|
||||
'');
|
||||
close(CFG);
|
||||
chmod 0555, $cfg;
|
||||
run_config_status();
|
||||
ok($@, qr/config.status failed/, '$@ should not be set');
|
||||
|
||||
} # check_run_config_status
|
||||
|
||||
###########################################################################
|
||||
## Intent: Verify makefile generation by legacy make-makefile functions
|
||||
## o make-makefile -t /x/y -d ..
|
||||
###########################################################################
|
||||
sub check_update_makefiles_legacy
|
||||
{
|
||||
print STDERR "Running: check_update_makefiles_legacy()\n"
|
||||
if ($main::argv{debug});
|
||||
|
||||
return unless ($argv{legacy});
|
||||
print STDERR "check_update_makefiles_legacy: not yet implemented\n";
|
||||
|
||||
} # check_update_makefiles_legacy
|
||||
|
||||
###########################################################################
|
||||
## Intent: Verify updateMakefiles()
|
||||
## o a makefile is generated when none exists.
|
||||
## o a makefile will only be updated when the templates changes.
|
||||
## o existing makefiles will be updated when the template changes.
|
||||
## o @foo@ tokens have been expanded
|
||||
###########################################################################
|
||||
sub check_updateMakefiles
|
||||
{
|
||||
my @errors;
|
||||
|
||||
print STDERR "Running: check_updateMakefiles()\n"
|
||||
if ($main::argv{debug});
|
||||
|
||||
my $mf = 'memory/mozalloc/Makefile.in';
|
||||
|
||||
my $work = createSandbox($mf);
|
||||
my $obj = join('/', $work, 'obj');
|
||||
my %args =
|
||||
(
|
||||
top => $work,
|
||||
obj => $obj,
|
||||
);
|
||||
|
||||
my $mf_src = join('/', $work, 'memory/mozalloc/Makefile.in');
|
||||
my $mf_dst = join('/', $obj, 'memory/mozalloc/Makefile');
|
||||
|
||||
updateMakefiles('memory/mozalloc', \%args);
|
||||
my $tlm0 = (stat $mf_dst)[9] || 0;
|
||||
ok(-e $mf_dst ? 1 : 0, 1, "failed to generate makefile: $mf_dst");
|
||||
|
||||
#############################
|
||||
## Regeneration will be a nop
|
||||
#############################
|
||||
updateMakefiles('memory/mozalloc', \%args);
|
||||
my $tlm1 = (stat $mf_dst)[9] || -1;
|
||||
ok($tlm1, $tlm0, "makefile should not have been modified");
|
||||
|
||||
#####################################################
|
||||
## Modify template to verify makefile will regenerate
|
||||
#####################################################
|
||||
local *MF;
|
||||
if (open(MF, ">> $mf_src"))
|
||||
{
|
||||
print MF map{ "# MODIFIED MAKEFILE\n" } 0..4;
|
||||
close(MF);
|
||||
}
|
||||
updateMakefiles('memory/mozalloc', \%args);
|
||||
my @data = makemakefile::cat($mf_dst);
|
||||
## Check content to avoid a silly 'sleep [n]' call here
|
||||
ok(grep(/^\# MODIFIED MAKEFILE/o, @data) ? 1 : 0,
|
||||
1,
|
||||
"template modified, makefile should have regenerated");
|
||||
|
||||
## VERIFY template expansion
|
||||
my @gen = makemakefile::cat($mf_dst);
|
||||
push(@errors, $@) if ($@);
|
||||
|
||||
foreach (@gen)
|
||||
{
|
||||
if (/\@[^\@]+\@/o)
|
||||
{
|
||||
push(@errors, join("\n",
|
||||
"Unexpanded template string detected [$_]",
|
||||
"Makefile: $mf_src",
|
||||
));
|
||||
last;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
ok(scalar(@errors), 0, "Errors detected: @errors");
|
||||
} # check_updateMakefiles
|
||||
|
||||
###########################################################################
|
||||
## Intent: Verify makefile generation by updateMakefiles() when
|
||||
## command line arguments --top and --obj were passed.
|
||||
###########################################################################
|
||||
sub check_updateMakefilesByTopObj
|
||||
{
|
||||
my @errors;
|
||||
|
||||
print STDERR "Running: check_updateMakefilesByTopObj()\n"
|
||||
if ($main::argv{debug});
|
||||
|
||||
my $work = createSandbox();
|
||||
my %args =
|
||||
(
|
||||
top => $work,
|
||||
obj => $work,
|
||||
);
|
||||
|
||||
## Grab a list of makefile templates to generate
|
||||
my @all = glob('data/mf.*');
|
||||
my @src = map{ /\.exp$/o ? () : $_ } @all;
|
||||
|
||||
foreach my $src (@src)
|
||||
{
|
||||
my $dst = join('/', $work, 'Makefile');
|
||||
unlink $dst;
|
||||
copy($src, "$work/Makefile.in");
|
||||
updateMakefiles('.', \%args);
|
||||
ok($@, '', '$@ should not be set');
|
||||
|
||||
my @dst = makemakefile::cat($dst);
|
||||
|
||||
my $exp = join('.', $src, 'exp');
|
||||
my @exp = makemakefile::cat($exp);
|
||||
ok("@dst", "@exp", "updateMakefile($dst) failed");
|
||||
}
|
||||
return;
|
||||
} # check_updateMakefilesByTopObj
|
||||
|
||||
###########################################################################
|
||||
## Intent: Smoke tests for the unittests module
|
||||
###########################################################################
|
||||
sub smoke
|
||||
{
|
||||
print STDERR "Running test: smoke()\n" if ($argv{debug});
|
||||
} # smoke()
|
||||
|
||||
###########################################################################
|
||||
## Intent: Intitialize global test objects and consts
|
||||
###########################################################################
|
||||
sub init
|
||||
{
|
||||
print "Running: init()\n" if ($argv{debug});
|
||||
# testplan(24, 0);
|
||||
|
||||
my @path = split(m%/%, $FindBin::RealBin);
|
||||
splice(@path, -3);
|
||||
my $top = join('/', @path);
|
||||
## Top set based on make-makefile startup directory so adjust for test/ use
|
||||
getTopDir('_set_', $top);
|
||||
|
||||
} # init()
|
||||
|
||||
##----------------##
|
||||
##---] MAIN [---##
|
||||
##----------------##
|
||||
unless(GetOptions(\%argv,
|
||||
qw(
|
||||
debug|d
|
||||
manual
|
||||
test=s@
|
||||
verbose
|
||||
)))
|
||||
{
|
||||
print "USAGE: $0\n";
|
||||
print " --debug Enable script debug mode\n";
|
||||
print " --manual Also run disabled tests\n";
|
||||
print " --smoke Run smoke tests then exit\n";
|
||||
print " --test Run a list of tests by function name\n";
|
||||
print " --verbose Enable script verbose mode\n";
|
||||
exit 1;
|
||||
}
|
||||
|
||||
init();
|
||||
smoke();
|
||||
|
||||
check_dirname_legacy();
|
||||
|
||||
check_getTopDir();
|
||||
check_getObjDir();
|
||||
check_getDepth();
|
||||
check_getExclusions();
|
||||
check_getRelPath();
|
||||
check_mkdirr();
|
||||
|
||||
check_updateMakefiles();
|
||||
check_update_makefiles_legacy();
|
||||
check_updateMakefilesByTopObj();
|
|
@ -1,95 +0,0 @@
|
|||
#!/usr/bin/env perl
|
||||
###########################################################################
|
||||
## Intent:
|
||||
## Test::Harness is a testing wrapper that will process output
|
||||
## from Test.pm module tests. Sumarize results, report stats
|
||||
## and exit with overall status for the testing suites.
|
||||
##
|
||||
## Run testing suite:
|
||||
## % make clean test
|
||||
## % perl runtest
|
||||
##
|
||||
## Run Individual tests
|
||||
## % perl tUtils0
|
||||
###########################################################################
|
||||
|
||||
##----------------------------##
|
||||
##---] CORE/CPAN INCLUDES [---##
|
||||
##----------------------------##
|
||||
use strict;
|
||||
use warnings;
|
||||
use Getopt::Long;
|
||||
|
||||
use Test::Harness;
|
||||
|
||||
##-------------------##
|
||||
##---] EXPORTS [---##
|
||||
##-------------------##
|
||||
our $VERSION = qw(1.0);
|
||||
use FindBin;
|
||||
|
||||
##-------------------##
|
||||
##---] GLOBALS [---##
|
||||
##-------------------##
|
||||
my %argv;
|
||||
|
||||
##----------------##
|
||||
##---] MAIN [---##
|
||||
##----------------##
|
||||
unless(GetOptions(\%argv,
|
||||
qw(debug|d)
|
||||
))
|
||||
{
|
||||
print "Usage: $0\n";
|
||||
print " --debug Enable debug mode\n";
|
||||
exit 1;
|
||||
}
|
||||
|
||||
if (2 > $Test::Harness::VERSION)
|
||||
{
|
||||
print "Unit tests will not be run, Test::Harness is too old\n"
|
||||
if ($argv{debug});
|
||||
exit 0;
|
||||
}
|
||||
|
||||
|
||||
my @tests;
|
||||
|
||||
########################################
|
||||
## Gather a list of tests if none passed
|
||||
########################################
|
||||
unless (@tests = @ARGV)
|
||||
{
|
||||
local *D;
|
||||
opendir(D, '.');
|
||||
while($_ = readdir(D)) {
|
||||
next unless /.t\S+$/;
|
||||
next if (/\.ts$/);
|
||||
push(@tests, $_);
|
||||
}
|
||||
closedir(D);
|
||||
}
|
||||
|
||||
###############################################
|
||||
## Glob a list of tests when directories passed
|
||||
###############################################
|
||||
my @tmp;
|
||||
foreach (@tests)
|
||||
{
|
||||
local *D;
|
||||
if (-d $_ && (my $dir = $_))
|
||||
{
|
||||
opendir(D, $_) || die "opendir(D) failed: $!";
|
||||
my @tests = grep(/\.t[^\.\s]+/o, readdir(D));
|
||||
closedir(D);
|
||||
push(@tmp, map{ join('/', $dir, $_); } @tests);
|
||||
} else {
|
||||
push(@tmp, $_);
|
||||
}
|
||||
}
|
||||
@tests = @tmp;
|
||||
|
||||
print "$0: @ARGV\n" if ($argv{debug});
|
||||
runtests(@tests);
|
||||
|
||||
# EOF
|
|
@ -50,7 +50,7 @@ except AttributeError:
|
|||
|
||||
rel_list = [os.path.pardir] * (len(start_list)-i) + path_list[i:]
|
||||
if not rel_list:
|
||||
return start
|
||||
return os.curdir
|
||||
return os.path.join(*rel_list)
|
||||
|
||||
# expr.py
|
||||
|
|
|
@ -0,0 +1,282 @@
|
|||
from __future__ import with_statement
|
||||
import os
|
||||
from StringIO import StringIO
|
||||
import unittest
|
||||
from mozunit import main, MockedOpen
|
||||
import ConfigStatus
|
||||
from ConfigStatus import FileAvoidWrite
|
||||
|
||||
class ConfigEnvironment(ConfigStatus.ConfigEnvironment):
|
||||
def __init__(self, **args):
|
||||
ConfigStatus.ConfigEnvironment.__init__(self, **args)
|
||||
# Be helpful to unit tests
|
||||
if not 'top_srcdir' in self.substs:
|
||||
self.substs['top_srcdir'] = self.topsrcdir.replace(os.sep, '/')
|
||||
|
||||
class TestFileAvoidWrite(unittest.TestCase):
|
||||
def test_file_avoid_write(self):
|
||||
'''Test the FileAvoidWrite class
|
||||
'''
|
||||
with MockedOpen({'file': 'content'}):
|
||||
# Overwriting an existing file replaces its content
|
||||
with FileAvoidWrite('file') as file:
|
||||
file.write('bazqux')
|
||||
self.assertEqual(open('file', 'r').read(), 'bazqux')
|
||||
|
||||
# Creating a new file (obviously) stores its content
|
||||
with FileAvoidWrite('file2') as file:
|
||||
file.write('content')
|
||||
self.assertEqual(open('file2').read(), 'content')
|
||||
|
||||
class MyMockedOpen(MockedOpen):
|
||||
'''MockedOpen extension to raise an exception if something
|
||||
attempts to write in an opened file.
|
||||
'''
|
||||
def __call__(self, name, mode):
|
||||
if 'w' in mode:
|
||||
raise Exception, 'Unexpected open with write mode'
|
||||
return MockedOpen.__call__(self, name, mode)
|
||||
|
||||
with MyMockedOpen({'file': 'content'}):
|
||||
# Validate that MyMockedOpen works as intended
|
||||
file = FileAvoidWrite('file')
|
||||
file.write('foobar')
|
||||
self.assertRaises(Exception, file.close)
|
||||
|
||||
# Check that no write actually happens when writing the
|
||||
# same content as what already is in the file
|
||||
with FileAvoidWrite('file') as file:
|
||||
file.write('content')
|
||||
|
||||
|
||||
class TestEnvironment(unittest.TestCase):
|
||||
def test_auto_substs(self):
|
||||
'''Test the automatically set values of ACDEFINES and ALLDEFINES.
|
||||
'''
|
||||
env = ConfigEnvironment(
|
||||
defines = [ ('foo', 'bar'), ('baz', 'qux 42'),
|
||||
('abc', 'def'), ('extra', 'foobar') ],
|
||||
non_global_defines = ['extra', 'ignore'])
|
||||
# non_global_defines should be filtered out in ACDEFINES and
|
||||
# ALLDEFINES.
|
||||
# Original order of the defines need to be respected in ACDEFINES
|
||||
self.assertEqual(env.substs['ACDEFINES'], '-Dfoo=bar -Dbaz=qux\\ 42 -Dabc=def')
|
||||
# ALLDEFINES, on the other hand, needs to be sorted
|
||||
self.assertEqual(env.substs['ALLDEFINES'], '''#define abc def
|
||||
#define baz qux 42
|
||||
#define foo bar''')
|
||||
|
||||
def test_config_file(self):
|
||||
'''Test the creation of config files.
|
||||
'''
|
||||
with MockedOpen({'file.in': '''#ifdef foo
|
||||
@foo@
|
||||
@bar@
|
||||
'''}):
|
||||
env = ConfigEnvironment(substs = [ ('foo', 'bar baz') ])
|
||||
env.create_config_file('file')
|
||||
self.assertEqual(open('file', 'r').read(), '''#ifdef foo
|
||||
bar baz
|
||||
@bar@
|
||||
''')
|
||||
|
||||
def test_config_header(self):
|
||||
'''Test the creation of config headers.
|
||||
'''
|
||||
with MockedOpen({'file.in': '''
|
||||
/* Comment */
|
||||
#define foo
|
||||
#define foo 42
|
||||
#undef foo
|
||||
#define bar
|
||||
#define bar 42
|
||||
#undef bar
|
||||
|
||||
# undef baz
|
||||
|
||||
#ifdef foo
|
||||
# undef foo
|
||||
# define foo 42
|
||||
# define foo 42
|
||||
#endif
|
||||
'''}):
|
||||
env = ConfigEnvironment(defines = [ ('foo', 'baz qux'), ('baz', 1) ])
|
||||
env.create_config_header('file')
|
||||
self.assertEqual(open('file','r').read(), '''
|
||||
/* Comment */
|
||||
#define foo
|
||||
#define foo baz qux
|
||||
#define foo baz qux
|
||||
#define bar
|
||||
#define bar 42
|
||||
/* #undef bar */
|
||||
|
||||
# define baz 1
|
||||
|
||||
#ifdef foo
|
||||
# define foo baz qux
|
||||
# define foo baz qux
|
||||
# define foo baz qux
|
||||
#endif
|
||||
''')
|
||||
|
||||
# Tests for get_relative_srcdir, get_depth, get_input and get_file_srcdir,
|
||||
# depending on various cases of top source directory and top build
|
||||
# directory location.
|
||||
class TestPaths(unittest.TestCase):
|
||||
def setUp(self):
|
||||
self.dir = os.path.basename(os.path.abspath(os.curdir))
|
||||
self.absolute = os.path.normpath('/absolute')
|
||||
|
||||
class TestPathsLocalBuildDir(TestPaths):
|
||||
def get_env(self, topsrcdir):
|
||||
env = ConfigEnvironment(topsrcdir = topsrcdir, topobjdir = '.')
|
||||
self.assertEqual(env.get_relative_srcdir('file'), '.')
|
||||
self.assertEqual(env.get_relative_srcdir('dir/file'), 'dir')
|
||||
self.assertEqual(env.get_relative_srcdir('deeply/nested/path/to/file'), 'deeply/nested/path/to')
|
||||
self.assertEqual(env.get_depth('file'), '.')
|
||||
self.assertEqual(env.get_depth('dir/file'), '..')
|
||||
self.assertEqual(env.get_depth('deeply/nested/path/to/file'), '../../../..')
|
||||
return env
|
||||
|
||||
def test_paths_local_build_local_src(self):
|
||||
env = self.get_env('.')
|
||||
self.assertEqual(env.get_input('file'), 'file.in')
|
||||
self.assertEqual(env.get_input('dir/file'), os.path.join('dir', 'file.in'))
|
||||
self.assertEqual(env.get_file_srcdir('file'), '.')
|
||||
self.assertEqual(env.get_file_srcdir('dir/file'), 'dir')
|
||||
|
||||
def test_paths_local_build_parent_src(self):
|
||||
env = self.get_env('..')
|
||||
self.assertEqual(env.get_input('file'), os.path.join('..', 'file.in'))
|
||||
self.assertEqual(env.get_input('dir/file'), os.path.join('..', 'dir', 'file.in'))
|
||||
self.assertEqual(env.get_file_srcdir('file'), '..')
|
||||
self.assertEqual(env.get_file_srcdir('dir/file'), '../dir')
|
||||
|
||||
def test_paths_local_build_absolute_src(self):
|
||||
env = self.get_env(self.absolute)
|
||||
self.assertEqual(env.get_input('file'), os.path.join(self.absolute, 'file.in'))
|
||||
self.assertEqual(env.get_input('dir/file'), os.path.join(self.absolute, 'dir', 'file.in'))
|
||||
self.assertEqual(env.get_input('%s/file' % self.dir), os.path.join(self.absolute, self.dir, 'file.in'))
|
||||
self.assertEqual(env.get_file_srcdir('file'), '/absolute')
|
||||
self.assertEqual(env.get_file_srcdir('dir/file'), '/absolute/dir')
|
||||
self.assertEqual(env.get_file_srcdir('%s/file' % dir), '/absolute/%s' % dir)
|
||||
|
||||
class TestPathsParentBuildDir(TestPaths):
|
||||
def get_env(self, topsrcdir):
|
||||
env = ConfigEnvironment(topsrcdir = topsrcdir, topobjdir = '..')
|
||||
self.assertEqual(env.get_relative_srcdir('..'), '.')
|
||||
self.assertEqual(env.get_relative_srcdir('file'), self.dir)
|
||||
self.assertEqual(env.get_relative_srcdir('dir/file'), '%s/dir' % self.dir)
|
||||
self.assertEqual(env.get_relative_srcdir('deeply/nested/path/to/file'), '%s/deeply/nested/path/to' % self.dir)
|
||||
self.assertEqual(env.get_depth('../file'), '.')
|
||||
self.assertEqual(env.get_depth('file'), '..')
|
||||
self.assertEqual(env.get_depth('dir/file'), '../..')
|
||||
self.assertEqual(env.get_depth('deeply/nested/path/to/file'), '../../../../..')
|
||||
return env
|
||||
|
||||
def test_paths_parent_build_parent_src(self):
|
||||
env = self.get_env('..')
|
||||
self.assertEqual(env.get_input('../file'), os.path.join('..', 'file.in'))
|
||||
self.assertEqual(env.get_input('file'), os.path.join('..', self.dir, 'file.in'))
|
||||
self.assertEqual(env.get_input('dir/file'), os.path.join('..', self.dir, 'dir', 'file.in'))
|
||||
self.assertEqual(env.get_file_srcdir('../file'), '..')
|
||||
self.assertEqual(env.get_file_srcdir('file'), '../%s' % self.dir)
|
||||
self.assertEqual(env.get_file_srcdir('dir/file'), '../%s/dir' % self.dir)
|
||||
|
||||
def test_paths_parent_build_ancestor_src(self):
|
||||
env = self.get_env('../..')
|
||||
self.assertEqual(env.get_input('../file'), os.path.join('..', '..', 'file.in'))
|
||||
self.assertEqual(env.get_input('file'), os.path.join('..', '..', self.dir, 'file.in'))
|
||||
self.assertEqual(env.get_input('dir/file'), os.path.join('..', '..', self.dir, 'dir', 'file.in'))
|
||||
self.assertEqual(env.get_file_srcdir('../file'), '../..')
|
||||
self.assertEqual(env.get_file_srcdir('file'), '../../%s' % self.dir)
|
||||
self.assertEqual(env.get_file_srcdir('dir/file'), '../../%s/dir' % self.dir)
|
||||
|
||||
def test_paths_parent_build_absolute_src(self):
|
||||
env = self.get_env(self.absolute)
|
||||
self.assertEqual(env.get_input('../file'), os.path.join(self.absolute, 'file.in'))
|
||||
self.assertEqual(env.get_input('file'), os.path.join(self.absolute, self.dir, 'file.in'))
|
||||
self.assertEqual(env.get_input('dir/file'), os.path.join(self.absolute, self.dir, 'dir', 'file.in'))
|
||||
self.assertEqual(env.get_file_srcdir('../file'), '/absolute')
|
||||
self.assertEqual(env.get_file_srcdir('file'), '/absolute/%s' % self.dir)
|
||||
self.assertEqual(env.get_file_srcdir('dir/file'), '/absolute/%s/dir' % self.dir)
|
||||
|
||||
class TestPathsRelativeBuild(TestPaths):
|
||||
def get_env(self, topsrcdir):
|
||||
env = ConfigEnvironment(topsrcdir = topsrcdir, topobjdir = 'relative')
|
||||
self.assertEqual(env.get_relative_srcdir('relative/file'), '.')
|
||||
self.assertEqual(env.get_relative_srcdir('relative/dir/file'), 'dir')
|
||||
self.assertEqual(env.get_relative_srcdir('relative/deeply/nested/path/to/file'), 'deeply/nested/path/to')
|
||||
self.assertEqual(env.get_depth('relative/file'), '.')
|
||||
self.assertEqual(env.get_depth('relative/dir/file'), '..')
|
||||
self.assertEqual(env.get_depth('relative/deeply/nested/path/to/file'), '../../../..')
|
||||
return env
|
||||
|
||||
def test_paths_relative_build_relative_src(self):
|
||||
env = self.get_env('relative')
|
||||
self.assertEqual(env.get_input('relative/file'), os.path.join('relative', 'file.in'))
|
||||
self.assertEqual(env.get_input('relative/dir/file'), os.path.join('relative', 'dir', 'file.in'))
|
||||
self.assertEqual(env.get_file_srcdir('relative/file'), 'relative')
|
||||
self.assertEqual(env.get_file_srcdir('relative/dir/file'), 'relative/dir')
|
||||
|
||||
def test_paths_relative_build_local_src(self):
|
||||
env = self.get_env('.')
|
||||
self.assertEqual(env.get_input('relative/file'), 'file.in')
|
||||
self.assertEqual(env.get_input('relative/dir/file'), os.path.join('dir', 'file.in'))
|
||||
self.assertEqual(env.get_file_srcdir('relative/file'), '.')
|
||||
self.assertEqual(env.get_file_srcdir('relative/dir/file'), 'dir')
|
||||
|
||||
def test_paths_relative_build_parent_src(self):
|
||||
env = self.get_env('..')
|
||||
self.assertEqual(env.get_input('relative/file'), os.path.join('..', 'file.in'))
|
||||
self.assertEqual(env.get_input('relative/dir/file'), os.path.join('..', 'dir', 'file.in'))
|
||||
self.assertEqual(env.get_file_srcdir('relative/file'), '..')
|
||||
self.assertEqual(env.get_file_srcdir('relative/dir/file'), '../dir')
|
||||
|
||||
def test_paths_relative_build_absolute_src(self):
|
||||
env = self.get_env(self.absolute)
|
||||
self.assertEqual(env.get_input('relative/file'), os.path.join(self.absolute, 'file.in'))
|
||||
self.assertEqual(env.get_input('relative/dir/file'), os.path.join(self.absolute, 'dir', 'file.in'))
|
||||
self.assertEqual(env.get_file_srcdir('relative/file'), '/absolute')
|
||||
self.assertEqual(env.get_file_srcdir('relative/dir/file'), '/absolute/dir')
|
||||
|
||||
class TestPathsAbsoluteBuild(unittest.TestCase):
|
||||
def setUp(self):
|
||||
self.absolute_build = os.path.normpath('/absolute/build')
|
||||
|
||||
def get_env(self, topsrcdir):
|
||||
env = ConfigEnvironment(topsrcdir = topsrcdir, topobjdir = self.absolute_build)
|
||||
self.assertEqual(env.get_relative_srcdir('/absolute/build/file'), '.')
|
||||
self.assertEqual(env.get_relative_srcdir('/absolute/build/dir/file'), 'dir')
|
||||
self.assertEqual(env.get_relative_srcdir('/absolute/build/deeply/nested/path/to/file'), 'deeply/nested/path/to')
|
||||
self.assertEqual(env.get_depth('/absolute/build/file'), '.')
|
||||
self.assertEqual(env.get_depth('/absolute/build/dir/file'), '..')
|
||||
self.assertEqual(env.get_depth('/absolute/build/deeply/nested/path/to/file'), '../../../..')
|
||||
return env
|
||||
|
||||
def test_paths_absolute_build_same_src(self):
|
||||
env = self.get_env(self.absolute_build)
|
||||
self.assertEqual(env.get_input('/absolute/build/file'), os.path.join(self.absolute_build, 'file.in'))
|
||||
self.assertEqual(env.get_input('/absolute/build/dir/file'), os.path.join(self.absolute_build, 'dir', 'file.in'))
|
||||
self.assertEqual(env.get_file_srcdir('/absolute/build/file'), '/absolute/build')
|
||||
self.assertEqual(env.get_file_srcdir('/absolute/build/dir/file'), '/absolute/build/dir')
|
||||
|
||||
def test_paths_absolute_build_ancestor_src(self):
|
||||
absolute = os.path.dirname(self.absolute_build)
|
||||
env = self.get_env(absolute)
|
||||
self.assertEqual(env.get_input('/absolute/build/file'), os.path.join(absolute, 'file.in'))
|
||||
self.assertEqual(env.get_input('/absolute/build/dir/file'), os.path.join(absolute, 'dir', 'file.in'))
|
||||
self.assertEqual(env.get_file_srcdir('/absolute/build/file'), '/absolute')
|
||||
self.assertEqual(env.get_file_srcdir('/absolute/build/dir/file'), '/absolute/dir')
|
||||
|
||||
def test_paths_absolute_build_different_src(self):
|
||||
absolute = os.path.normpath('/some/path')
|
||||
env = self.get_env(absolute)
|
||||
self.assertEqual(env.get_input('/absolute/build/file'), os.path.join(absolute, 'file.in'))
|
||||
self.assertEqual(env.get_input('/absolute/build/dir/file'), os.path.join(absolute, 'dir', 'file.in'))
|
||||
self.assertEqual(env.get_file_srcdir('/absolute/build/file'), '/some/path')
|
||||
self.assertEqual(env.get_file_srcdir('/absolute/build/dir/file'), '/some/path/dir')
|
||||
|
||||
if __name__ == "__main__":
|
||||
main()
|
|
@ -7,5 +7,6 @@ setup.py:testing/mozbase/mozprocess:develop
|
|||
setup.py:testing/mozbase/mozprofile:develop
|
||||
setup.py:testing/mozbase/mozrunner:develop
|
||||
setup.py:python/blessings:develop
|
||||
setup.py:python/mozbuild:develop
|
||||
mozilla.pth:build
|
||||
mozilla.pth:config
|
||||
|
|
|
@ -320,8 +320,7 @@ endif
|
|||
|
||||
ifneq (,$(CONFIG_STATUS))
|
||||
$(OBJDIR)/config/autoconf.mk: $(TOPSRCDIR)/config/autoconf.mk.in
|
||||
cd $(OBJDIR); \
|
||||
CONFIG_FILES=config/autoconf.mk ./config.status
|
||||
$(OBJDIR)/config.status -n --file=$(OBJDIR)/config/autoconf.mk
|
||||
endif
|
||||
|
||||
|
||||
|
|
|
@ -92,10 +92,17 @@ class Preprocessor:
|
|||
"""
|
||||
Set the marker to be used for processing directives.
|
||||
Used for handling CSS files, with pp.setMarker('%'), for example.
|
||||
The given marker may be None, in which case no markers are processed.
|
||||
"""
|
||||
self.marker = aMarker
|
||||
self.instruction = re.compile('%s(?P<cmd>[a-z]+)(?:\s(?P<args>.*))?$'%aMarker, re.U)
|
||||
self.comment = re.compile(aMarker, re.U)
|
||||
if aMarker:
|
||||
self.instruction = re.compile('%s(?P<cmd>[a-z]+)(?:\s(?P<args>.*))?$'%aMarker, re.U)
|
||||
self.comment = re.compile(aMarker, re.U)
|
||||
else:
|
||||
class NoMatch(object):
|
||||
def match(self, *args):
|
||||
return False
|
||||
self.instruction = self.comment = NoMatch()
|
||||
|
||||
def clone(self):
|
||||
"""
|
||||
|
@ -392,7 +399,7 @@ class Preprocessor:
|
|||
return str(self.context[varname])
|
||||
if fatal:
|
||||
raise Preprocessor.Error(self, 'UNDEFINED_VAR', varname)
|
||||
return ''
|
||||
return matchobj.group(0)
|
||||
return self.varsubst.sub(repl, aLine)
|
||||
def filter_attemptSubstitution(self, aLine):
|
||||
return self.filter_substitution(aLine, fatal=False)
|
||||
|
|
|
@ -1,164 +0,0 @@
|
|||
#!/perl
|
||||
# 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/.
|
||||
|
||||
|
||||
use File::Path;
|
||||
use Getopt::Std;
|
||||
use IO::File;
|
||||
use mozLock;
|
||||
|
||||
getopts("lxo:");
|
||||
|
||||
my $installedChromeFile = $ARGV[0];
|
||||
my $disableJarPackaging = $ARGV[1];
|
||||
my $chromeType = $ARGV[2];
|
||||
my $pkgName = $ARGV[3];
|
||||
my $jarFileName = $ARGV[4];
|
||||
|
||||
my $win32 = ($^O =~ /((MS)?win32)|msys|cygwin|os2/i) ? 1 : 0;
|
||||
my $macos = ($^O =~ /MacOS|darwin/i) ? 1 : 0;
|
||||
my $unix = !($win32 || $macos) ? 1 : 0;
|
||||
|
||||
sub foreignPlatformFile
|
||||
{
|
||||
my ($jarfile) = @_;
|
||||
|
||||
if (!$win32 && index($jarfile, "-win") != -1) {
|
||||
return 1;
|
||||
}
|
||||
|
||||
if (!$unix && index($jarfile, "-unix") != -1) {
|
||||
return 1;
|
||||
}
|
||||
|
||||
if (!$macos && index($jarfile, "-mac") != -1) {
|
||||
return 1;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
sub foreignPlatformPath
|
||||
{
|
||||
my ($jarpath) = @_;
|
||||
|
||||
if (!$win32 && index($jarpath, "-platform/win") != -1) {
|
||||
return 1;
|
||||
}
|
||||
|
||||
if (!$unix && index($jarpath, "-platform/unix") != -1) {
|
||||
return 1;
|
||||
}
|
||||
|
||||
if (!$macos && index($jarpath, "-platform/mac") != -1) {
|
||||
return 1;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
#print "add-chrome $installedChromeFile $disableJarPackaging $chromeType $pkgName $jarFileName\n";
|
||||
|
||||
my $nofilelocks = 0;
|
||||
if (defined($::opt_l)) {
|
||||
$nofilelocks = 1;
|
||||
}
|
||||
|
||||
if (defined($::opt_x)) {
|
||||
$win32 = 0;
|
||||
$macos = 0;
|
||||
$unix = 1;
|
||||
}
|
||||
|
||||
my $force_os;
|
||||
if (defined($::opt_o)) {
|
||||
$force_os = $::opt_o;
|
||||
}
|
||||
|
||||
if (defined($force_os)) {
|
||||
$win32 = 0;
|
||||
$macos = 0;
|
||||
$unix = 0;
|
||||
if ($force_os eq "WINNT") {
|
||||
$win32 = 1;
|
||||
} elsif ($force_os eq "OS2") {
|
||||
$win32 = 1;
|
||||
} elsif ($force_os eq "Darwin") {
|
||||
$macos = 1;
|
||||
} else {
|
||||
$unix = 1;
|
||||
}
|
||||
}
|
||||
|
||||
if ($jarFileName =~ /(.*)\.jar/) {
|
||||
$jarFileName = $1;
|
||||
}
|
||||
|
||||
if (!foreignPlatformFile($jarFileName) && !foreignPlatformPath($pkgName)) {
|
||||
|
||||
my $line;
|
||||
if ($disableJarPackaging) {
|
||||
$line = "$chromeType,install,url,resource:/chrome/$jarFileName/$chromeType/$pkgName/";
|
||||
}
|
||||
else {
|
||||
$line = "$chromeType,install,url,jar:resource:/chrome/$jarFileName.jar!/$chromeType/$pkgName/";
|
||||
}
|
||||
|
||||
my $lockfile = "$installedChromeFile.lck";
|
||||
my $err;
|
||||
|
||||
mozLock($lockfile) if (!$nofilelocks);
|
||||
$err = 0;
|
||||
if (open(FILE, "<$installedChromeFile")) {
|
||||
while (<FILE>) {
|
||||
chomp;
|
||||
if ($_ eq $line) {
|
||||
# line already appears in installed-chrome.txt file
|
||||
# just update the mod date
|
||||
close(FILE) or $err = 1;
|
||||
if ($err) {
|
||||
mozUnlock($lockfile) if (!$nofilelocks);
|
||||
die "error: can't close $installedChromeFile: $!";
|
||||
}
|
||||
my $now = time;
|
||||
utime($now, $now, $installedChromeFile) or $err = 1;
|
||||
mozUnlock($lockfile) if (!$nofilelocks);
|
||||
if ($err) {
|
||||
die "couldn't touch $installedChromeFile";
|
||||
}
|
||||
print "+++ updating chrome $installedChromeFile\n+++\t$line\n";
|
||||
exit;
|
||||
}
|
||||
}
|
||||
close(FILE) or $err = 1;
|
||||
if ($err) {
|
||||
mozUnlock($lockfile) if (!$nofilelocks);
|
||||
die "error: can't close $installedChromeFile: $!";
|
||||
}
|
||||
}
|
||||
mozUnlock($lockfile) if (!$nofilelocks);
|
||||
|
||||
my $dir = $installedChromeFile;
|
||||
if ("$dir" =~ /([\w\d.\-\\\/]+)[\\\/]([\w\d.\-]+)/) {
|
||||
$dir = $1;
|
||||
}
|
||||
mkpath($dir, 0, 0755);
|
||||
|
||||
mozLock($lockfile) if (!$nofilelocks);
|
||||
$err = 0;
|
||||
open(FILE, ">>$installedChromeFile") or $err = 1;
|
||||
if ($err) {
|
||||
mozUnlock($lockfile) if (!$nofilelocks);
|
||||
die "can't open $installedChromeFile: $!";
|
||||
}
|
||||
print FILE "$line\n";
|
||||
close(FILE) or $err = 1;
|
||||
mozUnlock($lockfile) if (!$nofilelocks);
|
||||
if ($err) {
|
||||
die "error: can't close $installedChromeFile: $!";
|
||||
}
|
||||
print "+++ adding chrome $installedChromeFile\n+++\t$line\n";
|
||||
}
|
||||
|
|
@ -82,7 +82,6 @@ MOZ_CALLGRIND = @MOZ_CALLGRIND@
|
|||
MOZ_VALGRIND = @MOZ_VALGRIND@
|
||||
MOZ_VTUNE = @MOZ_VTUNE@
|
||||
MOZ_ETW = @MOZ_ETW@
|
||||
MOZ_TRACE_JSCALLS = @MOZ_TRACE_JSCALLS@
|
||||
DEHYDRA_PATH = @DEHYDRA_PATH@
|
||||
|
||||
MOZ_USING_CCACHE = @MOZ_USING_CCACHE@
|
||||
|
@ -104,7 +103,6 @@ IBMBIDI = @IBMBIDI@
|
|||
MOZ_UNIVERSALCHARDET = @MOZ_UNIVERSALCHARDET@
|
||||
ACCESSIBILITY = @ACCESSIBILITY@
|
||||
MOZ_BRANDING_DIRECTORY = @MOZ_BRANDING_DIRECTORY@
|
||||
XPCOM_USE_LEA = @XPCOM_USE_LEA@
|
||||
MOZ_MAINTENANCE_SERVICE = @MOZ_MAINTENANCE_SERVICE@
|
||||
MOZ_VERIFY_MAR_SIGNATURE = @MOZ_VERIFY_MAR_SIGNATURE@
|
||||
MOZ_ENABLE_SIGNMAR = @MOZ_ENABLE_SIGNMAR@
|
||||
|
@ -484,7 +482,6 @@ DLL_SUFFIX = @DLL_SUFFIX@
|
|||
NO_LD_ARCHIVE_FLAGS = @NO_LD_ARCHIVE_FLAGS@
|
||||
|
||||
GTK_CONFIG = @GTK_CONFIG@
|
||||
QT_CONFIG = @QT_CONFIG@
|
||||
TK_CFLAGS = @TK_CFLAGS@
|
||||
TK_LIBS = @TK_LIBS@
|
||||
|
||||
|
@ -580,10 +577,6 @@ MOZ_OS2_HIGH_MEMORY = @MOZ_OS2_HIGH_MEMORY@
|
|||
|
||||
MOZ_PSM=@MOZ_PSM@
|
||||
|
||||
# Gssapi (krb5) libraries and headers for the Negotiate auth method
|
||||
GSSAPI_INCLUDES = @GSSAPI_INCLUDES@
|
||||
USE_GSSAPI = @USE_GSSAPI@
|
||||
|
||||
MOZILLA_OFFICIAL = @MOZILLA_OFFICIAL@
|
||||
|
||||
# Win32 options
|
||||
|
|
|
@ -126,13 +126,12 @@ MKDIR ?= mkdir
|
|||
SLEEP ?= sleep
|
||||
TOUCH ?= touch
|
||||
|
||||
ifndef .PYMAKE
|
||||
PYTHON_PATH = $(PYTHON) $(topsrcdir)/config/pythonpath.py
|
||||
else
|
||||
ifdef .PYMAKE
|
||||
PYCOMMANDPATH += $(topsrcdir)/config
|
||||
PYTHON_PATH = %pythonpath main
|
||||
endif
|
||||
|
||||
PYTHON_PATH = $(PYTHON) $(topsrcdir)/config/pythonpath.py
|
||||
|
||||
# determine debug-related options
|
||||
_DEBUG_ASFLAGS :=
|
||||
_DEBUG_CFLAGS :=
|
||||
|
|
|
@ -1153,27 +1153,26 @@ GARBAGE_DIRS += $(_JAVA_DIR)
|
|||
###############################################################################
|
||||
|
||||
ifndef NO_MAKEFILE_RULE
|
||||
# Note: Passing depth to make-makefile is optional.
|
||||
# It saves the script some work, though.
|
||||
Makefile: Makefile.in
|
||||
@$(PERL) $(AUTOCONF_TOOLS)/make-makefile -t $(topsrcdir) -d $(DEPTH)
|
||||
@$(DEPTH)/config.status -n --file=Makefile
|
||||
endif
|
||||
|
||||
ifndef NO_SUBMAKEFILES_RULE
|
||||
ifdef SUBMAKEFILES
|
||||
# VPATH does not work on some machines in this case, so add $(srcdir)
|
||||
$(SUBMAKEFILES): % : $(srcdir)/%.in
|
||||
$(if $(subsrcdir),cd $(subsrcdir) && )$(PERL) $(AUTOCONF_TOOLS)/make-makefile -t $(topsrcdir)$(addprefix /,$(subsrcdir)) -d $(DEPTH) $(@:$(subsrcdir)/%=%)
|
||||
$(DEPTH)$(addprefix /,$(subsrcdir))/config.status -n --file=$@
|
||||
endif
|
||||
endif
|
||||
|
||||
ifdef AUTOUPDATE_CONFIGURE
|
||||
$(topsrcdir)/configure: $(topsrcdir)/configure.in
|
||||
(cd $(topsrcdir) && $(AUTOCONF)) && (cd $(DEPTH) && ./config.status --recheck)
|
||||
(cd $(topsrcdir) && $(AUTOCONF)) && $(DEPTH)/config.status -n --recheck)
|
||||
endif
|
||||
|
||||
$(DEPTH)/config/autoconf.mk: $(topsrcdir)/config/autoconf.mk.in
|
||||
cd $(DEPTH) && CONFIG_HEADERS= CONFIG_FILES=config/autoconf.mk ./config.status
|
||||
$(DEPTH)/config.status -n --file=$(DEPTH)/config/autoconf.mk
|
||||
$(TOUCH) $@
|
||||
|
||||
###############################################################################
|
||||
# Bunch of things that extend the 'export' rule (in order):
|
||||
|
@ -1385,14 +1384,11 @@ libs::
|
|||
endif
|
||||
|
||||
################################################################################
|
||||
# Copy each element of EXTRA_JS_MODULES to JS_MODULES_PATH, or
|
||||
# $(FINAL_TARGET)/modules if that isn't defined.
|
||||
JS_MODULES_PATH ?= $(FINAL_TARGET)/modules
|
||||
|
||||
# Copy each element of EXTRA_JS_MODULES to $(FINAL_TARGET)/modules
|
||||
ifdef EXTRA_JS_MODULES
|
||||
libs:: $(EXTRA_JS_MODULES)
|
||||
ifndef NO_DIST_INSTALL
|
||||
$(call install_cmd,$(IFLAGS1) $^ $(JS_MODULES_PATH))
|
||||
$(call install_cmd,$(IFLAGS1) $^ $(FINAL_TARGET)/modules)
|
||||
endif
|
||||
|
||||
endif
|
||||
|
@ -1401,9 +1397,9 @@ ifdef EXTRA_PP_JS_MODULES
|
|||
libs:: $(EXTRA_PP_JS_MODULES)
|
||||
ifndef NO_DIST_INSTALL
|
||||
$(EXIT_ON_ERROR) \
|
||||
$(NSINSTALL) -D $(JS_MODULES_PATH); \
|
||||
$(NSINSTALL) -D $(FINAL_TARGET)/modules; \
|
||||
for i in $^; do \
|
||||
dest=$(JS_MODULES_PATH)/`basename $$i`; \
|
||||
dest=$(FINAL_TARGET)/modules/`basename $$i`; \
|
||||
$(RM) -f $$dest; \
|
||||
$(PYTHON) $(topsrcdir)/config/Preprocessor.py $(DEFINES) $(ACDEFINES) $(XULPPFLAGS) $$i > $$dest; \
|
||||
done
|
||||
|
@ -1553,23 +1549,6 @@ libs::
|
|||
|
||||
endif
|
||||
|
||||
ifneq (,$(filter flat symlink,$(MOZ_CHROME_FILE_FORMAT)))
|
||||
_JAR_REGCHROME_DISABLE_JAR=1
|
||||
else
|
||||
_JAR_REGCHROME_DISABLE_JAR=0
|
||||
endif
|
||||
|
||||
REGCHROME = $(PERL) -I$(MOZILLA_DIR)/config $(MOZILLA_DIR)/config/add-chrome.pl \
|
||||
$(if $(filter gtk2,$(MOZ_WIDGET_TOOLKIT)),-x) \
|
||||
$(if $(CROSS_COMPILE),-o $(OS_ARCH)) $(FINAL_TARGET)/chrome/installed-chrome.txt \
|
||||
$(_JAR_REGCHROME_DISABLE_JAR)
|
||||
|
||||
REGCHROME_INSTALL = $(PERL) -I$(MOZILLA_DIR)/config $(MOZILLA_DIR)/config/add-chrome.pl \
|
||||
$(if $(filter gtk2,$(MOZ_WIDGET_TOOLKIT)),-x) \
|
||||
$(if $(CROSS_COMPILE),-o $(OS_ARCH)) $(DESTDIR)$(mozappdir)/chrome/installed-chrome.txt \
|
||||
$(_JAR_REGCHROME_DISABLE_JAR)
|
||||
|
||||
|
||||
#############################################################################
|
||||
# Dependency system
|
||||
#############################################################################
|
||||
|
|
|
@ -33,6 +33,16 @@ PASS
|
|||
self.pp.do_include(f)
|
||||
self.assertEqual(self.pp.out.getvalue(), "PASS\n")
|
||||
|
||||
def test_no_marker(self):
|
||||
no_marker = """#if 0
|
||||
PASS
|
||||
#endif
|
||||
"""
|
||||
f = NamedIO("no_marker.in", no_marker)
|
||||
self.pp.setMarker(None)
|
||||
self.pp.do_include(f)
|
||||
self.assertEqual(self.pp.out.getvalue(), no_marker)
|
||||
|
||||
def test_string_value(self):
|
||||
f = NamedIO("string_value.in", """#define FOO STRING
|
||||
#if FOO
|
||||
|
@ -172,11 +182,11 @@ BAR
|
|||
|
||||
def test_filter_attemptSubstitution(self):
|
||||
f = NamedIO('filter_attemptSubstitution.in', '''#filter attemptSubstitution
|
||||
P@VAR@ASS
|
||||
@PASS@
|
||||
#unfilter attemptSubstitution
|
||||
''')
|
||||
self.pp.do_include(f)
|
||||
self.assertEqual(self.pp.out.getvalue(), "PASS\n")
|
||||
self.assertEqual(self.pp.out.getvalue(), "@PASS@\n")
|
||||
|
||||
def test_filter_emptyLines(self):
|
||||
f = NamedIO('filter_emptyLines.in', '''lines with a
|
||||
|
|
151
configure.in
151
configure.in
|
@ -1033,7 +1033,6 @@ ASM_SUFFIX=s
|
|||
IMPORT_LIB_SUFFIX=
|
||||
TARGET_MD_ARCH=unix
|
||||
DIRENT_INO=d_ino
|
||||
WIN_TOP_SRC=
|
||||
MOZ_USER_DIR=".mozilla"
|
||||
|
||||
MOZ_JPEG_CFLAGS=
|
||||
|
@ -2991,6 +2990,8 @@ case $target in
|
|||
;;
|
||||
esac
|
||||
|
||||
MOZ_LINUX_PERF_EVENT
|
||||
|
||||
dnl Checks for libraries.
|
||||
dnl ========================================================
|
||||
case $target in
|
||||
|
@ -3252,6 +3253,7 @@ AC_CACHE_CHECK(for clock_gettime(CLOCK_MONOTONIC),
|
|||
[ struct timespec ts;
|
||||
clock_gettime(CLOCK_MONOTONIC, &ts); ],
|
||||
ac_cv_clock_monotonic=$libs
|
||||
LIBS="$_SAVE_LIBS"
|
||||
break,
|
||||
ac_cv_clock_monotonic=no)
|
||||
LIBS="$_SAVE_LIBS"
|
||||
|
@ -3859,7 +3861,7 @@ if test -n "$MOZ_NATIVE_NSPR"; then
|
|||
AC_MSG_ERROR([system NSPR does not support PR_UINT64 or including prtypes.h does not provide it]))
|
||||
CFLAGS=$_SAVE_CFLAGS
|
||||
else
|
||||
if test "$OS_ARCH" = "WINNT"; then
|
||||
if test -z "$LIBXUL_SDK"; then
|
||||
NSPR_CFLAGS="-I${LIBXUL_DIST}/include/nspr"
|
||||
if test -n "$GNU_CC"; then
|
||||
NSPR_LIBS="-L${LIBXUL_DIST}/lib -lnspr${NSPR_VERSION} -lplc${NSPR_VERSION} -lplds${NSPR_VERSION}"
|
||||
|
@ -3867,8 +3869,8 @@ else
|
|||
NSPR_LIBS="${LIBXUL_DIST}/lib/nspr${NSPR_VERSION}.lib ${LIBXUL_DIST}/lib/plc${NSPR_VERSION}.lib ${LIBXUL_DIST}/lib/plds${NSPR_VERSION}.lib "
|
||||
fi
|
||||
else
|
||||
NSPR_CFLAGS='`$(LIBXUL_DIST)/sdk/bin/nspr-config --prefix='${LIBXUL_DIST}' --includedir='${LIBXUL_DIST}'/include/nspr --cflags`'
|
||||
NSPR_LIBS='`$(LIBXUL_DIST)/sdk/bin/nspr-config --prefix='${LIBXUL_DIST}' --libdir='${LIBXUL_DIST}'/lib --libs`'
|
||||
NSPR_CFLAGS=`"${LIBXUL_DIST}"/sdk/bin/nspr-config --prefix="${LIBXUL_DIST}" --includedir="${LIBXUL_DIST}/include/nspr" --cflags`
|
||||
NSPR_LIBS=`"${LIBXUL_DIST}"/sdk/bin/nspr-config --prefix="${LIBXUL_DIST}" --libdir="${LIBXUL_DIST}"/lib --libs`
|
||||
fi
|
||||
fi
|
||||
|
||||
|
@ -7987,8 +7989,6 @@ if test "$MOZ_TREE_CAIRO"; then
|
|||
fi
|
||||
|
||||
CAIRO_FEATURES_H=gfx/cairo/cairo/src/cairo-features.h
|
||||
mv -f $CAIRO_FEATURES_H "$CAIRO_FEATURES_H".orig 2> /dev/null
|
||||
|
||||
else
|
||||
PKG_CHECK_MODULES(CAIRO, cairo >= $CAIRO_VERSION)
|
||||
MOZ_CAIRO_CFLAGS="$CAIRO_CFLAGS"
|
||||
|
@ -8110,6 +8110,7 @@ NECKO_PROTOCOLS=`${PERL} ${srcdir}/build/unix/uniq.pl ${NECKO_PROTOCOLS}`
|
|||
AC_SUBST(NECKO_PROTOCOLS)
|
||||
for p in $NECKO_PROTOCOLS; do
|
||||
AC_DEFINE_UNQUOTED(NECKO_PROTOCOL_$p)
|
||||
_NON_GLOBAL_ACDEFINES="$_NON_GLOBAL_ACDEFINES NECKO_PROTOCOL_$p"
|
||||
done
|
||||
|
||||
dnl
|
||||
|
@ -8142,6 +8143,7 @@ fi
|
|||
|
||||
if test "$NECKO_WIFI"; then
|
||||
AC_DEFINE(NECKO_WIFI)
|
||||
_NON_GLOBAL_ACDEFINES="$_NON_GLOBAL_ACDEFINES NECKO_WIFI"
|
||||
fi
|
||||
AC_SUBST(NECKO_WIFI)
|
||||
|
||||
|
@ -8155,6 +8157,7 @@ MOZ_ARG_DISABLE_BOOL(cookies,
|
|||
AC_SUBST(NECKO_COOKIES)
|
||||
if test "$NECKO_COOKIES"; then
|
||||
AC_DEFINE(NECKO_COOKIES)
|
||||
_NON_GLOBAL_ACDEFINES="$_NON_GLOBAL_ACDEFINES NECKO_COOKIES"
|
||||
fi
|
||||
|
||||
dnl
|
||||
|
@ -8169,9 +8172,6 @@ if test "$BUILD_CTYPES"; then
|
|||
AC_DEFINE(BUILD_CTYPES)
|
||||
fi
|
||||
|
||||
dnl NECKO_ configuration options are not global
|
||||
_NON_GLOBAL_ACDEFINES="$_NON_GLOBAL_ACDEFINES NECKO_"
|
||||
|
||||
dnl Build Places if required
|
||||
if test "$MOZ_PLACES"; then
|
||||
AC_DEFINE(MOZ_PLACES)
|
||||
|
@ -8671,14 +8671,6 @@ if test "$ACCESSIBILITY" -a "$MOZ_ENABLE_GTK2" ; then
|
|||
AC_DEFINE_UNQUOTED(ATK_REV_VERSION, $ATK_REV_VERSION)
|
||||
fi
|
||||
|
||||
case "$host_os" in
|
||||
mingw*)
|
||||
WIN_TOP_SRC=`cd $srcdir; pwd -W`
|
||||
;;
|
||||
esac
|
||||
|
||||
AC_SUBST(WIN_TOP_SRC)
|
||||
|
||||
AC_SUBST(MOZILLA_VERSION)
|
||||
|
||||
AC_SUBST(ac_configure_args)
|
||||
|
@ -8696,6 +8688,7 @@ HAVE_CPP_DYNAMIC_CAST_TO_VOID_PTR
|
|||
HAVE_CPP_PARTIAL_SPECIALIZATION
|
||||
HAVE_CPP_TROUBLE_COMPARING_TO_ZERO
|
||||
HAVE_STATVFS
|
||||
HAVE_STATVFS64
|
||||
NEED_CPP_UNUSED_IMPLEMENTATIONS
|
||||
NEW_H
|
||||
HAVE_GETPAGESIZE
|
||||
|
@ -8729,80 +8722,6 @@ case "$host" in
|
|||
;;
|
||||
esac
|
||||
|
||||
# Save the defines header file before autoconf removes it.
|
||||
# (Do not add AC_DEFINE calls after this line.)
|
||||
_CONFIG_TMP=confdefs-tmp.h
|
||||
_CONFIG_DEFS_H=mozilla-config.h
|
||||
|
||||
cat > $_CONFIG_TMP <<\EOF
|
||||
/* List of defines generated by configure. Included with preprocessor flag,
|
||||
* -include, to avoid long list of -D defines on the compile command-line.
|
||||
* Do not edit.
|
||||
*/
|
||||
|
||||
#ifndef _MOZILLA_CONFIG_H_
|
||||
#define _MOZILLA_CONFIG_H_
|
||||
EOF
|
||||
|
||||
_EGREP_PATTERN='^#define ('
|
||||
if test -n "$_NON_GLOBAL_ACDEFINES"; then
|
||||
for f in $_NON_GLOBAL_ACDEFINES; do
|
||||
_EGREP_PATTERN="${_EGREP_PATTERN}$f|"
|
||||
done
|
||||
fi
|
||||
_EGREP_PATTERN="${_EGREP_PATTERN}dummy_never_defined)"
|
||||
|
||||
sort confdefs.h | $FIXED_EGREP -v "$_EGREP_PATTERN" >> $_CONFIG_TMP
|
||||
|
||||
if test "$?" != 0; then
|
||||
AC_MSG_ERROR([Error outputting config definitions])
|
||||
fi
|
||||
|
||||
cat >> $_CONFIG_TMP <<\EOF
|
||||
|
||||
/* The c99 defining the limit macros (UINT32_MAX for example), says:
|
||||
* C++ implementations should define these macros only when __STDC_LIMIT_MACROS
|
||||
* is defined before <stdint.h> is included. */
|
||||
#define __STDC_LIMIT_MACROS
|
||||
|
||||
/* Force-include hunspell_alloc_hooks.h for hunspell, so that we don't need to
|
||||
* modify it directly.
|
||||
*
|
||||
* HUNSPELL_STATIC is defined in extensions/spellcheck/hunspell/src/Makefile.in,
|
||||
* unless --enable-system-hunspell is defined.
|
||||
*/
|
||||
#if defined(HUNSPELL_STATIC)
|
||||
#include "hunspell_alloc_hooks.h"
|
||||
#endif
|
||||
|
||||
#endif /* _MOZILLA_CONFIG_H_ */
|
||||
|
||||
EOF
|
||||
|
||||
# Only write mozilla-config.h when something changes (or it doesn't exist)
|
||||
if cmp -s $_CONFIG_TMP $_CONFIG_DEFS_H; then
|
||||
rm $_CONFIG_TMP
|
||||
else
|
||||
AC_MSG_RESULT("creating $_CONFIG_DEFS_H")
|
||||
mv -f $_CONFIG_TMP $_CONFIG_DEFS_H
|
||||
|
||||
echo ==== $_CONFIG_DEFS_H =================================
|
||||
cat $_CONFIG_DEFS_H
|
||||
fi
|
||||
|
||||
dnl Probably shouldn't call this manually but we always want the output of DEFS
|
||||
rm -f confdefs.h.save
|
||||
mv confdefs.h confdefs.h.save
|
||||
$FIXED_EGREP -v "$_EGREP_PATTERN" confdefs.h.save > confdefs.h
|
||||
if test "$?" != 0; then
|
||||
AC_MSG_ERROR([Error outputting confdefs.h])
|
||||
fi
|
||||
AC_OUTPUT_MAKE_DEFS()
|
||||
ACDEFINES=$DEFS
|
||||
AC_SUBST(ACDEFINES)
|
||||
rm -f confdefs.h
|
||||
mv confdefs.h.save confdefs.h
|
||||
|
||||
dnl Create a virtualenv where we can install local Python packages
|
||||
AC_MSG_RESULT([Creating Python virtualenv])
|
||||
rm -rf _virtualenv
|
||||
|
@ -8832,27 +8751,9 @@ dnl Load the list of Makefiles to generate.
|
|||
dnl To add new Makefiles, edit allmakefiles.sh.
|
||||
dnl allmakefiles.sh sets the variable, MAKEFILES.
|
||||
. ${srcdir}/allmakefiles.sh
|
||||
dnl
|
||||
dnl Run a perl script to quickly create the makefiles.
|
||||
dnl If it succeeds, it outputs a shell command to set CONFIG_FILES
|
||||
dnl for the files it cannot handle correctly. This way, config.status
|
||||
dnl will handle these files.
|
||||
dnl If it fails, nothing is set and config.status will run as usual.
|
||||
dnl
|
||||
dnl This does not change the $MAKEFILES variable.
|
||||
dnl
|
||||
echo $MAKEFILES | ${PERL} $srcdir/build/autoconf/acoutput-fast.pl > conftest.sh
|
||||
res="$?"
|
||||
if test "$res" != 0; then
|
||||
exit $res
|
||||
fi
|
||||
. ./conftest.sh
|
||||
rm conftest.sh
|
||||
|
||||
echo $MAKEFILES > unallmakefiles
|
||||
|
||||
mv -f config/autoconf.mk config/autoconf.mk.orig 2> /dev/null
|
||||
|
||||
AC_OUTPUT($MAKEFILES)
|
||||
|
||||
# Generate Makefiles for WebRTC directly from .gyp files
|
||||
|
@ -8912,16 +8813,6 @@ else
|
|||
mv -f ./mozinfo.json.tmp ./mozinfo.json
|
||||
fi
|
||||
|
||||
dnl Prevent the regeneration of cairo-features.h forcing rebuilds of gfx stuff
|
||||
if test "$CAIRO_FEATURES_H"; then
|
||||
if cmp -s $CAIRO_FEATURES_H "$CAIRO_FEATURES_H".orig; then
|
||||
echo "$CAIRO_FEATURES_H is unchanged"
|
||||
mv -f "$CAIRO_FEATURES_H".orig "$CAIRO_FEATURES_H" 2> /dev/null
|
||||
else
|
||||
rm -f "$CAIRO_FEATURES_H".orig 2> /dev/null
|
||||
fi
|
||||
fi
|
||||
|
||||
# Run jemalloc configure script
|
||||
|
||||
if test "$MOZ_JEMALLOC" -a "$MOZ_MEMORY"; then
|
||||
|
@ -9074,18 +8965,6 @@ if test -z "$MOZ_NATIVE_NSPR"; then
|
|||
ac_configure_args="$_SUBDIR_CONFIG_ARGS"
|
||||
fi
|
||||
|
||||
if test -z "$MOZ_NATIVE_NSPR"; then
|
||||
# Hack to deal with the fact that we use NSPR_CFLAGS everywhere
|
||||
AC_MSG_WARN([Recreating autoconf.mk with updated nspr-config output])
|
||||
if test "$OS_ARCH" != "WINNT"; then
|
||||
NSPR_LIBS=`./nsprpub/config/nspr-config --prefix=$LIBXUL_DIST --exec-prefix=$MOZ_BUILD_ROOT/dist --libdir=$LIBXUL_DIST/lib --libs`
|
||||
$PERL -pi.bak -e "s '^NSPR_LIBS\\s*=.*'NSPR_LIBS = $NSPR_LIBS'" config/autoconf.mk
|
||||
NSPR_CFLAGS=`./nsprpub/config/nspr-config --prefix=$LIBXUL_DIST --exec-prefix=$MOZ_BUILD_ROOT/dist --includedir=$LIBXUL_DIST/include/nspr --cflags`
|
||||
$PERL -pi.bak -e "s '^NSPR_CFLAGS\\s*=.*'NSPR_CFLAGS = $NSPR_CFLAGS'" config/autoconf.mk
|
||||
fi
|
||||
rm -f config/autoconf.mk.bak
|
||||
fi
|
||||
|
||||
dnl ========================================================
|
||||
dnl = Setup a nice relatively clean build environment for
|
||||
dnl = sub-configures.
|
||||
|
@ -9142,13 +9021,3 @@ AC_OUTPUT_SUBDIRS(js/src)
|
|||
ac_configure_args="$_SUBDIR_CONFIG_ARGS"
|
||||
|
||||
fi # COMPILE_ENVIRONMENT && !LIBXUL_SDK_DIR
|
||||
|
||||
dnl Prevent the regeneration of autoconf.mk forcing rebuilds of the world
|
||||
dnl Needs to be at the end to respect possible changes from NSPR configure
|
||||
if cmp -s config/autoconf.mk config/autoconf.mk.orig; then
|
||||
echo "config/autoconf.mk is unchanged"
|
||||
mv -f config/autoconf.mk.orig config/autoconf.mk 2> /dev/null
|
||||
else
|
||||
rm -f config/autoconf.mk.orig 2> /dev/null
|
||||
fi
|
||||
|
||||
|
|
|
@ -2019,44 +2019,6 @@ public:
|
|||
*/
|
||||
static bool IsJavaScriptLanguage(const nsString& aName, PRUint32 *aVerFlags);
|
||||
|
||||
/**
|
||||
* Returns the JSVersion for a string of the form '1.n', n = 0, ..., 8, and
|
||||
* JSVERSION_UNKNOWN for other strings.
|
||||
*/
|
||||
static JSVersion ParseJavascriptVersion(const nsAString& aVersionStr);
|
||||
|
||||
static bool IsJavascriptMIMEType(const nsAString& aMIMEType)
|
||||
{
|
||||
// Table ordered from most to least likely JS MIME types.
|
||||
static const char* jsTypes[] = {
|
||||
"text/javascript",
|
||||
"text/ecmascript",
|
||||
"application/javascript",
|
||||
"application/ecmascript",
|
||||
"application/x-javascript",
|
||||
"application/x-ecmascript",
|
||||
"text/javascript1.0",
|
||||
"text/javascript1.1",
|
||||
"text/javascript1.2",
|
||||
"text/javascript1.3",
|
||||
"text/javascript1.4",
|
||||
"text/javascript1.5",
|
||||
"text/jscript",
|
||||
"text/livescript",
|
||||
"text/x-ecmascript",
|
||||
"text/x-javascript",
|
||||
nullptr
|
||||
};
|
||||
|
||||
for (PRUint32 i = 0; jsTypes[i]; ++i) {
|
||||
if (aMIMEType.LowerCaseEqualsASCII(jsTypes[i])) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
static void SplitMimeType(const nsAString& aValue, nsString& aType,
|
||||
nsString& aParams);
|
||||
|
||||
|
|
|
@ -444,8 +444,10 @@ nsAttrAndChildArray::RemoveAttrAt(PRUint32 aPos, nsAttrValue& aValue)
|
|||
return NS_OK;
|
||||
}
|
||||
|
||||
nsRefPtr<nsMappedAttributes> mapped =
|
||||
GetModifiableMapped(nullptr, nullptr, false);
|
||||
nsRefPtr<nsMappedAttributes> mapped;
|
||||
nsresult rv = GetModifiableMapped(nullptr, nullptr, false,
|
||||
getter_AddRefs(mapped));
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
mapped->RemoveAttrAt(aPos, aValue);
|
||||
|
||||
|
@ -556,15 +558,18 @@ nsAttrAndChildArray::SetAndTakeMappedAttr(nsIAtom* aLocalName,
|
|||
nsMappedAttributeElement* aContent,
|
||||
nsHTMLStyleSheet* aSheet)
|
||||
{
|
||||
nsRefPtr<nsMappedAttributes> mapped;
|
||||
|
||||
bool willAdd = true;
|
||||
if (mImpl && mImpl->mMappedAttrs) {
|
||||
willAdd = !mImpl->mMappedAttrs->GetAttr(aLocalName);
|
||||
willAdd = mImpl->mMappedAttrs->GetAttr(aLocalName) == nullptr;
|
||||
}
|
||||
|
||||
nsRefPtr<nsMappedAttributes> mapped =
|
||||
GetModifiableMapped(aContent, aSheet, willAdd);
|
||||
nsresult rv = GetModifiableMapped(aContent, aSheet, willAdd,
|
||||
getter_AddRefs(mapped));
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
nsresult rv = mapped->SetAndTakeAttr(aLocalName, aValue);
|
||||
rv = mapped->SetAndTakeAttr(aLocalName, aValue);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
return MakeMappedUnique(mapped);
|
||||
|
@ -579,8 +584,10 @@ nsAttrAndChildArray::DoSetMappedAttrStyleSheet(nsHTMLStyleSheet* aSheet)
|
|||
return NS_OK;
|
||||
}
|
||||
|
||||
nsRefPtr<nsMappedAttributes> mapped =
|
||||
GetModifiableMapped(nullptr, nullptr, false);
|
||||
nsRefPtr<nsMappedAttributes> mapped;
|
||||
nsresult rv = GetModifiableMapped(nullptr, nullptr, false,
|
||||
getter_AddRefs(mapped));
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
mapped->SetStyleSheet(aSheet);
|
||||
|
||||
|
@ -690,20 +697,33 @@ nsAttrAndChildArray::MappedAttrCount() const
|
|||
return mImpl && mImpl->mMappedAttrs ? (PRUint32)mImpl->mMappedAttrs->Count() : 0;
|
||||
}
|
||||
|
||||
nsMappedAttributes*
|
||||
nsresult
|
||||
nsAttrAndChildArray::GetModifiableMapped(nsMappedAttributeElement* aContent,
|
||||
nsHTMLStyleSheet* aSheet,
|
||||
bool aWillAddAttr)
|
||||
bool aWillAddAttr,
|
||||
nsMappedAttributes** aModifiable)
|
||||
{
|
||||
*aModifiable = nullptr;
|
||||
|
||||
if (mImpl && mImpl->mMappedAttrs) {
|
||||
return mImpl->mMappedAttrs->Clone(aWillAddAttr);
|
||||
*aModifiable = mImpl->mMappedAttrs->Clone(aWillAddAttr);
|
||||
NS_ENSURE_TRUE(*aModifiable, NS_ERROR_OUT_OF_MEMORY);
|
||||
|
||||
NS_ADDREF(*aModifiable);
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
MOZ_ASSERT(aContent, "Trying to create modifiable without content");
|
||||
NS_ASSERTION(aContent, "Trying to create modifiable without content");
|
||||
|
||||
nsMapRuleToAttributesFunc mapRuleFunc =
|
||||
aContent->GetAttributeMappingFunction();
|
||||
return new nsMappedAttributes(aSheet, mapRuleFunc);
|
||||
*aModifiable = new nsMappedAttributes(aSheet, mapRuleFunc);
|
||||
NS_ENSURE_TRUE(*aModifiable, NS_ERROR_OUT_OF_MEMORY);
|
||||
|
||||
NS_ADDREF(*aModifiable);
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
nsresult
|
||||
|
|
|
@ -127,11 +127,10 @@ private:
|
|||
PRUint32 NonMappedAttrCount() const;
|
||||
PRUint32 MappedAttrCount() const;
|
||||
|
||||
// Returns a non-null zero-refcount object.
|
||||
nsMappedAttributes*
|
||||
GetModifiableMapped(nsMappedAttributeElement* aContent,
|
||||
nsHTMLStyleSheet* aSheet,
|
||||
bool aWillAddAttr);
|
||||
nsresult GetModifiableMapped(nsMappedAttributeElement* aContent,
|
||||
nsHTMLStyleSheet* aSheet,
|
||||
bool aWillAddAttr,
|
||||
nsMappedAttributes** aModifiable);
|
||||
nsresult MakeMappedUnique(nsMappedAttributes* aAttributes);
|
||||
|
||||
PRUint32 AttrSlotsSize() const
|
||||
|
|
|
@ -19,6 +19,7 @@
|
|||
#include "nsIDOMNode.h"
|
||||
#include "nsIDOMNodeList.h"
|
||||
#include "nsIDOMEvent.h"
|
||||
#include "nsIDOMNSEvent.h"
|
||||
#include "nsIDOMDragEvent.h"
|
||||
#include "nsPIDOMWindow.h"
|
||||
#include "nsIDOMDocument.h"
|
||||
|
@ -56,7 +57,7 @@
|
|||
class NS_STACK_CLASS DragDataProducer
|
||||
{
|
||||
public:
|
||||
DragDataProducer(nsPIDOMWindow* aWindow,
|
||||
DragDataProducer(nsIDOMWindow* aWindow,
|
||||
nsIContent* aTarget,
|
||||
nsIContent* aSelectionTargetNode,
|
||||
bool aIsAltKeyPressed);
|
||||
|
@ -84,7 +85,7 @@ private:
|
|||
static void GetSelectedLink(nsISelection* inSelection,
|
||||
nsIContent **outLinkNode);
|
||||
|
||||
nsCOMPtr<nsPIDOMWindow> mWindow;
|
||||
nsCOMPtr<nsIDOMWindow> mWindow;
|
||||
nsCOMPtr<nsIContent> mTarget;
|
||||
nsCOMPtr<nsIContent> mSelectionTargetNode;
|
||||
bool mIsAltKeyPressed;
|
||||
|
@ -104,7 +105,7 @@ private:
|
|||
|
||||
|
||||
nsresult
|
||||
nsContentAreaDragDrop::GetDragData(nsPIDOMWindow* aWindow,
|
||||
nsContentAreaDragDrop::GetDragData(nsIDOMWindow* aWindow,
|
||||
nsIContent* aTarget,
|
||||
nsIContent* aSelectionTargetNode,
|
||||
bool aIsAltKeyPressed,
|
||||
|
@ -238,7 +239,7 @@ nsContentAreaDragDropDataProvider::GetFlavorData(nsITransferable *aTransferable,
|
|||
return rv;
|
||||
}
|
||||
|
||||
DragDataProducer::DragDataProducer(nsPIDOMWindow* aWindow,
|
||||
DragDataProducer::DragDataProducer(nsIDOMWindow* aWindow,
|
||||
nsIContent* aTarget,
|
||||
nsIContent* aSelectionTargetNode,
|
||||
bool aIsAltKeyPressed)
|
||||
|
@ -648,7 +649,9 @@ DragDataProducer::Produce(nsDOMDataTransfer* aDataTransfer,
|
|||
mInfoString.Truncate();
|
||||
mTitleString.Truncate();
|
||||
|
||||
nsCOMPtr<nsIDocument> doc = mWindow->GetDoc();
|
||||
nsCOMPtr<nsIDOMDocument> domDoc;
|
||||
mWindow->GetDocument(getter_AddRefs(domDoc));
|
||||
nsCOMPtr<nsIDocument> doc = do_QueryInterface(domDoc);
|
||||
NS_ENSURE_TRUE(doc, NS_ERROR_FAILURE);
|
||||
|
||||
// if we have selected text, use it in preference to the node
|
||||
|
|
|
@ -14,7 +14,7 @@
|
|||
#include "nsITransferable.h"
|
||||
|
||||
class nsIDOMNode;
|
||||
class nsPIDOMWindow;
|
||||
class nsIDOMWindow;
|
||||
class nsIDOMDragEvent;
|
||||
class nsISelection;
|
||||
class nsITransferable;
|
||||
|
@ -49,7 +49,7 @@ public:
|
|||
* aDragNode - [out] the link, image or area being dragged, or null if the
|
||||
* drag occurred on another element.
|
||||
*/
|
||||
static nsresult GetDragData(nsPIDOMWindow* aWindow,
|
||||
static nsresult GetDragData(nsIDOMWindow* aWindow,
|
||||
nsIContent* aTarget,
|
||||
nsIContent* aSelectionTargetNode,
|
||||
bool aIsAltKeyPressed,
|
||||
|
|
|
@ -88,6 +88,7 @@ static NS_DEFINE_CID(kXTFServiceCID, NS_XTFSERVICE_CID);
|
|||
#include "nsContentErrors.h"
|
||||
#include "nsUnicharUtilCIID.h"
|
||||
#include "nsINativeKeyBindings.h"
|
||||
#include "nsIDOMNSEvent.h"
|
||||
#include "nsXULPopupManager.h"
|
||||
#include "nsIPermissionManager.h"
|
||||
#include "nsIScriptObjectPrincipal.h"
|
||||
|
@ -844,28 +845,6 @@ nsContentUtils::IsJavaScriptLanguage(const nsString& aName, PRUint32 *aFlags)
|
|||
return true;
|
||||
}
|
||||
|
||||
JSVersion
|
||||
nsContentUtils::ParseJavascriptVersion(const nsAString& aVersionStr)
|
||||
{
|
||||
if (aVersionStr.Length() != 3 || aVersionStr[0] != '1' ||
|
||||
aVersionStr[1] != '.') {
|
||||
return JSVERSION_UNKNOWN;
|
||||
}
|
||||
|
||||
switch (aVersionStr[2]) {
|
||||
case '0': return JSVERSION_1_0;
|
||||
case '1': return JSVERSION_1_1;
|
||||
case '2': return JSVERSION_1_2;
|
||||
case '3': return JSVERSION_1_3;
|
||||
case '4': return JSVERSION_1_4;
|
||||
case '5': return JSVERSION_1_5;
|
||||
case '6': return JSVERSION_1_6;
|
||||
case '7': return JSVERSION_1_7;
|
||||
case '8': return JSVERSION_1_8;
|
||||
default: return JSVERSION_UNKNOWN;
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
nsContentUtils::SplitMimeType(const nsAString& aValue, nsString& aType,
|
||||
nsString& aParams)
|
||||
|
@ -4688,13 +4667,14 @@ nsContentUtils::DOMEventToNativeKeyEvent(nsIDOMKeyEvent* aKeyEvent,
|
|||
nsNativeKeyEvent* aNativeEvent,
|
||||
bool aGetCharCode)
|
||||
{
|
||||
nsCOMPtr<nsIDOMNSEvent> nsevent = do_QueryInterface(aKeyEvent);
|
||||
bool defaultPrevented;
|
||||
aKeyEvent->GetPreventDefault(&defaultPrevented);
|
||||
nsevent->GetPreventDefault(&defaultPrevented);
|
||||
if (defaultPrevented)
|
||||
return false;
|
||||
|
||||
bool trusted = false;
|
||||
aKeyEvent->GetIsTrusted(&trusted);
|
||||
nsevent->GetIsTrusted(&trusted);
|
||||
if (!trusted)
|
||||
return false;
|
||||
|
||||
|
|
|
@ -12,6 +12,7 @@
|
|||
#include "nsDOMError.h"
|
||||
#include "nsICharsetDetector.h"
|
||||
#include "nsICharsetConverterManager.h"
|
||||
#include "nsIClassInfo.h"
|
||||
#include "nsIConverterInputStream.h"
|
||||
#include "nsIDocument.h"
|
||||
#include "nsIFileStreams.h"
|
||||
|
@ -45,7 +46,9 @@ using namespace mozilla::dom;
|
|||
// from NS_NewByteInputStream is held alive as long as the
|
||||
// stream is. We do that by passing back this class instead.
|
||||
class DataOwnerAdapter MOZ_FINAL : public nsIInputStream,
|
||||
public nsISeekableStream
|
||||
public nsISeekableStream,
|
||||
public nsIIPCSerializable,
|
||||
public nsIClassInfo
|
||||
{
|
||||
typedef nsDOMMemoryFile::DataOwner DataOwner;
|
||||
public:
|
||||
|
@ -56,15 +59,22 @@ public:
|
|||
|
||||
NS_DECL_ISUPPORTS
|
||||
|
||||
// These are mandatory.
|
||||
NS_FORWARD_NSIINPUTSTREAM(mStream->)
|
||||
|
||||
NS_FORWARD_NSISEEKABLESTREAM(mSeekableStream->)
|
||||
|
||||
// These are optional. We use a conditional QI to keep them from being called
|
||||
// if the underlying stream doesn't QI to either interface.
|
||||
NS_FORWARD_NSIIPCSERIALIZABLE(mSerializable->)
|
||||
NS_FORWARD_NSICLASSINFO(mClassInfo->)
|
||||
|
||||
private:
|
||||
DataOwnerAdapter(DataOwner* aDataOwner,
|
||||
nsIInputStream* aStream)
|
||||
: mDataOwner(aDataOwner), mStream(aStream),
|
||||
mSeekableStream(do_QueryInterface(aStream))
|
||||
mSeekableStream(do_QueryInterface(aStream)),
|
||||
mSerializable(do_QueryInterface(aStream)),
|
||||
mClassInfo(do_QueryInterface(aStream))
|
||||
{
|
||||
NS_ASSERTION(mSeekableStream, "Somebody gave us the wrong stream!");
|
||||
}
|
||||
|
@ -72,11 +82,20 @@ private:
|
|||
nsRefPtr<DataOwner> mDataOwner;
|
||||
nsCOMPtr<nsIInputStream> mStream;
|
||||
nsCOMPtr<nsISeekableStream> mSeekableStream;
|
||||
nsCOMPtr<nsIIPCSerializable> mSerializable;
|
||||
nsCOMPtr<nsIClassInfo> mClassInfo;
|
||||
};
|
||||
|
||||
NS_IMPL_THREADSAFE_ISUPPORTS2(DataOwnerAdapter,
|
||||
nsIInputStream,
|
||||
nsISeekableStream)
|
||||
NS_IMPL_THREADSAFE_ADDREF(DataOwnerAdapter)
|
||||
NS_IMPL_THREADSAFE_RELEASE(DataOwnerAdapter)
|
||||
|
||||
NS_INTERFACE_MAP_BEGIN(DataOwnerAdapter)
|
||||
NS_INTERFACE_MAP_ENTRY(nsIInputStream)
|
||||
NS_INTERFACE_MAP_ENTRY(nsISeekableStream)
|
||||
NS_INTERFACE_MAP_ENTRY_CONDITIONAL(nsIIPCSerializable, mSerializable)
|
||||
NS_INTERFACE_MAP_ENTRY_CONDITIONAL(nsIClassInfo, mClassInfo)
|
||||
NS_INTERFACE_MAP_ENTRY_AMBIGUOUS(nsISupports, nsIInputStream)
|
||||
NS_INTERFACE_MAP_END
|
||||
|
||||
nsresult DataOwnerAdapter::Create(DataOwner* aDataOwner,
|
||||
PRUint32 aStart,
|
||||
|
|
|
@ -2262,6 +2262,7 @@ nsDocument::ResetStylesheetsToURI(nsIURI* aURI)
|
|||
// is probably the right thing to do.
|
||||
|
||||
// Now reset our inline style and attribute sheets.
|
||||
nsresult rv = NS_OK;
|
||||
if (mAttrStyleSheet) {
|
||||
// Remove this sheet from all style sets
|
||||
nsCOMPtr<nsIPresShell> shell = GetShell();
|
||||
|
@ -2271,8 +2272,11 @@ nsDocument::ResetStylesheetsToURI(nsIURI* aURI)
|
|||
}
|
||||
mAttrStyleSheet->Reset(aURI);
|
||||
} else {
|
||||
mAttrStyleSheet = new nsHTMLStyleSheet(aURI, this);
|
||||
NS_ADDREF(mAttrStyleSheet);
|
||||
rv = NS_NewHTMLStyleSheet(&mAttrStyleSheet, aURI, this);
|
||||
if (NS_FAILED(rv)) {
|
||||
NS_IF_RELEASE(mAttrStyleSheet);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
}
|
||||
}
|
||||
|
||||
// Don't use AddStyleSheet, since it'll put the sheet into style
|
||||
|
@ -2289,7 +2293,8 @@ nsDocument::ResetStylesheetsToURI(nsIURI* aURI)
|
|||
mStyleAttrStyleSheet->Reset(aURI);
|
||||
} else {
|
||||
mStyleAttrStyleSheet = new nsHTMLCSSStyleSheet();
|
||||
nsresult rv = mStyleAttrStyleSheet->Init(aURI, this);
|
||||
NS_ENSURE_TRUE(mStyleAttrStyleSheet, NS_ERROR_OUT_OF_MEMORY);
|
||||
rv = mStyleAttrStyleSheet->Init(aURI, this);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
}
|
||||
|
||||
|
@ -2303,7 +2308,7 @@ nsDocument::ResetStylesheetsToURI(nsIURI* aURI)
|
|||
FillStyleSet(shell->StyleSet());
|
||||
}
|
||||
|
||||
return NS_OK;
|
||||
return rv;
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -6414,44 +6419,15 @@ nsDocument::IsScriptEnabled()
|
|||
}
|
||||
|
||||
nsRadioGroupStruct*
|
||||
nsDocument::GetRadioGroupInternal(const nsAString& aName) const
|
||||
nsDocument::GetRadioGroup(const nsAString& aName)
|
||||
{
|
||||
#ifdef DEBUG
|
||||
nsAutoString tmKey(aName);
|
||||
if (IsHTML()) {
|
||||
nsAutoString lcName;
|
||||
ToLowerCase(aName, lcName);
|
||||
MOZ_ASSERT(aName == lcName);
|
||||
ToLowerCase(tmKey); //should case-insensitive.
|
||||
}
|
||||
#endif
|
||||
|
||||
nsRadioGroupStruct* radioGroup;
|
||||
if (!mRadioGroups.Get(aName, &radioGroup)) {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
return radioGroup;
|
||||
}
|
||||
|
||||
nsRadioGroupStruct*
|
||||
nsDocument::GetRadioGroup(const nsAString& aName) const
|
||||
{
|
||||
nsAutoString tmKey(aName);
|
||||
if (IsHTML()) {
|
||||
ToLowerCase(tmKey); //should case-insensitive.
|
||||
}
|
||||
|
||||
return GetRadioGroupInternal(tmKey);
|
||||
}
|
||||
|
||||
nsRadioGroupStruct*
|
||||
nsDocument::GetOrCreateRadioGroup(const nsAString& aName)
|
||||
{
|
||||
nsAutoString tmKey(aName);
|
||||
if (IsHTML()) {
|
||||
ToLowerCase(tmKey); //should case-insensitive.
|
||||
}
|
||||
|
||||
if (nsRadioGroupStruct* radioGroup = GetRadioGroupInternal(tmKey)) {
|
||||
if (mRadioGroups.Get(tmKey, &radioGroup)) {
|
||||
return radioGroup;
|
||||
}
|
||||
|
||||
|
@ -6465,7 +6441,9 @@ NS_IMETHODIMP
|
|||
nsDocument::SetCurrentRadioButton(const nsAString& aName,
|
||||
nsIDOMHTMLInputElement* aRadio)
|
||||
{
|
||||
nsRadioGroupStruct* radioGroup = GetOrCreateRadioGroup(aName);
|
||||
nsRadioGroupStruct* radioGroup = GetRadioGroup(aName);
|
||||
NS_ENSURE_TRUE(radioGroup, NS_OK);
|
||||
|
||||
radioGroup->mSelectedRadioButton = aRadio;
|
||||
return NS_OK;
|
||||
}
|
||||
|
@ -6474,7 +6452,9 @@ NS_IMETHODIMP
|
|||
nsDocument::GetCurrentRadioButton(const nsAString& aName,
|
||||
nsIDOMHTMLInputElement** aRadio)
|
||||
{
|
||||
nsRadioGroupStruct* radioGroup = GetOrCreateRadioGroup(aName);
|
||||
nsRadioGroupStruct* radioGroup = GetRadioGroup(aName);
|
||||
NS_ENSURE_TRUE(radioGroup, NS_OK);
|
||||
|
||||
*aRadio = radioGroup->mSelectedRadioButton;
|
||||
NS_IF_ADDREF(*aRadio);
|
||||
return NS_OK;
|
||||
|
@ -6492,7 +6472,8 @@ nsDocument::GetNextRadioButton(const nsAString& aName,
|
|||
// opposed to nsHTMLDocument?
|
||||
*aRadioOut = nullptr;
|
||||
|
||||
nsRadioGroupStruct* radioGroup = GetOrCreateRadioGroup(aName);
|
||||
nsRadioGroupStruct* radioGroup = GetRadioGroup(aName);
|
||||
NS_ENSURE_TRUE(radioGroup, NS_ERROR_FAILURE);
|
||||
|
||||
// Return the radio button relative to the focused radio button.
|
||||
// If no radio is focused, get the radio relative to the selected one.
|
||||
|
@ -6537,7 +6518,8 @@ NS_IMETHODIMP
|
|||
nsDocument::AddToRadioGroup(const nsAString& aName,
|
||||
nsIFormControl* aRadio)
|
||||
{
|
||||
nsRadioGroupStruct* radioGroup = GetOrCreateRadioGroup(aName);
|
||||
nsRadioGroupStruct* radioGroup = GetRadioGroup(aName);
|
||||
NS_ENSURE_TRUE(radioGroup, NS_OK);
|
||||
|
||||
radioGroup->mRadioButtons.AppendObject(aRadio);
|
||||
|
||||
|
@ -6553,7 +6535,8 @@ NS_IMETHODIMP
|
|||
nsDocument::RemoveFromRadioGroup(const nsAString& aName,
|
||||
nsIFormControl* aRadio)
|
||||
{
|
||||
nsRadioGroupStruct* radioGroup = GetOrCreateRadioGroup(aName);
|
||||
nsRadioGroupStruct* radioGroup = GetRadioGroup(aName);
|
||||
NS_ENSURE_TRUE(radioGroup, NS_OK);
|
||||
|
||||
radioGroup->mRadioButtons.RemoveObject(aRadio);
|
||||
|
||||
|
@ -6572,7 +6555,8 @@ nsDocument::WalkRadioGroup(const nsAString& aName,
|
|||
nsIRadioVisitor* aVisitor,
|
||||
bool aFlushContent)
|
||||
{
|
||||
nsRadioGroupStruct* radioGroup = GetOrCreateRadioGroup(aName);
|
||||
nsRadioGroupStruct* radioGroup = GetRadioGroup(aName);
|
||||
NS_ENSURE_TRUE(radioGroup, NS_OK);
|
||||
|
||||
for (int i = 0; i < radioGroup->mRadioButtons.Count(); i++) {
|
||||
if (!aVisitor->Visit(radioGroup->mRadioButtons[i])) {
|
||||
|
@ -6586,14 +6570,26 @@ nsDocument::WalkRadioGroup(const nsAString& aName,
|
|||
PRUint32
|
||||
nsDocument::GetRequiredRadioCount(const nsAString& aName) const
|
||||
{
|
||||
nsRadioGroupStruct* radioGroup = GetRadioGroup(aName);
|
||||
nsRadioGroupStruct* radioGroup = nullptr;
|
||||
// TODO: we should call GetRadioGroup here (and make it const) but for that
|
||||
// we would need to have an explicit CreateRadioGroup() instead of create
|
||||
// one when GetRadioGroup is called. See bug 636123.
|
||||
nsAutoString tmKey(aName);
|
||||
if (IsHTML())
|
||||
ToLowerCase(tmKey); //should case-insensitive.
|
||||
mRadioGroups.Get(tmKey, &radioGroup);
|
||||
|
||||
return radioGroup ? radioGroup->mRequiredRadioCount : 0;
|
||||
}
|
||||
|
||||
void
|
||||
nsDocument::RadioRequiredChanged(const nsAString& aName, nsIFormControl* aRadio)
|
||||
{
|
||||
nsRadioGroupStruct* radioGroup = GetOrCreateRadioGroup(aName);
|
||||
nsRadioGroupStruct* radioGroup = GetRadioGroup(aName);
|
||||
|
||||
if (!radioGroup) {
|
||||
return;
|
||||
}
|
||||
|
||||
nsCOMPtr<nsIContent> element = do_QueryInterface(aRadio);
|
||||
NS_ASSERTION(element, "radio controls have to be content elements");
|
||||
|
@ -6609,14 +6605,27 @@ nsDocument::RadioRequiredChanged(const nsAString& aName, nsIFormControl* aRadio)
|
|||
bool
|
||||
nsDocument::GetValueMissingState(const nsAString& aName) const
|
||||
{
|
||||
nsRadioGroupStruct* radioGroup = GetRadioGroup(aName);
|
||||
nsRadioGroupStruct* radioGroup = nullptr;
|
||||
// TODO: we should call GetRadioGroup here (and make it const) but for that
|
||||
// we would need to have an explicit CreateRadioGroup() instead of create
|
||||
// one when GetRadioGroup is called. See bug 636123.
|
||||
nsAutoString tmKey(aName);
|
||||
if (IsHTML())
|
||||
ToLowerCase(tmKey); //should case-insensitive.
|
||||
mRadioGroups.Get(tmKey, &radioGroup);
|
||||
|
||||
return radioGroup && radioGroup->mGroupSuffersFromValueMissing;
|
||||
}
|
||||
|
||||
void
|
||||
nsDocument::SetValueMissingState(const nsAString& aName, bool aValue)
|
||||
{
|
||||
nsRadioGroupStruct* radioGroup = GetOrCreateRadioGroup(aName);
|
||||
nsRadioGroupStruct* radioGroup = GetRadioGroup(aName);
|
||||
|
||||
if (!radioGroup) {
|
||||
return;
|
||||
}
|
||||
|
||||
radioGroup->mGroupSuffersFromValueMissing = aValue;
|
||||
}
|
||||
|
||||
|
|
|
@ -723,13 +723,8 @@ public:
|
|||
virtual void SetValueMissingState(const nsAString& aName, bool aValue);
|
||||
|
||||
// for radio group
|
||||
nsRadioGroupStruct* GetRadioGroup(const nsAString& aName) const;
|
||||
nsRadioGroupStruct* GetOrCreateRadioGroup(const nsAString& aName);
|
||||
nsRadioGroupStruct* GetRadioGroup(const nsAString& aName);
|
||||
|
||||
private:
|
||||
nsRadioGroupStruct* GetRadioGroupInternal(const nsAString& aName) const;
|
||||
|
||||
public:
|
||||
// nsIDOMNode
|
||||
NS_DECL_NSIDOMNODE
|
||||
|
||||
|
|
|
@ -437,11 +437,10 @@ nsINode::RemoveChild(nsINode *aOldChild)
|
|||
}
|
||||
|
||||
if (IsNodeOfType(eDATA_NODE)) {
|
||||
// aOldChild can't be one of our children.
|
||||
return NS_ERROR_DOM_NOT_FOUND_ERR;
|
||||
return NS_ERROR_DOM_HIERARCHY_REQUEST_ERR;
|
||||
}
|
||||
|
||||
if (aOldChild->GetNodeParent() == this) {
|
||||
if (aOldChild && aOldChild->GetNodeParent() == this) {
|
||||
nsContentUtils::MaybeFireNodeRemoved(aOldChild, this, OwnerDoc());
|
||||
}
|
||||
|
||||
|
|
|
@ -68,7 +68,9 @@ void* nsMappedAttributes::operator new(size_t aSize, PRUint32 aAttrCount) CPP_TH
|
|||
aAttrCount * sizeof(InternalAttr));
|
||||
|
||||
#ifdef DEBUG
|
||||
static_cast<nsMappedAttributes*>(newAttrs)->mBufferSize = aAttrCount;
|
||||
if (newAttrs) {
|
||||
static_cast<nsMappedAttributes*>(newAttrs)->mBufferSize = aAttrCount;
|
||||
}
|
||||
#endif
|
||||
|
||||
return newAttrs;
|
||||
|
|
|
@ -26,8 +26,8 @@ public:
|
|||
nsMappedAttributes(nsHTMLStyleSheet* aSheet,
|
||||
nsMapRuleToAttributesFunc aMapRuleFunc);
|
||||
|
||||
// Do not return null.
|
||||
void* operator new(size_t size, PRUint32 aAttrCount = 1) CPP_THROW_NEW;
|
||||
|
||||
nsMappedAttributes* Clone(bool aWillAddAttr);
|
||||
|
||||
NS_DECL_ISUPPORTS
|
||||
|
|
|
@ -1839,7 +1839,7 @@ nsRange::CompareBoundaryPoints(PRUint16 aHow, nsIDOMRange* aOtherRange,
|
|||
break;
|
||||
default:
|
||||
// We were passed an illegal value
|
||||
return NS_ERROR_DOM_NOT_SUPPORTED_ERR;
|
||||
return NS_ERROR_ILLEGAL_VALUE;
|
||||
}
|
||||
|
||||
if (mRoot != otherRange->GetRoot())
|
||||
|
|
|
@ -352,50 +352,6 @@ public:
|
|||
}
|
||||
};
|
||||
|
||||
static inline bool
|
||||
ParseTypeAttribute(const nsAString& aType, JSVersion* aVersion)
|
||||
{
|
||||
MOZ_ASSERT(!aType.IsEmpty());
|
||||
MOZ_ASSERT(aVersion);
|
||||
MOZ_ASSERT(*aVersion == JSVERSION_DEFAULT);
|
||||
|
||||
nsContentTypeParser parser(aType);
|
||||
|
||||
nsAutoString mimeType;
|
||||
nsresult rv = parser.GetType(mimeType);
|
||||
NS_ENSURE_SUCCESS(rv, false);
|
||||
|
||||
if (!nsContentUtils::IsJavascriptMIMEType(mimeType)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// Get the version string, and ensure the language supports it.
|
||||
nsAutoString versionName;
|
||||
rv = parser.GetParameter("version", versionName);
|
||||
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
*aVersion = nsContentUtils::ParseJavascriptVersion(versionName);
|
||||
} else if (rv != NS_ERROR_INVALID_ARG) {
|
||||
return false;
|
||||
}
|
||||
|
||||
nsAutoString value;
|
||||
rv = parser.GetParameter("e4x", value);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
if (value.Length() == 1 && value[0] == '1') {
|
||||
// This happens in about 2 web pages. Enable E4X no matter what JS
|
||||
// version number was selected. We do this by turning on the "moar
|
||||
// XML" version bit. This is OK even if version has
|
||||
// JSVERSION_UNKNOWN (-1).
|
||||
*aVersion = js::VersionSetMoarXML(*aVersion, true);
|
||||
}
|
||||
} else if (rv != NS_ERROR_INVALID_ARG) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool
|
||||
nsScriptLoader::ProcessScriptElement(nsIScriptElement *aElement)
|
||||
{
|
||||
|
@ -437,38 +393,126 @@ nsScriptLoader::ProcessScriptElement(nsIScriptElement *aElement)
|
|||
return false;
|
||||
}
|
||||
|
||||
JSVersion version = JSVERSION_DEFAULT;
|
||||
PRUint32 typeID = nsIProgrammingLanguage::JAVASCRIPT;
|
||||
PRUint32 version = 0;
|
||||
nsAutoString language, type, src;
|
||||
nsresult rv = NS_OK;
|
||||
|
||||
// Check the type attribute to determine language and version.
|
||||
// If type exists, it trumps the deprecated 'language='
|
||||
nsAutoString type;
|
||||
aElement->GetScriptType(type);
|
||||
if (!type.IsEmpty()) {
|
||||
NS_ENSURE_TRUE(ParseTypeAttribute(type, &version), false);
|
||||
nsContentTypeParser parser(type);
|
||||
|
||||
nsAutoString mimeType;
|
||||
rv = parser.GetType(mimeType);
|
||||
NS_ENSURE_SUCCESS(rv, false);
|
||||
|
||||
// Javascript keeps the fast path, optimized for most-likely type
|
||||
// Table ordered from most to least likely JS MIME types.
|
||||
// See bug 62485, feel free to add <script type="..."> survey data to it,
|
||||
// or to a new bug once 62485 is closed.
|
||||
static const char *jsTypes[] = {
|
||||
"text/javascript",
|
||||
"text/ecmascript",
|
||||
"application/javascript",
|
||||
"application/ecmascript",
|
||||
"application/x-javascript",
|
||||
nullptr
|
||||
};
|
||||
|
||||
bool isJavaScript = false;
|
||||
for (PRInt32 i = 0; jsTypes[i]; i++) {
|
||||
if (mimeType.LowerCaseEqualsASCII(jsTypes[i])) {
|
||||
isJavaScript = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (!isJavaScript) {
|
||||
typeID = nsIProgrammingLanguage::UNKNOWN;
|
||||
}
|
||||
|
||||
if (typeID != nsIProgrammingLanguage::UNKNOWN) {
|
||||
// Get the version string, and ensure the language supports it.
|
||||
nsAutoString versionName;
|
||||
rv = parser.GetParameter("version", versionName);
|
||||
if (NS_FAILED(rv)) {
|
||||
// no version attribute - version remains 0.
|
||||
if (rv != NS_ERROR_INVALID_ARG)
|
||||
return false;
|
||||
} else {
|
||||
nsCOMPtr<nsIScriptRuntime> runtime;
|
||||
rv = NS_GetJSRuntime(getter_AddRefs(runtime));
|
||||
if (NS_FAILED(rv)) {
|
||||
NS_ERROR("Failed to locate the language with this ID");
|
||||
return false;
|
||||
}
|
||||
rv = runtime->ParseVersion(versionName, &version);
|
||||
if (NS_FAILED(rv)) {
|
||||
NS_WARNING("This script language version is not supported - ignored");
|
||||
typeID = nsIProgrammingLanguage::UNKNOWN;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Some js specifics yet to be abstracted.
|
||||
if (typeID == nsIProgrammingLanguage::JAVASCRIPT) {
|
||||
nsAutoString value;
|
||||
rv = parser.GetParameter("e4x", value);
|
||||
if (NS_FAILED(rv)) {
|
||||
if (rv != NS_ERROR_INVALID_ARG)
|
||||
return false;
|
||||
} else {
|
||||
if (value.Length() == 1 && value[0] == '1')
|
||||
// This happens in about 2 web pages. Enable E4X no matter what JS
|
||||
// version number was selected. We do this by turning on the "moar
|
||||
// XML" version bit. This is OK even if version has
|
||||
// JSVERSION_UNKNOWN (-1).
|
||||
version = js::VersionSetMoarXML(JSVersion(version), true);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
// no 'type=' element
|
||||
// "language" is a deprecated attribute of HTML, so we check it only for
|
||||
// HTML script elements.
|
||||
if (scriptContent->IsHTML()) {
|
||||
nsAutoString language;
|
||||
scriptContent->GetAttr(kNameSpaceID_None, nsGkAtoms::language, language);
|
||||
if (!language.IsEmpty()) {
|
||||
if (nsContentUtils::IsJavaScriptLanguage(language, &version))
|
||||
typeID = nsIProgrammingLanguage::JAVASCRIPT;
|
||||
else
|
||||
typeID = nsIProgrammingLanguage::UNKNOWN;
|
||||
// IE, Opera, etc. do not respect language version, so neither should
|
||||
// we at this late date in the browser wars saga. Note that this change
|
||||
// affects HTML but not XUL or SVG (but note also that XUL has its own
|
||||
// code to check nsContentUtils::IsJavaScriptLanguage -- that's probably
|
||||
// a separate bug, one we may not be able to fix short of XUL2). See
|
||||
// bug 255895 (https://bugzilla.mozilla.org/show_bug.cgi?id=255895).
|
||||
PRUint32 dummy;
|
||||
if (!nsContentUtils::IsJavaScriptLanguage(language, &dummy)) {
|
||||
return false;
|
||||
}
|
||||
NS_ASSERTION(JSVERSION_DEFAULT == 0,
|
||||
"We rely on all languages having 0 as a version default");
|
||||
version = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// If we don't know the language, we don't know how to evaluate
|
||||
if (typeID == nsIProgrammingLanguage::UNKNOWN) {
|
||||
return false;
|
||||
}
|
||||
// If not from a chrome document (which is always trusted), we need some way
|
||||
// of checking the language is "safe". Currently the only other language
|
||||
// impl is Python, and that is *not* safe in untrusted code - so fixing
|
||||
// this isn't a priority.!
|
||||
// See also similar code in nsXULContentSink.cpp
|
||||
if (typeID != nsIProgrammingLanguage::JAVASCRIPT &&
|
||||
!nsContentUtils::IsChromeDoc(mDocument)) {
|
||||
NS_WARNING("Untrusted language called from non-chrome - ignored");
|
||||
return false;
|
||||
}
|
||||
|
||||
// Step 14. in the HTML5 spec
|
||||
nsresult rv = NS_OK;
|
||||
|
||||
nsRefPtr<nsScriptLoadRequest> request;
|
||||
if (aElement->GetScriptExternal()) {
|
||||
// external script
|
||||
|
|
|
@ -1120,7 +1120,9 @@ nsTreeSanitizer::SanitizeStyleSheet(const nsAString& aOriginal,
|
|||
// -moz-binding is blacklisted.
|
||||
bool didSanitize = false;
|
||||
// Create a sheet to hold the parsed CSS
|
||||
nsRefPtr<nsCSSStyleSheet> sheet = new nsCSSStyleSheet();
|
||||
nsRefPtr<nsCSSStyleSheet> sheet;
|
||||
rv = NS_NewCSSStyleSheet(getter_AddRefs(sheet));
|
||||
NS_ENSURE_SUCCESS(rv, true);
|
||||
sheet->SetURIs(aDocument->GetDocumentURI(), nullptr, aBaseURI);
|
||||
sheet->SetPrincipal(aDocument->NodePrincipal());
|
||||
// Create the CSS parser, and parse the CSS text.
|
||||
|
|
|
@ -977,6 +977,8 @@ nsXMLHttpRequest::CreateResponseParsedJSON(JSContext* aCx)
|
|||
if (!aCx) {
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
RootResultArrayBuffer();
|
||||
|
||||
// The Unicode converter has already zapped the BOM if there was one
|
||||
if (!JS_ParseJSON(aCx,
|
||||
static_cast<const jschar*>(mResponseText.get()),
|
||||
|
@ -3173,21 +3175,15 @@ nsXMLHttpRequest::Send(nsIVariant* aVariant, const Nullable<RequestBody>& aBody)
|
|||
}
|
||||
|
||||
/* void setRequestHeader (in AUTF8String header, in AUTF8String value); */
|
||||
// http://dvcs.w3.org/hg/xhr/raw-file/tip/Overview.html#dom-xmlhttprequest-setrequestheader
|
||||
NS_IMETHODIMP
|
||||
nsXMLHttpRequest::SetRequestHeader(const nsACString& header,
|
||||
const nsACString& value)
|
||||
{
|
||||
// Step 1 and 2
|
||||
if (!(mState & XML_HTTP_REQUEST_OPENED)) {
|
||||
return NS_ERROR_DOM_INVALID_STATE_ERR;
|
||||
}
|
||||
NS_ASSERTION(mChannel, "mChannel must be valid if we're OPENED.");
|
||||
nsresult rv;
|
||||
|
||||
// Step 3
|
||||
// Make sure we don't store an invalid header name in mCORSUnsafeHeaders
|
||||
if (!IsValidHTTPToken(header)) { // XXX nsHttp::IsValidToken?
|
||||
return NS_ERROR_DOM_SYNTAX_ERR;
|
||||
if (!IsValidHTTPToken(header)) {
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
// Check that we haven't already opened the channel. We can't rely on
|
||||
|
@ -3195,7 +3191,7 @@ nsXMLHttpRequest::SetRequestHeader(const nsACString& header,
|
|||
// still be waiting for mCORSPreflightChannel to actually open mChannel
|
||||
if (mCORSPreflightChannel) {
|
||||
bool pending;
|
||||
nsresult rv = mCORSPreflightChannel->IsPending(&pending);
|
||||
rv = mCORSPreflightChannel->IsPending(&pending);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
if (pending) {
|
||||
|
@ -3203,10 +3199,13 @@ nsXMLHttpRequest::SetRequestHeader(const nsACString& header,
|
|||
}
|
||||
}
|
||||
|
||||
if (!(mState & XML_HTTP_REQUEST_OPENED))
|
||||
return NS_ERROR_IN_PROGRESS;
|
||||
|
||||
if (!mChannel) // open() initializes mChannel, and open()
|
||||
return NS_ERROR_FAILURE; // must be called before first setRequestHeader()
|
||||
|
||||
nsCOMPtr<nsIHttpChannel> httpChannel = do_QueryInterface(mChannel);
|
||||
nsCOMPtr<nsIHttpChannel> httpChannel(do_QueryInterface(mChannel));
|
||||
if (!httpChannel) {
|
||||
return NS_OK;
|
||||
}
|
||||
|
@ -3215,11 +3214,12 @@ nsXMLHttpRequest::SetRequestHeader(const nsACString& header,
|
|||
// the executing script has UniversalXPConnect.
|
||||
|
||||
bool privileged;
|
||||
if (NS_FAILED(IsCapabilityEnabled("UniversalXPConnect", &privileged)))
|
||||
rv = IsCapabilityEnabled("UniversalXPConnect", &privileged);
|
||||
if (NS_FAILED(rv))
|
||||
return NS_ERROR_FAILURE;
|
||||
|
||||
if (!privileged) {
|
||||
// Step 5: Check for dangerous headers.
|
||||
// Check for dangerous headers
|
||||
const char *kInvalidHeaders[] = {
|
||||
"accept-charset", "accept-encoding", "access-control-request-headers",
|
||||
"access-control-request-method", "connection", "content-length",
|
||||
|
@ -3264,10 +3264,7 @@ nsXMLHttpRequest::SetRequestHeader(const nsACString& header,
|
|||
}
|
||||
|
||||
// We need to set, not add to, the header.
|
||||
nsresult rv = httpChannel->SetRequestHeader(header, value, false);
|
||||
if (rv == NS_ERROR_INVALID_ARG) {
|
||||
return NS_ERROR_DOM_SYNTAX_ERR;
|
||||
}
|
||||
rv = httpChannel->SetRequestHeader(header, value, false);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
// We'll want to duplicate this header for any replacement channels (eg. on redirect)
|
||||
RequestHeader reqHeader = {
|
||||
|
@ -3275,6 +3272,7 @@ nsXMLHttpRequest::SetRequestHeader(const nsACString& header,
|
|||
};
|
||||
mModifiedRequestHeaders.AppendElement(reqHeader);
|
||||
}
|
||||
|
||||
return rv;
|
||||
}
|
||||
|
||||
|
@ -4013,6 +4011,7 @@ DOMCI_DATA(XMLHttpProgressEvent, nsXMLHttpProgressEvent)
|
|||
NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION(nsXMLHttpProgressEvent)
|
||||
NS_INTERFACE_MAP_ENTRY_AMBIGUOUS(nsISupports, nsIDOMProgressEvent)
|
||||
NS_INTERFACE_MAP_ENTRY_AMBIGUOUS(nsIDOMEvent, nsIDOMProgressEvent)
|
||||
NS_INTERFACE_MAP_ENTRY(nsIDOMNSEvent)
|
||||
NS_INTERFACE_MAP_ENTRY(nsIDOMProgressEvent)
|
||||
NS_INTERFACE_MAP_ENTRY(nsIDOMLSProgressEvent)
|
||||
NS_DOM_INTERFACE_MAP_ENTRY_CLASSINFO(XMLHttpProgressEvent)
|
||||
|
|
|
@ -26,6 +26,7 @@
|
|||
#include "nsTArray.h"
|
||||
#include "nsIJSNativeInitializer.h"
|
||||
#include "nsIDOMLSProgressEvent.h"
|
||||
#include "nsIDOMNSEvent.h"
|
||||
#include "nsITimer.h"
|
||||
#include "nsDOMProgressEvent.h"
|
||||
#include "nsDOMEventTargetHelper.h"
|
||||
|
@ -34,13 +35,13 @@
|
|||
#include "nsDOMBlobBuilder.h"
|
||||
#include "nsIPrincipal.h"
|
||||
#include "nsIScriptObjectPrincipal.h"
|
||||
|
||||
#include "mozilla/Assertions.h"
|
||||
#include "mozilla/dom/BindingUtils.h"
|
||||
#include "mozilla/dom/TypedArray.h"
|
||||
#include "mozilla/dom/XMLHttpRequestBinding.h"
|
||||
#include "mozilla/dom/XMLHttpRequestUploadBinding.h"
|
||||
|
||||
#include "mozilla/Assertions.h"
|
||||
#include "mozilla/dom/TypedArray.h"
|
||||
|
||||
class nsILoadGroup;
|
||||
class AsyncVerifyRedirectCallbackForwarder;
|
||||
class nsIUnicodeDecoder;
|
||||
|
@ -709,7 +710,8 @@ protected:
|
|||
// helper class to expose a progress DOM Event
|
||||
|
||||
class nsXMLHttpProgressEvent : public nsIDOMProgressEvent,
|
||||
public nsIDOMLSProgressEvent
|
||||
public nsIDOMLSProgressEvent,
|
||||
public nsIDOMNSEvent
|
||||
{
|
||||
public:
|
||||
nsXMLHttpProgressEvent(nsIDOMProgressEvent* aInner,
|
||||
|
@ -719,8 +721,9 @@ public:
|
|||
virtual ~nsXMLHttpProgressEvent();
|
||||
|
||||
NS_DECL_CYCLE_COLLECTING_ISUPPORTS
|
||||
NS_DECL_CYCLE_COLLECTION_CLASS_AMBIGUOUS(nsXMLHttpProgressEvent, nsIDOMProgressEvent)
|
||||
NS_DECL_CYCLE_COLLECTION_CLASS_AMBIGUOUS(nsXMLHttpProgressEvent, nsIDOMNSEvent)
|
||||
NS_FORWARD_NSIDOMEVENT(mInner->)
|
||||
NS_FORWARD_NSIDOMNSEVENT(mInner->)
|
||||
NS_FORWARD_NSIDOMPROGRESSEVENT(mInner->)
|
||||
NS_DECL_NSIDOMLSPROGRESSEVENT
|
||||
|
||||
|
|
|
@ -175,6 +175,7 @@ DOMCI_DATA(Event, nsDOMEvent)
|
|||
NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION(nsDOMEvent)
|
||||
NS_INTERFACE_MAP_ENTRY_AMBIGUOUS(nsISupports, nsIDOMEvent)
|
||||
NS_INTERFACE_MAP_ENTRY(nsIDOMEvent)
|
||||
NS_INTERFACE_MAP_ENTRY(nsIDOMNSEvent)
|
||||
NS_INTERFACE_MAP_ENTRY(nsIJSNativeInitializer)
|
||||
NS_DOM_INTERFACE_MAP_ENTRY_CLASSINFO(Event)
|
||||
NS_INTERFACE_MAP_END
|
||||
|
@ -535,7 +536,7 @@ NS_IMETHODIMP
|
|||
nsDOMEvent::InitEvent(const nsAString& aEventTypeArg, bool aCanBubbleArg, bool aCancelableArg)
|
||||
{
|
||||
// Make sure this event isn't already being dispatched.
|
||||
NS_ENSURE_TRUE(!NS_IS_EVENT_IN_DISPATCH(mEvent), NS_OK);
|
||||
NS_ENSURE_TRUE(!NS_IS_EVENT_IN_DISPATCH(mEvent), NS_ERROR_INVALID_ARG);
|
||||
|
||||
if (NS_IS_TRUSTED_EVENT(mEvent)) {
|
||||
// Ensure the caller is permitted to dispatch trusted DOM events.
|
||||
|
|
|
@ -7,6 +7,7 @@
|
|||
#define nsDOMEvent_h__
|
||||
|
||||
#include "nsIDOMEvent.h"
|
||||
#include "nsIDOMNSEvent.h"
|
||||
#include "nsISupports.h"
|
||||
#include "nsCOMPtr.h"
|
||||
#include "nsIDOMEventTarget.h"
|
||||
|
@ -23,6 +24,7 @@ struct JSContext;
|
|||
struct JSObject;
|
||||
|
||||
class nsDOMEvent : public nsIDOMEvent,
|
||||
public nsIDOMNSEvent,
|
||||
public nsIJSNativeInitializer
|
||||
{
|
||||
public:
|
||||
|
@ -189,6 +191,9 @@ public:
|
|||
// nsIDOMEvent Interface
|
||||
NS_DECL_NSIDOMEVENT
|
||||
|
||||
// nsIDOMNSEvent Interface
|
||||
NS_DECL_NSIDOMNSEVENT
|
||||
|
||||
// nsIJSNativeInitializer
|
||||
NS_IMETHOD Initialize(nsISupports* aOwner, JSContext* aCx, JSObject* aObj,
|
||||
PRUint32 aArgc, jsval* aArgv);
|
||||
|
@ -246,12 +251,6 @@ protected:
|
|||
NS_IMETHOD InitEvent(const nsAString & eventTypeArg, bool canBubbleArg, bool cancelableArg) { return _to InitEvent(eventTypeArg, canBubbleArg, cancelableArg); } \
|
||||
NS_IMETHOD GetDefaultPrevented(bool *aDefaultPrevented) { return _to GetDefaultPrevented(aDefaultPrevented); } \
|
||||
NS_IMETHOD StopImmediatePropagation(void) { return _to StopImmediatePropagation(); } \
|
||||
NS_IMETHOD GetOriginalTarget(nsIDOMEventTarget** aOriginalTarget) { return _to GetOriginalTarget(aOriginalTarget); } \
|
||||
NS_IMETHOD GetExplicitOriginalTarget(nsIDOMEventTarget** aExplicitOriginalTarget) { return _to GetExplicitOriginalTarget(aExplicitOriginalTarget); } \
|
||||
NS_IMETHOD PreventBubble() { return _to PreventBubble(); } \
|
||||
NS_IMETHOD PreventCapture() { return _to PreventCapture(); } \
|
||||
NS_IMETHOD GetPreventDefault(bool* aRetval) { return _to GetPreventDefault(aRetval); } \
|
||||
NS_IMETHOD GetIsTrusted(bool* aIsTrusted) { return _to GetIsTrusted(aIsTrusted); } \
|
||||
NS_IMETHOD SetTarget(nsIDOMEventTarget *aTarget) { return _to SetTarget(aTarget); } \
|
||||
NS_IMETHOD_(bool) IsDispatchStopped(void) { return _to IsDispatchStopped(); } \
|
||||
NS_IMETHOD_(nsEvent *) GetInternalNSEvent(void) { return _to GetInternalNSEvent(); } \
|
||||
|
|
|
@ -29,6 +29,8 @@ public:
|
|||
NS_IMETHOD_(void) Serialize(IPC::Message* aMsg, bool aSerializeInterfaceType);
|
||||
NS_IMETHOD_(bool) Deserialize(const IPC::Message* aMsg, void** aIter);
|
||||
|
||||
NS_FORWARD_NSIDOMNSEVENT(nsDOMEvent::)
|
||||
|
||||
virtual nsresult InitFromCtor(const nsAString& aType,
|
||||
JSContext* aCx, jsval* aVal);
|
||||
|
||||
|
|
|
@ -545,7 +545,7 @@ nsEventDispatcher::Dispatch(nsISupports* aTarget,
|
|||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
// Make sure that nsIDOMEvent::target and nsIDOMEvent::originalTarget
|
||||
// Make sure that nsIDOMEvent::target and nsIDOMNSEvent::originalTarget
|
||||
// point to the last item in the chain.
|
||||
if (!aEvent->target) {
|
||||
// Note, CurrentTarget() points always to the object returned by
|
||||
|
@ -682,8 +682,10 @@ nsEventDispatcher::DispatchDOMEvent(nsISupports* aTarget,
|
|||
if (innerEvent->flags & NS_EVENT_DISPATCHED) {
|
||||
innerEvent->target = nullptr;
|
||||
innerEvent->originalTarget = nullptr;
|
||||
} else {
|
||||
aDOMEvent->GetIsTrusted(&dontResetTrusted);
|
||||
}
|
||||
else {
|
||||
nsCOMPtr<nsIDOMNSEvent> nsevent(do_QueryInterface(aDOMEvent));
|
||||
nsevent->GetIsTrusted(&dontResetTrusted);
|
||||
}
|
||||
|
||||
if (!dontResetTrusted) {
|
||||
|
|
|
@ -14,6 +14,7 @@
|
|||
#include "nsDOMEvent.h"
|
||||
#include "nsEventListenerManager.h"
|
||||
#include "nsCaret.h"
|
||||
#include "nsIDOMNSEvent.h"
|
||||
#include "nsIDOMEventListener.h"
|
||||
#include "nsITextControlFrame.h"
|
||||
#include "nsGkAtoms.h"
|
||||
|
|
|
@ -2292,7 +2292,7 @@ nsEventStateManager::DetermineDragTarget(nsPresContext* aPresContext,
|
|||
*aTargetNode = nullptr;
|
||||
|
||||
nsCOMPtr<nsISupports> container = aPresContext->GetContainer();
|
||||
nsCOMPtr<nsPIDOMWindow> window = do_GetInterface(container);
|
||||
nsCOMPtr<nsIDOMWindow> window = do_GetInterface(container);
|
||||
if (!window)
|
||||
return;
|
||||
|
||||
|
|
|
@ -17,6 +17,7 @@
|
|||
#include "nsPresContext.h"
|
||||
#include "nsIDOMWindow.h"
|
||||
#include "nsIDOMMouseEvent.h"
|
||||
#include "nsIDOMNSEvent.h"
|
||||
#include "nsContentUtils.h"
|
||||
#include "nsINode.h"
|
||||
#include "nsIFrame.h"
|
||||
|
@ -201,7 +202,8 @@ nsIMEStateManager::OnClickInEditor(nsPresContext* aPresContext,
|
|||
NS_ENSURE_TRUE(widget, );
|
||||
|
||||
bool isTrusted;
|
||||
nsresult rv = aMouseEvent->GetIsTrusted(&isTrusted);
|
||||
nsCOMPtr<nsIDOMNSEvent> NSEvent = do_QueryInterface(aMouseEvent);
|
||||
nsresult rv = NSEvent->GetIsTrusted(&isTrusted);
|
||||
NS_ENSURE_SUCCESS(rv, );
|
||||
if (!isTrusted) {
|
||||
return; // ignore untrusted event.
|
||||
|
|
|
@ -84,9 +84,8 @@ MOCHITEST_FILES = \
|
|||
test_bug741666.html \
|
||||
test_dom_keyboard_event.html \
|
||||
test_dom_mouse_event.html \
|
||||
test_bug603008.html \
|
||||
test_bug716822.html \
|
||||
test_bug742376.html \
|
||||
test_bug603008.html \
|
||||
$(NULL)
|
||||
|
||||
#bug 585630
|
||||
|
|
|
@ -53,7 +53,7 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=238987
|
|||
shouldStop = true;
|
||||
}
|
||||
} else if (e.target.id == "end") {
|
||||
modifier = Components.interfaces.nsIDOMEvent.SHIFT_MASK;
|
||||
modifier = Components.interfaces.nsIDOMNSEvent.SHIFT_MASK;
|
||||
} else if (modifier) {
|
||||
var expected = backwardFocusArray.pop();
|
||||
ok(expected == e.target.id,
|
||||
|
|
|
@ -19,8 +19,8 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=409604
|
|||
|
||||
/** Test for Bug 409604 **/
|
||||
|
||||
var modifier = Components.interfaces.nsIDOMEvent.ALT_MASK |
|
||||
Components.interfaces.nsIDOMEvent.SHIFT_MASK;
|
||||
var modifier = Components.interfaces.nsIDOMNSEvent.ALT_MASK |
|
||||
Components.interfaces.nsIDOMNSEvent.SHIFT_MASK;
|
||||
var expectedFocus = "a,c,d,e,f,g,h,i,j,k,l,m,n,p,x,y";
|
||||
// XXX the "map" test is causing trouble, see bug 433089
|
||||
var focusArray = expectedFocus.split(",");
|
||||
|
|
|
@ -81,7 +81,7 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=617528
|
|||
browser.removeEventListener("contextmenu", onContextMenu1, false);
|
||||
|
||||
browser.addEventListener("contextmenu", onContextMenu2, false);
|
||||
var shiftMask = Components.interfaces.nsIDOMEvent.SHIFT_MASK;
|
||||
var shiftMask = Components.interfaces.nsIDOMNSEvent.SHIFT_MASK;
|
||||
wu.sendMouseEvent("contextmenu", left, top, 2, 1, shiftMask);
|
||||
browser.removeEventListener("contextmenu", onContextMenu2, false);
|
||||
|
||||
|
|
|
@ -1,28 +0,0 @@
|
|||
<!DOCTYPE HTML>
|
||||
<html>
|
||||
<!--
|
||||
https://bugzilla.mozilla.org/show_bug.cgi?id=716822
|
||||
-->
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<title>Test for Bug 716822</title>
|
||||
<script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
|
||||
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
|
||||
</head>
|
||||
<body>
|
||||
<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=716822">Mozilla Bug 716822</a>
|
||||
<p id="display"></p>
|
||||
<div id="content" style="display: none">
|
||||
|
||||
</div>
|
||||
<pre id="test">
|
||||
<script type="application/javascript">
|
||||
/** Test for Bug 716822 **/
|
||||
for (var p in window.NSEvent) {
|
||||
ok(p in window.Event, p + " should be in Event.");
|
||||
is(window.NSEvent[p], window.Event[p], "Value of " + p);
|
||||
}
|
||||
</script>
|
||||
</pre>
|
||||
</body>
|
||||
</html>
|
|
@ -58,6 +58,7 @@
|
|||
#include "nsGkAtoms.h"
|
||||
#include "nsEventStateManager.h"
|
||||
#include "nsIDOMEvent.h"
|
||||
#include "nsIDOMNSEvent.h"
|
||||
#include "nsDOMCSSDeclaration.h"
|
||||
#include "nsITextControlFrame.h"
|
||||
#include "nsIForm.h"
|
||||
|
|
|
@ -19,6 +19,7 @@
|
|||
#include "nsIFrame.h"
|
||||
#include "nsIFormControlFrame.h"
|
||||
#include "nsIDOMEvent.h"
|
||||
#include "nsIDOMNSEvent.h"
|
||||
#include "nsIDocument.h"
|
||||
#include "nsGUIEvent.h"
|
||||
#include "nsUnicharUtils.h"
|
||||
|
|
|
@ -46,6 +46,7 @@
|
|||
#include "nsPresState.h"
|
||||
#include "nsLayoutErrors.h"
|
||||
#include "nsIDOMEvent.h"
|
||||
#include "nsIDOMNSEvent.h"
|
||||
#include "nsIDOMNodeList.h"
|
||||
#include "nsIDOMHTMLCollection.h"
|
||||
#include "nsLinebreakConverter.h" //to strip out carriage returns
|
||||
|
|
|
@ -10,6 +10,7 @@
|
|||
#include "nsIDOMKeyEvent.h"
|
||||
#include "nsIDOMMouseEvent.h"
|
||||
#include "nsXBLPrototypeHandler.h"
|
||||
#include "nsIDOMNSEvent.h"
|
||||
#include "nsGUIEvent.h"
|
||||
#include "nsContentUtils.h"
|
||||
|
||||
|
@ -85,8 +86,10 @@ nsXBLKeyEventHandler::ExecuteMatchedHandlers(nsIDOMKeyEvent* aKeyEvent,
|
|||
PRUint32 aCharCode,
|
||||
bool aIgnoreShiftKey)
|
||||
{
|
||||
nsCOMPtr<nsIDOMNSEvent> domNSEvent = do_QueryInterface(aKeyEvent);
|
||||
bool trustedEvent = false;
|
||||
aKeyEvent->GetIsTrusted(&trustedEvent);
|
||||
if (domNSEvent)
|
||||
domNSEvent->GetIsTrusted(&trustedEvent);
|
||||
|
||||
nsCOMPtr<nsIDOMEventTarget> target;
|
||||
aKeyEvent->GetCurrentTarget(getter_AddRefs(target));
|
||||
|
|
|
@ -27,6 +27,7 @@
|
|||
#include "nsEventListenerManager.h"
|
||||
#include "nsIDOMEventTarget.h"
|
||||
#include "nsIDOMEventListener.h"
|
||||
#include "nsIDOMNSEvent.h"
|
||||
#include "nsPIDOMWindow.h"
|
||||
#include "nsPIWindowRoot.h"
|
||||
#include "nsIDOMWindow.h"
|
||||
|
@ -209,8 +210,11 @@ nsXBLPrototypeHandler::ExecuteHandler(nsIDOMEventTarget* aTarget,
|
|||
// XUL handlers and commands shouldn't be triggered by non-trusted
|
||||
// events.
|
||||
if (isXULKey || isXBLCommand) {
|
||||
nsCOMPtr<nsIDOMNSEvent> domNSEvent = do_QueryInterface(aEvent);
|
||||
bool trustedEvent = false;
|
||||
aEvent->GetIsTrusted(&trustedEvent);
|
||||
if (domNSEvent) {
|
||||
domNSEvent->GetIsTrusted(&trustedEvent);
|
||||
}
|
||||
|
||||
if (!trustedEvent)
|
||||
return NS_OK;
|
||||
|
@ -356,17 +360,20 @@ nsXBLPrototypeHandler::DispatchXBLCommand(nsIDOMEventTarget* aTarget, nsIDOMEven
|
|||
// This is a special-case optimization to make command handling fast.
|
||||
// It isn't really a part of XBL, but it helps speed things up.
|
||||
|
||||
// See if preventDefault has been set. If so, don't execute.
|
||||
bool preventDefault = false;
|
||||
nsCOMPtr<nsIDOMNSEvent> domNSEvent = do_QueryInterface(aEvent);
|
||||
if (domNSEvent) {
|
||||
domNSEvent->GetPreventDefault(&preventDefault);
|
||||
}
|
||||
|
||||
if (preventDefault)
|
||||
return NS_OK;
|
||||
|
||||
if (aEvent) {
|
||||
// See if preventDefault has been set. If so, don't execute.
|
||||
bool preventDefault = false;
|
||||
aEvent->GetPreventDefault(&preventDefault);
|
||||
if (preventDefault) {
|
||||
return NS_OK;
|
||||
}
|
||||
bool dispatchStopped = aEvent->IsDispatchStopped();
|
||||
if (dispatchStopped) {
|
||||
if (dispatchStopped)
|
||||
return NS_OK;
|
||||
}
|
||||
}
|
||||
|
||||
// Instead of executing JS, let's get the controller for the bound
|
||||
|
|
|
@ -10,6 +10,7 @@
|
|||
#include "nsIAtom.h"
|
||||
#include "nsIDOMKeyEvent.h"
|
||||
#include "nsIDOMEventTarget.h"
|
||||
#include "nsIDOMNSEvent.h"
|
||||
#include "nsXBLService.h"
|
||||
#include "nsIServiceManager.h"
|
||||
#include "nsGkAtoms.h"
|
||||
|
@ -279,14 +280,17 @@ DoCommandCallback(const char *aCommand, void *aData)
|
|||
nsresult
|
||||
nsXBLWindowKeyHandler::WalkHandlers(nsIDOMKeyEvent* aKeyEvent, nsIAtom* aEventType)
|
||||
{
|
||||
nsCOMPtr<nsIDOMNSEvent> domNSEvent = do_QueryInterface(aKeyEvent);
|
||||
bool prevent;
|
||||
aKeyEvent->GetPreventDefault(&prevent);
|
||||
domNSEvent->GetPreventDefault(&prevent);
|
||||
if (prevent)
|
||||
return NS_OK;
|
||||
|
||||
bool trustedEvent = false;
|
||||
// Don't process the event if it was not dispatched from a trusted source
|
||||
aKeyEvent->GetIsTrusted(&trustedEvent);
|
||||
if (domNSEvent) {
|
||||
//Don't process the event if it was not dispatched from a trusted source
|
||||
domNSEvent->GetIsTrusted(&trustedEvent);
|
||||
}
|
||||
|
||||
if (!trustedEvent)
|
||||
return NS_OK;
|
||||
|
@ -299,7 +303,7 @@ nsXBLWindowKeyHandler::WalkHandlers(nsIDOMKeyEvent* aKeyEvent, nsIAtom* aEventTy
|
|||
if (!el) {
|
||||
if (mUserHandler) {
|
||||
WalkHandlersInternal(aKeyEvent, aEventType, mUserHandler);
|
||||
aKeyEvent->GetPreventDefault(&prevent);
|
||||
domNSEvent->GetPreventDefault(&prevent);
|
||||
if (prevent)
|
||||
return NS_OK; // Handled by the user bindings. Our work here is done.
|
||||
}
|
||||
|
|
|
@ -99,6 +99,7 @@
|
|||
#include "nsEventDispatcher.h"
|
||||
#include "mozAutoDocUpdate.h"
|
||||
#include "nsIDOMXULCommandEvent.h"
|
||||
#include "nsIDOMNSEvent.h"
|
||||
#include "nsCCUncollectableMarker.h"
|
||||
|
||||
namespace css = mozilla::css;
|
||||
|
@ -1135,18 +1136,19 @@ nsXULElement::PreHandleEvent(nsEventChainPreVisitor& aVisitor)
|
|||
// pointed to by the command attribute. The new event's
|
||||
// sourceEvent will be the original command event that we're
|
||||
// handling.
|
||||
nsCOMPtr<nsIDOMEvent> domEvent = aVisitor.mDOMEvent;
|
||||
while (domEvent) {
|
||||
nsCOMPtr<nsIDOMNSEvent> nsevent =
|
||||
do_QueryInterface(aVisitor.mDOMEvent);
|
||||
while (nsevent) {
|
||||
nsCOMPtr<nsIDOMEventTarget> oTarget;
|
||||
domEvent->GetOriginalTarget(getter_AddRefs(oTarget));
|
||||
nsevent->GetOriginalTarget(getter_AddRefs(oTarget));
|
||||
NS_ENSURE_STATE(!SameCOMIdentity(oTarget, commandContent));
|
||||
nsCOMPtr<nsIDOMEvent> tmp;
|
||||
nsCOMPtr<nsIDOMXULCommandEvent> commandEvent =
|
||||
do_QueryInterface(domEvent);
|
||||
do_QueryInterface(nsevent);
|
||||
if (commandEvent) {
|
||||
commandEvent->GetSourceEvent(getter_AddRefs(domEvent));
|
||||
} else {
|
||||
domEvent = NULL;
|
||||
commandEvent->GetSourceEvent(getter_AddRefs(tmp));
|
||||
}
|
||||
nsevent = do_QueryInterface(tmp);
|
||||
}
|
||||
|
||||
nsInputEvent* orig =
|
||||
|
|
|
@ -25,6 +25,7 @@
|
|||
#include "nsIDOMXULDocument.h"
|
||||
#include "nsIDocument.h"
|
||||
#include "nsIDOMEventTarget.h"
|
||||
#include "nsIDOMNSEvent.h"
|
||||
#include "nsServiceManagerUtils.h"
|
||||
#include "nsIPrincipal.h"
|
||||
#include "nsIScriptSecurityManager.h"
|
||||
|
@ -92,6 +93,12 @@ nsXULPopupListener::HandleEvent(nsIDOMEvent* aEvent)
|
|||
return NS_OK;
|
||||
}
|
||||
|
||||
// check if someone has attempted to prevent this action.
|
||||
nsCOMPtr<nsIDOMNSEvent> domNSEvent = do_QueryInterface(mouseEvent);
|
||||
if (!domNSEvent) {
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
// Get the node that was clicked on.
|
||||
nsCOMPtr<nsIDOMEventTarget> target;
|
||||
mouseEvent->GetTarget(getter_AddRefs(target));
|
||||
|
@ -116,7 +123,7 @@ nsXULPopupListener::HandleEvent(nsIDOMEvent* aEvent)
|
|||
}
|
||||
|
||||
bool preventDefault;
|
||||
mouseEvent->GetPreventDefault(&preventDefault);
|
||||
domNSEvent->GetPreventDefault(&preventDefault);
|
||||
if (preventDefault && targetNode && mIsContext) {
|
||||
// Someone called preventDefault on a context menu.
|
||||
// Let's make sure they are allowed to do so.
|
||||
|
@ -166,6 +173,8 @@ nsXULPopupListener::HandleEvent(nsIDOMEvent* aEvent)
|
|||
return NS_OK;
|
||||
}
|
||||
|
||||
nsCOMPtr<nsIDOMNSEvent> nsevent = do_QueryInterface(aEvent);
|
||||
|
||||
if (mIsContext) {
|
||||
#ifndef NS_CONTEXT_MENU_IS_MOUSEUP
|
||||
// If the context menu launches on mousedown,
|
||||
|
|
|
@ -865,7 +865,29 @@ XULContentSinkImpl::OpenScript(const PRUnichar** aAttributes,
|
|||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
}
|
||||
|
||||
if (nsContentUtils::IsJavascriptMIMEType(mimeType)) {
|
||||
// Javascript keeps the fast path, optimized for most-likely type
|
||||
// Table ordered from most to least likely JS MIME types. For .xul
|
||||
// files that we host, the likeliest type is application/x-javascript.
|
||||
// See bug 62485, feel free to add <script type="..."> survey data to it,
|
||||
// or to a new bug once 62485 is closed.
|
||||
static const char *jsTypes[] = {
|
||||
"application/x-javascript",
|
||||
"text/javascript",
|
||||
"text/ecmascript",
|
||||
"application/javascript",
|
||||
"application/ecmascript",
|
||||
nullptr
|
||||
};
|
||||
|
||||
bool isJavaScript = false;
|
||||
for (PRInt32 i = 0; jsTypes[i]; i++) {
|
||||
if (mimeType.LowerCaseEqualsASCII(jsTypes[i])) {
|
||||
isJavaScript = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (isJavaScript) {
|
||||
langID = nsIProgrammingLanguage::JAVASCRIPT;
|
||||
version = JSVERSION_LATEST;
|
||||
} else {
|
||||
|
@ -876,11 +898,20 @@ XULContentSinkImpl::OpenScript(const PRUnichar** aAttributes,
|
|||
// Get the version string, and ensure the language supports it.
|
||||
nsAutoString versionName;
|
||||
rv = parser.GetParameter("version", versionName);
|
||||
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
version = nsContentUtils::ParseJavascriptVersion(versionName);
|
||||
} else if (rv != NS_ERROR_INVALID_ARG) {
|
||||
return rv;
|
||||
if (NS_FAILED(rv)) {
|
||||
if (rv != NS_ERROR_INVALID_ARG)
|
||||
return rv;
|
||||
// no version specified - version remains the default.
|
||||
} else {
|
||||
nsCOMPtr<nsIScriptRuntime> runtime;
|
||||
rv = NS_GetJSRuntime(getter_AddRefs(runtime));
|
||||
if (NS_FAILED(rv))
|
||||
return rv;
|
||||
rv = runtime->ParseVersion(versionName, &version);
|
||||
if (NS_FAILED(rv)) {
|
||||
NS_WARNING("This script language version is not supported - ignored");
|
||||
langID = nsIProgrammingLanguage::UNKNOWN;
|
||||
}
|
||||
}
|
||||
}
|
||||
// Some js specifics yet to be abstracted.
|
||||
|
|
|
@ -951,9 +951,11 @@ NS_IMETHODIMP nsDocShell::GetInterface(const nsIID & aIID, void **aSink)
|
|||
}
|
||||
else if (aIID.Equals(NS_GET_IID(nsIDocument)) &&
|
||||
NS_SUCCEEDED(EnsureContentViewer())) {
|
||||
nsCOMPtr<nsIDocument> doc = mContentViewer->GetDocument();
|
||||
doc.forget(aSink);
|
||||
return *aSink ? NS_OK : NS_NOINTERFACE;
|
||||
nsCOMPtr<nsIDOMDocument> domDoc;
|
||||
mContentViewer->GetDOMDocument(getter_AddRefs(domDoc));
|
||||
if (!domDoc)
|
||||
return NS_NOINTERFACE;
|
||||
return domDoc->QueryInterface(aIID, aSink);
|
||||
}
|
||||
else if (aIID.Equals(NS_GET_IID(nsIApplicationCacheContainer))) {
|
||||
*aSink = nullptr;
|
||||
|
|
|
@ -125,6 +125,7 @@ WebappsRegistry.prototype = {
|
|||
let requestID = this.getRequestId(request);
|
||||
let xhr = Cc["@mozilla.org/xmlextras/xmlhttprequest;1"].createInstance(Ci.nsIXMLHttpRequest);
|
||||
xhr.open("GET", aURL, true);
|
||||
xhr.channel.loadFlags |= Ci.nsIRequest.VALIDATE_ALWAYS;
|
||||
|
||||
xhr.addEventListener("load", (function() {
|
||||
if (xhr.status == 200) {
|
||||
|
|
|
@ -64,6 +64,7 @@
|
|||
#include "nsIDOMDocument.h"
|
||||
#include "nsIDOMXMLDocument.h"
|
||||
#include "nsIDOMEvent.h"
|
||||
#include "nsIDOMNSEvent.h"
|
||||
#include "nsIDOMKeyEvent.h"
|
||||
#include "nsIDOMEventListener.h"
|
||||
#include "nsContentUtils.h"
|
||||
|
@ -2374,6 +2375,7 @@ nsDOMClassInfo::RegisterExternalClasses()
|
|||
|
||||
#define DOM_CLASSINFO_EVENT_MAP_ENTRIES \
|
||||
DOM_CLASSINFO_MAP_ENTRY(nsIDOMEvent) \
|
||||
DOM_CLASSINFO_MAP_ENTRY(nsIDOMNSEvent) \
|
||||
|
||||
#define DOM_CLASSINFO_UI_EVENT_MAP_ENTRIES \
|
||||
DOM_CLASSINFO_MAP_ENTRY(nsIDOMUIEvent) \
|
||||
|
@ -6394,6 +6396,14 @@ nsDOMConstructor::ResolveInterfaceConstants(JSContext *cx, JSObject *obj)
|
|||
nsresult rv = DefineInterfaceConstants(cx, obj, class_iid);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
// Special case for |Event|, Event needs constants from NSEvent
|
||||
// too for backwards compatibility.
|
||||
if (class_iid->Equals(NS_GET_IID(nsIDOMEvent))) {
|
||||
rv = DefineInterfaceConstants(cx, obj,
|
||||
&NS_GET_IID(nsIDOMNSEvent));
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
}
|
||||
|
||||
// Special case for |IDBKeyRange| which gets funny "static" functions.
|
||||
if (class_iid->Equals(NS_GET_IID(nsIIDBKeyRange)) &&
|
||||
!indexedDB::IDBKeyRange::DefineConstructors(cx, obj)) {
|
||||
|
@ -6538,6 +6548,14 @@ ResolvePrototype(nsIXPConnect *aXPConnect, nsGlobalWindow *aWin, JSContext *cx,
|
|||
rv = DefineInterfaceConstants(cx, class_obj, primary_iid);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
// Special case for |Event|, Event needs constants from NSEvent
|
||||
// too for backwards compatibility.
|
||||
if (primary_iid->Equals(NS_GET_IID(nsIDOMEvent))) {
|
||||
rv = DefineInterfaceConstants(cx, class_obj,
|
||||
&NS_GET_IID(nsIDOMNSEvent));
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
}
|
||||
|
||||
// Special case for |IDBKeyRange| which gets funny "static" functions.
|
||||
if (primary_iid->Equals(NS_GET_IID(nsIIDBKeyRange)) &&
|
||||
!indexedDB::IDBKeyRange::DefineConstructors(cx, class_obj)) {
|
||||
|
@ -7369,12 +7387,17 @@ nsWindowSH::NewResolve(nsIXPConnectWrappedNative *wrapper, JSContext *cx,
|
|||
}
|
||||
|
||||
if (sDocument_id == id) {
|
||||
nsCOMPtr<nsIDocument> document = win->GetDoc();
|
||||
JS::Value v;
|
||||
nsCOMPtr<nsIDOMDocument> document;
|
||||
rv = win->GetDocument(getter_AddRefs(document));
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
// FIXME Ideally we'd have an nsIDocument here and get nsWrapperCache
|
||||
// from it.
|
||||
jsval v;
|
||||
nsCOMPtr<nsIXPConnectJSObjectHolder> holder;
|
||||
rv = WrapNative(cx, JS_GetGlobalForScopeChain(cx), document, document,
|
||||
&NS_GET_IID(nsIDOMDocument), &v, getter_AddRefs(holder),
|
||||
false);
|
||||
rv = WrapNative(cx, JS_GetGlobalForScopeChain(cx), document,
|
||||
&NS_GET_IID(nsIDOMDocument), false, &v,
|
||||
getter_AddRefs(holder));
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
// The PostCreate hook for the document will handle defining the
|
||||
|
|
|
@ -7,7 +7,7 @@
|
|||
#include "nsPresContext.h"
|
||||
#include "nsDOMClassInfoID.h"
|
||||
#include "nsDOMError.h"
|
||||
#include "nsIDOMEvent.h"
|
||||
#include "nsIDOMNSEvent.h"
|
||||
#include "nsDOMWindowUtils.h"
|
||||
#include "nsQueryContentEventResult.h"
|
||||
#include "nsGlobalWindow.h"
|
||||
|
|
|
@ -2830,23 +2830,25 @@ nsGlobalWindow::GetPrincipal()
|
|||
// nsGlobalWindow::nsIDOMWindow
|
||||
//*****************************************************************************
|
||||
|
||||
void
|
||||
nsPIDOMWindow::MaybeCreateDoc()
|
||||
{
|
||||
MOZ_ASSERT(!mDoc);
|
||||
if (nsIDocShell* docShell = GetDocShell()) {
|
||||
// Note that |document| here is the same thing as our mDocument, but we
|
||||
// don't have to explicitly set the member variable because the docshell
|
||||
// has already called SetNewDocument().
|
||||
nsCOMPtr<nsIDocument> document = do_GetInterface(docShell);
|
||||
}
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsGlobalWindow::GetDocument(nsIDOMDocument** aDocument)
|
||||
{
|
||||
nsCOMPtr<nsIDOMDocument> document = do_QueryInterface(GetDoc());
|
||||
document.forget(aDocument);
|
||||
// This method *should* forward calls to the outer window, but since
|
||||
// there's nothing here that *depends* on anything in the outer
|
||||
// (GetDocShell() eliminates that dependency), we won't do that to
|
||||
// avoid the extra virtual function call.
|
||||
|
||||
// lazily instantiate an about:blank document if necessary, and if
|
||||
// we have what it takes to do so. Note that domdoc here is the same
|
||||
// thing as our mDocument, but we don't have to explicitly set the
|
||||
// member variable because the docshell has already called
|
||||
// SetNewDocument().
|
||||
nsIDocShell *docShell;
|
||||
if (!mDocument && (docShell = GetDocShell()))
|
||||
nsCOMPtr<nsIDOMDocument> domdoc(do_GetInterface(docShell));
|
||||
|
||||
NS_IF_ADDREF(*aDocument = mDocument);
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
|
|
@ -8,8 +8,8 @@
|
|||
#include "nsIScriptContext.h"
|
||||
|
||||
#define NS_ISCRIPTRUNTIME_IID \
|
||||
{ 0xfa30d7a8, 0x7f0a, 0x437a, \
|
||||
{ 0xa1, 0x0c, 0xc2, 0xbe, 0xa3, 0xdb, 0x4f, 0x4b } }
|
||||
{ 0xb146580f, 0x55f7, 0x4d97, \
|
||||
{ 0x8a, 0xbb, 0x4a, 0x50, 0xb0, 0xa8, 0x04, 0x97 } }
|
||||
|
||||
/**
|
||||
* A singleton language environment for an application. Responsible for
|
||||
|
@ -21,6 +21,13 @@ class nsIScriptRuntime : public nsISupports
|
|||
public:
|
||||
NS_DECLARE_STATIC_IID_ACCESSOR(NS_ISCRIPTRUNTIME_IID)
|
||||
|
||||
/* Parses a "version string" for the language into a bit-mask used by
|
||||
* the language implementation. If the specified version is not supported
|
||||
* an error should be returned. If the specified version is blank, a default
|
||||
* version should be assumed
|
||||
*/
|
||||
virtual nsresult ParseVersion(const nsString &aVersionStr, PRUint32 *verFlags) = 0;
|
||||
|
||||
/* Factory for a new context for this language */
|
||||
virtual already_AddRefed<nsIScriptContext> CreateContext() = 0;
|
||||
|
||||
|
|
|
@ -3658,6 +3658,29 @@ nsJSRuntime::CreateContext()
|
|||
return scriptContext.forget();
|
||||
}
|
||||
|
||||
nsresult
|
||||
nsJSRuntime::ParseVersion(const nsString &aVersionStr, PRUint32 *flags)
|
||||
{
|
||||
NS_PRECONDITION(flags, "Null flags param?");
|
||||
JSVersion jsVersion = JSVERSION_UNKNOWN;
|
||||
if (aVersionStr.Length() != 3 || aVersionStr[0] != '1' || aVersionStr[1] != '.')
|
||||
jsVersion = JSVERSION_UNKNOWN;
|
||||
else switch (aVersionStr[2]) {
|
||||
case '0': jsVersion = JSVERSION_1_0; break;
|
||||
case '1': jsVersion = JSVERSION_1_1; break;
|
||||
case '2': jsVersion = JSVERSION_1_2; break;
|
||||
case '3': jsVersion = JSVERSION_1_3; break;
|
||||
case '4': jsVersion = JSVERSION_1_4; break;
|
||||
case '5': jsVersion = JSVERSION_1_5; break;
|
||||
case '6': jsVersion = JSVERSION_1_6; break;
|
||||
case '7': jsVersion = JSVERSION_1_7; break;
|
||||
case '8': jsVersion = JSVERSION_1_8; break;
|
||||
default: jsVersion = JSVERSION_UNKNOWN;
|
||||
}
|
||||
*flags = (PRUint32)jsVersion;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
//static
|
||||
void
|
||||
nsJSRuntime::Startup()
|
||||
|
|
|
@ -317,6 +317,8 @@ public:
|
|||
|
||||
virtual already_AddRefed<nsIScriptContext> CreateContext();
|
||||
|
||||
virtual nsresult ParseVersion(const nsString &aVersionStr, PRUint32 *flags);
|
||||
|
||||
virtual nsresult DropScriptObject(void *object);
|
||||
virtual nsresult HoldScriptObject(void *object);
|
||||
|
||||
|
|
|
@ -172,20 +172,6 @@ public:
|
|||
return mDoc;
|
||||
}
|
||||
|
||||
nsIDocument* GetDoc()
|
||||
{
|
||||
if (!mDoc) {
|
||||
MaybeCreateDoc();
|
||||
}
|
||||
return mDoc;
|
||||
}
|
||||
|
||||
protected:
|
||||
// Lazily instantiate an about:blank document if necessary, and if
|
||||
// we have what it takes to do so.
|
||||
void MaybeCreateDoc();
|
||||
|
||||
public:
|
||||
// Internal getter/setter for the frame element, this version of the
|
||||
// getter crosses chrome boundaries whereas the public scriptable
|
||||
// one doesn't for security reasons.
|
||||
|
|
|
@ -403,7 +403,13 @@ QueryInterface(JSContext* cx, unsigned argc, JS::Value* vp)
|
|||
JSBool
|
||||
ThrowingConstructor(JSContext* cx, unsigned argc, JS::Value* vp)
|
||||
{
|
||||
return ThrowErrorMessage(cx, MSG_ILLEGAL_CONSTRUCTOR);
|
||||
return Throw<true>(cx, NS_ERROR_FAILURE);
|
||||
}
|
||||
|
||||
JSBool
|
||||
ThrowingConstructorWorkers(JSContext* cx, unsigned argc, JS::Value* vp)
|
||||
{
|
||||
return Throw<false>(cx, NS_ERROR_FAILURE);
|
||||
}
|
||||
|
||||
bool
|
||||
|
|
|
@ -690,6 +690,8 @@ JSBool
|
|||
QueryInterface(JSContext* cx, unsigned argc, JS::Value* vp);
|
||||
JSBool
|
||||
ThrowingConstructor(JSContext* cx, unsigned argc, JS::Value* vp);
|
||||
JSBool
|
||||
ThrowingConstructorWorkers(JSContext* cx, unsigned argc, JS::Value* vp);
|
||||
|
||||
template<class T>
|
||||
class NonNull
|
||||
|
|
|
@ -1118,7 +1118,7 @@ class CGCreateInterfaceObjectsMethod(CGAbstractMethod):
|
|||
constructHook = CONSTRUCT_HOOK_NAME
|
||||
constructArgs = methodLength(self.descriptor.interface.ctor())
|
||||
else:
|
||||
constructHook = "ThrowingConstructor"
|
||||
constructHook = "ThrowingConstructorWorkers" if self.descriptor.workers else "ThrowingConstructor"
|
||||
constructArgs = 0
|
||||
|
||||
call = CGGeneric(("return dom::CreateInterfaceObjects(aCx, aGlobal, aReceiver, parentProto,\n"
|
||||
|
@ -1213,27 +1213,24 @@ def CheckPref(descriptor, globalName, varName, retval, wrapperCache = None):
|
|||
"""
|
||||
if not descriptor.prefable:
|
||||
return ""
|
||||
|
||||
if wrapperCache:
|
||||
wrapperCache = " %s->ClearIsDOMBinding();\n" % (wrapperCache)
|
||||
else:
|
||||
wrapperCache = ""
|
||||
|
||||
failureCode = (" %s = false;\n" +
|
||||
" return %s;") % (varName, retval)
|
||||
return """
|
||||
{
|
||||
XPCWrappedNativeScope* scope =
|
||||
XPCWrappedNativeScope::FindInJSObjectScope(aCx, %s);
|
||||
if (!scope) {
|
||||
%s
|
||||
return %s;
|
||||
}
|
||||
|
||||
if (!scope->ExperimentalBindingsEnabled()) {
|
||||
%s%s
|
||||
%s %s = false;
|
||||
return %s;
|
||||
}
|
||||
}
|
||||
""" % (globalName, failureCode, wrapperCache, failureCode)
|
||||
""" % (globalName, retval, wrapperCache, varName, retval)
|
||||
|
||||
class CGDefineDOMInterfaceMethod(CGAbstractMethod):
|
||||
"""
|
||||
|
|
|
@ -24,4 +24,3 @@ MSG_DEF(MSG_MISSING_ARGUMENTS, 1, "Not enough arguments to {0}.")
|
|||
MSG_DEF(MSG_NOT_OBJECT, 0, "Value not an object.")
|
||||
MSG_DEF(MSG_DOES_NOT_IMPLEMENT_INTERFACE, 1, "Value does not implement interface {0}.")
|
||||
MSG_DEF(MSG_NOT_IN_UNION, 1, "Value could not be converted to any of: {0}.")
|
||||
MSG_DEF(MSG_ILLEGAL_CONSTRUCTOR, 0, "Illegal constructor.")
|
||||
|
|
|
@ -62,16 +62,15 @@ EXPORTS_mozilla = \
|
|||
$(NULL)
|
||||
|
||||
EXPORTS_$(binding_include_path) = \
|
||||
BindingUtils.h \
|
||||
DOMJSClass.h \
|
||||
Errors.msg \
|
||||
Nullable.h \
|
||||
PrimitiveConversions.h \
|
||||
PrototypeList.h \
|
||||
RegisterBindings.h \
|
||||
Nullable.h \
|
||||
TypedArray.h \
|
||||
UnionConversions.h \
|
||||
BindingUtils.h \
|
||||
UnionTypes.h \
|
||||
UnionConversions.h \
|
||||
$(exported_binding_headers) \
|
||||
$(NULL)
|
||||
|
||||
|
|
|
@ -91,7 +91,7 @@ struct PrimitiveConversionTraits<int64_t> {
|
|||
typedef int64_t jstype;
|
||||
typedef int64_t intermediateType;
|
||||
static inline bool converter(JSContext* cx, JS::Value v, jstype* retval) {
|
||||
return xpc::ValueToInt64(cx, v, retval);
|
||||
return JS::ToInt64(cx, v, retval);
|
||||
}
|
||||
};
|
||||
|
||||
|
@ -100,7 +100,7 @@ struct PrimitiveConversionTraits<uint64_t> {
|
|||
typedef uint64_t jstype;
|
||||
typedef uint64_t intermediateType;
|
||||
static inline bool converter(JSContext* cx, JS::Value v, jstype* retval) {
|
||||
return xpc::ValueToUint64(cx, v, retval);
|
||||
return JS::ToUint64(cx, v, retval);
|
||||
}
|
||||
};
|
||||
|
||||
|
|
|
@ -49,8 +49,7 @@ bindinggen_dependencies := \
|
|||
$(GLOBAL_DEPS) \
|
||||
$(NULL)
|
||||
|
||||
MOCHITEST_FILES := \
|
||||
test_bug773326.html \
|
||||
MOCHITEST_FILES = \
|
||||
test_enums.html \
|
||||
test_integers.html \
|
||||
test_interfaceToString.html \
|
||||
|
|
|
@ -1,11 +0,0 @@
|
|||
<!doctype html>
|
||||
<meta charset=utf-8>
|
||||
<title>Test for Bug 773326</title>
|
||||
<script src=/resources/testharness.js></script>
|
||||
<script src=/resources/testharnessreport.js></script>
|
||||
<div id=log></div>
|
||||
<script>
|
||||
test(function() {
|
||||
new Worker("data:text/javascript,new XMLHttpRequest(42)");
|
||||
}, "Should not crash")
|
||||
</script>
|
|
@ -8,7 +8,7 @@
|
|||
|
||||
interface nsIDOMBluetoothDevice;
|
||||
|
||||
[scriptable, builtinclass, uuid(819b4683-23a9-4af9-96b9-2c40a14ecb0b)]
|
||||
[scriptable, builtinclass, uuid(49294da3-b698-4a7f-aca2-3f9bc44c7625)]
|
||||
interface nsIDOMBluetoothDeviceEvent : nsIDOMEvent
|
||||
{
|
||||
readonly attribute nsIDOMBluetoothDevice device;
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
|
||||
#include "nsIDOMEvent.idl"
|
||||
|
||||
[scriptable, builtinclass, uuid(5927bb1f-e8eb-4b40-ae20-cd02f34412ce)]
|
||||
[scriptable, builtinclass, uuid(2604ce78-abaa-4af4-b456-daa4c6386a11)]
|
||||
interface nsIDOMBluetoothPropertyEvent : nsIDOMEvent
|
||||
{
|
||||
readonly attribute DOMString property;
|
||||
|
|
|
@ -117,20 +117,12 @@ const ContentPanning = {
|
|||
|
||||
let nodeContent = node.ownerDocument.defaultView;
|
||||
while (!(node instanceof Ci.nsIDOMHTMLBodyElement)) {
|
||||
let style = nodeContent.getComputedStyle(node, null);
|
||||
|
||||
let overflow = [style.getPropertyValue('overflow'),
|
||||
style.getPropertyValue('overflow-x'),
|
||||
style.getPropertyValue('overflow-y')];
|
||||
|
||||
let rect = node.getBoundingClientRect();
|
||||
let isAuto = (overflow.indexOf('auto') != -1 &&
|
||||
(rect.height < node.scrollHeight ||
|
||||
rect.width < node.scrollWidth));
|
||||
|
||||
let isScroll = (overflow.indexOf('scroll') != -1);
|
||||
if (isScroll || isAuto)
|
||||
if (node.scrollHeight > node.clientHeight ||
|
||||
node.scrollWidth > node.clientWidth ||
|
||||
('scrollLeftMax' in node && node.scrollLeftMax > 0) ||
|
||||
('scrollTopMax' in node && node.scrollTopMax > 0)) {
|
||||
return [node, this._generateCallback(node)];
|
||||
}
|
||||
|
||||
node = node.parentNode;
|
||||
}
|
||||
|
|
|
@ -66,7 +66,7 @@ private:
|
|||
enum {
|
||||
DEVICE_STORAGE_TYPE_DEFAULT = 0,
|
||||
DEVICE_STORAGE_TYPE_SHARED,
|
||||
DEVICE_STORAGE_TYPE_EXTERNAL,
|
||||
DEVICE_STORAGE_TYPE_EXTERNAL
|
||||
};
|
||||
};
|
||||
|
||||
|
|
|
@ -535,7 +535,7 @@ LockedFile::SetLocation(JSContext* aCx,
|
|||
}
|
||||
|
||||
uint64_t location;
|
||||
if (!xpc::ValueToUint64(aCx, aLocation, &location)) {
|
||||
if (!JS::ToUint64(aCx, aLocation, &location)) {
|
||||
return NS_ERROR_TYPE_ERR;
|
||||
}
|
||||
|
||||
|
|
Некоторые файлы не были показаны из-за слишком большого количества измененных файлов Показать больше
Загрузка…
Ссылка в новой задаче