Backed out changeset 374e44c835a8 (bug 937317) WinXP Build Bustage on a CLOSED TREE

This commit is contained in:
Carsten "Tomcat" Book 2013-12-06 08:41:42 +01:00
parent 738e31ed98
commit 076ec87e09
15 changed files with 89 additions and 69 deletions

View File

@ -14,6 +14,7 @@
#include "States.h"
#include "nsContentList.h"
#include "nsCxPusher.h"
#include "mozilla/dom/HTMLInputElement.h"
#include "nsIAccessibleRelation.h"
#include "nsIDOMNSEditableElement.h"
@ -25,7 +26,6 @@
#include "nsISelectionController.h"
#include "nsIServiceManager.h"
#include "nsITextControlFrame.h"
#include "mozilla/dom/ScriptSettings.h"
#include "mozilla/FloatingPoint.h"
#include "mozilla/Preferences.h"
@ -470,7 +470,8 @@ HTMLTextFieldAccessible::GetEditor() const
// nsGenericHTMLElement::GetEditor has a security check.
// Make sure we're not restricted by the permissions of
// whatever script is currently running.
mozilla::dom::AutoSystemCaller asc;
nsCxPusher pusher;
pusher.PushNull();
nsCOMPtr<nsIEditor> editor;
editableElt->GetEditor(getter_AddRefs(editor));

View File

