Merge birch to m-c

This commit is contained in:
Phil Ringnalda 2013-05-27 09:55:00 -07:00
commit cea75154ce
61 changed files with 935 additions and 398 deletions

View File

@ -17,7 +17,7 @@
#
# Modifying this file will now automatically clobber the buildbot machines \o/
#
Bug 874640 touched webidl, so Windows needs to clobber + Bug 854517: Integrate valgrind into B2G builds
Bug 869002 touched webidl, so Windows needs to clobber
Alternative to clobber is to run ./config.status from the objdir and to
touch the CLOBBER file in the objdir.

View File

@ -290,12 +290,6 @@ let SessionStoreInternal = {
// number of tabs currently restoring
_tabsRestoringCount: 0,
// overrides MAX_CONCURRENT_TAB_RESTORES and restore_hidden_tabs when true
_restoreOnDemand: false,
// whether to restore app tabs on demand or not, pref controlled.
_restorePinnedTabsOnDemand: null,
// The state from the previous session (after restoring pinned tabs). This
// state is persisted and passed through to the next session during an app
// restart to make the third party add-on warning not trash the deferred
@ -371,14 +365,6 @@ let SessionStoreInternal = {
this._sessionhistory_max_entries =
this._prefBranch.getIntPref("sessionhistory.max_entries");
this._restoreOnDemand =
this._prefBranch.getBoolPref("sessionstore.restore_on_demand");
this._prefBranch.addObserver("sessionstore.restore_on_demand", this, true);
this._restorePinnedTabsOnDemand =
this._prefBranch.getBoolPref("sessionstore.restore_pinned_tabs_on_demand");
this._prefBranch.addObserver("sessionstore.restore_pinned_tabs_on_demand", this, true);
gSessionStartup.onceInitialized.then(
this.initSession.bind(this)
);
@ -1188,14 +1174,6 @@ let SessionStoreInternal = {
_SessionFile.wipe();
this.saveState(true);
break;
case "sessionstore.restore_on_demand":
this._restoreOnDemand =
this._prefBranch.getBoolPref("sessionstore.restore_on_demand");
break;
case "sessionstore.restore_pinned_tabs_on_demand":
this._restorePinnedTabsOnDemand =
this._prefBranch.getBoolPref("sessionstore.restore_pinned_tabs_on_demand");
break;
}
},
@ -3266,10 +3244,8 @@ let SessionStoreInternal = {
if (this._loadState == STATE_QUITTING)
return;
// If it's not possible to restore anything, then just bail out.
if ((this._restoreOnDemand &&
(this._restorePinnedTabsOnDemand || !TabRestoreQueue.hasPriorityTabs)) ||
this._tabsRestoringCount >= MAX_CONCURRENT_TAB_RESTORES)
// Don't exceed the maximum number of concurrent tab restores.
if (this._tabsRestoringCount >= MAX_CONCURRENT_TAB_RESTORES)
return;
let tab = TabRestoreQueue.shift();
@ -4496,20 +4472,50 @@ let TabRestoreQueue = {
// The separate buckets used to store tabs.
tabs: {priority: [], visible: [], hidden: []},
// Returns whether we have any high priority tabs in the queue.
get hasPriorityTabs() !!this.tabs.priority.length,
// Preferences used by the TabRestoreQueue to determine which tabs
// are restored automatically and which tabs will be on-demand.
prefs: {
// Lazy getter that returns whether tabs are restored on demand.
get restoreOnDemand() {
let updateValue = () => {
let value = Services.prefs.getBoolPref(PREF);
let definition = {value: value, configurable: true};
Object.defineProperty(this, "restoreOnDemand", definition);
return value;
}
// Lazy getter that returns whether we should restore hidden tabs.
get restoreHiddenTabs() {
let updateValue = () => {
let value = Services.prefs.getBoolPref(PREF);
let definition = {value: value, configurable: true};
Object.defineProperty(this, "restoreHiddenTabs", definition);
const PREF = "browser.sessionstore.restore_on_demand";
Services.prefs.addObserver(PREF, updateValue, false);
return updateValue();
},
// Lazy getter that returns whether pinned tabs are restored on demand.
get restorePinnedTabsOnDemand() {
let updateValue = () => {
let value = Services.prefs.getBoolPref(PREF);
let definition = {value: value, configurable: true};
Object.defineProperty(this, "restorePinnedTabsOnDemand", definition);
return value;
}
const PREF = "browser.sessionstore.restore_pinned_tabs_on_demand";
Services.prefs.addObserver(PREF, updateValue, false);
return updateValue();
},
// Lazy getter that returns whether we should restore hidden tabs.
get restoreHiddenTabs() {
let updateValue = () => {
let value = Services.prefs.getBoolPref(PREF);
let definition = {value: value, configurable: true};
Object.defineProperty(this, "restoreHiddenTabs", definition);
return value;
}
const PREF = "browser.sessionstore.restore_hidden_tabs";
Services.prefs.addObserver(PREF, updateValue, false);
return updateValue();
}
const PREF = "browser.sessionstore.restore_hidden_tabs";
Services.prefs.addObserver(PREF, updateValue, false);
updateValue();
},
// Resets the queue and removes all tabs.
@ -4554,12 +4560,16 @@ let TabRestoreQueue = {
let set;
let {priority, hidden, visible} = this.tabs;
if (priority.length) {
let {restoreOnDemand, restorePinnedTabsOnDemand} = this.prefs;
let restorePinned = !(restoreOnDemand && restorePinnedTabsOnDemand);
if (restorePinned && priority.length) {
set = priority;
} else if (visible.length) {
set = visible;
} else if (this.restoreHiddenTabs && hidden.length) {
set = hidden;
} else if (!restoreOnDemand) {
if (visible.length) {
set = visible;
} else if (this.prefs.restoreHiddenTabs && hidden.length) {
set = hidden;
}
}
return set && set.shift();

View File

@ -41,154 +41,149 @@ timestampFormat=%02S:%02S:%02S.%03S
helperFuncUnsupportedTypeError=Can't call pprint on this type of object.
NetworkPanel.label=Inspect Network Request
# LOCALIZATION NOTE (NetworkPanel.deltaDurationMS):
#
# This string is used to show the duration between two network events (e.g
# request and response header or response header and response body).
# LOCALIZATION NOTE (NetworkPanel.deltaDurationMS): this string is used to
# show the duration between two network events (e.g request and response
# header or response header and response body). Parameters: %S is the duration.
NetworkPanel.durationMS=%Sms
# LOCALIZATION NOTE (NetworkPanel.imageSizeDeltaDurationMS):
# This string is used to show the duration between the response header and the
# response body event. It also shows the size of the received or cached image.
#
# The first %S is replace by the width of the inspected image.
# The second %S is replaced by the height of the inspected image.
# The third %S is replaced by the duration between the response header and the
# response body event.
NetworkPanel.imageSizeDeltaDurationMS=%Sx%Spx, Δ%Sms
# LOCALIZATION NOTE (NetworkPanel.responseBodyUnableToDisplay.content):
#
# This string is displayed within the response body section of the NetworkPanel
# if the content type of the network request can't be displayed in the
# NetworkPanel. E.g. any kind of text is easy to display, but some audio or
# flash data received from the server can't be displayed.
#
# The %S is replaced by the content type, that can't be displayed, examples are
# o application/x-shockwave-flash
# o music/crescendo
# LOCALIZATION NOTE (NetworkPanel.imageSizeDeltaDurationMS): this string is
# used to show the duration between the response header and the response body
# event. It also shows the size of the received or cached image. Parameters:
# %1$S is the width of the inspected image, %2$S is the height of the
# inspected image, %3$S is the duration between the response header and the
# response body event. Example: 150x100px, Δ50ms.
NetworkPanel.imageSizeDeltaDurationMS=%1$Sx%2$Spx, Δ%3$Sms
# LOCALIZATION NOTE (NetworkPanel.responseBodyUnableToDisplay.content): this
# string is displayed within the response body section of the NetworkPanel if
# the content type of the network request can't be displayed. E.g. any kind of
# text is easy to display, but some audio or flash data received from the
# server can't be displayed. Parameters: %S is the content type that can't be
# displayed, examples are application/x-shockwave-flash, music/crescendo.
NetworkPanel.responseBodyUnableToDisplay.content=Unable to display responses of type "%S"
ConsoleAPIDisabled=The Web Console logging API (console.log, console.info, console.warn, console.error) has been disabled by a script on this page.
# LOCALIZATION NOTE (webConsoleWindowTitleAndURL): The Web Console floating
# panel title, followed by the web page URL.
# For RTL languages you need to set the LRM in the string to give the URL
# the correct direction.
# LOCALIZATION NOTE (webConsoleWindowTitleAndURL): the Web Console floating
# panel title. For RTL languages you need to set the LRM in the string to give
# the URL the correct direction. Parameters: %S is the web page URL.
webConsoleWindowTitleAndURL=Web Console - %S
# LOCALIZATION NOTE (webConsoleMixedContentWarning): Message displayed after a
# URL in the Web Console that has been flagged for Mixed Content (i.e. http
# content in an https page)
# LOCALIZATION NOTE (webConsoleMixedContentWarning): the message displayed
# after a URL in the Web Console that has been flagged for Mixed Content (i.e.
# http content in an https page).
webConsoleMixedContentWarning=Mixed Content
# LOCALIZATION NOTE (scratchpad.linkText):
# The text used in the right hand side of the web console command line when
# JavaScript is being entered, to indicate how to jump into scratchpad mode
# LOCALIZATION NOTE (scratchpad.linkText): the text used in the right hand
# side of the Web Console command line when JavaScript is being entered, to
# indicate how to jump into scratchpad mode.
scratchpad.linkText=Shift+RETURN - Open in Scratchpad
# LOCALIZATION NOTE (gcliterm.instanceLabel): The console displays
# objects using their type (from the constructor function) in this descriptive
# string
# LOCALIZATION NOTE (gcliterm.instanceLabel): the console displays objects
# using their type (from the constructor function) in this descriptive string.
# Parameters: %S is the object type.
gcliterm.instanceLabel=Instance of %S
# LOCALIZATION NOTE (stacktrace.anonymousFunction):
# This string is used to display JavaScript functions that have no given name -
# they are said to be anonymous. See stacktrace.outputMessage.
# LOCALIZATION NOTE (stacktrace.anonymousFunction): this string is used to
# display JavaScript functions that have no given name - they are said to be
# anonymous. See also stacktrace.outputMessage.
stacktrace.anonymousFunction=<anonymous>
# LOCALIZATION NOTE (stacktrace.outputMessage):
# This string is used in the Web Console output to identify a web developer call
# to console.trace(). The stack trace of JavaScript function calls is displayed.
# In this minimal message we only show the last call.
stacktrace.outputMessage=Stack trace from %S, function %S, line %S.
# LOCALIZATION NOTE (stacktrace.outputMessage): this string is used in the Web
# Console output to identify a web developer call to console.trace(). The
# stack trace of JavaScript function calls is displayed. In this minimal
# message we only show the last call. Parameters: %1$S is the file name, %2$S
# is the function name, %3$S is the line number.
stacktrace.outputMessage=Stack trace from %1$S, function %2$S, line %3$S.
# LOCALIZATION NOTE (timerStarted):
# This string is used to display the result of the console.time() call.
# %S=name of timer
# LOCALIZATION NOTE (timerStarted): this string is used to display the result
# of the console.time() call. Parameters: %S is the name of the timer.
timerStarted=%S: timer started
# LOCALIZATION NOTE (timeEnd):
# This string is used to display the result of the console.timeEnd() call.
# %1$S=name of timer, %2$S=number of milliseconds
# LOCALIZATION NOTE (timeEnd): this string is used to display the result of
# the console.timeEnd() call. Parameters: %1$S is the name of the timer, %2$S
# is the number of milliseconds.
timeEnd=%1$S: %2$Sms
# LOCALIZATION NOTE (Autocomplete.blank):
# This string is used when inputnode string containing anchor doesn't
# doesn't matches to any property in the content.
# LOCALIZATION NOTE (Autocomplete.blank): this string is used when inputnode
# string containing anchor doesn't matches to any property in the content.
Autocomplete.blank= <- no result
maxTimersExceeded=The maximum allowed number of timers in this page was exceeded.
# LOCALIZATION NOTE (JSTerm.updateNotInspectable):
# This string is used when the user inspects an evaluation result in the Web
# Console and tries the Update button, but the new result no longer returns an
# object that can be inspected.
# LOCALIZATION NOTE (JSTerm.updateNotInspectable): this string is used when
# the user inspects an evaluation result in the Web Console and tries the
# Update button, but the new result no longer returns an object that can be
# inspected.
JSTerm.updateNotInspectable=After your input has been re-evaluated the result is no longer inspectable.
# LOCALIZATION NOTE (remoteWebConsolePromptTitle): The title displayed on the
# LOCALIZATION NOTE (remoteWebConsolePromptTitle): the title displayed on the
# Web Console prompt asking for the remote host and port to connect to.
remoteWebConsolePromptTitle=Remote Connection
# LOCALIZATION NOTE (remoteWebConsolePromptMessage): The message displayed on the
# Web Console prompt asking for the remote host and port to connect to.
# LOCALIZATION NOTE (remoteWebConsolePromptMessage): the message displayed on
# the Web Console prompt asking for the remote host and port to connect to.
remoteWebConsolePromptMessage=Enter hostname and port number (host:port)
# LOCALIZATION NOTE (remoteWebConsoleSelectTabTitle): The title displayed on the
# Web Console prompt asking the user to pick a tab to attach to.
# LOCALIZATION NOTE (remoteWebConsoleSelectTabTitle): the title displayed on
# the Web Console prompt asking the user to pick a tab to attach to.
remoteWebConsoleSelectTabTitle=Tab list - Remote Connection
# LOCALIZATION NOTE (remoteWebConsoleSelectTabMessage): The message displayed on the
# Web Console prompt asking the user to pick a tab to attach to.
# LOCALIZATION NOTE (remoteWebConsoleSelectTabMessage): the message displayed
# on the Web Console prompt asking the user to pick a tab to attach to.
remoteWebConsoleSelectTabMessage=Select one of the tabs you want to attach to, or select the global console.
# LOCALIZATION NOTE (listTabs.globalConsoleActor): The string displayed for the
# global console in the tabs selection.
# LOCALIZATION NOTE (listTabs.globalConsoleActor): the string displayed for
# the global console in the tabs selection.
listTabs.globalConsoleActor=*Global Console*
# LOCALIZATION NOTE (MenuWebconsole.label):
# This string is displayed in the Tools menu as a shortcut to open the devtools
# with the web console tab selected.
# LOCALIZATION NOTE (MenuWebconsole.label): the string displayed in the Tools
# menu as a shortcut to open the devtools with the Web Console tab selected.
MenuWebconsole.label=Web Console
# LOCALIZATION NOTE (ToolboxTabWebconsole.label):
# This string is displayed as the label of the tab in the devtools window.
# LOCALIZATION NOTE (ToolboxTabWebconsole.label): the string displayed as the
# label of the tab in the devtools window.
ToolboxTabWebconsole.label=Console
# LOCALIZATION NOTE (ToolboxWebconsole.tooltip):
# This string is displayed in the tooltip of the tab when the web console is
# displayed inside the developer tools window.
# LOCALIZATION NOTE (ToolboxWebconsole.tooltip): the string displayed in the
# tooltip of the tab when the Web Console is displayed inside the developer
# tools window.
ToolboxWebconsole.tooltip=Web Console
# LOCALIZATION NOTE (longStringEllipsis): The string displayed after a long
# string. This string is clickable such that the rest of the string is retrieved
# from the server.
# LOCALIZATION NOTE (longStringEllipsis): the string displayed after a long
# string. This string is clickable such that the rest of the string is
# retrieved from the server.
longStringEllipsis=[…]
# LOCALIZATION NOTE (longStringTooLong): The string displayed after the user
# LOCALIZATION NOTE (longStringTooLong): the string displayed after the user
# tries to expand a long string.
longStringTooLong=The string you are trying to view is too long to be displayed by the Web Console.
# LOCALIZATION NOTE (executeEmptyInput): This is displayed when the user tries
# to execute code, but the input is empty.
# LOCALIZATION NOTE (executeEmptyInput): the string displayed when the user
# tries to execute code, but the input is empty.
executeEmptyInput=No value to execute.
# LOCALIZATION NOTE (NetworkPanel.fetchRemainingResponseContentLink): This is
# displayed in the network panel when the response body is only partially
# available.
NetworkPanel.fetchRemainingResponseContentLink=Fetch the remaining %1$S bytes
# LOCALIZATION NOTE (NetworkPanel.fetchRemainingResponseContentLink): the
# string displayed in the network panel when the response body is only
# partially available. Parameters: %S is the amount of bytes that need to be
# fetched.
NetworkPanel.fetchRemainingResponseContentLink=Fetch the remaining %S bytes
# LOCALIZATION NOTE (NetworkPanel.fetchRemainingRequestContentLink): This is
# displayed in the network panel when the request body is only partially
# available.
NetworkPanel.fetchRemainingRequestContentLink=Fetch the request body (%1$S bytes)
# LOCALIZATION NOTE (NetworkPanel.fetchRemainingRequestContentLink): the
# string displayed in the network panel when the request body is only
# partially available. Parameters: %S is the amount of bytes that need to be
# fetched.
NetworkPanel.fetchRemainingRequestContentLink=Fetch the request body (%S bytes)
# LOCALIZATION NOTE (connectionTimeout): Message displayed when the Remote Web
# LOCALIZATION NOTE (connectionTimeout): message displayed when the Remote Web
# Console fails to connect to the server due to a timeout.
connectionTimeout=Connection timeout. Check the Error Console on both ends for potential error messages. Reopen the Web Console to try again.
# LOCALIZATION NOTE (propertiesFilterPlaceholder): This is the text that
# LOCALIZATION NOTE (propertiesFilterPlaceholder): this is the text that
# appears in the filter text box for the properties view container.
propertiesFilterPlaceholder=Filter properties
# LOCALIZATION NOTE (emptyPropertiesList): The text that is displayed in the
# LOCALIZATION NOTE (emptyPropertiesList): the text that is displayed in the
# properties pane when there are no properties to display.
emptyPropertiesList=No properties to display

View File

@ -1306,8 +1306,6 @@ public:
}
static void ReleaseWrapper(void* aScriptObjectHolder,
nsWrapperCache* aCache);
static void TraceWrapper(nsWrapperCache* aCache, TraceCallback aCallback,
void *aClosure);
/*
* Notify when the first XUL menu is opened and when the all XUL menus are

View File

@ -1725,10 +1725,10 @@ public:
#include "nsEventNameList.h"
#undef DOCUMENT_ONLY_EVENT
#undef TOUCH_EVENT
#undef EVENT
#undef EVENT
protected:
static void Trace(nsINode *tmp, TraceCallback cb, void *closure);
static void Trace(nsINode *tmp, const TraceCallbacks &cb, void *closure);
static bool Traverse(nsINode *tmp, nsCycleCollectionTraversalCallback &cb);
static void Unlink(nsINode *tmp);

View File

@ -67,7 +67,7 @@ NS_IMPL_CYCLE_COLLECTION_TRAVERSE_BEGIN(Attr)
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_END
NS_IMPL_CYCLE_COLLECTION_TRACE_BEGIN(Attr)
nsINode::Trace(tmp, aCallback, aClosure);
nsINode::Trace(tmp, aCallbacks, aClosure);
NS_IMPL_CYCLE_COLLECTION_TRACE_END
NS_IMPL_CYCLE_COLLECTION_UNLINK_BEGIN(Attr)

View File

@ -107,6 +107,18 @@ DocumentFragment::DumpContent(FILE* out, int32_t aIndent,
}
#endif
/* static */ already_AddRefed<DocumentFragment>
DocumentFragment::Constructor(const GlobalObject& aGlobal, ErrorResult& aRv)
{
nsCOMPtr<nsPIDOMWindow> window = do_QueryInterface(aGlobal.Get());
if (!window || !window->GetDoc()) {
aRv.Throw(NS_ERROR_FAILURE);
return nullptr;
}
return window->GetDoc()->CreateDocumentFragment();
}
// QueryInterface implementation for DocumentFragment
NS_INTERFACE_MAP_BEGIN(DocumentFragment)
NS_WRAPPERCACHE_INTERFACE_MAP_ENTRY

View File

@ -141,6 +141,9 @@ public:
mHost = aHost;
}
static already_AddRefed<DocumentFragment>
Constructor(const GlobalObject& aGlobal, ErrorResult& aRv);
#ifdef DEBUG
virtual void List(FILE* out, int32_t aIndent) const;
virtual void DumpContent(FILE* out, int32_t aIndent, bool aDumpAll) const;

View File

@ -1157,7 +1157,7 @@ NS_IMPL_CYCLE_COLLECTION_UNLINK_BEGIN(FragmentOrElement)
NS_IMPL_CYCLE_COLLECTION_UNLINK_END
NS_IMPL_CYCLE_COLLECTION_TRACE_BEGIN(FragmentOrElement)
nsINode::Trace(tmp, aCallback, aClosure);
nsINode::Trace(tmp, aCallbacks, aClosure);
NS_IMPL_CYCLE_COLLECTION_TRACE_END
void

View File

@ -5909,7 +5909,7 @@ nsContentUtils::CheckCCWrapperTraversal(void* aScriptObjectHolder,
"wrapper! This will probably crash.");
callback.mFound = false;
aTracer->Trace(aScriptObjectHolder, DebugWrapperTraceCallback, &callback);
aTracer->Trace(aScriptObjectHolder, TraceCallbackFunc(DebugWrapperTraceCallback), &callback);
MOZ_ASSERT(callback.mFound,
"Cycle collection participant didn't trace preserved wrapper! "
"This will probably crash.");
@ -6436,19 +6436,6 @@ nsContentUtils::ReleaseWrapper(void* aScriptObjectHolder,
}
}
// static
void
nsContentUtils::TraceWrapper(nsWrapperCache* aCache, TraceCallback aCallback,
void *aClosure)
{
if (aCache->PreservingWrapper()) {
JSObject *wrapper = aCache->GetWrapperPreserveColor();
if (wrapper) {
aCallback(wrapper, "Preserved wrapper", aClosure);
}
}
}
// static
int32_t
nsContentUtils::GetAdjustedOffsetInTextControl(nsIFrame* aOffsetFrame,

View File

@ -1782,28 +1782,28 @@ NS_IMPL_CYCLE_COLLECTION_TRAVERSE_END
struct CustomPrototypeTraceArgs {
TraceCallback callback;
const TraceCallbacks& callbacks;
void* closure;
};
static PLDHashOperator
CustomPrototypeTrace(const nsAString& aName, JSObject* aObject, void *aArg)
CustomPrototypeTrace(const nsAString& aName, JSObject*& aObject, void *aArg)
{
CustomPrototypeTraceArgs* traceArgs = static_cast<CustomPrototypeTraceArgs*>(aArg);
MOZ_ASSERT(aObject, "Protocol object value must not be null");
traceArgs->callback(aObject, "mCustomPrototypes entry", traceArgs->closure);
traceArgs->callbacks.Trace(&aObject, "mCustomPrototypes entry", traceArgs->closure);
return PL_DHASH_NEXT;
}
NS_IMPL_CYCLE_COLLECTION_TRACE_BEGIN(nsDocument)
CustomPrototypeTraceArgs customPrototypeArgs = { aCallback, aClosure };
tmp->mCustomPrototypes.EnumerateRead(CustomPrototypeTrace, &customPrototypeArgs);
CustomPrototypeTraceArgs customPrototypeArgs = { aCallbacks, aClosure };
tmp->mCustomPrototypes.Enumerate(CustomPrototypeTrace, &customPrototypeArgs);
if (tmp->PreservingWrapper()) {
NS_IMPL_CYCLE_COLLECTION_TRACE_JSVAL_MEMBER_CALLBACK(mExpandoAndGeneration.expando);
}
nsINode::Trace(tmp, aCallback, aClosure);
nsINode::Trace(tmp, aCallbacks, aClosure);
NS_IMPL_CYCLE_COLLECTION_TRACE_END

View File

@ -63,7 +63,7 @@ nsGenericDOMDataNode::~nsGenericDOMDataNode()
}
NS_IMPL_CYCLE_COLLECTION_TRACE_BEGIN(nsGenericDOMDataNode)
nsINode::Trace(tmp, aCallback, aClosure);
nsINode::Trace(tmp, aCallbacks, aClosure);
NS_IMPL_CYCLE_COLLECTION_TRACE_END
NS_IMPL_CYCLE_COLLECTION_CAN_SKIP_BEGIN(nsGenericDOMDataNode)

View File

@ -1165,9 +1165,9 @@ nsINode::GetContextForEventHandlers(nsresult* aRv)
/* static */
void
nsINode::Trace(nsINode *tmp, TraceCallback cb, void *closure)
nsINode::Trace(nsINode *tmp, const TraceCallbacks& cb, void *closure)
{
nsContentUtils::TraceWrapper(tmp, cb, closure);
tmp->TraceWrapper(cb, closure);
}

View File

@ -628,6 +628,7 @@ MOCHITEST_FILES_C= \
test_bug869006.html \
test_bug868999.html \
test_bug869000.html \
test_bug869002.html \
$(NULL)
# OOP tests don't work on Windows (bug 763081) or native-fennec

View File

@ -0,0 +1,32 @@
<!DOCTYPE HTML>
<html>
<!--
https://bugzilla.mozilla.org/show_bug.cgi?id=868999
-->
<head>
<meta charset="utf-8">
<title>Test for Bug 868999</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=868999">Mozilla Bug 869002</a>
<p id="display"></p>
<div id="content" style="display: none">
</div>
<pre id="test">
<script type="application/javascript">
/** Test for Bug 868999 **/
var d = new DocumentFragment();
ok(d, "DocumentFragment has been created");
document.appendChild(d);
ok(true, "DocumentFragment has been added to the document");
</script>
</pre>
</body>
</html>

View File

@ -796,6 +796,11 @@ protected:
* Mute or unmute the audio and change the value that the |muted| map.
*/
void SetMutedInternal(uint32_t aMuted);
/**
* Update the volume of the output audio stream to match the element's
* current mMuted/mVolume state.
*/
void SetVolumeInternal();
/**
* Suspend (if aPauseForInactiveDocument) or resume element playback and

View File

@ -1509,7 +1509,7 @@ HTMLMediaElement::SetVolume(double aVolume, ErrorResult& aRv)
mVolume = aVolume;
// Here we want just to update the volume.
SetMutedInternal(mMuted);
SetVolumeInternal();
DispatchAsyncEvent(NS_LITERAL_STRING("volumechange"));
}
@ -1687,6 +1687,11 @@ void HTMLMediaElement::SetMutedInternal(uint32_t aMuted)
return;
}
SetVolumeInternal();
}
void HTMLMediaElement::SetVolumeInternal()
{
float effectiveVolume = mMuted ? 0.0f : float(mVolume);
if (mDecoder) {

View File

@ -412,7 +412,7 @@ UnlinkProtoJSObjects(nsHashKey *aKey, void *aData, void* aClosure)
struct ProtoTracer
{
TraceCallback mCallback;
const TraceCallbacks &mCallbacks;
void *mClosure;
};
@ -421,7 +421,7 @@ TraceProtos(nsHashKey *aKey, void *aData, void* aClosure)
{
ProtoTracer* closure = static_cast<ProtoTracer*>(aClosure);
nsXBLPrototypeBinding *proto = static_cast<nsXBLPrototypeBinding*>(aData);
proto->Trace(closure->mCallback, closure->mClosure);
proto->Trace(closure->mCallbacks, closure->mClosure);
return kHashEnumerateNext;
}
@ -448,7 +448,7 @@ NS_IMPL_CYCLE_COLLECTION_TRAVERSE_BEGIN(nsXBLDocumentInfo)
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_END
NS_IMPL_CYCLE_COLLECTION_TRACE_BEGIN(nsXBLDocumentInfo)
if (tmp->mBindingTable) {
ProtoTracer closure = { aCallback, aClosure };
ProtoTracer closure = { aCallbacks, aClosure };
tmp->mBindingTable->Enumerate(TraceProtos, &closure);
}
NS_IMPL_CYCLE_COLLECTION_TRACE_END
@ -463,7 +463,7 @@ static bool
UnmarkProtos(nsHashKey* aKey, void* aData, void* aClosure)
{
nsXBLPrototypeBinding* proto = static_cast<nsXBLPrototypeBinding*>(aData);
proto->Trace(UnmarkXBLJSObject, nullptr);
proto->Trace(TraceCallbackFunc(UnmarkXBLJSObject), nullptr);
return kHashEnumerateNext;
}

View File

@ -261,7 +261,7 @@ nsXBLProtoImpl::LookupMember(JSContext* aCx, nsString& aName,
}
void
nsXBLProtoImpl::Trace(TraceCallback aCallback, void *aClosure) const
nsXBLProtoImpl::Trace(const TraceCallbacks& aCallbacks, void *aClosure)
{
// If we don't have a class object then we either didn't compile members
// or we only have fields, in both cases there are no cycles through our
@ -272,7 +272,7 @@ nsXBLProtoImpl::Trace(TraceCallback aCallback, void *aClosure) const
nsXBLProtoImplMember *member;
for (member = mMembers; member; member = member->GetNext()) {
member->Trace(aCallback, aClosure);
member->Trace(aCallbacks, aClosure);
}
}

View File

@ -60,7 +60,7 @@ public:
mFields = aFieldList;
}
void Trace(TraceCallback aCallback, void *aClosure) const;
void Trace(const TraceCallbacks& aCallbacks, void *aClosure);
void UnlinkJSObjects();
nsXBLProtoImplField* FindField(const nsString& aFieldName) const;

View File

@ -79,7 +79,7 @@ public:
const nsCString& aClassStr,
JS::Handle<JSObject*> aClassObject) = 0;
virtual void Trace(TraceCallback aCallback, void *aClosure) const = 0;
virtual void Trace(const TraceCallbacks& aCallbacks, void *aClosure) = 0;
virtual nsresult Write(nsIScriptContext* aContext,
nsIObjectOutputStream* aStream)

View File

@ -225,10 +225,10 @@ nsXBLProtoImplMethod::CompileMember(nsIScriptContext* aContext, const nsCString&
}
void
nsXBLProtoImplMethod::Trace(TraceCallback aCallback, void *aClosure) const
nsXBLProtoImplMethod::Trace(const TraceCallbacks& aCallbacks, void *aClosure)
{
if (IsCompiled() && mJSMethodObject) {
aCallback(mJSMethodObject, "mJSMethodObject", aClosure);
aCallbacks.Trace(&mJSMethodObject, "mJSMethodObject", aClosure);
}
}

View File

@ -94,7 +94,7 @@ public:
const nsCString& aClassStr,
JS::Handle<JSObject*> aClassObject);
virtual void Trace(TraceCallback aCallback, void *aClosure) const;
virtual void Trace(const TraceCallbacks& aCallbacks, void *aClosure);
nsresult Read(nsIScriptContext* aContext, nsIObjectInputStream* aStream);
virtual nsresult Write(nsIScriptContext* aContext, nsIObjectOutputStream* aStream);

View File

@ -295,19 +295,19 @@ nsXBLProtoImplProperty::CompileMember(nsIScriptContext* aContext, const nsCStrin
#ifdef DEBUG
mIsCompiled = NS_SUCCEEDED(rv);
#endif
return rv;
}
void
nsXBLProtoImplProperty::Trace(TraceCallback aCallback, void *aClosure) const
nsXBLProtoImplProperty::Trace(const TraceCallbacks& aCallbacks, void *aClosure)
{
if (mJSAttributes & JSPROP_GETTER) {
aCallback(mJSGetterObject, "mJSGetterObject", aClosure);
aCallbacks.Trace(&mJSGetterObject, "mJSGetterObject", aClosure);
}
if (mJSAttributes & JSPROP_SETTER) {
aCallback(mJSSetterObject, "mJSSetterObject", aClosure);
aCallbacks.Trace(&mJSSetterObject, "mJSSetterObject", aClosure);
}
}

View File

@ -38,7 +38,7 @@ public:
const nsCString& aClassStr,
JS::Handle<JSObject*> aClassObject);
virtual void Trace(TraceCallback aCallback, void *aClosure) const;
virtual void Trace(const TraceCallbacks& aCallback, void *aClosure);
nsresult Read(nsIScriptContext* aContext,
nsIObjectInputStream* aStream,

View File

@ -271,10 +271,10 @@ nsXBLPrototypeBinding::UnlinkJSObjects()
}
void
nsXBLPrototypeBinding::Trace(TraceCallback aCallback, void *aClosure) const
nsXBLPrototypeBinding::Trace(const TraceCallbacks& aCallbacks, void *aClosure) const
{
if (mImplementation)
mImplementation->Trace(aCallback, aClosure);
mImplementation->Trace(aCallbacks, aClosure);
}
void

View File

@ -283,7 +283,7 @@ public:
void Traverse(nsCycleCollectionTraversalCallback &cb) const;
void UnlinkJSObjects();
void Trace(TraceCallback aCallback, void *aClosure) const;
void Trace(const TraceCallbacks& aCallbacks, void *aClosure) const;
// Internal member functions.
// XXXbz GetImmediateChild needs to be public to be called by SetAttrs,

View File

@ -1966,9 +1966,7 @@ NS_IMPL_CYCLE_COLLECTION_TRACE_BEGIN(nsXULPrototypeNode)
if (tmp->mType == nsXULPrototypeNode::eType_Script) {
nsXULPrototypeScript *script =
static_cast<nsXULPrototypeScript*>(tmp);
NS_IMPL_CYCLE_COLLECTION_TRACE_JS_CALLBACK(script->GetScriptObject(),
"mScriptObject")
script->Trace(aCallbacks, aClosure);
}
NS_IMPL_CYCLE_COLLECTION_TRACE_END

View File

@ -252,6 +252,13 @@ public:
}
}
void Trace(const TraceCallbacks& aCallbacks, void* aClosure)
{
if (mScriptObject) {
aCallbacks.Trace(&mScriptObject, "mScriptObject", aClosure);
}
}
nsCOMPtr<nsIURI> mSrcURI;
uint32_t mLineNo;
bool mSrcLoading;

View File

@ -1728,25 +1728,22 @@ NS_IMPL_CYCLE_COLLECTION_UNLINK_END
struct TraceData
{
TraceData(TraceCallback& aCallback, void* aClosure) :
callback(aCallback), closure(aClosure) {}
TraceCallback& callback;
const TraceCallbacks& callbacks;
void* closure;
};
static PLDHashOperator
TraceXBLHandlers(nsXBLPrototypeHandler* aKey, JSObject* aData, void* aClosure)
TraceXBLHandlers(nsXBLPrototypeHandler* aKey, JSObject*& aData, void* aClosure)
{
TraceData* data = static_cast<TraceData*>(aClosure);
data->callback(aData, "Cached XBL prototype handler", data->closure);
data->callbacks.Trace(&aData, "Cached XBL prototype handler", data->closure);
return PL_DHASH_NEXT;
}
NS_IMPL_CYCLE_COLLECTION_TRACE_BEGIN(nsGlobalWindow)
if (tmp->mCachedXBLPrototypeHandlers.IsInitialized()) {
TraceData data(aCallback, aClosure);
tmp->mCachedXBLPrototypeHandlers.EnumerateRead(TraceXBLHandlers, &data);
TraceData data = { aCallbacks, aClosure };
tmp->mCachedXBLPrototypeHandlers.Enumerate(TraceXBLHandlers, &data);
}
NS_IMPL_CYCLE_COLLECTION_TRACE_END

View File

@ -1319,7 +1319,8 @@ nsJSContext::CompileScript(const PRUnichar* aText,
NS_ENSURE_ARG_POINTER(aPrincipal);
AutoPushJSContext cx(mContext);
JSContext* cx = mContext;
JSAutoRequest ar(cx);
JS::Rooted<JSObject*> scopeObject(mContext, GetNativeGlobal());
xpc_UnmarkGrayObject(scopeObject);
@ -3581,14 +3582,10 @@ NS_IMPL_CYCLE_COLLECTION_TRAVERSE_BEGIN(nsJSArgArray)
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_END
NS_IMPL_CYCLE_COLLECTION_TRACE_BEGIN(nsJSArgArray)
JS::Value *argv = tmp->mArgv;
if (argv) {
JS::Value *end;
for (end = argv + tmp->mArgc; argv < end; ++argv) {
if (JSVAL_IS_GCTHING(*argv))
NS_IMPL_CYCLE_COLLECTION_TRACE_JS_CALLBACK(JSVAL_TO_GCTHING(*argv),
"mArgv[i]")
}
if (tmp->mArgv) {
for (uint32_t i = 0; i < tmp->mArgc; ++i) {
NS_IMPL_CYCLE_COLLECTION_TRACE_JSVAL_MEMBER_CALLBACK(mArgv[i])
}
}
NS_IMPL_CYCLE_COLLECTION_TRACE_END

View File

@ -179,6 +179,18 @@ public:
}
}
void TraceWrapper(const TraceCallbacks& aCallbacks, void* aClosure)
{
if (PreservingWrapper()) {
JSObject *wrapper = GetWrapperPreserveColor();
if (wrapper) {
uintptr_t flags = mWrapperPtrBits & kWrapperBitMask;
aCallbacks.Trace(&wrapper, "Preserved wrapper", aClosure);
mWrapperPtrBits = reinterpret_cast<uintptr_t>(wrapper) | flags;
}
}
}
private:
JSObject *GetJSObjectFromBits() const
{
@ -236,7 +248,7 @@ NS_DEFINE_STATIC_IID_ACCESSOR(nsWrapperCache, NS_WRAPPERCACHE_IID)
// Cycle collector macros for wrapper caches.
#define NS_IMPL_CYCLE_COLLECTION_TRACE_PRESERVED_WRAPPER \
nsContentUtils::TraceWrapper(tmp, aCallback, aClosure);
tmp->TraceWrapper(aCallbacks, aClosure);
#define NS_IMPL_CYCLE_COLLECTION_UNLINK_PRESERVED_WRAPPER \
nsContentUtils::ReleaseWrapper(p, tmp);

View File

@ -51,7 +51,7 @@ nsWrapperCache::IsBlackAndDoesNotNeedTracing(nsISupports* aThis)
nsXPCOMCycleCollectionParticipant* participant = nullptr;
CallQueryInterface(aThis, &participant);
bool hasGrayObjects = false;
participant->Trace(aThis, SearchGray, &hasGrayObjects);
participant->Trace(aThis, TraceCallbackFunc(SearchGray), &hasGrayObjects);
return !hasGrayObjects;
}
return false;

View File

@ -105,13 +105,20 @@ NS_IMPL_CYCLE_COLLECTING_RELEASE(NotificationPermissionRequest)
NS_IMETHODIMP
NotificationPermissionRequest::Run()
{
// File are automatically granted permission.
nsCOMPtr<nsIURI> uri;
mPrincipal->GetURI(getter_AddRefs(uri));
bool isFile;
uri->SchemeIs("file", &isFile);
if (isFile) {
if (nsContentUtils::IsSystemPrincipal(mPrincipal)) {
mPermission = NotificationPermission::Granted;
} else {
// File are automatically granted permission.
nsCOMPtr<nsIURI> uri;
mPrincipal->GetURI(getter_AddRefs(uri));
if (uri) {
bool isFile;
uri->SchemeIs("file", &isFile);
if (isFile) {
mPermission = NotificationPermission::Granted;
}
}
}
// Grant permission if pref'ed on.
@ -398,15 +405,21 @@ Notification::GetPermissionInternal(nsISupports* aGlobal, ErrorResult& aRv)
aRv.Throw(NS_ERROR_UNEXPECTED);
return NotificationPermission::Denied;
}
nsCOMPtr<nsIPrincipal> principal = sop->GetPrincipal();
// Allow files to show notifications by default.
nsCOMPtr<nsIURI> uri;
principal->GetURI(getter_AddRefs(uri));
bool isFile;
uri->SchemeIs("file", &isFile);
if (isFile) {
nsCOMPtr<nsIPrincipal> principal = sop->GetPrincipal();
if (nsContentUtils::IsSystemPrincipal(principal)) {
return NotificationPermission::Granted;
} else {
// Allow files to show notifications by default.
nsCOMPtr<nsIURI> uri;
principal->GetURI(getter_AddRefs(uri));
if (uri) {
bool isFile;
uri->SchemeIs("file", &isFile);
if (isFile) {
return NotificationPermission::Granted;
}
}
}
// We also allow notifications is they are pref'ed on.

View File

@ -10,6 +10,10 @@ relativesrcdir = @relativesrcdir@
include $(DEPTH)/config/autoconf.mk
MOCHITEST_CHROME_FILES = \
test_system_principal.xul \
$(NULL)
MOCHITEST_FILES = \
test_basic_notification.html \
test_basic_notification_click.html \

View File

@ -0,0 +1,81 @@
<?xml version="1.0"?>
<?xml-stylesheet type="text/css" href="chrome://global/skin"?>
<?xml-stylesheet type="text/css" href="chrome://mochikit/content/tests/SimpleTest/test.css"?>
<!--
https://bugzilla.mozilla.org/show_bug.cgi?id=874090
-->
<window title="Mozilla Bug 874090" onload="runTests()"
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
<script type="application/javascript" src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"/>
<script type="application/javascript" src="chrome://mochikit/content/tests/SimpleTest/EventUtils.js"/>
<!-- test results are displayed in the html:body -->
<body xmlns="http://www.w3.org/1999/xhtml">
<a href="https://bugzilla.mozilla.org/show_bug.cgi?id=874090"
target="_blank">Mozilla Bug 874090</a>
</body>
<!-- test code goes here -->
<script type="application/javascript">
<![CDATA[
/** Test for Bug 874090 **/
const MOCK_CID = Components.ID("{2a0f83c4-8818-4914-a184-f1172b4eaaa7}");
const ALERTS_SERVICE_CONTRACT_ID = "@mozilla.org/alerts-service;1";
var mockAlertsService = {
showAlertNotification: function(imageUrl, title, text, textClickable,
cookie, alertListener, name, dir, lang) {
ok(true, "System principal was granted permission and is able to call showAlertNotification.");
unregisterMock();
SimpleTest.finish();
},
QueryInterface: function(aIID) {
if (aIID.equals(Components.interfaces.nsISupports) ||
aIID.equals(Components.interfaces.nsIAlertsService)) {
return this;
}
throw Components.results.NS_ERROR_NO_INTERFACE;
},
createInstance: function(aOuter, aIID) {
if (aOuter != null) {
throw Components.results.NS_ERROR_NO_AGGREGATION;
}
return this.QueryInterface(aIID);
}
};
function registerMock() {
Components.manager.QueryInterface(Components.interfaces.nsIComponentRegistrar).
registerFactory(MOCK_CID, "alerts service", ALERTS_SERVICE_CONTRACT_ID, mockAlertsService);
}
function unregisterMock() {
Components.manager.QueryInterface(Components.interfaces.nsIComponentRegistrar).
unregisterFactory(MOCK_CID, mockAlertsService);
}
function runTests() {
registerMock();
is(Notification.permission, "granted", "System principal should be automatically granted permission.");
Notification.requestPermission(function(permission) {
is(permission, "granted", "System principal should be granted permission when calling requestPermission.");
if (permission == "granted") {
// Create a notification and make sure that it is able to call into
// the mock alert service to show the notification.
new Notification("Hello");
} else {
unregisterMock();
SimpleTest.finish();
}
});
}
SimpleTest.waitForExplicitFinish();
]]>
</script>
</window>

View File

@ -11,6 +11,7 @@
* liability, trademark and document use rules apply.
*/
[Constructor]
interface DocumentFragment : Node {
// NEW
/*

View File

@ -962,8 +962,8 @@ CompositorOGL::DrawQuad(const Rect& aRect, const Rect& aClipRect,
IntRect intClipRect;
aClipRect.ToIntRect(&intClipRect);
mGLContext->fScissor(intClipRect.x, intClipRect.y,
intClipRect.width, intClipRect.height);
mGLContext->PushScissorRect(nsIntRect(intClipRect.x, intClipRect.y,
intClipRect.width, intClipRect.height));
MaskType maskType;
EffectMask* effectMask;
@ -1198,6 +1198,7 @@ CompositorOGL::DrawQuad(const Rect& aRect, const Rect& aClipRect,
break;
}
mGLContext->PopScissorRect();
mGLContext->fActiveTexture(LOCAL_GL_TEXTURE0);
// in case rendering has used some other GL context
MakeCurrent();

View File

@ -157,6 +157,9 @@
#define NS_THEME_SCROLLBAR_THUMB_HORIZONTAL 88
#define NS_THEME_SCROLLBAR_THUMB_VERTICAL 89
// A non-disappearing scrollbar.
#define NS_THEME_SCROLLBAR_NON_DISAPPEARING 90
// A textfield or text area
#define NS_THEME_TEXTFIELD 95

View File

@ -113,6 +113,9 @@ class HandleBase {};
template <typename T>
class MutableHandleBase {};
template <typename T>
class HeapBase {};
/*
* js::NullPtr acts like a NULL pointer in contexts that require a Handle.
*
@ -131,6 +134,10 @@ struct NullPtr
static void * const constNullValue;
};
namespace gc {
struct Cell;
} /* namespace gc */
} /* namespace js */
namespace JS {
@ -162,6 +169,69 @@ struct JS_PUBLIC_API(NullPtr)
static void * const constNullValue;
};
/*
* Encapsulated pointer class for use on the heap.
*
* Implements post barriers for heap-based GC thing pointers outside the engine.
*/
template <typename T>
class Heap : public js::HeapBase<T>
{
public:
Heap() { set(js::RootMethods<T>::initial()); }
explicit Heap(T p) { set(p); }
explicit Heap(const Heap<T> &p) { set(p.ptr); }
~Heap() {
if (js::RootMethods<T>::needsPostBarrier(ptr))
relocate();
}
bool operator!=(const T &other) { return *ptr != other; }
bool operator==(const T &other) { return *ptr == other; }
operator T() const { return ptr; }
T operator->() const { return ptr; }
const T *address() const { return &ptr; }
const T &get() const { return ptr; }
T *unsafeGet() { return &ptr; }
Heap<T> &operator=(T p) {
set(p);
return *this;
}
void set(T newPtr) {
JS_ASSERT(!js::RootMethods<T>::poisoned(newPtr));
if (js::RootMethods<T>::needsPostBarrier(newPtr)) {
ptr = newPtr;
post();
} else if (js::RootMethods<T>::needsPostBarrier(ptr)) {
relocate(); /* Called before overwriting ptr. */
ptr = newPtr;
} else {
ptr = newPtr;
}
}
private:
void post() {
#ifdef JSGC_GENERATIONAL
JS_ASSERT(js::RootMethods<T>::needsPostBarrier(ptr));
js::RootMethods<T>::postBarrier(&ptr);
#endif
}
void relocate() {
#ifdef JSGC_GENERATIONAL
js::RootMethods<T>::relocate(&ptr);
#endif
}
T ptr;
};
/*
* Reference to a T that has been rooted elsewhere. This is most useful
* as a parameter type, which guarantees that the T lvalue is properly
@ -202,6 +272,10 @@ class MOZ_STACK_CLASS Handle : public js::HandleBase<T>
ptr = handle.address();
}
Handle(const Heap<T> &heapPtr) {
ptr = heapPtr.address();
}
/*
* This may be called only if the location of the T is guaranteed
* to be marked (for some reason other than being a Rooted),
@ -315,6 +389,11 @@ typedef MutableHandle<JSString*> MutableHandleString;
typedef MutableHandle<jsid> MutableHandleId;
typedef MutableHandle<Value> MutableHandleValue;
#ifdef JSGC_GENERATIONAL
JS_PUBLIC_API(void) HeapCellPostBarrier(js::gc::Cell **cellp);
JS_PUBLIC_API(void) HeapCellRelocate(js::gc::Cell **cellp);
#endif
} /* namespace JS */
namespace js {
@ -394,6 +473,15 @@ struct RootMethods<T *>
static T *initial() { return NULL; }
static ThingRootKind kind() { return RootKind<T *>::rootKind(); }
static bool poisoned(T *v) { return JS::IsPoisonedPtr(v); }
static bool needsPostBarrier(T *v) { return v; }
#ifdef JSGC_GENERATIONAL
static void postBarrier(T **vp) {
JS::HeapCellPostBarrier(reinterpret_cast<js::gc::Cell **>(vp));
}
static void relocate(T **vp) {
JS::HeapCellRelocate(reinterpret_cast<js::gc::Cell **>(vp));
}
#endif
};
} /* namespace js */
@ -790,10 +878,6 @@ inline void MaybeCheckStackRoots(JSContext *cx)
#endif
}
namespace gc {
struct Cell;
} /* namespace gc */
/* Base class for automatic read-only object rooting during compilation. */
class CompilerRootNode
{

View File

@ -1393,6 +1393,13 @@ SameType(const Value &lhs, const Value &rhs)
/************************************************************************/
#ifdef JSGC_GENERATIONAL
namespace JS {
JS_PUBLIC_API(void) HeapValuePostBarrier(Value *valuep);
JS_PUBLIC_API(void) HeapValueRelocate(Value *valuep);
}
#endif
namespace js {
template <> struct RootMethods<const JS::Value>
@ -1407,6 +1414,11 @@ template <> struct RootMethods<JS::Value>
static JS::Value initial() { return JS::UndefinedValue(); }
static ThingRootKind kind() { return THING_ROOT_VALUE; }
static bool poisoned(const JS::Value &v) { return JS::IsPoisonedValue(v); }
static bool needsPostBarrier(const JS::Value &v) { return v.isMarkable(); }
#ifdef JSGC_GENERATIONAL
static void postBarrier(JS::Value *v) { JS::HeapValuePostBarrier(v); }
static void relocate(JS::Value *v) { JS::HeapValueRelocate(v); }
#endif
};
template <class Outer> class MutableValueOperations;
@ -1483,6 +1495,19 @@ class MutableValueOperations : public ValueOperations<Outer>
void setObjectOrNull(JSObject *arg) { value()->setObjectOrNull(arg); }
};
/*
* Augment the generic Heap<T> interface when T = Value with type-querying
* and value-extracting operations.
*/
template <>
class HeapBase<JS::Value> : public ValueOperations<JS::Heap<JS::Value> >
{
friend class ValueOperations<JS::Heap<JS::Value> >;
const JS::Value * extract() const {
return static_cast<const JS::Heap<JS::Value>*>(this)->address();
}
};
/*
* Augment the generic Handle<T> interface when T = Value with type-querying
* and value-extracting operations.

View File

@ -473,6 +473,40 @@ StoreBuffer::releaseVerificationData()
edgeSet.finish();
}
JS_PUBLIC_API(void)
JS::HeapCellPostBarrier(js::gc::Cell **cellp)
{
JS_ASSERT(*cellp);
JSRuntime *runtime = (*cellp)->runtime();
runtime->gcStoreBuffer.putRelocatableCell(cellp);
}
JS_PUBLIC_API(void)
JS::HeapCellRelocate(js::gc::Cell **cellp)
{
/* Called with old contents of *pp before overwriting. */
JS_ASSERT(*cellp);
JSRuntime *runtime = (*cellp)->runtime();
runtime->gcStoreBuffer.removeRelocatableCell(cellp);
}
JS_PUBLIC_API(void)
JS::HeapValuePostBarrier(JS::Value *valuep)
{
JS_ASSERT(JSVAL_IS_TRACEABLE(*valuep));
JSRuntime *runtime = static_cast<js::gc::Cell *>(valuep->toGCThing())->runtime();
runtime->gcStoreBuffer.putRelocatableValue(valuep);
}
JS_PUBLIC_API(void)
JS::HeapValueRelocate(JS::Value *valuep)
{
/* Called with old contents of *valuep before overwriting. */
JS_ASSERT(JSVAL_IS_TRACEABLE(*valuep));
JSRuntime *runtime = static_cast<js::gc::Cell *>(valuep->toGCThing())->runtime();
runtime->gcStoreBuffer.removeRelocatableValue(valuep);
}
template class StoreBuffer::MonoTypeBuffer<StoreBuffer::ValueEdge>;
template class StoreBuffer::MonoTypeBuffer<StoreBuffer::CellPtrEdge>;
template class StoreBuffer::MonoTypeBuffer<StoreBuffer::SlotEdge>;

