зеркало из https://github.com/mozilla/pjs.git
Merge backout a=me
This commit is contained in:
Коммит
da9888206a
|
@ -256,10 +256,10 @@ var FullZoom = {
|
|||
var self = this;
|
||||
Services.contentPrefs.getPref(aURI, this.name, function (aResult) {
|
||||
// Check that we're still where we expect to be in case this took a while.
|
||||
let isSaneURI = (aBrowser && aBrowser.currentURI) ?
|
||||
aURI.equals(aBrowser.currentURI) : false;
|
||||
if (!aBrowser || isSaneURI)
|
||||
self._applyPrefToSetting(aResult, aBrowser);
|
||||
let browser = aBrowser || gBrowser.selectedBrowser;
|
||||
if (aURI.equals(browser.currentURI)) {
|
||||
self._applyPrefToSetting(aResult, browser);
|
||||
}
|
||||
});
|
||||
},
|
||||
|
||||
|
|
|
@ -348,3 +348,7 @@ window[chromehidden~="toolbar"] toolbar:not(.toolbar-primary):not(.chromeclass-m
|
|||
#notification-popup-box[anchorid="addons-notification-icon"] > #addons-notification-icon {
|
||||
display: -moz-box;
|
||||
}
|
||||
|
||||
#geolocation-notification {
|
||||
-moz-binding: url("chrome://browser/content/urlbarBindings.xml#geolocation-notification");
|
||||
}
|
||||
|
|
|
@ -808,6 +808,8 @@
|
|||
this._fastFind.setDocShell(this.mCurrentBrowser.docShell);
|
||||
|
||||
this.updateTitlebar();
|
||||
|
||||
this.mCurrentTab.removeAttribute("titlechanged");
|
||||
}
|
||||
|
||||
// If the new tab is busy, and our current state is not busy, then
|
||||
|
@ -2449,6 +2451,8 @@
|
|||
this.setTabTitle(tab);
|
||||
if (tab == this.mCurrentTab)
|
||||
this.updateTitlebar();
|
||||
else if (!tab.hasAttribute("busy"))
|
||||
tab.setAttribute("titlechanged", "true");
|
||||
]]>
|
||||
</handler>
|
||||
</handlers>
|
||||
|
@ -2773,7 +2777,16 @@
|
|||
<method name="_getDragTargetTab">
|
||||
<parameter name="event"/>
|
||||
<body><![CDATA[
|
||||
return event.target.localName == "tab" ? event.target : null;
|
||||
let tab = event.target.localName == "tab" ? event.target : null;
|
||||
if (tab &&
|
||||
(event.type == "drop" || event.type == "dragover") &&
|
||||
event.dataTransfer.dropEffect == "link") {
|
||||
let boxObject = tab.boxObject;
|
||||
if (event.screenX < boxObject.screenX + boxObject.width * .25 ||
|
||||
event.screenX > boxObject.screenX + boxObject.width * .75)
|
||||
return null;
|
||||
}
|
||||
return tab;
|
||||
]]></body>
|
||||
</method>
|
||||
|
||||
|
@ -3022,6 +3035,7 @@
|
|||
this._dragTime = Date.now();
|
||||
if (Date.now() >= this._dragTime + this._dragOverDelay)
|
||||
this.selectedItem = tab;
|
||||
ind.collapsed = true;
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -81,6 +81,10 @@ var UIManager = {
|
|||
// Used to facilitate zooming down from a previous tab.
|
||||
_currentTab : null,
|
||||
|
||||
// Variable: _eventListeners
|
||||
// Keeps track of event listeners added to the AllTabs object.
|
||||
_eventListeners: {},
|
||||
|
||||
// ----------
|
||||
// Function: init
|
||||
// Must be called after the object is created.
|
||||
|
@ -238,6 +242,7 @@ var UIManager = {
|
|||
GroupItems.uninit();
|
||||
Storage.uninit();
|
||||
|
||||
this._removeTabActionHandlers();
|
||||
this._currentTab = null;
|
||||
this._pageBounds = null;
|
||||
this._reorderTabItemsOnShow = null;
|
||||
|
@ -407,7 +412,7 @@ var UIManager = {
|
|||
_addTabActionHandlers: function() {
|
||||
var self = this;
|
||||
|
||||
AllTabs.register("close", function(tab) {
|
||||
this._eventListeners.close = function(tab) {
|
||||
if (tab.ownerDocument.defaultView != gWindow)
|
||||
return;
|
||||
|
||||
|
@ -438,23 +443,34 @@ var UIManager = {
|
|||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
AllTabs.register("move", function(tab) {
|
||||
this._eventListeners.move = function(tab) {
|
||||
if (tab.ownerDocument.defaultView != gWindow)
|
||||
return;
|
||||
|
||||
let activeGroupItem = GroupItems.getActiveGroupItem();
|
||||
if (activeGroupItem)
|
||||
self.setReorderTabItemsOnShow(activeGroupItem);
|
||||
});
|
||||
};
|
||||
|
||||
AllTabs.register("select", function(tab) {
|
||||
this._eventListeners.select = function(tab) {
|
||||
if (tab.ownerDocument.defaultView != gWindow)
|
||||
return;
|
||||
|
||||
self.onTabSelect(tab);
|
||||
});
|
||||
};
|
||||
|
||||
for (let name in this._eventListeners)
|
||||
AllTabs.register(name, this._eventListeners[name]);
|
||||
},
|
||||
|
||||
// ----------
|
||||
// Function: _removeTabActionHandlers
|
||||
// Removes handlers to handle tab actions.
|
||||
_removeTabActionHandlers: function() {
|
||||
for (let name in this._eventListeners)
|
||||
AllTabs.unregister(name, this._eventListeners[name]);
|
||||
},
|
||||
|
||||
// ----------
|
||||
|
|
|
@ -90,6 +90,8 @@ endif
|
|||
# back to the clear recent history dialog (santize.xul), if it ever is (bug
|
||||
# 480169)
|
||||
|
||||
# browser_drag.js is disabled, as it needs to be updated for the new behavior from bug 320638.
|
||||
|
||||
_BROWSER_FILES = \
|
||||
browser_typeAheadFind.js \
|
||||
browser_NetworkPrioritizer.js \
|
||||
|
@ -136,6 +138,7 @@ _BROWSER_FILES = \
|
|||
browser_bug555224.js \
|
||||
browser_bug555767.js \
|
||||
browser_bug556061.js \
|
||||
browser_bug559991.js \
|
||||
browser_bug561623.js \
|
||||
browser_bug562649.js \
|
||||
browser_bug563588.js \
|
||||
|
@ -148,7 +151,6 @@ _BROWSER_FILES = \
|
|||
browser_contextSearchTabPosition.js \
|
||||
browser_ctrlTab.js \
|
||||
browser_discovery.js \
|
||||
browser_drag.js \
|
||||
browser_duplicateIDs.js \
|
||||
browser_gestureSupport.js \
|
||||
browser_getshortcutoruri.js \
|
||||
|
|
|
@ -0,0 +1,64 @@
|
|||
function test() {
|
||||
|
||||
// ----------
|
||||
// Test setup
|
||||
|
||||
waitForExplicitFinish();
|
||||
|
||||
let oldOLC = FullZoom.onLocationChange;
|
||||
FullZoom.onLocationChange = function(aURI, aIsTabSwitch, aBrowser) {
|
||||
// Ignore calls that are not about tab switching on this test
|
||||
if (aIsTabSwitch)
|
||||
oldOLC.call(FullZoom, aURI, aIsTabSwitch, aBrowser);
|
||||
};
|
||||
|
||||
gPrefService.setBoolPref("browser.zoom.updateBackgroundTabs", true);
|
||||
gPrefService.setBoolPref("browser.zoom.siteSpecific", true);
|
||||
|
||||
let oldAPTS = FullZoom._applyPrefToSetting;
|
||||
let uri = "http://example.org/browser/browser/base/content/test/dummy_page.html";
|
||||
|
||||
// ------------------------------------------------------
|
||||
// Test 1 - Zoom should not be called if URIs don't match
|
||||
FullZoom._applyPrefToSetting = function() {
|
||||
ok(false, "This should not be called");
|
||||
};
|
||||
FullZoom.onLocationChange(makeURI(uri), true);
|
||||
|
||||
let tab = gBrowser.addTab();
|
||||
tab.linkedBrowser.addEventListener("load", function(event) {
|
||||
tab.linkedBrowser.removeEventListener("load", arguments.callee, true);
|
||||
|
||||
// -------------------------------------------------------------------
|
||||
// Test 2 - Trigger a tab switch that should now update the zoom level
|
||||
FullZoom._applyPrefToSetting = function() {
|
||||
ok(true, "applyPrefToSetting was called");
|
||||
endTest();
|
||||
}
|
||||
gBrowser.selectedTab = tab;
|
||||
|
||||
}, true);
|
||||
tab.linkedBrowser.loadURI(uri);
|
||||
|
||||
// -------------
|
||||
// Test clean-up
|
||||
function endTest() {
|
||||
gBrowser.removeTab(tab);
|
||||
FullZoom._applyPrefToSetting = oldAPTS;
|
||||
FullZoom.onLocationChange = oldOLC;
|
||||
|
||||
oldAPTS = null;
|
||||
oldOLC = null;
|
||||
tab = null;
|
||||
|
||||
if (gPrefService.prefHasUserValue("browser.zoom.updateBackgroundTabs"))
|
||||
gPrefService.clearUserPref("browser.zoom.updateBackgroundTabs");
|
||||
|
||||
if (gPrefService.prefHasUserValue("browser.zoom.siteSpecific"))
|
||||
gPrefService.clearUserPref("browser.zoom.siteSpecific");
|
||||
|
||||
finish();
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -688,4 +688,37 @@
|
|||
|
||||
</implementation>
|
||||
</binding>
|
||||
|
||||
<binding id="geolocation-notification" extends="chrome://global/content/bindings/notification.xml#popup-notification">
|
||||
<content>
|
||||
<xul:image class="popup-notification-icon"
|
||||
xbl:inherits="popupid"/>
|
||||
<xul:vbox>
|
||||
<xul:description class="popup-notification-description"
|
||||
xbl:inherits="value=label"/>
|
||||
<xul:spacer flex="1"/>
|
||||
<xul:hbox pack="end">
|
||||
<xul:label anonid="learnmore" class="text-link geolocation-text-link"/>
|
||||
<xul:spacer flex="1"/>
|
||||
<xul:button anonid="button"
|
||||
class="popup-notification-menubutton"
|
||||
xbl:inherits="oncommand=buttoncommand,label=buttonlabel,accesskey=buttonaccesskey,type=buttontype">
|
||||
<xul:menupopup anonid="menupopup"
|
||||
xbl:inherits="oncommand=menucommand">
|
||||
<children/>
|
||||
</xul:menupopup>
|
||||
</xul:button>
|
||||
</xul:hbox>
|
||||
</xul:vbox>
|
||||
</content>
|
||||
<implementation>
|
||||
<constructor><![CDATA[
|
||||
let link = document.getAnonymousElementByAttribute(this, "anonid", "learnmore");
|
||||
link.value = gNavigatorBundle.getString("geolocation.learnMore");
|
||||
|
||||
let formatter = Cc["@mozilla.org/toolkit/URLFormatterService;1"].getService(Ci.nsIURLFormatter);
|
||||
link.href = formatter.formatURLPref("browser.geolocation.warning.infoURL");
|
||||
]]></constructor>
|
||||
</implementation>
|
||||
</binding>
|
||||
</bindings>
|
||||
|
|
|
@ -1027,6 +1027,11 @@ toolbar[iconsize="small"] #fullscreen-button {
|
|||
list-style-image: url(chrome://browser/skin/Geolocation-16.png);
|
||||
}
|
||||
|
||||
.geolocation-text-link {
|
||||
-moz-padding-start: 13px;
|
||||
padding-top: 10px;
|
||||
}
|
||||
|
||||
#addons-notification-icon {
|
||||
list-style-image: url(chrome://mozapps/skin/extensions/extensionGeneric-16.png);
|
||||
}
|
||||
|
@ -1230,6 +1235,10 @@ statusbarpanel#statusbar-display {
|
|||
-moz-margin-start: 0;
|
||||
}
|
||||
|
||||
.tabbrowser-tab[pinned][titlechanged]:not([selected="true"]) {
|
||||
-moz-box-shadow: 0 0 0 1em rgba(255,0,0,.5) inset;
|
||||
}
|
||||
|
||||
.tab-icon-image {
|
||||
width: 16px;
|
||||
height: 16px;
|
||||
|
|
|
@ -1484,6 +1484,10 @@ toolbarbutton.chevron > .toolbarbutton-menu-dropmarker {
|
|||
background-color: -moz-mac-chrome-inactive;
|
||||
}
|
||||
|
||||
.tabbrowser-tab[pinned][titlechanged]:not([selected="true"]) {
|
||||
background-color: rgba(255,0,0,.5) !important;
|
||||
}
|
||||
|
||||
#tabbrowser-tabs[tabsontop="true"] > .tabbrowser-tab[selected="true"] {
|
||||
-moz-border-top-colors: rgba(0,0,0,.04) rgba(0,0,0,.17) rgba(255,255,255,.9);
|
||||
-moz-border-right-colors: rgba(0,0,0,.04) rgba(0,0,0,.17) rgba(255,255,255,.6);
|
||||
|
@ -1855,6 +1859,7 @@ toolbarbutton.chevron > .toolbarbutton-menu-dropmarker {
|
|||
}
|
||||
|
||||
#notification-popup {
|
||||
color: #fff;
|
||||
margin-top: -1px;
|
||||
margin-left: -27px;
|
||||
}
|
||||
|
@ -1878,12 +1883,12 @@ toolbarbutton.chevron > .toolbarbutton-menu-dropmarker {
|
|||
list-style-image: url(chrome://browser/skin/Geolocation-16.png);
|
||||
}
|
||||
|
||||
#addons-notification-icon {
|
||||
list-style-image: url(chrome://mozapps/skin/extensions/extensionGeneric-16.png);
|
||||
.geolocation-text-link {
|
||||
color: #fff;
|
||||
}
|
||||
|
||||
.popup-notification-description {
|
||||
color: #fff;
|
||||
#addons-notification-icon {
|
||||
list-style-image: url(chrome://mozapps/skin/extensions/extensionGeneric-16.png);
|
||||
}
|
||||
|
||||
.popup-notification-icon {
|
||||
|
|
|
@ -1367,6 +1367,10 @@ richlistitem[type~="action"][actiontype="switchtab"] > .ac-url-box > .ac-action-
|
|||
background-image: -moz-linear-gradient(hsla(0,0%,80%,.5), hsla(0,0%,60%,.5) 50%);
|
||||
}
|
||||
|
||||
.tabbrowser-tab[pinned][titlechanged]:not([selected="true"]) {
|
||||
background-image: -moz-linear-gradient(rgba(255,0,0,.5), rgba(255,0,0,.5)) !important;
|
||||
}
|
||||
|
||||
.tabbrowser-tab[busy] > .tab-icon-image {
|
||||
list-style-image: url("chrome://browser/skin/tabbrowser/progress.png") !important;
|
||||
-moz-image-region: rect(0, 16px, 16px, 0);
|
||||
|
@ -1803,6 +1807,10 @@ toolbarbutton.bookmark-item[dragover="true"][open="true"] {
|
|||
list-style-image: url(chrome://browser/skin/Geolocation-64.png);
|
||||
}
|
||||
|
||||
.geolocation-text-link {
|
||||
padding-top: 5px;
|
||||
}
|
||||
|
||||
.popup-notification-icon[popupid="xpinstall-disabled"],
|
||||
.popup-notification-icon[popupid="addon-install-blocked"],
|
||||
.popup-notification-icon[popupid="addon-install-failed"],
|
||||
|
|
|
@ -394,9 +394,6 @@ DEFINES += \
|
|||
ifndef JS_SHARED_LIBRARY
|
||||
DEFINES += -DSTATIC_EXPORTABLE_JS_API
|
||||
endif
|
||||
ifndef MOZ_NATIVE_ZLIB
|
||||
DEFINES += -DZLIB_INTERNAL
|
||||
endif
|
||||
endif
|
||||
endif
|
||||
|
||||
|
|
|
@ -82,6 +82,8 @@ class nsHTMLButtonElement : public nsGenericHTMLFormElement,
|
|||
public nsIConstraintValidation
|
||||
{
|
||||
public:
|
||||
using nsIConstraintValidation::GetValidationMessage;
|
||||
|
||||
nsHTMLButtonElement(already_AddRefed<nsINodeInfo> aNodeInfo);
|
||||
virtual ~nsHTMLButtonElement();
|
||||
|
||||
|
|
|
@ -49,6 +49,8 @@ class nsHTMLFieldSetElement : public nsGenericHTMLFormElement,
|
|||
public nsIConstraintValidation
|
||||
{
|
||||
public:
|
||||
using nsIConstraintValidation::GetValidationMessage;
|
||||
|
||||
nsHTMLFieldSetElement(already_AddRefed<nsINodeInfo> aNodeInfo);
|
||||
virtual ~nsHTMLFieldSetElement();
|
||||
|
||||
|
|
|
@ -118,6 +118,8 @@ class nsHTMLInputElement : public nsGenericHTMLFormElement,
|
|||
public nsIConstraintValidation
|
||||
{
|
||||
public:
|
||||
using nsIConstraintValidation::GetValidationMessage;
|
||||
|
||||
nsHTMLInputElement(already_AddRefed<nsINodeInfo> aNodeInfo,
|
||||
PRUint32 aFromParser);
|
||||
virtual ~nsHTMLInputElement();
|
||||
|
|
|
@ -49,6 +49,8 @@ class nsHTMLOutputElement : public nsGenericHTMLFormElement,
|
|||
public nsIConstraintValidation
|
||||
{
|
||||
public:
|
||||
using nsIConstraintValidation::GetValidationMessage;
|
||||
|
||||
nsHTMLOutputElement(already_AddRefed<nsINodeInfo> aNodeInfo);
|
||||
virtual ~nsHTMLOutputElement();
|
||||
|
||||
|
|
|
@ -241,6 +241,8 @@ class nsHTMLSelectElement : public nsGenericHTMLFormElement,
|
|||
public nsIConstraintValidation
|
||||
{
|
||||
public:
|
||||
using nsIConstraintValidation::GetValidationMessage;
|
||||
|
||||
nsHTMLSelectElement(already_AddRefed<nsINodeInfo> aNodeInfo,
|
||||
PRUint32 aFromParser = 0);
|
||||
virtual ~nsHTMLSelectElement();
|
||||
|
|
|
@ -94,6 +94,8 @@ class nsHTMLTextAreaElement : public nsGenericHTMLFormElement,
|
|||
public nsIConstraintValidation
|
||||
{
|
||||
public:
|
||||
using nsIConstraintValidation::GetValidationMessage;
|
||||
|
||||
nsHTMLTextAreaElement(already_AddRefed<nsINodeInfo> aNodeInfo,
|
||||
PRUint32 aFromParser = 0);
|
||||
|
||||
|
|
|
@ -961,79 +961,6 @@ nsJSContext::DOMOperationCallback(JSContext *cx)
|
|||
ctx->mOperationCallbackTime = callbackTime;
|
||||
ctx->mModalStateTime = modalStateTime;
|
||||
|
||||
// Check to see if we are running OOM
|
||||
nsCOMPtr<nsIMemory> mem;
|
||||
NS_GetMemoryManager(getter_AddRefs(mem));
|
||||
if (!mem) {
|
||||
JS_ClearPendingException(cx);
|
||||
return JS_FALSE;
|
||||
}
|
||||
|
||||
PRBool lowMemory;
|
||||
mem->IsLowMemory(&lowMemory);
|
||||
if (lowMemory) {
|
||||
// try to clean up:
|
||||
nsJSContext::CC();
|
||||
|
||||
// never prevent system scripts from running
|
||||
if (!::JS_IsSystemObject(cx, ::JS_GetGlobalObject(cx))) {
|
||||
|
||||
// lets see if CC() did anything, if not, cancel the script.
|
||||
mem->IsLowMemory(&lowMemory);
|
||||
if (lowMemory) {
|
||||
|
||||
if (nsContentUtils::GetBoolPref("dom.prevent_oom_dialog", PR_FALSE)) {
|
||||
JS_ClearPendingException(cx);
|
||||
return JS_FALSE;
|
||||
}
|
||||
|
||||
nsCOMPtr<nsIScriptError> errorObject =
|
||||
do_CreateInstance("@mozilla.org/scripterror;1");
|
||||
|
||||
if (errorObject) {
|
||||
nsXPIDLString msg;
|
||||
nsContentUtils::GetLocalizedString(nsContentUtils::eDOM_PROPERTIES,
|
||||
"LowMemoryMessage",
|
||||
msg);
|
||||
|
||||
JSStackFrame *fp, *iterator = nsnull;
|
||||
fp = ::JS_FrameIterator(cx, &iterator);
|
||||
PRUint32 lineno = 0;
|
||||
nsAutoString sourcefile;
|
||||
if (fp) {
|
||||
JSScript* script = ::JS_GetFrameScript(cx, fp);
|
||||
if (script) {
|
||||
const char* filename = ::JS_GetScriptFilename(cx, script);
|
||||
if (filename) {
|
||||
CopyUTF8toUTF16(nsDependentCString(filename), sourcefile);
|
||||
}
|
||||
jsbytecode* pc = ::JS_GetFramePC(cx, fp);
|
||||
if (pc) {
|
||||
lineno = ::JS_PCToLineNumber(cx, script, pc);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
rv = errorObject->Init(msg.get(),
|
||||
sourcefile.get(),
|
||||
EmptyString().get(),
|
||||
lineno, 0, nsIScriptError::errorFlag,
|
||||
"content javascript");
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
nsCOMPtr<nsIConsoleService> consoleService =
|
||||
do_GetService(NS_CONSOLESERVICE_CONTRACTID, &rv);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
consoleService->LogMessage(errorObject);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
JS_ClearPendingException(cx);
|
||||
return JS_FALSE;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
PRTime now = PR_Now();
|
||||
|
||||
if (callbackTime == 0) {
|
||||
|
@ -1045,7 +972,6 @@ nsJSContext::DOMOperationCallback(JSContext *cx)
|
|||
|
||||
if (ctx->mModalStateDepth) {
|
||||
// We're waiting on a modal dialog, nothing more to do here.
|
||||
|
||||
return JS_TRUE;
|
||||
}
|
||||
|
||||
|
|
|
@ -8,7 +8,7 @@ load 428489-1.html
|
|||
load 431086-1.xhtml
|
||||
load 448329-1.html
|
||||
load 448329-2.html
|
||||
asserts(16-20) load 448329-3.html
|
||||
asserts(8-20) load 448329-3.html
|
||||
load 456727-1.html
|
||||
load 456727-2.html
|
||||
asserts(1) load 467647-1.html # bug 382210
|
||||
|
|
|
@ -3628,8 +3628,6 @@ cairo_d2d_surface_create_for_handle(cairo_device_t *device, HANDLE handle, cairo
|
|||
|
||||
newSurf->rt->CreateSolidColorBrush(D2D1::ColorF(0, 1.0), &newSurf->solidColorBrush);
|
||||
|
||||
_d2d_clear_surface(newSurf);
|
||||
|
||||
newSurf->device = d2d_device;
|
||||
cairo_addref_device(device);
|
||||
|
||||
|
|
|
@ -70,6 +70,7 @@ UseOpaqueSurface(Layer* aLayer)
|
|||
ThebesLayerD3D9::ThebesLayerD3D9(LayerManagerD3D9 *aManager)
|
||||
: ThebesLayer(aManager, NULL)
|
||||
, LayerD3D9(aManager)
|
||||
, mD2DSurfaceInitialized(false)
|
||||
{
|
||||
mImplData = static_cast<LayerD3D9*>(this);
|
||||
aManager->deviceManager()->mThebesLayers.AppendElement(this);
|
||||
|
@ -289,6 +290,7 @@ ThebesLayerD3D9::DrawRegion(const nsIntRegion &aRegion)
|
|||
if (mD2DSurface) {
|
||||
context = new gfxContext(mD2DSurface);
|
||||
nsIntRegionRectIterator iter(aRegion);
|
||||
|
||||
context->Translate(gfxPoint(-visibleRect.x, -visibleRect.y));
|
||||
context->NewPath();
|
||||
const nsIntRect *iterRect;
|
||||
|
@ -296,11 +298,14 @@ ThebesLayerD3D9::DrawRegion(const nsIntRegion &aRegion)
|
|||
context->Rectangle(gfxRect(iterRect->x, iterRect->y, iterRect->width, iterRect->height));
|
||||
}
|
||||
context->Clip();
|
||||
if (mD2DSurface->GetContentType() != gfxASurface::CONTENT_COLOR) {
|
||||
if (!mD2DSurfaceInitialized ||
|
||||
mD2DSurface->GetContentType() != gfxASurface::CONTENT_COLOR) {
|
||||
context->SetOperator(gfxContext::OPERATOR_CLEAR);
|
||||
context->Paint();
|
||||
context->SetOperator(gfxContext::OPERATOR_OVER);
|
||||
mD2DSurfaceInitialized = true;
|
||||
}
|
||||
|
||||
LayerManagerD3D9::CallbackInfo cbInfo = mD3DManager->GetCallbackInfo();
|
||||
cbInfo.Callback(this, context, aRegion, nsIntRegion(), cbInfo.CallbackData);
|
||||
mD2DSurface->Flush();
|
||||
|
@ -423,6 +428,7 @@ ThebesLayerD3D9::CreateNewTexture(const gfxIntSize &aSize)
|
|||
D3DUSAGE_RENDERTARGET, D3DFMT_A8R8G8B8,
|
||||
D3DPOOL_DEFAULT, getter_AddRefs(mTexture), &sharedHandle);
|
||||
|
||||
mD2DSurfaceInitialized = false;
|
||||
mD2DSurface = new gfxD2DSurface(sharedHandle, UseOpaqueSurface(this) ?
|
||||
gfxASurface::CONTENT_COLOR : gfxASurface::CONTENT_COLOR_ALPHA);
|
||||
|
||||
|
|
|
@ -73,6 +73,8 @@ private:
|
|||
/* This contains the D2D surface if we have one */
|
||||
nsRefPtr<gfxASurface> mD2DSurface;
|
||||
|
||||
bool mD2DSurfaceInitialized;
|
||||
|
||||
/* Have a region of our layer drawn */
|
||||
void DrawRegion(const nsIntRegion &aRegion);
|
||||
|
||||
|
|
|
@ -394,9 +394,6 @@ DEFINES += \
|
|||
ifndef JS_SHARED_LIBRARY
|
||||
DEFINES += -DSTATIC_EXPORTABLE_JS_API
|
||||
endif
|
||||
ifndef MOZ_NATIVE_ZLIB
|
||||
DEFINES += -DZLIB_INTERNAL
|
||||
endif
|
||||
endif
|
||||
endif
|
||||
|
||||
|
|
|
@ -192,17 +192,6 @@ nsresult imgFrame::Init(PRInt32 aX, PRInt32 aY, PRInt32 aWidth, PRInt32 aHeight,
|
|||
if (!AllowedImageSize(aWidth, aHeight))
|
||||
return NS_ERROR_FAILURE;
|
||||
|
||||
// Check to see if we are running OOM
|
||||
nsCOMPtr<nsIMemory> mem;
|
||||
NS_GetMemoryManager(getter_AddRefs(mem));
|
||||
if (!mem)
|
||||
return NS_ERROR_UNEXPECTED;
|
||||
|
||||
PRBool lowMemory;
|
||||
mem->IsLowMemory(&lowMemory);
|
||||
if (lowMemory)
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
|
||||
mOffset.MoveTo(aX, aY);
|
||||
mSize.SizeTo(aWidth, aHeight);
|
||||
|
||||
|
@ -553,17 +542,6 @@ nsresult imgFrame::Extract(const nsIntRect& aRegion, imgFrame** aResult)
|
|||
|
||||
nsresult imgFrame::ImageUpdated(const nsIntRect &aUpdateRect)
|
||||
{
|
||||
// Check to see if we are running OOM
|
||||
nsCOMPtr<nsIMemory> mem;
|
||||
NS_GetMemoryManager(getter_AddRefs(mem));
|
||||
if (!mem)
|
||||
return NS_ERROR_UNEXPECTED;
|
||||
|
||||
PRBool lowMemory;
|
||||
mem->IsLowMemory(&lowMemory);
|
||||
if (lowMemory)
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
|
||||
mDecoded.UnionRect(mDecoded, aUpdateRect);
|
||||
|
||||
// clamp to bounds, in case someone sends a bogus updateRect (I'm looking at
|
||||
|
|
|
@ -1822,13 +1822,13 @@ static PRBool isUnwantedPlugin(nsPluginTag * tag)
|
|||
return PR_TRUE;
|
||||
|
||||
for (PRInt32 i = 0; i < tag->mVariants; ++i) {
|
||||
if (nsnull == PL_strcasecmp(tag->mMimeTypeArray[i], "application/pdf"))
|
||||
if (!PL_strcasecmp(tag->mMimeTypeArray[i], "application/pdf"))
|
||||
return PR_FALSE;
|
||||
|
||||
if (nsnull == PL_strcasecmp(tag->mMimeTypeArray[i], "application/x-shockwave-flash"))
|
||||
if (!PL_strcasecmp(tag->mMimeTypeArray[i], "application/x-shockwave-flash"))
|
||||
return PR_FALSE;
|
||||
|
||||
if (nsnull == PL_strcasecmp(tag->mMimeTypeArray[i],"application/x-director"))
|
||||
if (!PL_strcasecmp(tag->mMimeTypeArray[i], "application/x-director"))
|
||||
return PR_FALSE;
|
||||
}
|
||||
|
||||
|
|
|
@ -8,7 +8,6 @@ pref("security.ssl.renego_unrestricted_hosts", "");
|
|||
pref("security.ssl.treat_unsafe_negotiation_as_broken", false);
|
||||
pref("security.ssl.require_safe_negotiation", false);
|
||||
pref("security.ssl.warn_missing_rfc5746", 1);
|
||||
pref("security.ssl.enable_compression", false);
|
||||
pref("security.ssl.enable_false_start", true);
|
||||
|
||||
pref("security.ssl2.rc4_128", false);
|
||||
|
|
|
@ -1719,8 +1719,6 @@ nsNSSComponent::InitializeNSS(PRBool showWarningBox)
|
|||
SSL_OptionSetDefault(SSL_ENABLE_RENEGOTIATION,
|
||||
enabled ? SSL_RENEGOTIATE_UNRESTRICTED : SSL_RENEGOTIATE_REQUIRES_XTN);
|
||||
|
||||
mPrefBranch->GetBoolPref("security.ssl.enable_compression", &enabled);
|
||||
SSL_OptionSetDefault(SSL_ENABLE_DEFLATE, enabled);
|
||||
#ifdef SSL_ENABLE_FALSE_START // Requires NSS 3.12.8
|
||||
mPrefBranch->GetBoolPref("security.ssl.enable_false_start", &enabled);
|
||||
SSL_OptionSetDefault(SSL_ENABLE_FALSE_START, enabled);
|
||||
|
@ -2253,10 +2251,6 @@ nsNSSComponent::Observe(nsISupports *aSubject, const char *aTopic,
|
|||
PRInt32 warnLevel = 1;
|
||||
mPrefBranch->GetIntPref("security.ssl.warn_missing_rfc5746", &warnLevel);
|
||||
nsSSLIOLayerHelpers::setWarnLevelMissingRFC5746(warnLevel);
|
||||
} else if (prefName.Equals("security.ssl.enable_compression")) {
|
||||
mPrefBranch->GetBoolPref("security.ssl.enable_compression", &enabled);
|
||||
SSL_OptionSetDefault(SSL_ENABLE_DEFLATE, enabled);
|
||||
clearSessionCache = PR_TRUE;
|
||||
#ifdef SSL_ENABLE_FALSE_START // Requires NSS 3.12.8
|
||||
} else if (prefName.Equals("security.ssl.enable_false_start")) {
|
||||
mPrefBranch->GetBoolPref("security.ssl.enable_false_start", &enabled);
|
||||
|
|
|
@ -79,6 +79,11 @@ XPCOMUtils.defineLazyGetter(this, "PropertyPanel", function () {
|
|||
return obj.PropertyPanel;
|
||||
});
|
||||
|
||||
XPCOMUtils.defineLazyGetter(this, "namesAndValuesOf", function () {
|
||||
var obj = {};
|
||||
Cu.import("resource://gre/modules/PropertyPanel.jsm", obj);
|
||||
return obj.namesAndValuesOf;
|
||||
});
|
||||
|
||||
function LogFactory(aMessagePrefix)
|
||||
{
|
||||
|
@ -160,14 +165,23 @@ ResponseListener.prototype =
|
|||
let httpActivity = this.httpActivity;
|
||||
// Check if the header isn't set yet.
|
||||
if (!httpActivity.response.header) {
|
||||
httpActivity.response.header = {};
|
||||
if (aRequest instanceof Ci.nsIHttpChannel) {
|
||||
httpActivity.response.header = {};
|
||||
try {
|
||||
aRequest.visitResponseHeaders({
|
||||
visitHeader: function(aName, aValue) {
|
||||
httpActivity.response.header[aName] = aValue;
|
||||
}
|
||||
});
|
||||
}
|
||||
// Accessing the response header can throw an NS_ERROR_NOT_AVAILABLE
|
||||
// exception. Catch it and stop it to make it not show up in the.
|
||||
// This can happen if the response is not finished yet and the user
|
||||
// reloades the page.
|
||||
catch (ex) {
|
||||
delete httpActivity.response.header;
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
|
@ -3488,6 +3502,171 @@ function JSPropertyProvider(aScope, aInputValue)
|
|||
// JSTerm
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
|
||||
/**
|
||||
* JSTermHelper
|
||||
*
|
||||
* Defines a set of functions ("helper functions") that are available from the
|
||||
* WebConsole but not from the webpage.
|
||||
* A list of helper functions used by Firebug can be found here:
|
||||
* http://getfirebug.com/wiki/index.php/Command_Line_API
|
||||
*/
|
||||
function JSTermHelper(aJSTerm)
|
||||
{
|
||||
return {
|
||||
/**
|
||||
* Returns the result of document.getElementById(aId).
|
||||
*
|
||||
* @param string aId
|
||||
* A string that is passed to window.document.getElementById.
|
||||
* @returns nsIDOMNode or null
|
||||
*/
|
||||
$: function JSTH_$(aId)
|
||||
{
|
||||
try {
|
||||
return aJSTerm._window.document.getElementById(aId);
|
||||
}
|
||||
catch (ex) {
|
||||
aJSTerm.console.error(ex.message);
|
||||
}
|
||||
},
|
||||
|
||||
/**
|
||||
* Returns the result of document.querySelectorAll(aSelector).
|
||||
*
|
||||
* @param string aSelector
|
||||
* A string that is passed to window.document.querySelectorAll.
|
||||
* @returns array of nsIDOMNode
|
||||
*/
|
||||
$$: function JSTH_$$(aSelector)
|
||||
{
|
||||
try {
|
||||
return aJSTerm._window.document.querySelectorAll(aSelector);
|
||||
}
|
||||
catch (ex) {
|
||||
aJSTerm.console.error(ex.message);
|
||||
}
|
||||
},
|
||||
|
||||
/**
|
||||
* Runs a xPath query and returns all matched nodes.
|
||||
*
|
||||
* @param string aXPath
|
||||
* xPath search query to execute.
|
||||
* @param [optional] nsIDOMNode aContext
|
||||
* Context to run the xPath query on. Uses window.document if not set.
|
||||
* @returns array of nsIDOMNode
|
||||
*/
|
||||
$x: function JSTH_$x(aXPath, aContext)
|
||||
{
|
||||
let nodes = [];
|
||||
let doc = aJSTerm._window.wrappedJSObject.document;
|
||||
let aContext = aContext || doc;
|
||||
|
||||
try {
|
||||
let results = doc.evaluate(aXPath, aContext, null,
|
||||
Ci.nsIDOMXPathResult.ANY_TYPE, null);
|
||||
|
||||
let node;
|
||||
while (node = results.iterateNext()) {
|
||||
nodes.push(node);
|
||||
}
|
||||
}
|
||||
catch (ex) {
|
||||
aJSTerm.console.error(ex.message);
|
||||
}
|
||||
|
||||
return nodes;
|
||||
},
|
||||
|
||||
/**
|
||||
* Clears the output of the JSTerm.
|
||||
*/
|
||||
clear: function JSTH_clear()
|
||||
{
|
||||
aJSTerm.clearOutput();
|
||||
},
|
||||
|
||||
/**
|
||||
* Returns the result of Object.keys(aObject).
|
||||
*
|
||||
* @param object aObject
|
||||
* Object to return the property names from.
|
||||
* @returns array of string
|
||||
*/
|
||||
keys: function JSTH_keys(aObject)
|
||||
{
|
||||
try {
|
||||
return Object.keys(XPCNativeWrapper.unwrap(aObject));
|
||||
}
|
||||
catch (ex) {
|
||||
aJSTerm.console.error(ex.message);
|
||||
}
|
||||
},
|
||||
|
||||
/**
|
||||
* Returns the values of all properties on aObject.
|
||||
*
|
||||
* @param object aObject
|
||||
* Object to display the values from.
|
||||
* @returns array of string
|
||||
*/
|
||||
values: function JSTH_values(aObject)
|
||||
{
|
||||
let arrValues = [];
|
||||
let obj = XPCNativeWrapper.unwrap(aObject);
|
||||
|
||||
try {
|
||||
for (let prop in obj) {
|
||||
arrValues.push(obj[prop]);
|
||||
}
|
||||
}
|
||||
catch (ex) {
|
||||
aJSTerm.console.error(ex.message);
|
||||
}
|
||||
return arrValues;
|
||||
},
|
||||
|
||||
/**
|
||||
* Inspects the passed aObject. This is done by opening the PropertyPanel.
|
||||
*
|
||||
* @param object aObject
|
||||
* Object to inspect.
|
||||
* @returns void
|
||||
*/
|
||||
inspect: function JSTH_inspect(aObject)
|
||||
{
|
||||
let obj = XPCNativeWrapper.unwrap(aObject);
|
||||
aJSTerm.openPropertyPanel(null, obj);
|
||||
},
|
||||
|
||||
/**
|
||||
* Prints aObject to the output.
|
||||
*
|
||||
* @param object aObject
|
||||
* Object to print to the output.
|
||||
* @returns void
|
||||
*/
|
||||
pprint: function JSTH_pprint(aObject)
|
||||
{
|
||||
if (aObject === null || aObject === undefined || aObject === true || aObject === false) {
|
||||
aJSTerm.console.error(HUDService.getStr("helperFuncUnsupportedTypeError"));
|
||||
return;
|
||||
}
|
||||
let output = [];
|
||||
if (typeof aObject != "string") {
|
||||
aObject = XPCNativeWrapper.unwrap(aObject);
|
||||
}
|
||||
let pairs = namesAndValuesOf(aObject);
|
||||
|
||||
pairs.forEach(function(pair) {
|
||||
output.push(" " + pair.display);
|
||||
});
|
||||
|
||||
aJSTerm.writeOutput(output.join("\n"));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* JSTerm
|
||||
*
|
||||
|
@ -3576,6 +3755,7 @@ JSTerm.prototype = {
|
|||
this.sandbox = new Cu.Sandbox(this._window);
|
||||
this.sandbox.window = this._window;
|
||||
this.sandbox.console = this.console;
|
||||
this.sandbox.__helperFunctions__ = JSTermHelper(this);
|
||||
this.sandbox.__proto__ = this._window.wrappedJSObject;
|
||||
},
|
||||
|
||||
|
@ -3594,7 +3774,7 @@ JSTerm.prototype = {
|
|||
*/
|
||||
evalInSandbox: function JST_evalInSandbox(aString)
|
||||
{
|
||||
let execStr = "with(window) {" + aString + "}";
|
||||
let execStr = "with(__helperFunctions__) { with(window) {" + aString + "} }";
|
||||
return Cu.evalInSandbox(execStr, this.sandbox, "default", "HUD Console", 1);
|
||||
},
|
||||
|
||||
|
|
|
@ -44,7 +44,7 @@ const Cu = Components.utils;
|
|||
Cu.import("resource://gre/modules/XPCOMUtils.jsm");
|
||||
Cu.import("resource://gre/modules/Services.jsm");
|
||||
|
||||
var EXPORTED_SYMBOLS = ["PropertyPanel", "PropertyTreeView"];
|
||||
var EXPORTED_SYMBOLS = ["PropertyPanel", "PropertyTreeView", "namesAndValuesOf"];
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
//// Helper for PropertyTreeView
|
||||
|
|
|
@ -1049,6 +1049,51 @@ function testExecutionScope()
|
|||
"command was executed in the window scope");
|
||||
}
|
||||
|
||||
function testJSTermHelper()
|
||||
{
|
||||
content.location.href = TEST_URI;
|
||||
|
||||
let HUD = HUDService.hudWeakReferences[hudId].get();
|
||||
let jsterm = HUD.jsterm;
|
||||
|
||||
jsterm.clearOutput();
|
||||
jsterm.execute("'id=' + $('header').getAttribute('id')");
|
||||
let group = jsterm.outputNode.querySelector(".hud-group");
|
||||
is(group.childNodes[2].textContent, "id=header", "$() worked");
|
||||
|
||||
jsterm.clearOutput();
|
||||
jsterm.execute("headerQuery = $$('h1')");
|
||||
jsterm.execute("'length=' + headerQuery.length");
|
||||
let group = jsterm.outputNode.querySelector(".hud-group");
|
||||
is(group.childNodes[4].textContent, "length=1", "$$() worked");
|
||||
|
||||
jsterm.clearOutput();
|
||||
jsterm.execute("xpathQuery = $x('.//*', document.body);");
|
||||
jsterm.execute("'headerFound=' + (xpathQuery[0] == headerQuery[0])");
|
||||
let group = jsterm.outputNode.querySelector(".hud-group");
|
||||
is(group.childNodes[4].textContent, "headerFound=true", "$x() worked");
|
||||
|
||||
// no jsterm.clearOutput() here as we clear the output using the clear() fn.
|
||||
jsterm.execute("clear()");
|
||||
let group = jsterm.outputNode.querySelector(".hud-group");
|
||||
is(group.childNodes[1].textContent, "undefined", "clear() worked");
|
||||
|
||||
jsterm.clearOutput();
|
||||
jsterm.execute("'keysResult=' + (keys({b:1})[0] == 'b')");
|
||||
let group = jsterm.outputNode.querySelector(".hud-group");
|
||||
is(group.childNodes[2].textContent, "keysResult=true", "keys() worked");
|
||||
|
||||
jsterm.clearOutput();
|
||||
jsterm.execute("'valuesResult=' + (values({b:1})[0] == 1)");
|
||||
let group = jsterm.outputNode.querySelector(".hud-group");
|
||||
is(group.childNodes[2].textContent, "valuesResult=true", "values() worked");
|
||||
|
||||
jsterm.clearOutput();
|
||||
jsterm.execute("pprint({b:2, a:1})");
|
||||
let group = jsterm.outputNode.querySelector(".hud-group");
|
||||
is(group.childNodes[2].textContent, " a: 1\n b: 2", "pprint() worked");
|
||||
}
|
||||
|
||||
function testPropertyPanel()
|
||||
{
|
||||
var HUD = HUDService.hudWeakReferences[hudId].get();
|
||||
|
@ -1383,6 +1428,7 @@ function test() {
|
|||
testPropertyProvider();
|
||||
testJSInputExpand();
|
||||
testPropertyPanel();
|
||||
testJSTermHelper();
|
||||
|
||||
// NOTE: Put any sync test above this comment.
|
||||
//
|
||||
|
|
|
@ -16,7 +16,7 @@
|
|||
</script>
|
||||
</head>
|
||||
<body>
|
||||
<h1>Heads Up Display Demo</h1>
|
||||
<h1 id="header">Heads Up Display Demo</h1>
|
||||
<button onclick="test();">Log stuff about Dolske</button>
|
||||
</body>
|
||||
</html>
|
||||
|
|
|
@ -90,6 +90,7 @@ window.onload = function () {
|
|||
// Update the application basics section.
|
||||
document.getElementById("application-box").textContent = Application.name;
|
||||
document.getElementById("version-box").textContent = Application.version;
|
||||
document.getElementById("useragent-box").textContent = navigator.userAgent;
|
||||
document.getElementById("supportLink").href = supportUrl;
|
||||
|
||||
// Update the other sections.
|
||||
|
|
|
@ -99,6 +99,15 @@
|
|||
</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<th class="column">
|
||||
&aboutSupport.appBasicsUserAgent;
|
||||
</th>
|
||||
|
||||
<td id="useragent-box">
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<th class="column">
|
||||
&aboutSupport.appBasicsProfileDir;
|
||||
|
|
|
@ -38,6 +38,7 @@
|
|||
// Force references to all of the symbols that we want exported from
|
||||
// the dll that are located in the .lib files we link with
|
||||
|
||||
#define ZLIB_INTERNAL
|
||||
#include "zlib.h"
|
||||
|
||||
void xxxNeverCalledZLib()
|
||||
|
|
|
@ -58,7 +58,6 @@ RCINCLUDE = xulrunner.rc
|
|||
|
||||
ifndef MOZ_NATIVE_ZLIB
|
||||
CPPSRCS += dlldeps-zlib.cpp
|
||||
DEFINES += -DZLIB_INTERNAL
|
||||
endif
|
||||
|
||||
LOCAL_INCLUDES += -I$(topsrcdir)/widget/src/windows
|
||||
|
@ -79,7 +78,6 @@ CPPSRCS += \
|
|||
|
||||
ifndef MOZ_NATIVE_ZLIB
|
||||
CPPSRCS += dlldeps-zlib.cpp
|
||||
DEFINES += -DZLIB_INTERNAL
|
||||
endif
|
||||
|
||||
ifdef MOZ_ENABLE_LIBXUL
|
||||
|
|
|
@ -19,6 +19,7 @@
|
|||
<!ENTITY aboutSupport.appBasicsProfileDir "Profile Directory">
|
||||
<!ENTITY aboutSupport.appBasicsEnabledPlugins "Enabled Plugins">
|
||||
<!ENTITY aboutSupport.appBasicsBuildConfig "Build Configuration">
|
||||
<!ENTITY aboutSupport.appBasicsUserAgent "User Agent">
|
||||
|
||||
<!ENTITY aboutSupport.show.label "Open Containing Folder">
|
||||
|
||||
|
|
|
@ -63,6 +63,7 @@ jsPropertyTitle=Object Inspector
|
|||
jsPropertyInspectTitle=Inspect: %S
|
||||
copyCmd.label=Copy
|
||||
copyCmd.accesskey=C
|
||||
helperFuncUnsupportedTypeError=Can't call pprint on this type of object.
|
||||
# LOCALIZATION NOTE (networkUrlWithStatus):
|
||||
#
|
||||
# When the HTTP request is started only the URL of the request is printed to the
|
||||
|
|
|
@ -553,14 +553,11 @@ nsWindow::Create(nsIWidget *aParent,
|
|||
|
||||
mPopupType = aInitData->mPopupHint;
|
||||
mContentType = aInitData->mContentType;
|
||||
mIsRTL = aInitData->mRTL;
|
||||
|
||||
DWORD style = WindowStyle();
|
||||
DWORD extendedStyle = WindowExStyle();
|
||||
|
||||
if (aInitData->mRTL) {
|
||||
extendedStyle |= WS_EX_LAYOUTRTL | WS_EX_NOINHERITLAYOUT;
|
||||
}
|
||||
|
||||
if (mWindowType == eWindowType_popup) {
|
||||
if (!aParent)
|
||||
parent = NULL;
|
||||
|
@ -4897,10 +4894,28 @@ PRBool nsWindow::ProcessMessage(UINT msg, WPARAM &wParam, LPARAM &lParam,
|
|||
break;
|
||||
|
||||
case WM_MBUTTONDBLCLK:
|
||||
result = DispatchMouseEvent(NS_MOUSE_BUTTON_DOWN, wParam, lParam, PR_FALSE,
|
||||
result = DispatchMouseEvent(NS_MOUSE_DOUBLECLICK, wParam, lParam, PR_FALSE,
|
||||
nsMouseEvent::eMiddleButton, MOUSE_INPUT_SOURCE());
|
||||
break;
|
||||
|
||||
case WM_NCMBUTTONDOWN:
|
||||
result = DispatchMouseEvent(NS_MOUSE_BUTTON_DOWN, 0, lParamToClient(lParam), PR_FALSE,
|
||||
nsMouseEvent::eMiddleButton, MOUSE_INPUT_SOURCE());
|
||||
DispatchPendingEvents();
|
||||
break;
|
||||
|
||||
case WM_NCMBUTTONUP:
|
||||
result = DispatchMouseEvent(NS_MOUSE_BUTTON_UP, 0, lParamToClient(lParam), PR_FALSE,
|
||||
nsMouseEvent::eMiddleButton, MOUSE_INPUT_SOURCE());
|
||||
DispatchPendingEvents();
|
||||
break;
|
||||
|
||||
case WM_NCMBUTTONDBLCLK:
|
||||
result = DispatchMouseEvent(NS_MOUSE_DOUBLECLICK, 0, lParamToClient(lParam), PR_FALSE,
|
||||
nsMouseEvent::eMiddleButton, MOUSE_INPUT_SOURCE());
|
||||
DispatchPendingEvents();
|
||||
break;
|
||||
|
||||
case WM_RBUTTONDOWN:
|
||||
{
|
||||
result = DispatchMouseEvent(NS_MOUSE_BUTTON_DOWN, wParam, lParam, PR_FALSE,
|
||||
|
|
|
@ -473,6 +473,9 @@ protected:
|
|||
PRPackedBool mPainting;
|
||||
PRPackedBool mExitToNonClientArea;
|
||||
PRPackedBool mTouchWindow;
|
||||
PRPackedBool mDisplayPanFeedback;
|
||||
PRPackedBool mHideChrome;
|
||||
PRPackedBool mIsRTL;
|
||||
PRUint32 mBlurSuppressLevel;
|
||||
nsContentType mContentType;
|
||||
DWORD_PTR mOldStyle;
|
||||
|
@ -482,8 +485,6 @@ protected:
|
|||
nsNativeDragTarget* mNativeDragTarget;
|
||||
HKL mLastKeyboardLayout;
|
||||
nsPopupType mPopupType;
|
||||
PRPackedBool mDisplayPanFeedback;
|
||||
PRPackedBool mHideChrome;
|
||||
nsSizeMode mOldSizeMode;
|
||||
WindowHook mWindowHook;
|
||||
static PRUint32 sInstanceCount;
|
||||
|
|
|
@ -122,6 +122,8 @@ interface nsIMemory : nsISupports
|
|||
* This predicate can be used to determine if we're in a low-memory
|
||||
* situation (what constitutes low-memory is platform dependent). This
|
||||
* can be used to trigger the memory pressure observers.
|
||||
*
|
||||
* DEPRECATED - Always returns false. See bug 592308.
|
||||
*/
|
||||
boolean isLowMemory();
|
||||
};
|
||||
|
|
|
@ -54,30 +54,6 @@
|
|||
#include "nsString.h"
|
||||
#include "mozilla/Services.h"
|
||||
|
||||
#if defined(XP_WIN)
|
||||
#include <windows.h>
|
||||
#endif
|
||||
|
||||
#if (MOZ_PLATFORM_MAEMO == 5 || MOZ_PLATFORM_MAEMO == 4) && defined(__arm__)
|
||||
#include <fcntl.h>
|
||||
#include <unistd.h>
|
||||
static const char kHighMark[] = "/sys/kernel/high_watermark";
|
||||
#endif
|
||||
|
||||
// Some platforms notify you when system memory is low, others do not.
|
||||
// In the case of those that do not, we want to post low memory
|
||||
// notifications from IsLowMemory(). For those that can notify us, that
|
||||
// code usually lives in toolkit.
|
||||
#ifdef WINCE
|
||||
#define NOTIFY_LOW_MEMORY
|
||||
#endif
|
||||
|
||||
#ifdef WINCE_WINDOWS_MOBILE
|
||||
#include "aygshell.h"
|
||||
#endif
|
||||
|
||||
#include "nsITimer.h"
|
||||
|
||||
static nsMemoryImpl sGlobalMemory;
|
||||
|
||||
NS_IMPL_QUERY_INTERFACE1(nsMemoryImpl, nsIMemory)
|
||||
|
@ -106,56 +82,11 @@ nsMemoryImpl::HeapMinimize(PRBool aImmediate)
|
|||
return FlushMemory(NS_LITERAL_STRING("heap-minimize").get(), aImmediate);
|
||||
}
|
||||
|
||||
/* this magic number is something greater than 40mb
|
||||
* and after all, 40mb should be good enough for any web app
|
||||
* unless it's part of an office suite.
|
||||
*/
|
||||
static const int kRequiredMemory = 0x3000000;
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsMemoryImpl::IsLowMemory(PRBool *result)
|
||||
{
|
||||
#if defined(WINCE_WINDOWS_MOBILE)
|
||||
MEMORYSTATUS stat;
|
||||
GlobalMemoryStatus(&stat);
|
||||
*result = (stat.dwMemoryLoad >= 98);
|
||||
#elif defined(WINCE)
|
||||
// Bug 525323 - GlobalMemoryStatus kills perf on WinCE.
|
||||
NS_ERROR("IsLowMemory is deprecated. See bug 592308.");
|
||||
*result = PR_FALSE;
|
||||
#elif defined(XP_WIN)
|
||||
MEMORYSTATUSEX stat;
|
||||
stat.dwLength = sizeof stat;
|
||||
GlobalMemoryStatusEx(&stat);
|
||||
*result = (stat.ullAvailPageFile < kRequiredMemory) &&
|
||||
((float)stat.ullAvailPageFile / stat.ullTotalPageFile) < 0.1;
|
||||
#elif (MOZ_PLATFORM_MAEMO == 5 || MOZ_PLATFORM_MAEMO == 4) && defined(__arm__)
|
||||
static int osso_highmark_fd = -1;
|
||||
if (osso_highmark_fd == -1) {
|
||||
osso_highmark_fd = open (kHighMark, O_RDONLY);
|
||||
|
||||
if (osso_highmark_fd == -1) {
|
||||
NS_ERROR("can't find the osso highmark file");
|
||||
*result = PR_FALSE;
|
||||
return NS_OK;
|
||||
}
|
||||
}
|
||||
|
||||
// be kind, rewind.
|
||||
lseek(osso_highmark_fd, 0L, SEEK_SET);
|
||||
|
||||
int c = 0;
|
||||
read (osso_highmark_fd, &c, 1);
|
||||
|
||||
*result = (c == '1');
|
||||
#else
|
||||
*result = PR_FALSE;
|
||||
#endif
|
||||
|
||||
#ifdef NOTIFY_LOW_MEMORY
|
||||
if (*result) {
|
||||
sGlobalMemory.FlushMemory(NS_LITERAL_STRING("low-memory").get(), PR_FALSE);
|
||||
}
|
||||
#endif
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
|
|
@ -73,7 +73,6 @@ CPPSRCS = \
|
|||
TestRegistrationOrder.cpp \
|
||||
TestThreadPoolListener.cpp \
|
||||
TestTimers.cpp \
|
||||
TestOOM.cpp \
|
||||
TestBlockingProcess.cpp \
|
||||
TestQuickReturn.cpp \
|
||||
TestArguments.cpp \
|
||||
|
|
|
@ -1,108 +0,0 @@
|
|||
/* ***** BEGIN LICENSE BLOCK *****
|
||||
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||
*
|
||||
* The contents of this file are subject to the Mozilla Public License Version
|
||||
* 1.1 (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
* http://www.mozilla.org/MPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
||||
* for the specific language governing rights and limitations under the
|
||||
* License.
|
||||
*
|
||||
* The Original Code is a simple OOM Test.
|
||||
*
|
||||
* The Initial Developer of the Original Code is
|
||||
* Mozilla Corporation.
|
||||
* Portions created by the Initial Developer are Copyright (C) 2008
|
||||
* the Initial Developer. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
* Doug Turner <dougt@meer.net>
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the terms of
|
||||
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
* in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
* of those above. If you wish to allow use of your version of this file only
|
||||
* under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
* use your version of this file under the terms of the MPL, indicate your
|
||||
* decision by deleting the provisions above and replace them with the notice
|
||||
* and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
* the provisions above, a recipient may use your version of this file under
|
||||
* the terms of any one of the MPL, the GPL or the LGPL.
|
||||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <math.h>
|
||||
|
||||
#include "nsXPCOM.h"
|
||||
#include "nsISupportsUtils.h"
|
||||
#include "nsCOMPtr.h"
|
||||
#include "nsIMemory.h"
|
||||
|
||||
int main(int argc, char **argv)
|
||||
{
|
||||
nsCOMPtr<nsIMemory> mem;
|
||||
nsresult rv = NS_GetMemoryManager(getter_AddRefs(mem));
|
||||
|
||||
if (!mem || NS_FAILED(rv))
|
||||
{
|
||||
printf("Could not get the memory manager\n");
|
||||
return -1;
|
||||
}
|
||||
|
||||
// allocation note. don't use nsIMemory to allocate,
|
||||
// because we want to test the isLowMemory predicate
|
||||
// without regard for the nsIMemory impelmentation (the
|
||||
// implementation might count bytes handed out. however,
|
||||
// the predicate should work with out having to rely on
|
||||
// that.
|
||||
void *big_alloc = malloc(1024 * 1024 * 16);
|
||||
(void)big_alloc; // Tell compiler we're not using big_alloc, to fix warning
|
||||
|
||||
const int highpower = 500000;
|
||||
|
||||
char* buffers[highpower];
|
||||
for (int i=0; i<highpower; i++)
|
||||
buffers[i] = nsnull;
|
||||
|
||||
for (int i=0; i<highpower; i++)
|
||||
{
|
||||
PRBool lowMem = PR_FALSE;
|
||||
size_t s = 4096; //pow(2,i);
|
||||
buffers[i] = (char*) malloc(s);
|
||||
|
||||
// You have to touch the buffer
|
||||
if (!buffers[i])
|
||||
printf("Could not allocate a buffer of size %lu\n", (unsigned long)s);
|
||||
else
|
||||
{
|
||||
for (size_t j=0; j<s; j++)
|
||||
buffers[i][j] = 'a';
|
||||
}
|
||||
|
||||
PRIntervalTime start = PR_IntervalNow();
|
||||
mem->IsLowMemory(&lowMem);
|
||||
PRIntervalTime cost = PR_IntervalNow() - start;
|
||||
|
||||
|
||||
printf("Total Allocated: %lu. \tLow Memory now? %s\t Took (%d)\n",
|
||||
(unsigned long)s*i,
|
||||
lowMem ? "Yes" : "No",
|
||||
PR_IntervalToMilliseconds(cost));
|
||||
|
||||
if (lowMem)
|
||||
break;
|
||||
}
|
||||
|
||||
for(int i=0; i<highpower; i++)
|
||||
{
|
||||
if (buffers[i])
|
||||
free(buffers[i]);
|
||||
}
|
||||
return 0;
|
||||
}
|
Загрузка…
Ссылка в новой задаче