@ -39,6 +39,7 @@
#include "nsIDOMNode.h"
#include "nsContentUtils.h"
#include "nsCxPusher.h"
#include "nsLayoutUtils.h"
#include "nsIContentPolicy.h"
#include "nsEventDispatcher.h"
@ -46,7 +47,6 @@
#include "mozAutoDocUpdate.h"
#include "mozilla/dom/Element.h"
#include "mozilla/dom/ScriptSettings.h"
#if defined(XP_WIN)
// Undefine LoadImage to prevent naming conflict with Windows.
@ -54,7 +54,6 @@
#endif
using namespace mozilla;
using mozilla::dom::AutoSystemCaller;
#ifdef DEBUG_chb
static void PrintReqURL(imgIRequest* req) {
@ -1195,8 +1194,11 @@ nsImageLoadingContent::ClearPendingRequest(nsresult aReason,
if (!mPendingRequest)
return;
// See bug 604262.
AutoSystemCaller asc;
// Push a null JSContext on the stack so that code that runs within
// the below code doesn't think it's being called by JS. See bug
// 604262.
nsCxPusher pusher;
pusher.PushNull();
// Deregister this image from the refresh driver so it no longer receives
// notifications.
@ -1257,9 +1259,10 @@ nsImageLoadingContent::BindToTree(nsIDocument* aDocument, nsIContent* aParent,
if (!aDocument)
return;
// Make sure the callbacks triggered by the below code don't think they're
// being called from JS.
AutoSystemCaller asc;
// Push a null JSContext on the stack so that callbacks triggered by the
// below code won't think they're being called from JS.
nsCxPusher pusher;
pusher.PushNull();
TrackImage(mCurrentRequest);
TrackImage(mPendingRequest);
@ -1276,9 +1279,10 @@ nsImageLoadingContent::UnbindFromTree(bool aDeep, bool aNullParent)
if (!doc)
return;
// Make sure the callbacks triggered by the below code don't think they're
// being called from JS.
AutoSystemCaller asc;
// Push a null JSContext on the stack so that callbacks triggered by the
// below code won't think they're being called from JS.
nsCxPusher pusher;
pusher.PushNull();
UntrackImage(mCurrentRequest);
UntrackImage(mPendingRequest);

View File

@ -38,11 +38,11 @@
#include "mozilla/Selection.h"
#include "nsEventListenerManager.h"
#include "nsContentUtils.h"
#include "nsCxPusher.h"
#include "mozilla/Preferences.h"
#include "nsTextNode.h"
#include "nsIController.h"
#include "mozilla/TextEvents.h"
#include "mozilla/dom/ScriptSettings.h"
using namespace mozilla;
using namespace mozilla::dom;
@ -1283,12 +1283,13 @@ nsTextEditorState::PrepareEditor(const nsAString *aValue)
// What follows is a bit of a hack. The editor uses the public DOM APIs
// for its content manipulations, and it causes it to fail some security
// checks deep inside when initializing. So we explictly make it clear that
// we're native code.
// checks deep inside when initializing. So we push a null JSContext
// on the JS stack here to make it clear that we're native code.
// Note that any script that's directly trying to access our value
// has to be going through some scriptable object to do that and that
// already does the relevant security checks.
AutoSystemCaller asc;
nsCxPusher pusher;
pusher.PushNull();
rv = newEditor->Init(domdoc, GetRootNode(), mSelCon, editorFlags);
NS_ENSURE_SUCCESS(rv, rv);
@ -1776,8 +1777,9 @@ nsTextEditorState::GetValue(nsAString& aValue, bool aIgnoreWrap) const
// XXXbz if we could just get the textContent of our anonymous content (eg
// if plaintext editor didn't create <br> nodes all over), we wouldn't need
// this.
{ /* Scope for AutoSystemCaller. */
AutoSystemCaller asc;
{ /* Scope for context pusher */
nsCxPusher pusher;
pusher.PushNull();
mEditor->OutputToString(NS_LITERAL_STRING("text/plain"), flags,
aValue);
@ -1855,8 +1857,9 @@ nsTextEditorState::SetValue(const nsAString& aValue, bool aUserInput,
// Time to mess with our security context... See comments in GetValue()
// for why this is needed. Note that we have to do this up here, because
// otherwise SelectAll() will fail.
{
AutoSystemCaller asc;
{ /* Scope for context pusher */
nsCxPusher pusher;
pusher.PushNull();
nsCOMPtr<nsISelection> domSel;
nsCOMPtr<nsISelectionPrivate> selPriv;

View File

@ -212,7 +212,6 @@
#include "nsITabChild.h"
#include "nsIDOMMediaQueryList.h"
#include "mozilla/dom/DOMJSClass.h"
#include "mozilla/dom/ScriptSettings.h"
#ifdef MOZ_WEBSPEECH
#include "mozilla/dom/SpeechSynthesis.h"
@ -11204,18 +11203,18 @@ nsGlobalWindow::OpenInternal(const nsAString& aUrl, const nsAString& aName,
aDialog, aNavigate, argv,
getter_AddRefs(domReturn));
} else {
// Force a system caller here so that the window watcher won't screw us
// Push a null JSContext here so that the window watcher won't screw us
// up. We do NOT want this case looking at the JS context on the stack
// when searching. Compare comments on
// nsIDOMWindow::OpenWindow and nsIWindowWatcher::OpenWindow.
// Note: Because nsWindowWatcher is so broken, it's actually important
// that we don't force a system caller here, because that screws it up
// when it tries to compute the caller principal to associate with dialog
// that we don't push a null cx here, because that screws it up when it
// tries to compute the caller principal to associate with dialog
// arguments. That whole setup just really needs to be rewritten. :-(
Maybe<AutoSystemCaller> asc;
nsCxPusher pusher;
if (!aContentModal) {
asc.construct();
pusher.PushNull();
}

View File

@ -27,7 +27,6 @@
#include "nsPrintfCString.h"
#include "prprf.h"
#include "mozilla/dom/ScriptSettings.h"
#include "mozilla/dom/DOMError.h"
#include "mozilla/dom/DOMErrorBinding.h"
#include "mozilla/dom/HTMLObjectElement.h"
@ -2016,12 +2015,12 @@ ConstructJSImplementation(JSContext* aCx, const char* aContractId,
return nullptr;
}
// Make sure to divorce ourselves from the calling JS while creating and
// Make sure to have nothing on the JS context stack while creating and
// initializing the object, so exceptions from that will get reported
// properly, since those are never exceptions that a spec wants to be thrown.
{
AutoSystemCaller asc;
{ // Scope for the nsCxPusher
nsCxPusher pusher;
pusher.PushNull();
// Get the XPCOM component containing the JS implementation.
nsCOMPtr<nsISupports> implISupports = do_CreateInstance(aContractId);
if (!implISupports) {

View File

@ -14,6 +14,7 @@
#include "nsComponentManagerUtils.h"
#include "nsServiceManagerUtils.h"
#include "nsContentUtils.h"
#include "nsCxPusher.h"
#include "nsIDocument.h"
#include "nsIObserverService.h"
#include "nsPIDOMWindow.h"
@ -24,7 +25,6 @@
#include "mozilla/ClearOnShutdown.h"
#include "PCOMContentPermissionRequestChild.h"
#include "mozilla/dom/PermissionMessageUtils.h"
#include "mozilla/dom/ScriptSettings.h"
class nsIPrincipal;
@ -294,8 +294,9 @@ PositionError::WrapObject(JSContext* aCx, JS::Handle<JSObject*> aScope)
void
PositionError::NotifyCallback(const GeoPositionErrorCallback& aCallback)
{
// We need to be system here. See bug 452762.
AutoSystemCaller asc;
// Ensure that the proper context is on the stack (bug 452762)
nsCxPusher pusher;
pusher.PushNull();
nsAutoMicroTask mt;
if (aCallback.HasWebIDLCallback()) {
@ -528,8 +529,9 @@ nsGeolocationRequest::SendLocation(nsIDOMGeoPosition* aPosition)
Shutdown();
}
// We need to be system here. See bug 452762.
AutoSystemCaller asc;
// Ensure that the proper context is on the stack (bug 452762)
nsCxPusher pusher;
pusher.PushNull();
nsAutoMicroTask mt;
if (mCallback.HasWebIDLCallback()) {
ErrorResult err;

View File

@ -36,11 +36,10 @@
#include "SandboxPrivate.h"
#include "nsJSPrincipals.h"
#include "nsContentUtils.h"
#include "mozilla/dom/ScriptSettings.h"
#include "nsCxPusher.h"
using mozilla::AutoSafeJSContext;
using mozilla::AutoPushJSContext;
using mozilla::dom::AutoSystemCaller;
/*
* defining CAUTIOUS_SCRIPTHOOK makes jsds disable GC while calling out to the
@ -3005,7 +3004,8 @@ jsdService::EnterNestedEventLoop (jsdINestCallback *callback, uint32_t *_rval)
// Nesting event queues is a thing of the past. Now, we just spin the
// current event loop.
nsresult rv = NS_OK;
AutoSystemCaller asc;
nsCxPusher pusher;
pusher.PushNull();
uint32_t nestLevel = ++mNestedLoopLevel;
nsCOMPtr<nsIThread> thread = do_GetCurrentThread();

View File

@ -35,6 +35,7 @@
#include "nsRenderingContext.h"
#include "nsIInterfaceRequestorUtils.h"
#include "nsCSSRendering.h"
#include "nsCxPusher.h"
#include "nsThemeConstants.h"
#include "nsPIDOMWindow.h"
#include "nsIDocShell.h"
@ -72,7 +73,6 @@
#include "nsComputedDOMStyle.h"
#include "ActiveLayerTracker.h"
#include "mozilla/dom/ScriptSettings.h"
#include "mozilla/Preferences.h"
#ifdef MOZ_XUL
@ -4775,9 +4775,11 @@ nsLayoutUtils::SurfaceFromElement(nsIImageLoadingContent* aElement,
wantImageSurface = true;
}
// Force a system caller so that the below code doesn't think it's being
// called by JS. See bug 604262.
AutoSystemCaller asc;
// Push a null JSContext on the stack so that code that runs within
// the below code doesn't think it's being called by JS. See bug
// 604262.
nsCxPusher pusher;
pusher.PushNull();
nsCOMPtr<imgIRequest> imgRequest;
rv = aElement->GetRequest(nsIImageLoadingContent::CURRENT_REQUEST,

View File

@ -37,6 +37,7 @@
#include "nsIDocument.h"
#include "jsapi.h"
#include "nsContentUtils.h"
#include "nsCxPusher.h"
#include "mozilla/Preferences.h"
#include "nsViewManager.h"
#include "GeckoProfiler.h"
@ -47,7 +48,6 @@
#include "Layers.h"
#include "imgIContainer.h"
#include "nsIFrameRequestCallback.h"
#include "mozilla/dom/ScriptSettings.h"
using namespace mozilla;
using namespace mozilla::widget;
@ -722,7 +722,8 @@ nsRefreshDriver::AdvanceTimeAndRefresh(int64_t aMilliseconds)
mMostRecentRefreshEpochTime += aMilliseconds * 1000;
mMostRecentRefresh += TimeDuration::FromMilliseconds((double) aMilliseconds);
mozilla::dom::AutoSystemCaller asc;
nsCxPusher pusher;
pusher.PushNull();
DoTick();
}

View File

@ -42,9 +42,9 @@
#include "nsAttrValueInlines.h"
#include "mozilla/Selection.h"
#include "nsContentUtils.h"
#include "nsCxPusher.h"
#include "nsTextNode.h"
#include "nsStyleSet.h"
#include "mozilla/dom/ScriptSettings.h"
#define DEFAULT_COLUMN_WIDTH 20
@ -274,7 +274,8 @@ nsTextControlFrame::EnsureEditorInitialized()
// Time to mess with our security context... See comments in GetValue()
// for why this is needed.
mozilla::dom::AutoSystemCaller asc;
nsCxPusher pusher;
pusher.PushNull();
// Make sure that we try to focus the content even if the method fails
class EnsureSetFocus {

View File

@ -23,10 +23,10 @@
#include "nsImageFrame.h"
#include "nsIImageLoadingContent.h"
#include "nsContentUtils.h"
#include "nsCxPusher.h"
#include "ImageContainer.h"
#include "ImageLayers.h"
#include "nsContentList.h"
#include "mozilla/dom/ScriptSettings.h"
#include <algorithm>
using namespace mozilla;
@ -75,8 +75,11 @@ nsVideoFrame::CreateAnonymousContent(nsTArray<ContentInfo>& aElements)
mPosterImage = element;
NS_ENSURE_TRUE(mPosterImage, NS_ERROR_OUT_OF_MEMORY);
// See bug 604262.
AutoSystemCaller asc;
// Push a null JSContext on the stack so that code that runs
// within the below code doesn't think it's being called by
// JS. See bug 604262.
nsCxPusher pusher;
pusher.PushNull();
// Set the nsImageLoadingContent::ImageState() to 0. This means that the
// image will always report its state as 0, so it will never be reframed

View File

@ -8,10 +8,10 @@
#include "nsIWindowWatcher.h"
#include "nsCOMPtr.h"
#include "nsIComponentManager.h"
#include "nsCxPusher.h"
#include "nsIServiceManager.h"
#include "nsIInterfaceRequestor.h"
#include "nsIInterfaceRequestorUtils.h"
#include "mozilla/dom/ScriptSettings.h"
static const char kOpenDialogParam[] = "centerscreen,chrome,modal,titlebar";
static const char kOpenWindowParam[] = "centerscreen,chrome,titlebar";
@ -39,7 +39,8 @@ nsNSSDialogHelper::openDialog(
// gets a system principal, otherwise we'll bork when trying to wrap the
// nsIKeyGenThread |arguments| property into the unprivileged scoope.
MOZ_ASSERT(!strncmp("chrome://", url, strlen("chrome://")));
mozilla::dom::AutoSystemCaller asc;
nsCxPusher pusher;
pusher.PushNull();
nsCOMPtr<nsIDOMWindow> newWindow;
rv = windowWatcher->OpenWindow(parent,

View File

@ -6,11 +6,11 @@
#include "nsJSInspector.h"
#include "nsIXPConnect.h"
#include "nsThreadUtils.h"
#include "nsCxPusher.h"
#include "jsfriendapi.h"
#include "js/OldDebugAPI.h"
#include "mozilla/HoldDropJSObjects.h"
#include "mozilla/ModuleUtils.h"
#include "mozilla/dom/ScriptSettings.h"
#include "nsServiceManagerUtils.h"
#include "nsMemory.h"
#include "nsArray.h"
@ -73,7 +73,8 @@ nsJSInspector::EnterNestedEventLoop(const JS::Value& requestor, uint32_t *out)
mRequestors.AppendElement(requestor);
mozilla::HoldJSObjects(this);
mozilla::dom::AutoSystemCaller asc;
nsCxPusher pusher;
pusher.PushNull();
uint32_t nestLevel = ++mNestedLoopLevel;
while (NS_SUCCEEDED(rv) && mNestedLoopLevel >= nestLevel) {

View File

@ -12,6 +12,7 @@
// Helper Classes
#include "nsIServiceManager.h"
#include "nsAutoPtr.h"
#include "nsCxPusher.h"
// Interfaces needed to be included
#include "nsIDOMNode.h"
@ -46,7 +47,6 @@
#include "mozilla/Preferences.h"
#include "mozilla/dom/Element.h"
#include "mozilla/dom/ScriptSettings.h"
using namespace mozilla;
@ -945,7 +945,8 @@ nsContentTreeOwner::ProvideWindow(nsIDOMWindow* aParent,
*aWindowIsNew = (containerPref != nsIBrowserDOMWindow::OPEN_CURRENTWINDOW);
{
dom::AutoSystemCaller asc;
nsCxPusher pusher;
pusher.PushNull();
// Get a new rendering area from the browserDOMWin. We don't want
// to be starting any loads here, so get it with a null URI.

View File

@ -50,6 +50,7 @@
#include "nsStyleConsts.h"
#include "nsPresContext.h"
#include "nsContentUtils.h"
#include "nsCxPusher.h"
#include "nsWebShellWindow.h" // get rid of this one, too...
#include "nsDOMEvent.h"
#include "nsGlobalWindow.h"
@ -59,10 +60,8 @@
#include "mozilla/Preferences.h"
#include "mozilla/dom/BarProps.h"
#include "mozilla/dom/Element.h"
#include "mozilla/dom/ScriptSettings.h"
using namespace mozilla;
using dom::AutoSystemCaller;
#define SIZEMODE_NORMAL NS_LITERAL_STRING("normal")
#define SIZEMODE_MAXIMIZED NS_LITERAL_STRING("maximized")
@ -359,7 +358,8 @@ NS_IMETHODIMP nsXULWindow::ShowModal()
EnableParent(false);
{
AutoSystemCaller asc;
nsCxPusher pusher;
pusher.PushNull();
nsIThread *thread = NS_GetCurrentThread();
while (mContinueModalLoop) {
if (!NS_ProcessNextEvent(thread))
@ -1767,16 +1767,16 @@ NS_IMETHODIMP nsXULWindow::CreateNewContentWindow(int32_t aChromeFlags,
// We need to create a chrome window to contain the content window we're about
// to pass back. The subject principal needs to be system while we're creating
// it to make things work right, so force a system caller. See bug 799348
// comment 13 for a description of what happens when we don't.
// it to make things work right, so push a null cx. See bug 799348 comment 13
// for a description of what happens when we don't.
nsCxPusher pusher;
pusher.PushNull();
nsCOMPtr<nsIXULWindow> newWindow;
{
AutoSystemCaller asc;
appShell->CreateTopLevelWindow(this, uri,
aChromeFlags, 615, 480,
getter_AddRefs(newWindow));
NS_ENSURE_TRUE(newWindow, NS_ERROR_FAILURE);
}
appShell->CreateTopLevelWindow(this, uri,
aChromeFlags, 615, 480,
getter_AddRefs(newWindow));
NS_ENSURE_TRUE(newWindow, NS_ERROR_FAILURE);
pusher.Pop();
// Specify that we want the window to remain locked until the chrome has loaded.
nsXULWindow *xulWin = static_cast<nsXULWindow*>
@ -1785,8 +1785,10 @@ NS_IMETHODIMP nsXULWindow::CreateNewContentWindow(int32_t aChromeFlags,
xulWin->LockUntilChromeLoad();
// Push nullptr onto the JSContext stack before we dispatch a native event.
{
AutoSystemCaller asc;
nsCxPusher pusher;
pusher.PushNull();
nsIThread *thread = NS_GetCurrentThread();
while (xulWin->IsLocked()) {
if (!NS_ProcessNextEvent(thread))