View File

@ -2521,6 +2521,36 @@ JS_CallGenericTracer(JSTracer *trc, void *gcthingArg, const char *name)
JS_ASSERT(gcthing == gcthingArg);
}
JS_PUBLIC_API(void)
JS_CallHeapValueTracer(JSTracer *trc, JS::Heap<JS::Value> *valuep, const char *name)
{
MarkValueUnbarriered(trc, valuep->unsafeGet(), name);
}
JS_PUBLIC_API(void)
JS_CallHeapIdTracer(JSTracer *trc, JS::Heap<jsid> *idp, const char *name)
{
MarkIdUnbarriered(trc, idp->unsafeGet(), name);
}
JS_PUBLIC_API(void)
JS_CallHeapObjectTracer(JSTracer *trc, JS::Heap<JSObject *> *objp, const char *name)
{
MarkObjectUnbarriered(trc, objp->unsafeGet(), name);
}
JS_PUBLIC_API(void)
JS_CallHeapStringTracer(JSTracer *trc, JS::Heap<JSString *> *strp, const char *name)
{
MarkStringUnbarriered(trc, strp->unsafeGet(), name);
}
JS_PUBLIC_API(void)
JS_CallHeapScriptTracer(JSTracer *trc, JS::Heap<JSScript *> *scriptp, const char *name)
{
MarkScriptUnbarriered(trc, scriptp->unsafeGet(), name);
}
JS_PUBLIC_API(void)
JS_TracerInit(JSTracer *trc, JSRuntime *rt, JSTraceCallback callback)
{

View File

@ -1796,6 +1796,11 @@ template <> struct RootMethods<jsid>
static jsid initial() { return JSID_VOID; }
static ThingRootKind kind() { return THING_ROOT_ID; }
static bool poisoned(jsid id) { return JS::IsPoisonedId(id); }
static bool needsPostBarrier(jsid id) { return false; }
#ifdef JSGC_GENERATIONAL
static void postBarrier(jsid *idp) {}
static void relocate(jsid *idp) {}
#endif
};
} /* namespace js */
@ -2530,6 +2535,21 @@ JS_CallStringTracer(JSTracer *trc, JSString **strp, const char *name);
extern JS_PUBLIC_API(void)
JS_CallScriptTracer(JSTracer *trc, JSScript **scriptp, const char *name);
extern JS_PUBLIC_API(void)
JS_CallHeapValueTracer(JSTracer *trc, JS::Heap<JS::Value> *valuep, const char *name);
extern JS_PUBLIC_API(void)
JS_CallHeapIdTracer(JSTracer *trc, JS::Heap<jsid> *idp, const char *name);
extern JS_PUBLIC_API(void)
JS_CallHeapObjectTracer(JSTracer *trc, JS::Heap<JSObject *> *objp, const char *name);
extern JS_PUBLIC_API(void)
JS_CallHeapStringTracer(JSTracer *trc, JS::Heap<JSString *> *strp, const char *name);
extern JS_PUBLIC_API(void)
JS_CallHeapScriptTracer(JSTracer *trc, JS::Heap<JSScript *> *scriptp, const char *name);
extern JS_PUBLIC_API(void)
JS_CallGenericTracer(JSTracer *trc, void *gcthing, const char *name);

View File

@ -934,7 +934,7 @@ JS::IncrementalReferenceBarrier(void *ptr, JSGCTraceKind kind)
JS_FRIEND_API(void)
JS::IncrementalValueBarrier(const Value &v)
{
HeapValue::writeBarrierPre(v);
js::HeapValue::writeBarrierPre(v);
}
JS_FRIEND_API(void)

View File

@ -345,7 +345,7 @@ XPCJSRuntime::AssertNoObjectsToTrace(void* aPossibleJSHolder)
{
nsScriptObjectTracer* tracer = mJSHolders.Get(aPossibleJSHolder);
if (tracer && tracer->Trace) {
tracer->Trace(aPossibleJSHolder, AssertNoGcThing, nullptr);
tracer->Trace(aPossibleJSHolder, TraceCallbackFunc(AssertNoGcThing), nullptr);
}
}
#endif
@ -411,16 +411,29 @@ void XPCJSRuntime::TraceGrayJS(JSTracer* trc, void* data)
self->TraceXPConnectRoots(trc);
}
static void
TraceJSObject(void *aScriptThing, const char *name, void *aClosure)
struct JsGcTracer : public TraceCallbacks
{
JS_CallGenericTracer(static_cast<JSTracer*>(aClosure), aScriptThing, name);
}
virtual void Trace(JS::Value *p, const char *name, void *closure) const MOZ_OVERRIDE {
JS_CallValueTracer(static_cast<JSTracer*>(closure), p, name);
}
virtual void Trace(jsid *p, const char *name, void *closure) const MOZ_OVERRIDE {
JS_CallIdTracer(static_cast<JSTracer*>(closure), p, name);
}
virtual void Trace(JSObject **p, const char *name, void *closure) const MOZ_OVERRIDE {
JS_CallObjectTracer(static_cast<JSTracer*>(closure), p, name);
}
virtual void Trace(JSString **p, const char *name, void *closure) const MOZ_OVERRIDE {
JS_CallStringTracer(static_cast<JSTracer*>(closure), p, name);
}
virtual void Trace(JSScript **p, const char *name, void *closure) const MOZ_OVERRIDE {
JS_CallScriptTracer(static_cast<JSTracer*>(closure), p, name);
}
};
static PLDHashOperator
TraceJSHolder(void *holder, nsScriptObjectTracer *&tracer, void *arg)
{
tracer->Trace(holder, TraceJSObject, arg);
tracer->Trace(holder, JsGcTracer(), arg);
return PL_DHASH_NEXT;
}
@ -474,8 +487,7 @@ NoteJSHolder(void *holder, nsScriptObjectTracer *&tracer, void *arg)
Closure *closure = static_cast<Closure*>(arg);
closure->cycleCollectionEnabled = false;
tracer->Trace(holder, CheckParticipatesInCycleCollection,
closure);
tracer->Trace(holder, TraceCallbackFunc(CheckParticipatesInCycleCollection), closure);
if (closure->cycleCollectionEnabled)
closure->cb->NoteNativeRoot(holder, tracer);

View File

@ -56,6 +56,7 @@
#include "mozilla/Likely.h"
#include <algorithm>
#include "nsTextNode.h"
#include "mozilla/LookAndFeel.h"
using namespace mozilla;
@ -738,8 +739,8 @@ nsComboboxControlFrame::GetIntrinsicWidth(nsRenderingContext* aRenderingContext,
if (mListControlFrame) {
nsIScrollableFrame* scrollable = do_QueryFrame(mListControlFrame);
NS_ASSERTION(scrollable, "List must be a scrollable frame");
scrollbarWidth =
scrollable->GetDesiredScrollbarSizes(presContext, aRenderingContext).LeftRight();
scrollbarWidth = scrollable->GetNondisappearingScrollbarWidth(
presContext, aRenderingContext);
}
nscoord displayWidth = 0;
@ -751,11 +752,19 @@ nsComboboxControlFrame::GetIntrinsicWidth(nsRenderingContext* aRenderingContext,
if (mDropdownFrame) {
nscoord dropdownContentWidth;
bool isUsingOverlayScrollbars =
LookAndFeel::GetInt(LookAndFeel::eIntID_UseOverlayScrollbars) != 0;
if (aType == nsLayoutUtils::MIN_WIDTH) {
dropdownContentWidth = mDropdownFrame->GetMinWidth(aRenderingContext);
if (isUsingOverlayScrollbars) {
dropdownContentWidth += scrollbarWidth;
}
} else {
NS_ASSERTION(aType == nsLayoutUtils::PREF_WIDTH, "Unexpected type");
dropdownContentWidth = mDropdownFrame->GetPrefWidth(aRenderingContext);
if (isUsingOverlayScrollbars) {
dropdownContentWidth += scrollbarWidth;
}
}
dropdownContentWidth = NSCoordSaturatingSubtract(dropdownContentWidth,
scrollbarWidth,
@ -850,9 +859,8 @@ nsComboboxControlFrame::Reflow(nsPresContext* aPresContext,
else {
nsIScrollableFrame* scrollable = do_QueryFrame(mListControlFrame);
NS_ASSERTION(scrollable, "List must be a scrollable frame");
buttonWidth =
scrollable->GetDesiredScrollbarSizes(PresContext(),
aReflowState.rendContext).LeftRight();
buttonWidth = scrollable->GetNondisappearingScrollbarWidth(
PresContext(), aReflowState.rendContext);
if (buttonWidth > aReflowState.ComputedWidth()) {
buttonWidth = 0;
}

View File

@ -43,6 +43,7 @@ MOCHITEST_FILES = test_bug231389.html \
test_bug644542.html \
test_bug672810.html \
test_bug704049.html \
test_bug869314.html \
test_listcontrol_search.html \
$(NULL)

View File

@ -0,0 +1,54 @@
<!DOCTYPE HTML>
<html>
<!--
https://bugzilla.mozilla.org/show_bug.cgi?id=869314
-->
<head>
<meta charset="utf-8">
<title>Test for Bug 869314</title>
<script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
<style type="text/css">
.selectbox {
background-color: #00FF00;
}
</style>
</head>
<body>
<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=869314">Mozilla Bug 869314</a>
<p id="display"></p>
<div id="content">
<select id="selectbox1" name="non-native selectbox" class="selectbox">
<option value="item">test item</option>
</select>
<select id="selectbox2" name="native selectbox">
<option value="item">test item</option>
</select>
<script type="application/javascript">
var Cc = SpecialPowers.Cc;
var Ci = SpecialPowers.Ci;
var sysInfo = Cc["@mozilla.org/system-info;1"].getService(Ci.nsIPropertyBag2);
var osName = sysInfo.getProperty("name");
if (osName == "Darwin") { // Mac OS X.
// This test is for Mac only. See bug for more info.
ok(document.getElementById("selectbox1").clientWidth >
document.getElementById("selectbox2").clientWidth,
"Non-native styled combobox does not have enough space for a " +
"dropmarker!");
} else {
// We need to call at least one test function to make the test harness
// happy.
ok(true, "Test wasn't ignored but should have been.");
}
</script>
</div>
<pre id="test">
</pre>
</body>
</html>

View File

@ -932,6 +932,40 @@ nsGfxScrollFrameInner::GetDesiredScrollbarSizes(nsBoxLayoutState* aState)
return result;
}
nscoord
nsGfxScrollFrameInner::GetNondisappearingScrollbarWidth(nsBoxLayoutState* aState)
{
NS_ASSERTION(aState && aState->GetRenderingContext(),
"Must have rendering context in layout state for size "
"computations");
if (LookAndFeel::GetInt(LookAndFeel::eIntID_UseOverlayScrollbars) != 0) {
// We're using overlay scrollbars, so we need to get the width that
// non-disappearing scrollbars would have.
nsITheme* theme = aState->PresContext()->GetTheme();
if (theme &&
theme->ThemeSupportsWidget(aState->PresContext(),
mVScrollbarBox,
NS_THEME_SCROLLBAR_NON_DISAPPEARING)) {
nsIntSize size;
nsRenderingContext* rendContext = aState->GetRenderingContext();
if (rendContext) {
bool canOverride = true;
theme->GetMinimumWidgetSize(rendContext,
mVScrollbarBox,
NS_THEME_SCROLLBAR_NON_DISAPPEARING,
&size,
&canOverride);
if (size.width) {
return aState->PresContext()->DevPixelsToAppUnits(size.width);
}
}
}
}
return GetDesiredScrollbarSizes(aState).LeftRight();
}
nsresult
nsXULScrollFrame::CreateAnonymousContent(nsTArray<ContentInfo>& aElements)
{

View File

@ -235,6 +235,7 @@ public:
}
nsMargin GetActualScrollbarSizes() const;
nsMargin GetDesiredScrollbarSizes(nsBoxLayoutState* aState);
nscoord GetNondisappearingScrollbarWidth(nsBoxLayoutState* aState);
bool IsLTR() const;
bool IsScrollbarOnRight() const;
bool IsScrollingActive() const { return mScrollingActive || ShouldBuildLayer(); }
@ -486,6 +487,11 @@ public:
nsBoxLayoutState bls(aPresContext, aRC, 0);
return GetDesiredScrollbarSizes(&bls);
}
virtual nscoord GetNondisappearingScrollbarWidth(nsPresContext* aPresContext,
nsRenderingContext* aRC) MOZ_OVERRIDE {
nsBoxLayoutState bls(aPresContext, aRC, 0);
return mInner.GetNondisappearingScrollbarWidth(&bls);
}
virtual nsRect GetScrollPortRect() const MOZ_OVERRIDE {
return mInner.GetScrollPortRect();
}
@ -744,6 +750,11 @@ public:
nsBoxLayoutState bls(aPresContext, aRC, 0);
return GetDesiredScrollbarSizes(&bls);
}
virtual nscoord GetNondisappearingScrollbarWidth(nsPresContext* aPresContext,
nsRenderingContext* aRC) MOZ_OVERRIDE {
nsBoxLayoutState bls(aPresContext, aRC, 0);
return mInner.GetNondisappearingScrollbarWidth(&bls);
}
virtual nsRect GetScrollPortRect() const MOZ_OVERRIDE {
return mInner.GetScrollPortRect();
}

View File

@ -81,7 +81,11 @@ public:
*/
virtual nsMargin GetDesiredScrollbarSizes(nsPresContext* aPresContext,
nsRenderingContext* aRC) = 0;
/**
* Return the width for non-disappearing scrollbars.
*/
virtual nscoord GetNondisappearingScrollbarWidth(nsPresContext* aPresContext,
nsRenderingContext* aRC) = 0;
/**
* Get the area of the scrollport relative to the origin of this frame's
* border-box.

View File

@ -1164,7 +1164,7 @@ NS_IMPL_CYCLE_COLLECTION_TRACE_BEGIN(DOMCSSStyleRule)
// Trace the wrapper for our declaration. This just expands out
// NS_IMPL_CYCLE_COLLECTION_TRACE_PRESERVED_WRAPPER which we can't use
// directly because the wrapper is on the declaration, not on us.
nsContentUtils::TraceWrapper(tmp->DOMDeclaration(), aCallback, aClosure);
tmp->DOMDeclaration()->TraceWrapper(aCallbacks, aClosure);
NS_IMPL_CYCLE_COLLECTION_TRACE_END
NS_IMPL_CYCLE_COLLECTION_UNLINK_BEGIN(DOMCSSStyleRule)

View File

@ -1766,7 +1766,7 @@ NS_IMPL_CYCLE_COLLECTION_TRACE_BEGIN(nsCSSFontFaceRule)
// Trace the wrapper for our declaration. This just expands out
// NS_IMPL_CYCLE_COLLECTION_TRACE_PRESERVED_WRAPPER which we can't use
// directly because the wrapper is on the declaration, not on us.
nsContentUtils::TraceWrapper(&tmp->mDecl, aCallback, aClosure);
tmp->mDecl.TraceWrapper(aCallbacks, aClosure);
NS_IMPL_CYCLE_COLLECTION_TRACE_END
NS_IMPL_CYCLE_COLLECTION_UNLINK_BEGIN(nsCSSFontFaceRule)

View File

@ -440,6 +440,7 @@ nsStyleContext::CalcStyleDifference(nsStyleContext* aOther,
// by font-size changing, so we don't need to worry about them like
// we worry about 'inherit' values.)
bool compare = mRuleNode != aOther->mRuleNode;
DebugOnly<int> styleStructCount = 0;
#define DO_STRUCT_DIFFERENCE(struct_) \
PR_BEGIN_MACRO \
@ -458,6 +459,7 @@ nsStyleContext::CalcStyleDifference(nsStyleContext* aOther,
NS_UpdateHint(hint, this##struct_->CalcDifference(*other##struct_)); \
} \
} \
styleStructCount++; \
PR_END_MACRO
// In general, we want to examine structs starting with those that can
@ -491,6 +493,9 @@ nsStyleContext::CalcStyleDifference(nsStyleContext* aOther,
#undef DO_STRUCT_DIFFERENCE
MOZ_ASSERT(styleStructCount == nsStyleStructID_Length,
"missing a call to DO_STRUCT_DIFFERENCE");
// Note that we do not check whether this->RelevantLinkVisited() !=
// aOther->RelevantLinkVisited(); we don't need to since
// nsCSSFrameConstructor::DoContentStateChanged always adds

View File

@ -82,44 +82,6 @@ nsSVGGradientFrame::AttributeChanged(int32_t aNameSpaceID,
//----------------------------------------------------------------------
uint32_t
nsSVGGradientFrame::GetStopCount()
{
return GetStopFrame(-1, nullptr);
}
void
nsSVGGradientFrame::GetStopInformation(int32_t aIndex,
float *aOffset,
nscolor *aStopColor,
float *aStopOpacity)
{
*aOffset = 0.0f;
*aStopColor = NS_RGBA(0, 0, 0, 0);
*aStopOpacity = 1.0f;
nsIFrame *stopFrame = nullptr;
GetStopFrame(aIndex, &stopFrame);
nsIContent* stopContent = stopFrame->GetContent();
if (stopContent) {
MOZ_ASSERT(stopContent->IsSVG(nsGkAtoms::stop));
SVGStopElement* stopElement = nullptr;
stopElement = static_cast<SVGStopElement*>(stopContent);
nsCOMPtr<nsIDOMSVGAnimatedNumber> aNum = stopElement->Offset();
aNum->GetAnimVal(aOffset);
if (*aOffset < 0.0f)
*aOffset = 0.0f;
else if (*aOffset > 1.0f)
*aOffset = 1.0f;
}
*aStopColor = stopFrame->StyleSVGReset()->mStopColor;
*aStopOpacity = stopFrame->StyleSVGReset()->mStopOpacity;
}
uint16_t
nsSVGGradientFrame::GetEnumValue(uint32_t aIndex, nsIContent *aDefault)
{
@ -174,18 +136,9 @@ nsSVGGradientFrame::GetGradientTransform(nsIFrame *aSource,
gfxMatrix bboxMatrix;
uint16_t gradientUnits = GetGradientUnits();
if (gradientUnits == SVG_UNIT_TYPE_USERSPACEONUSE) {
// If this gradient is applied to text, our caller
// will be the glyph, which is not a container, so we
// need to get the parent
if (aSource->GetContent()->IsNodeOfType(nsINode::eTEXT))
mSource = aSource->GetParent();
else
mSource = aSource;
} else {
NS_ASSERTION(
gradientUnits == SVG_UNIT_TYPE_OBJECTBOUNDINGBOX,
"Unknown gradientUnits type");
if (gradientUnits != SVG_UNIT_TYPE_USERSPACEONUSE) {
NS_ASSERTION(gradientUnits == SVG_UNIT_TYPE_OBJECTBOUNDINGBOX,
"Unknown gradientUnits type");
// objectBoundingBox is the default anyway
gfxRect bbox =
@ -235,6 +188,23 @@ nsSVGGradientFrame::GetRadialGradientWithLength(uint32_t aIndex,
//----------------------------------------------------------------------
// nsSVGPaintServerFrame methods:
//helper
static void GetStopInformation(nsIFrame* aStopFrame,
float *aOffset,
nscolor *aStopColor,
float *aStopOpacity)
{
nsIContent* stopContent = aStopFrame->GetContent();
MOZ_ASSERT(stopContent && stopContent->IsSVG(nsGkAtoms::stop));
static_cast<SVGStopElement*>(stopContent)->
GetAnimatedNumberValues(aOffset, nullptr);
*aOffset = mozilla::clamped(*aOffset, 0.0f, 1.0f);
*aStopColor = aStopFrame->StyleSVGReset()->mStopColor;
*aStopOpacity = aStopFrame->StyleSVGReset()->mStopOpacity;
}
already_AddRefed<gfxPattern>
nsSVGGradientFrame::GetPaintServerPattern(nsIFrame *aSource,
const gfxMatrix& aContextMatrix,
@ -242,13 +212,21 @@ nsSVGGradientFrame::GetPaintServerPattern(nsIFrame *aSource,
float aGraphicOpacity,
const gfxRect *aOverrideBounds)
{
// Get the transform list (if there is one)
gfxMatrix patternMatrix = GetGradientTransform(aSource, aOverrideBounds);
uint16_t gradientUnits = GetGradientUnits();
MOZ_ASSERT(gradientUnits == SVG_UNIT_TYPE_OBJECTBOUNDINGBOX ||
gradientUnits == SVG_UNIT_TYPE_USERSPACEONUSE);
if (gradientUnits == SVG_UNIT_TYPE_USERSPACEONUSE) {
// Set mSource for this consumer.
// If this gradient is applied to text, our caller will be the glyph, which
// is not an element, so we need to get the parent
mSource = aSource->GetContent()->IsNodeOfType(nsINode::eTEXT) ?
aSource->GetParent() : aSource;
}
if (patternMatrix.IsSingular())
return nullptr;
nsAutoTArray<nsIFrame*,8> stopFrames;
GetStopFrames(&stopFrames);
uint32_t nStops = GetStopCount();
uint32_t nStops = stopFrames.Length();
// SVG specification says that no stops should be treated like
// the corresponding fill or stroke had "none" specified.
@ -256,13 +234,13 @@ nsSVGGradientFrame::GetPaintServerPattern(nsIFrame *aSource,
nsRefPtr<gfxPattern> pattern = new gfxPattern(gfxRGBA(0, 0, 0, 0));
return pattern.forget();
}
// If the gradient is a single colour,
// use the last gradient stop colour as the colour.
if (IsSingleColour(nStops)) {
float offset, stopOpacity;
nscolor stopColor;
GetStopInformation(nStops - 1, &offset, &stopColor, &stopOpacity);
if (nStops == 1 || GradientVectorLengthIsZero()) {
// The gradient paints a single colour, using the stop-color of the last
// gradient step if there are more than one.
float stopOpacity = stopFrames[nStops-1]->StyleSVGReset()->mStopOpacity;
nscolor stopColor = stopFrames[nStops-1]->StyleSVGReset()->mStopColor;
nsRefPtr<gfxPattern> pattern = new gfxPattern(
gfxRGBA(NS_GET_R(stopColor)/255.0,
NS_GET_G(stopColor)/255.0,
@ -272,6 +250,15 @@ nsSVGGradientFrame::GetPaintServerPattern(nsIFrame *aSource,
return pattern.forget();
}
// Get the transform list (if there is one). We do this after the returns
// above since this call can be expensive when "gradientUnits" is set to
// "objectBoundingBox" (since that requiring a GetBBox() call).
gfxMatrix patternMatrix = GetGradientTransform(aSource, aOverrideBounds);
if (patternMatrix.IsSingular()) {
return nullptr;
}
// revert the vector effect transform so that the gradient appears unchanged
if (aFillOrStroke == &nsStyleSVG::mStroke) {
patternMatrix.Multiply(nsSVGUtils::GetStrokeTransform(aSource).Invert());
@ -300,7 +287,7 @@ nsSVGGradientFrame::GetPaintServerPattern(nsIFrame *aSource,
float offset, stopOpacity;
nscolor stopColor;
GetStopInformation(i, &offset, &stopColor, &stopOpacity);
GetStopInformation(stopFrames[i], &offset, &stopColor, &stopOpacity);
if (offset < lastOffset)
offset = lastOffset;
@ -379,33 +366,29 @@ nsSVGGradientFrame::GetReferencedGradientIfNotInUse()
return referenced;
}
int32_t
nsSVGGradientFrame::GetStopFrame(int32_t aIndex, nsIFrame * *aStopFrame)
void
nsSVGGradientFrame::GetStopFrames(nsTArray<nsIFrame*>* aStopFrames)
{
int32_t stopCount = 0;
nsIFrame *stopFrame = nullptr;
for (stopFrame = mFrames.FirstChild(); stopFrame;
stopFrame = stopFrame->GetNextSibling()) {
if (stopFrame->GetType() == nsGkAtoms::svgStopFrame) {
// Is this the one we're looking for?
if (stopCount++ == aIndex)
break; // Yes, break out of the loop
aStopFrames->AppendElement(stopFrame);
}
}
if (stopCount > 0) {
if (aStopFrame)
*aStopFrame = stopFrame;
return stopCount;
if (aStopFrames->Length() > 0) {
return;
}
// Our gradient element doesn't have stops - try to "inherit" them
AutoGradientReferencer gradientRef(this);
nsSVGGradientFrame* next = GetReferencedGradientIfNotInUse();
if (!next)
return 0;
if (!next) {
return;
}
return next->GetStopFrame(aIndex, aStopFrame);
return next->GetStopFrames(aStopFrames);
}
// -------------------------------------------------------------------------
@ -495,15 +478,12 @@ nsSVGLinearGradientFrame::GetLinearGradientWithLength(uint32_t aIndex,
}
bool
nsSVGLinearGradientFrame::IsSingleColour(uint32_t nStops)
nsSVGLinearGradientFrame::GradientVectorLengthIsZero()
{
NS_ABORT_IF_FALSE(nStops == GetStopCount(), "Unexpected number of stops");
return nStops == 1 ||
(GetLengthValue(dom::SVGLinearGradientElement::ATTR_X1) ==
GetLengthValue(dom::SVGLinearGradientElement::ATTR_X2) &&
GetLengthValue(dom::SVGLinearGradientElement::ATTR_Y1) ==
GetLengthValue(dom::SVGLinearGradientElement::ATTR_Y2));
return GetLengthValue(dom::SVGLinearGradientElement::ATTR_X1) ==
GetLengthValue(dom::SVGLinearGradientElement::ATTR_X2) &&
GetLengthValue(dom::SVGLinearGradientElement::ATTR_Y1) ==
GetLengthValue(dom::SVGLinearGradientElement::ATTR_Y2);
}
already_AddRefed<gfxPattern>
@ -625,12 +605,9 @@ nsSVGRadialGradientFrame::GetRadialGradientWithLength(uint32_t aIndex,
}
bool
nsSVGRadialGradientFrame::IsSingleColour(uint32_t nStops)
nsSVGRadialGradientFrame::GradientVectorLengthIsZero()
{
NS_ABORT_IF_FALSE(nStops == GetStopCount(), "Unexpected number of stops");
return nStops == 1 ||
GetLengthValue(dom::SVGRadialGradientElement::ATTR_R) == 0;
return GetLengthValue(dom::SVGRadialGradientElement::ATTR_R) == 0;
}
already_AddRefed<gfxPattern>

View File

@ -72,10 +72,7 @@ private:
nsSVGGradientFrame* GetReferencedGradient();
// Optionally get a stop frame (returns stop index/count)
int32_t GetStopFrame(int32_t aIndex, nsIFrame * *aStopFrame);
void GetStopInformation(int32_t aIndex,
float *aOffset, nscolor *aColor, float *aStopOpacity);
void GetStopFrames(nsTArray<nsIFrame*>* aStopFrames);
const mozilla::nsSVGAnimatedTransformList* GetGradientTransformList(
nsIContent* aDefault);
@ -84,8 +81,7 @@ private:
const gfxRect *aOverrideBounds);
protected:
uint32_t GetStopCount();
virtual bool IsSingleColour(uint32_t nStops) = 0;
virtual bool GradientVectorLengthIsZero() = 0;
virtual already_AddRefed<gfxPattern> CreateGradient() = 0;
// Internal methods for handling referenced gradients
@ -163,7 +159,7 @@ protected:
float GetLengthValue(uint32_t aIndex);
virtual mozilla::dom::SVGLinearGradientElement* GetLinearGradientWithLength(
uint32_t aIndex, mozilla::dom::SVGLinearGradientElement* aDefault);
virtual bool IsSingleColour(uint32_t nStops);
virtual bool GradientVectorLengthIsZero();
virtual already_AddRefed<gfxPattern> CreateGradient();
};
@ -211,7 +207,7 @@ protected:
mozilla::dom::SVGRadialGradientElement& aElement);
virtual mozilla::dom::SVGRadialGradientElement* GetRadialGradientWithLength(
uint32_t aIndex, mozilla::dom::SVGRadialGradientElement* aDefault);
virtual bool IsSingleColour(uint32_t nStops);
virtual bool GradientVectorLengthIsZero();
virtual already_AddRefed<gfxPattern> CreateGradient();
};

View File

@ -40,7 +40,7 @@ public final class GeckoJarReader {
try {
// Load the initial jar file as a zip
zip = getZipFile(jarUrls.pop());
inputStream = getStream(zip, jarUrls);
inputStream = getStream(zip, jarUrls, url);
if (inputStream != null) {
bitmap = new BitmapDrawable(resources, inputStream);
}
@ -70,7 +70,7 @@ public final class GeckoJarReader {
String text = null;
try {
zip = getZipFile(jarUrls.pop());
InputStream input = getStream(zip, jarUrls);
InputStream input = getStream(zip, jarUrls, url);
if (input != null) {
reader = new BufferedReader(new InputStreamReader(input));
text = reader.readLine();
@ -98,7 +98,7 @@ public final class GeckoJarReader {
return new NativeZip(fileUrl.getPath());
}
private static InputStream getStream(NativeZip zip, Stack<String> jarUrls) {
private static InputStream getStream(NativeZip zip, Stack<String> jarUrls, String origUrl) {
InputStream inputStream = null;
// loop through children jar files until we reach the innermost one
@ -107,7 +107,13 @@ public final class GeckoJarReader {
if (inputStream != null) {
// intermediate NativeZips and InputStreams will be garbage collected.
zip = new NativeZip(inputStream);
try {
zip = new NativeZip(inputStream);
} catch (IllegalArgumentException e) {
String description = "!!! BUG 849589 !!! origUrl=" + origUrl;
Log.e(LOGTAG, description, e);
throw new IllegalArgumentException(description);
}
}
inputStream = zip.getInputStream(fileName);

View File

@ -2846,7 +2846,11 @@ nsNativeThemeCocoa::GetMinimumWidgetSize(nsRenderingContext* aContext,
aResult->SizeTo(16, 16);
break;
}
// Intentional fallthrough to next case.
}
case NS_THEME_SCROLLBAR_NON_DISAPPEARING:
{
// yeah, i know i'm cheating a little here, but i figure that it
// really doesn't matter if the scrollbar is vertical or horizontal
// and the width metric is a really good metric for every piece
@ -3056,6 +3060,7 @@ nsNativeThemeCocoa::ThemeSupportsWidget(nsPresContext* aPresContext, nsIFrame* a
case NS_THEME_SCROLLBAR_THUMB_VERTICAL:
case NS_THEME_SCROLLBAR_TRACK_VERTICAL:
case NS_THEME_SCROLLBAR_TRACK_HORIZONTAL:
case NS_THEME_SCROLLBAR_NON_DISAPPEARING:
case NS_THEME_DROPDOWN:
case NS_THEME_DROPDOWN_BUTTON:

View File

@ -5,6 +5,7 @@
#include "nsCycleCollectionParticipant.h"
#include "nsCOMPtr.h"
#include "jsapi.h"
#ifdef MOZILLA_INTERNAL_API
#include "nsString.h"
@ -41,7 +42,7 @@ nsXPCOMCycleCollectionParticipant::UnrootImpl(void *p)
// We define a default trace function because some participants don't need
// to trace anything, so it is okay for them not to define one.
NS_IMETHODIMP_(void)
nsXPCOMCycleCollectionParticipant::TraceImpl(void *p, TraceCallback cb,
nsXPCOMCycleCollectionParticipant::TraceImpl(void *p, const TraceCallbacks &cb,
void *closure)
{
}
@ -66,3 +67,36 @@ CycleCollectionNoteEdgeNameImpl(nsCycleCollectionTraversalCallback& aCallback,
}
aCallback.NoteNextEdgeName(arrayEdgeName.get());
}
void
TraceCallbackFunc::Trace(JS::Value* p, const char* name, void* closure) const
{
mCallback(JSVAL_TO_TRACEABLE(*p), name, closure);
}
void
TraceCallbackFunc::Trace(jsid* p, const char* name, void* closure) const
{
void *thing = JSID_TO_GCTHING(*p);
if (thing) {
mCallback(thing, name, closure);
}
}
void
TraceCallbackFunc::Trace(JSObject** p, const char* name, void* closure) const
{
mCallback(*p, name, closure);
}
void
TraceCallbackFunc::Trace(JSString** p, const char* name, void* closure) const
{
mCallback(*p, name, closure);
}
void
TraceCallbackFunc::Trace(JSScript** p, const char* name, void* closure) const
{
mCallback(*p, name, closure);
}

View File

@ -7,6 +7,7 @@
#define nsCycleCollectionParticipant_h__
#include "nsCycleCollectionNoteChild.h"
#include "jspubtd.h"
#define NS_CYCLECOLLECTIONPARTICIPANT_IID \
{ \
@ -40,7 +41,7 @@ public:
NS_DECLARE_STATIC_IID_ACCESSOR(NS_CYCLECOLLECTIONISUPPORTS_IID)
};
NS_DEFINE_STATIC_IID_ACCESSOR(nsCycleCollectionISupports,
NS_DEFINE_STATIC_IID_ACCESSOR(nsCycleCollectionISupports,
NS_CYCLECOLLECTIONISUPPORTS_IID)
/**
@ -50,8 +51,43 @@ class nsCycleCollectionParticipant;
class nsScriptObjectTracer;
class nsXPCOMCycleCollectionParticipant;
typedef void
(* TraceCallback)(void *p, const char* name, void *closure);
/*
* A struct defining pure virtual methods which are called when tracing cycle
* collection paticipants. The appropriate method is called depending on the
* type of JS GC thing.
*/
struct TraceCallbacks
{
virtual void Trace(JS::Value* p, const char* name, void* closure) const = 0;
virtual void Trace(jsid* p, const char* name, void* closure) const = 0;
virtual void Trace(JSObject** p, const char* name, void* closure) const = 0;
virtual void Trace(JSString** p, const char* name, void* closure) const = 0;
virtual void Trace(JSScript** p, const char* name, void* closure) const = 0;
void Trace(JSFlatString** p, const char* name, void* closure) const {
Trace(reinterpret_cast<JSString**>(p), name, closure);
}
};
/*
* An implementation of TraceCallbacks that calls a single function for all JS
* GC thing types encountered.
*/
struct TraceCallbackFunc : public TraceCallbacks
{
typedef void (* Func)(void* p, const char* name, void* closure);
explicit TraceCallbackFunc(Func cb) : mCallback(cb) {}
virtual void Trace(JS::Value* p, const char* name, void* closure) const MOZ_OVERRIDE;
virtual void Trace(jsid* p, const char* name, void* closure) const MOZ_OVERRIDE;
virtual void Trace(JSObject** p, const char* name, void* closure) const MOZ_OVERRIDE;
virtual void Trace(JSString** p, const char* name, void* closure) const MOZ_OVERRIDE;
virtual void Trace(JSScript** p, const char* name, void* closure) const MOZ_OVERRIDE;
private:
Func mCallback;
};
/**
* VTables
@ -100,7 +136,7 @@ typedef nsCycleCollectionParticipantVTableCommon<nsCycleCollectionParticipant>
/* Additional functions for nsScriptObjectTracer */
struct nsScriptObjectTracerVTable
{
void (NS_STDCALL *Trace)(void *p, TraceCallback cb, void *closure);
void (NS_STDCALL *Trace)(void *p, const TraceCallbacks &cb, void *closure);
};
/**
@ -226,7 +262,7 @@ public:
}
};
NS_DEFINE_STATIC_IID_ACCESSOR(nsCycleCollectionParticipant,
NS_DEFINE_STATIC_IID_ACCESSOR(nsCycleCollectionParticipant,
NS_CYCLECOLLECTIONPARTICIPANT_IID)
class nsScriptObjectTracer
@ -243,7 +279,7 @@ public:
static NS_METHOD RootImpl(void *p);
static NS_METHOD UnrootImpl(void *p);
static NS_METHOD_(void) TraceImpl(void *p, TraceCallback cb, void *closure);
static NS_METHOD_(void) TraceImpl(void *p, const TraceCallbacks &cb, void *closure);
static bool CheckForRightISupports(nsISupports *s);
};
@ -458,7 +494,10 @@ T* DowncastCCParticipant(void *p)
CycleCollectionNoteChild(cb, tmp->_field, #_field);
#define NS_IMPL_CYCLE_COLLECTION_TRAVERSE_SCRIPT_OBJECTS \
that->Trace(p, &nsScriptObjectTracer::NoteJSChild, &cb);
{ \
TraceCallbackFunc noteJsChild(&nsScriptObjectTracer::NoteJSChild); \
that->Trace(p, noteJsChild, &cb); \
}
#define NS_IMPL_CYCLE_COLLECTION_TRAVERSE_END \
(void)tmp; \
@ -469,32 +508,28 @@ T* DowncastCCParticipant(void *p)
// Helpers for implementing nsScriptObjectTracer::Trace
///////////////////////////////////////////////////////////////////////////////
#define NS_IMPL_CYCLE_COLLECTION_TRACE_BEGIN(_class) \
void \
NS_CYCLE_COLLECTION_CLASSNAME(_class)::TraceImpl(void *p, \
TraceCallback aCallback, \
void *aClosure) \
{ \
#define NS_IMPL_CYCLE_COLLECTION_TRACE_BEGIN(_class) \
void \
NS_CYCLE_COLLECTION_CLASSNAME(_class)::TraceImpl(void *p, \
const TraceCallbacks &aCallbacks, \
void *aClosure) \
{ \
_class *tmp = DowncastCCParticipant<_class >(p);
#define NS_IMPL_CYCLE_COLLECTION_TRACE_BEGIN_INHERITED(_class, _base_class) \
NS_IMPL_CYCLE_COLLECTION_TRACE_BEGIN(_class) \
nsISupports *s = static_cast<nsISupports*>(p); \
NS_CYCLE_COLLECTION_CLASSNAME(_base_class)::TraceImpl(s, \
aCallback, \
aCallbacks, \
aClosure);
#define NS_IMPL_CYCLE_COLLECTION_TRACE_JS_CALLBACK(_object, _name) \
if (_object) \
aCallback(_object, _name, aClosure);
#define NS_IMPL_CYCLE_COLLECTION_TRACE_JS_MEMBER_CALLBACK(_field) \
NS_IMPL_CYCLE_COLLECTION_TRACE_JS_CALLBACK(tmp->_field, #_field)
if (tmp->_field) \
aCallbacks.Trace(&tmp->_field, #_field, aClosure);
#define NS_IMPL_CYCLE_COLLECTION_TRACE_JSVAL_MEMBER_CALLBACK(_field) \
if (JSVAL_IS_TRACEABLE(tmp->_field)) { \
void *gcThing = JSVAL_TO_TRACEABLE(tmp->_field); \
aCallback(gcThing, #_field, aClosure); \
aCallbacks.Trace(&tmp->_field, #_field, aClosure); \
}
// NB: The (void)tmp; hack in the TRACE_END macro exists to support
@ -505,7 +540,7 @@ T* DowncastCCParticipant(void *p)
}
///////////////////////////////////////////////////////////////////////////////
// Helpers for implementing a concrete nsCycleCollectionParticipant
// Helpers for implementing a concrete nsCycleCollectionParticipant
///////////////////////////////////////////////////////////////////////////////
#define NS_DECL_CYCLE_COLLECTION_CLASS_BODY_NO_UNLINK(_class, _base) \
@ -586,14 +621,14 @@ NOT_INHERITED_CANT_OVERRIDE
#define NS_DECL_CYCLE_COLLECTION_SKIPPABLE_CLASS(_class) \
NS_DECL_CYCLE_COLLECTION_SKIPPABLE_CLASS_AMBIGUOUS(_class, _class)
#define NS_DECL_CYCLE_COLLECTION_SCRIPT_HOLDER_CLASS_AMBIGUOUS(_class, _base) \
class NS_CYCLE_COLLECTION_INNERCLASS \
: public nsXPCOMCycleCollectionParticipant \
{ \
NS_DECL_CYCLE_COLLECTION_CLASS_BODY(_class, _base) \
static NS_METHOD_(void) TraceImpl(void *p, TraceCallback cb, void *closure); \
NS_IMPL_GET_XPCOM_CYCLE_COLLECTION_PARTICIPANT(_class) \
}; \
#define NS_DECL_CYCLE_COLLECTION_SCRIPT_HOLDER_CLASS_AMBIGUOUS(_class, _base) \
class NS_CYCLE_COLLECTION_INNERCLASS \
: public nsXPCOMCycleCollectionParticipant \
{ \
NS_DECL_CYCLE_COLLECTION_CLASS_BODY(_class, _base) \
static NS_METHOD_(void) TraceImpl(void *p, const TraceCallbacks &cb, void *closure); \
NS_IMPL_GET_XPCOM_CYCLE_COLLECTION_PARTICIPANT(_class) \
}; \
NOT_INHERITED_CANT_OVERRIDE
#define NS_DECL_CYCLE_COLLECTION_SKIPPABLE_SCRIPT_HOLDER_CLASS_AMBIGUOUS(_class, _base) \
@ -602,29 +637,29 @@ class NS_CYCLE_COLLECTION_INNERCLASS
{ \
NS_DECL_CYCLE_COLLECTION_CLASS_BODY(_class, _base) \
static const bool isSkippable = true; \
static NS_METHOD_(void) TraceImpl(void *p, TraceCallback cb, void *closure); \
static NS_METHOD_(void) TraceImpl(void *p, const TraceCallbacks &cb, void *closure); \
static NS_METHOD_(bool) CanSkipImpl(void *p, bool aRemovingAllowed); \
static NS_METHOD_(bool) CanSkipInCCImpl(void *p); \
static NS_METHOD_(bool) CanSkipThisImpl(void *p); \
NS_IMPL_GET_XPCOM_CYCLE_COLLECTION_PARTICIPANT(_class) \
}; \
NS_IMPL_GET_XPCOM_CYCLE_COLLECTION_PARTICIPANT(_class) \
}; \
NOT_INHERITED_CANT_OVERRIDE
#define NS_DECL_CYCLE_COLLECTION_SKIPPABLE_SCRIPT_HOLDER_CLASS(_class) \
NS_DECL_CYCLE_COLLECTION_SKIPPABLE_SCRIPT_HOLDER_CLASS_AMBIGUOUS(_class, _class)
#define NS_DECL_CYCLE_COLLECTION_SKIPPABLE_SCRIPT_HOLDER_CLASS_INHERITED(_class, \
_base_class) \
class NS_CYCLE_COLLECTION_INNERCLASS \
: public NS_CYCLE_COLLECTION_CLASSNAME(_base_class) \
{ \
NS_DECL_CYCLE_COLLECTION_CLASS_INHERITED_BODY(_class, _base_class) \
static const bool isSkippable = true; \
static NS_METHOD_(void) TraceImpl(void *p, TraceCallback cb, void *closure); \
static NS_METHOD_(bool) CanSkipImpl(void *p, bool aRemovingAllowed); \
static NS_METHOD_(bool) CanSkipInCCImpl(void *p); \
static NS_METHOD_(bool) CanSkipThisImpl(void *p); \
NS_IMPL_GET_XPCOM_CYCLE_COLLECTION_PARTICIPANT(_class) \
#define NS_DECL_CYCLE_COLLECTION_SKIPPABLE_SCRIPT_HOLDER_CLASS_INHERITED(_class, \
_base_class) \
class NS_CYCLE_COLLECTION_INNERCLASS \
: public NS_CYCLE_COLLECTION_CLASSNAME(_base_class) \
{ \
NS_DECL_CYCLE_COLLECTION_CLASS_INHERITED_BODY(_class, _base_class) \
static const bool isSkippable = true; \
static NS_METHOD_(void) TraceImpl(void *p, const TraceCallbacks &cb, void *closure); \
static NS_METHOD_(bool) CanSkipImpl(void *p, bool aRemovingAllowed); \
static NS_METHOD_(bool) CanSkipInCCImpl(void *p); \
static NS_METHOD_(bool) CanSkipThisImpl(void *p); \
NS_IMPL_GET_XPCOM_CYCLE_COLLECTION_PARTICIPANT(_class) \
};
#define NS_DECL_CYCLE_COLLECTION_SCRIPT_HOLDER_CLASS(_class) \
@ -664,14 +699,14 @@ public: \
NS_IMPL_GET_XPCOM_CYCLE_COLLECTION_PARTICIPANT(_class) \
};
#define NS_DECL_CYCLE_COLLECTION_SCRIPT_HOLDER_CLASS_INHERITED(_class, \
_base_class) \
class NS_CYCLE_COLLECTION_INNERCLASS \
: public NS_CYCLE_COLLECTION_CLASSNAME(_base_class) \
{ \
NS_DECL_CYCLE_COLLECTION_CLASS_INHERITED_BODY(_class, _base_class) \
static NS_METHOD_(void) TraceImpl(void *p, TraceCallback cb, void *closure); \
NS_IMPL_GET_XPCOM_CYCLE_COLLECTION_PARTICIPANT(_class) \
#define NS_DECL_CYCLE_COLLECTION_SCRIPT_HOLDER_CLASS_INHERITED(_class, \
_base_class) \
class NS_CYCLE_COLLECTION_INNERCLASS \
: public NS_CYCLE_COLLECTION_CLASSNAME(_base_class) \
{ \
NS_DECL_CYCLE_COLLECTION_CLASS_INHERITED_BODY(_class, _base_class) \
static NS_METHOD_(void) TraceImpl(void *p, const TraceCallbacks &cb, void *closure); \
NS_IMPL_GET_XPCOM_CYCLE_COLLECTION_PARTICIPANT(_class) \
};
/**
@ -772,7 +807,7 @@ struct Skippable
{ \
NS_DECL_CYCLE_COLLECTION_NATIVE_CLASS_BODY(_class) \
NS_DECL_CYCLE_COLLECTION_NATIVE_UNMARK_IF_PURPLE(_class) \
static NS_METHOD_(void) TraceImpl(void *p, TraceCallback cb, \
static NS_METHOD_(void) TraceImpl(void *p, const TraceCallbacks &cb, \
void *closure); \
static nsScriptObjectTracer* GetParticipant() \
{ \