Merge the last PGO-green inbound changeset to m-c.

This commit is contained in:
Ryan VanderMeulen 2012-08-30 21:54:09 -04:00
commit 500be4ff7e
246 changed files with 5193 additions and 1815 deletions

View File

@ -1,14 +1,16 @@
[
{
"size": 195,
"digest": "209d6875524e6f81c158fe7d8c543683747cb186a53ddb729c6437273404f69468d4c91bfd74a26448ad2a726da1a9b48e6243602cbe60b5d0e0f97cdb29e2cc",
"algorithm": "sha512",
"size": 195,
"digest":
"7236ccc28312303e2f64b0afea767ca29c6c47c4714d727d68c294c898c75d06ba53486bf66cf4d76133fa780b1f5e330204c30a461f43f9b07a3dbfd4f653d4",
"algorithm": "sha512",
"filename": "setup.sh"
},
},
{
"size": 62014571,
"digest": "68327ed36d8a53615fd66a300d5c022517f2f3ea0199b9d95f80683bbf1d0a154266700c8bde235467cc707c4c37341cd3f5e9816bb2c4b66efc96f9e08c92df",
"algorithm": "sha512",
"filename": "gonk-toolchain-4.tar.bz2"
"size": 62788533,
"digest":
"1471e8847c9070d2062419a7be9d8921506b2d8b728d98986059771b8d45b4dba9afe54b25ba5665e4adde847cf4d5574c016c0390741139f6dd1749cd61d263",
"algorithm": "sha512",
"filename": "gonk-toolchain-6.tar.bz2"
}
]
]

View File

@ -222,6 +222,11 @@ pref("general.autoScroll", false);
pref("general.autoScroll", true);
#endif
// Send aol.com the legacy build date instead of the version number in the UA's
// Gecko token as a temporary measure against bug 778408 (mail.aol.com defaults
// to basic web UI when accessed with a user agent without Gecko/20100101).
pref("general.useragent.override.aol.com", "Gecko/[^ ]*#Gecko/20100101");
// At startup, check if we're the default browser and prompt user if not.
pref("browser.shell.checkDefaultBrowser", true);

View File

@ -288,7 +288,7 @@
#ifdef MOZ_SERVICES_SYNC
<menuitem id="appmenu_sync-tabs"
class="syncTabsMenuItem"
label="&syncTabsMenu.label;"
label="&syncTabsMenu2.label;"
oncommand="BrowserOpenSyncTabs();"
disabled="true"/>
#endif

View File

@ -362,7 +362,7 @@
#ifdef MOZ_SERVICES_SYNC
<menuitem id="sync-tabs-menuitem"
class="syncTabsMenuItem"
label="&syncTabsMenu.label;"
label="&syncTabsMenu2.label;"
oncommand="BrowserOpenSyncTabs();"
disabled="true"/>
#endif

View File

@ -18,7 +18,7 @@
onunload="RemoteTabViewer.uninit()"
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
xmlns:html="http://www.w3.org/1999/xhtml"
title="&tabs.otherComputers.label;">
title="&tabs.otherDevices.label;">
<script type="application/javascript;version=1.8" src="chrome://browser/content/sync/aboutSyncTabs.js"/>
<script type="application/javascript" src="chrome://browser/content/utilityOverlay.js"/>
<html:head>
@ -56,7 +56,7 @@
oncontextmenu="RemoteTabViewer.adjustContextMenu(event)">
<hbox id="headers" align="center">
<label id="tabsListHeading"
value="&tabs.otherComputers.label;"/>
value="&tabs.otherDevices.label;"/>
<spacer flex="1"/>
<textbox type="search"
emptytext="&tabs.searchText.label;"

View File

@ -32,7 +32,7 @@
<p id="synckey" dir="ltr">SYNCKEY</p>
<p>&syncKey.page.description;</p>
<p>&syncKey.page.description2;</p>
<div id="column1">
<h2>&syncKey.keepItSecret.heading;</h2>
@ -41,7 +41,7 @@
<div id="column2">
<h2>&syncKey.keepItSafe.heading;</h2>
<p><em>&syncKey.keepItSafe1.description;</em>&syncKey.keepItSafe2.description;<em>&syncKey.keepItSafe3.description;</em>&syncKey.keepItSafe4.description;</p>
<p><em>&syncKey.keepItSafe1.description;</em>&syncKey.keepItSafe2.description;<em>&syncKey.keepItSafe3.description;</em>&syncKey.keepItSafe4a.description;</p>
</div>
<p>&syncKey.findOutMore1.label;<a href="https://services.mozilla.com">https://services.mozilla.com</a>&syncKey.findOutMore2.label;</p>

View File

@ -929,6 +929,23 @@ var gSyncSetup = {
document.getElementById("prefsWipe").hidden = true;
}
if (Weave.Engines.get("addons").enabled) {
let ids = Weave.Engines.get("addons")._store.getAllIDs();
let blessedcount = 0;
for each (let i in ids) {
if (i) {
blessedcount++;
}
}
// bug 600141 does not apply, as this does not have to support existing strings
document.getElementById("addonCount").value =
PluralForm.get(blessedcount,
this._stringBundle.GetStringFromName("addonsCount.label"))
.replace("#1", blessedcount);
} else {
document.getElementById("addonCount").hidden = true;
}
this._case1Setup = true;
break;
case 2:

View File

@ -363,8 +363,8 @@
</columns>
<rows>
<row align="center">
<label value="&syncComputerName.label;"
accesskey="&syncComputerName.accesskey;"
<label value="&syncDeviceName.label;"
accesskey="&syncDeviceName.accesskey;"
control="syncComputerName"/>
<textbox id="syncComputerName" flex="1"
onchange="gSyncUtils.changeName(this)"/>
@ -416,7 +416,7 @@
aria-labelledby="resetClientLabel"/>
<label id="resetClientLabel" control="resetClient">
<html:strong>&choice2.merge.recommended.label;</html:strong>
&choice2.merge.main.label;
&choice2a.merge.main.label;
</label>
</row>
<row align="center">
@ -425,7 +425,7 @@
aria-labelledby="wipeClientLabel"/>
<label id="wipeClientLabel"
control="wipeClient">
&choice2.client.main.label;
&choice2a.client.main.label;
</label>
</row>
<row align="center">
@ -434,7 +434,7 @@
aria-labelledby="wipeRemoteLabel"/>
<label id="wipeRemoteLabel"
control="wipeRemote">
&choice2.server.main.label;
&choice2a.server.main.label;
</label>
</row>
</rows>
@ -449,24 +449,25 @@
<deck id="chosenActionDeck">
<vbox id="chosenActionMerge" class="confirm">
<description class="normal">
&confirm.merge.label;
&confirm.merge2.label;
</description>
</vbox>
<vbox id="chosenActionWipeClient" class="confirm">
<description class="normal">
&confirm.client2.label;
&confirm.client3.label;
</description>
<separator class="thin"/>
<vbox id="dataList">
<label class="data indent" id="bookmarkCount"/>
<label class="data indent" id="historyCount"/>
<label class="data indent" id="passwordCount"/>
<label class="data indent" id="addonCount"/>
<label class="data indent" id="prefsWipe"
value="&engine.prefs.label;"/>
</vbox>
<separator class="thin"/>
<description class="normal">
&confirm.client.moreinfo.label;
&confirm.client2.moreinfo.label;
</description>
</vbox>
<vbox id="chosenActionWipeServer" class="confirm">

View File

@ -274,6 +274,7 @@ _BROWSER_FILES = \
social_flyout.html \
social_window.html \
social_worker.js \
browser_bug784142.js \
$(NULL)
ifneq (cocoa,$(MOZ_WIDGET_TOOLKIT))

View File

@ -0,0 +1,61 @@
const windowMediator = Cc["@mozilla.org/appshell/window-mediator;1"].getService(Ci.nsIWindowMediator);
function test()
{
waitForExplicitFinish();
// Need to enable modal dialogs for this test.
Services.prefs.setBoolPref("prompts.tab_modal.enabled", false);
windowMediator.addListener(promptListener);
// Open a new tab and have that tab open a new window. This is done to
// ensure that the new window is a normal browser window.
var script = "window.open('data:text/html,<button id=\"button\" onclick=\"window.close(); alert(5);\">Close</button>', null, 'width=200,height=200');";
gBrowser.selectedTab =
gBrowser.addTab("data:text/html,<body onload='setTimeout(dotest, 0)'><script>function dotest() { " + script + "}</script></body>");
}
function windowOpened(win)
{
// Wait for the page in the window to load.
waitForFocus(clickButton, win.content);
}
function clickButton(win)
{
// Set the window in the prompt listener to indicate that the alert window
// is now expected to open.
promptListener.window = win;
// Click the Close button in the window.
EventUtils.synthesizeMouseAtCenter(win.content.document.getElementById("button"), { }, win);
windowMediator.removeListener(promptListener);
gBrowser.removeTab(gBrowser.selectedTab);
is(promptListener.message, "window appeared", "modal prompt closer didn't crash");
Services.prefs.clearUserPref("prompts.tab_modal.enabled", false);
finish();
}
var promptListener = {
onWindowTitleChange: function () {},
onOpenWindow: function (win) {
let domWin = win.QueryInterface(Ci.nsIInterfaceRequestor).getInterface(Ci.nsIDOMWindow);
if (!promptListener.window) {
// The first window that is open is the one opened by the new tab.
waitForFocus(windowOpened, domWin);
}
else {
// The second window is the alert opened when clicking the Close button in the window
ok(promptListener.window.closed, "window has closed");
// Assign a message so that it can be checked just before the test
// finishes to ensure that the alert opened properly.
promptListener.message = "window appeared";
executeSoon(function () { domWin.close() });
}
},
onCloseWindow: function () {}
};

View File

@ -20,6 +20,9 @@ XPCOMUtils.defineLazyModuleGetter(this, "AddonManager",
XPCOMUtils.defineLazyModuleGetter(this, "NetUtil",
"resource://gre/modules/NetUtil.jsm");
XPCOMUtils.defineLazyModuleGetter(this, "UserAgentOverrides",
"resource://gre/modules/UserAgentOverrides.jsm");
XPCOMUtils.defineLazyModuleGetter(this, "PlacesUtils",
"resource://gre/modules/PlacesUtils.jsm");
@ -311,6 +314,7 @@ BrowserGlue.prototype = {
os.removeObserver(this, "places-database-locked");
if (this._isPlacesShutdownObserver)
os.removeObserver(this, "places-shutdown");
UserAgentOverrides.uninit();
webappsUI.uninit();
SignInToWebsiteUX.uninit();
},
@ -337,14 +341,11 @@ BrowserGlue.prototype = {
// handle any UI migration
this._migrateUI();
// Initialize webapps UI
UserAgentOverrides.init();
webappsUI.init();
PageThumbs.init();
NewTabUtils.init();
SignInToWebsiteUX.init();
PdfJs.init();
Services.obs.notifyObservers(null, "browser-ui-startup-complete", "");

View File

@ -131,8 +131,8 @@
</columns>
<rows>
<row align="center">
<label value="&syncComputerName.label;"
accesskey="&syncComputerName.accesskey;"
<label value="&syncDeviceName.label;"
accesskey="&syncDeviceName.accesskey;"
control="syncComputerName"/>
<textbox id="syncComputerName"
onchange="gSyncUtils.changeName(this)"/>

View File

@ -135,8 +135,8 @@
</columns>
<rows>
<row align="center">
<label value="&syncComputerName.label;"
accesskey="&syncComputerName.accesskey;"
<label value="&syncDeviceName.label;"
accesskey="&syncDeviceName.accesskey;"
control="syncComputerName"/>
<textbox id="syncComputerName"
onchange="gSyncUtils.changeName(this)"/>

View File

@ -2,8 +2,8 @@
- License, v. 2.0. If a copy of the MPL was not distributed with this
- file, You can obtain one at http://mozilla.org/MPL/2.0/. -->
<!-- LOCALIZATION NOTE (tabs.otherComputers.label): Keep this in sync with syncTabsMenu.label from browser.dtd -->
<!ENTITY tabs.otherComputers.label "Tabs From Other Computers">
<!-- LOCALIZATION NOTE (tabs.otherDevices.label): Keep this in sync with syncTabsMenu2.label from browser.dtd -->
<!ENTITY tabs.otherDevices.label "Tabs From Other Devices">
<!ENTITY tabs.searchText.label "Type here to find tabs…">

View File

@ -621,8 +621,8 @@ just addresses the organization to follow, e.g. "This site is run by " -->
The word "toolbar" is appended automatically and should not be contained below! -->
<!ENTITY tabsToolbar.label "Browser tabs">
<!-- LOCALIZATION NOTE (syncTabsMenu.label): This appears in the history menu -->
<!ENTITY syncTabsMenu.label "Tabs From Other Computers">
<!-- LOCALIZATION NOTE (syncTabsMenu2.label): This appears in the history menu -->
<!ENTITY syncTabsMenu2.label "Tabs From Other Devices">
<!ENTITY syncBrand.shortName.label "Sync">

View File

@ -38,8 +38,8 @@
<!ENTITY engine.addons.accesskey "A">
<!-- Device Settings -->
<!ENTITY syncComputerName.label "Computer Name:">
<!ENTITY syncComputerName.accesskey "c">
<!ENTITY syncDeviceName.label "Device Name:">
<!ENTITY syncDeviceName.accesskey "c">
<!ENTITY unlinkDevice.label "Unlink This Device">
<!-- Footer stuff -->

View File

@ -3,14 +3,14 @@
- file, You can obtain one at http://mozilla.org/MPL/2.0/. -->
<!ENTITY syncKey.page.title "Your &syncBrand.fullName.label; Key">
<!ENTITY syncKey.page.description "This key is used to decode the data in your &syncBrand.fullName.label; account. You will need to enter the key each time you configure &syncBrand.fullName.label; on a new computer or device.">
<!ENTITY syncKey.page.description2 "This key is used to decode the data in your &syncBrand.fullName.label; account. You will need to enter the key each time you configure &syncBrand.fullName.label; on a new device.">
<!ENTITY syncKey.keepItSecret.heading "Keep it secret">
<!ENTITY syncKey.keepItSecret.description "Your &syncBrand.fullName.label; account is encrypted to protect your privacy. Without this key, it would take years for anyone to decode your personal information. You are the only person who holds this key. This means you're the only one who can access your &syncBrand.fullName.label; data.">
<!ENTITY syncKey.keepItSafe.heading "Keep it safe">
<!ENTITY syncKey.keepItSafe1.description "Do not lose this key.">
<!ENTITY syncKey.keepItSafe2.description " We don't keep a copy of your key (that wouldn't be keeping it secret!) so ">
<!ENTITY syncKey.keepItSafe3.description "we can't help you recover it">
<!ENTITY syncKey.keepItSafe4.description " if it's lost. You'll need to use this key any time you connect a new computer or device to &syncBrand.fullName.label;.">
<!ENTITY syncKey.keepItSafe4a.description " if it's lost. You'll need to use this key any time you connect a new device to &syncBrand.fullName.label;.">
<!ENTITY syncKey.findOutMore1.label "Find out more about &syncBrand.fullName.label; and your privacy at ">
<!ENTITY syncKey.findOutMore2.label ".">
<!ENTITY syncKey.footer1.label "&syncBrand.fullName.label; Terms of Service are available at ">

View File

@ -12,7 +12,7 @@
<!ENTITY setup.choicePage.title.label "Have you used &syncBrand.fullName.label; before?">
<!ENTITY setup.choicePage.new.label "I've never used &syncBrand.shortName.label; before">
<!ENTITY setup.choicePage.existing.label "I'm already using &syncBrand.shortName.label; on another computer">
<!ENTITY setup.choicePage.existing2.label "I'm already using &syncBrand.shortName.label; on another device">
<!-- New Account AND Existing Account -->
<!ENTITY server.label "Server">
@ -78,8 +78,8 @@
<!-- Sync Options -->
<!ENTITY setup.optionsPage.title "Sync Options">
<!ENTITY syncComputerName.label "Computer Name:">
<!ENTITY syncComputerName.accesskey "c">
<!ENTITY syncDeviceName.label "Device Name:">
<!ENTITY syncDeviceName.accesskey "c">
<!ENTITY syncMy.label "Sync My">
<!ENTITY engine.bookmarks.label "Bookmarks">
@ -95,16 +95,16 @@
<!ENTITY engine.addons.label "Add-ons">
<!ENTITY engine.addons.accesskey "A">
<!ENTITY choice2.merge.main.label "Merge this computer's data with my &syncBrand.shortName.label; data">
<!ENTITY choice2a.merge.main.label "Merge this device's data with my &syncBrand.shortName.label; data">
<!ENTITY choice2.merge.recommended.label "Recommended:">
<!ENTITY choice2.client.main.label "Replace all data on this computer with my &syncBrand.shortName.label; data">
<!ENTITY choice2.server.main.label "Replace all other devices with this computer's data">
<!ENTITY choice2a.client.main.label "Replace all data on this device with my &syncBrand.shortName.label; data">
<!ENTITY choice2a.server.main.label "Replace all other devices with this device's data">
<!-- Confirm Merge Options -->
<!ENTITY setup.optionsConfirmPage.title "Confirm">
<!ENTITY confirm.merge.label "&syncBrand.fullName.label; will now merge all this computer's browser data into your Sync account.">
<!ENTITY confirm.client2.label "Warning: The following &brandShortName; data on this computer will be deleted:">
<!ENTITY confirm.client.moreinfo.label "&brandShortName; will then copy your &syncBrand.fullName.label; data to this computer.">
<!ENTITY confirm.merge2.label "&syncBrand.fullName.label; will now merge all this device's browser data into your Sync account.">
<!ENTITY confirm.client3.label "Warning: The following &brandShortName; data on this device will be deleted:">
<!ENTITY confirm.client2.moreinfo.label "&brandShortName; will then copy your &syncBrand.fullName.label; data to this device.">
<!ENTITY confirm.server2.label "Warning: The following devices will be overwritten with your local data:">
<!-- New & Existing Account: Setup Complete -->

View File

@ -32,15 +32,18 @@ historyDaysCount.label = #1 day of history;#1 days of history
# http://developer.mozilla.org/en/docs/Localization_and_Plurals
# #1 is the number of passwords (was %S for a short while, use #1 instead, even if both work)
passwordsCount.label = #1 password;#1 passwords
# LOCALIZATION NOTE (addonsCount.label):
# #1 is the number of add-ons, see the link above for forms
addonsCount.label = #1 addon;#1 addons
save.recoverykey.title = Save Recovery Key
save.recoverykey.defaultfilename = Firefox Recovery Key.html
newAccount.action.label = Firefox Sync is now set up to automatically sync all of your browser data.
newAccount.change.label = You can choose exactly what to sync by selecting Sync Options below.
resetClient.change.label = Firefox Sync will now merge all this computer's browser data into your Sync account.
wipeClient.change.label = Firefox Sync will now replace all of the browser data on this computer with the data in your Sync account.
wipeRemote.change.label = Firefox Sync will now replace all of the browser data in your Sync account with the data on this computer.
resetClient.change2.label = Firefox Sync will now merge all this device's browser data into your Sync account.
wipeClient.change2.label = Firefox Sync will now replace all of the browser data on this device with the data in your Sync account.
wipeRemote.change2.label = Firefox Sync will now replace all of the browser data in your Sync account with the data on this device.
existingAccount.change.label = You can change this preference by selecting Sync Options below.
# Several other strings are used (via Weave.Status.login), but they come from

View File

@ -501,7 +501,7 @@ class DeviceManager:
# Right now this is just clearing the logcat so we can only see what happens after this call.
buf = StringIO.StringIO()
self.shell(['/system/bin/logcat', '-c'], buf)
self.shell(['/system/bin/logcat', '-c'], buf, root=True)
def getLogcat(self):
"""
@ -511,7 +511,7 @@ class DeviceManager:
failure: None
"""
buf = StringIO.StringIO()
if self.shell(["/system/bin/logcat", "-d", "dalvikvm:S", "ConnectivityService:S", "WifiMonitor:S", "WifiStateTracker:S", "wpa_supplicant:S", "NetworkStateTracker:S"], buf) != 0:
if self.shell(["/system/bin/logcat", "-d", "dalvikvm:S", "ConnectivityService:S", "WifiMonitor:S", "WifiStateTracker:S", "wpa_supplicant:S", "NetworkStateTracker:S"], buf, root=True) != 0:
return None
return str(buf.getvalue()[0:-1]).rstrip().split('\r')

View File

@ -96,14 +96,18 @@ class DeviceManagerADB(DeviceManager):
# returns:
# success: <return code>
# failure: None
def shell(self, cmd, outputfile, env=None, cwd=None, timeout=None):
def shell(self, cmd, outputfile, env=None, cwd=None, timeout=None, root=False):
# FIXME: this function buffers all output of the command into memory,
# always. :(
# Getting the return code is more complex than you'd think because adb
# doesn't actually return the return code from a process, so we have to
# capture the output to get it
cmdline = "%s; echo $?" % self._escapedCommandLine(cmd)
if root:
cmdline = "su -c \"%s\"" % self._escapedCommandLine(cmd)
else:
cmdline = self._escapedCommandLine(cmd)
cmdline += "; echo $?"
# prepend cwd and env to command if necessary
if cwd:

View File

@ -14,6 +14,7 @@ from threading import Thread
import StringIO
from devicemanager import DeviceManager, FileError, NetworkTools, _pop_last_line
import errno
from distutils.version import StrictVersion
class AgentError(Exception):
"SUTAgent-specific exception."
@ -52,7 +53,12 @@ class DeviceManagerSUT(DeviceManager):
self._sock = None
self.deviceRoot = deviceRoot
if self.getDeviceRoot() == None:
raise BaseException("Failed to connect to SUT Agent and retrieve the device root.")
raise BaseException("Failed to connect to SUT Agent and retrieve the device root.")
try:
verstring = self.runCmds([{ 'cmd': 'ver' }])
self.agentVersion = re.sub('SUTAgentAndroid Version ', '', verstring)
except AgentError, err:
raise BaseException("Failed to get SUTAgent version")
def _cmdNeedsResponse(self, cmd):
""" Not all commands need a response from the agent:
@ -263,16 +269,38 @@ class DeviceManagerSUT(DeviceManager):
# returns:
# success: <return code>
# failure: None
def shell(self, cmd, outputfile, env=None, cwd=None, timeout=None):
def shell(self, cmd, outputfile, env=None, cwd=None, timeout=None, root=False):
cmdline = self._escapedCommandLine(cmd)
if env:
cmdline = '%s %s' % (self.formatEnvString(env), cmdline)
haveExecSu = (StrictVersion(self.agentVersion) >= StrictVersion('1.13'))
# Depending on agent version we send one of the following commands here:
# * exec (run as normal user)
# * execsu (run as privileged user)
# * execcwd (run as normal user from specified directory)
# * execcwdsu (run as privileged user from specified directory)
cmd = "exec"
if cwd:
cmd += "cwd"
if root and haveExecSu:
cmd += "su"
try:
if cwd:
self.sendCmds([{ 'cmd': 'execcwd %s %s' % (cwd, cmdline) }], outputfile, timeout)
self.sendCmds([{ 'cmd': '%s %s %s' % (cmd, cwd, cmdline) }], outputfile, timeout)
else:
self.sendCmds([{ 'cmd': 'exec su -c "%s"' % cmdline }], outputfile, timeout)
if (not root) or haveExecSu:
self.sendCmds([{ 'cmd': '%s %s' % (cmd, cmdline) }], outputfile, timeout)
else:
# need to manually inject su -c for backwards compatibility (this may
# not work on ICS or above!!)
# (FIXME: this backwards compatibility code is really ugly and should
# be deprecated at some point in the future)
self.sendCmds([ { 'cmd': '%s su -c "%s"' % (cmd, cmdline) }], outputfile,
timeout)
except AgentError:
return None

View File

@ -124,6 +124,7 @@ public class FennecNativeActions implements Actions {
}
endTime = SystemClock.uptimeMillis();
if (!mEventReceived && (endTime - startTime >= MAX_WAIT_MS)) {
FennecNativeDriver.logAllStackTraces(FennecNativeDriver.LogLevel.ERROR);
mAsserter.ok(false, "GeckoEventExpecter",
"blockForEvent timeout: "+mGeckoEvent);
return;
@ -156,6 +157,7 @@ public class FennecNativeActions implements Actions {
}
endTime = SystemClock.uptimeMillis();
if (!mEventReceived && (endTime - startTime >= MAX_WAIT_MS)) {
FennecNativeDriver.logAllStackTraces(FennecNativeDriver.LogLevel.ERROR);
mAsserter.ok(false, "GeckoEventExpecter", "blockUtilClear timeout");
return;
}
@ -286,6 +288,7 @@ public class FennecNativeActions implements Actions {
}
endTime = SystemClock.uptimeMillis();
if (!mPaintDone && (endTime - startTime >= MAX_WAIT_MS)) {
FennecNativeDriver.logAllStackTraces(FennecNativeDriver.LogLevel.ERROR);
mAsserter.ok(false, "PaintExpecter", "blockForEvent timeout");
return;
}
@ -317,6 +320,7 @@ public class FennecNativeActions implements Actions {
}
endTime = SystemClock.uptimeMillis();
if (!mPaintDone && (endTime - startTime >= MAX_WAIT_MS)) {
FennecNativeDriver.logAllStackTraces(FennecNativeDriver.LogLevel.ERROR);
mAsserter.ok(false, "PaintExpecter", "blockUtilClear timeout");
return;
}

View File

@ -98,7 +98,7 @@ public class CmdWorkerThread extends Thread
String inputLine, outputLine;
DoCommand dc = new DoCommand(theParent.svc);
SUTAgentAndroid.logToFile(dc, "CmdWorkerThread starts: "+getId());
SUTAgentAndroid.log(dc, "CmdWorkerThread starts: "+getId());
int nAvail = cmdIn.available();
cmdIn.skip(nAvail);
@ -136,7 +136,7 @@ public class CmdWorkerThread extends Thread
{
String message = String.format("%s : %s",
socket.getInetAddress().getHostAddress(), inputLine);
SUTAgentAndroid.logToFile(dc, message);
SUTAgentAndroid.log(dc, message);
outputLine = dc.processCommand(inputLine, out, in, cmdOut);
if (outputLine.length() > 0)
@ -166,7 +166,7 @@ public class CmdWorkerThread extends Thread
in.close();
in = null;
socket.close();
SUTAgentAndroid.logToFile(dc, "CmdWorkerThread ends: "+getId());
SUTAgentAndroid.log(dc, "CmdWorkerThread ends: "+getId());
}
catch (IOException e)
{

View File

@ -84,6 +84,7 @@ import android.os.Debug;
import android.os.Environment;
import android.os.StatFs;
import android.os.SystemClock;
import android.text.TextUtils;
import android.util.DisplayMetrics;
import android.util.Log;
import android.view.Surface;
@ -106,13 +107,15 @@ public class DoCommand {
String ffxProvider = "org.mozilla.ffxcp";
String fenProvider = "org.mozilla.fencp";
private final String prgVersion = "SUTAgentAndroid Version 1.11";
private final String prgVersion = "SUTAgentAndroid Version 1.13";
public enum Command
{
RUN ("run"),
EXEC ("exec"),
EXECSU ("execsu"),
EXECCWD ("execcwd"),
EXECCWDSU ("execcwdsu"),
ENVRUN ("envrun"),
KILL ("kill"),
PS ("ps"),
@ -683,7 +686,25 @@ public class DoCommand {
theArgs[lcv - 1] = Argv[lcv];
}
strReturn = StartPrg2(theArgs, cmdOut, null);
strReturn = StartPrg2(theArgs, cmdOut, null, false);
}
else
{
strReturn = sErrorPrefix + "Wrong number of arguments for " + Argv[0] + " command!";
}
break;
case EXECSU:
if (Argc >= 2)
{
String [] theArgs = new String [Argc - 1];
for (int lcv = 1; lcv < Argc; lcv++)
{
theArgs[lcv - 1] = Argv[lcv];
}
strReturn = StartPrg2(theArgs, cmdOut, null, true);
}
else
{
@ -701,7 +722,25 @@ public class DoCommand {
theArgs[lcv - 2] = Argv[lcv];
}
strReturn = StartPrg2(theArgs, cmdOut, Argv[1]);
strReturn = StartPrg2(theArgs, cmdOut, Argv[1], false);
}
else
{
strReturn = sErrorPrefix + "Wrong number of arguments for " + Argv[0] + " command!";
}
break;
case EXECCWDSU:
if (Argc >= 3)
{
String [] theArgs = new String [Argc - 2];
for (int lcv = 2; lcv < Argc; lcv++)
{
theArgs[lcv - 2] = Argv[lcv];
}
strReturn = StartPrg2(theArgs, cmdOut, Argv[1], true);
}
else
{
@ -720,7 +759,7 @@ public class DoCommand {
}
if (Argv[1].contains("/") || Argv[1].contains("\\") || !Argv[1].contains("."))
strReturn = StartPrg(theArgs, cmdOut);
strReturn = StartPrg(theArgs, cmdOut, false);
else
strReturn = StartJavaPrg(theArgs, null);
}
@ -860,12 +899,16 @@ private void CancelNotification()
int nStart = 0;
// if we have a quote
if (workingString.startsWith("\""))
if (workingString.startsWith("\"") || workingString.startsWith("'"))
{
char quoteChar = '"';
if (workingString.startsWith("\'"))
quoteChar = '\'';
// point to the first non quote char
nStart = 1;
// find the matching quote
nEnd = workingString.indexOf('"', nStart);
nEnd = workingString.indexOf(quoteChar, nStart);
char prevChar;
@ -878,7 +921,7 @@ private void CancelNotification()
// if escaped, point past this quotation mark and find the next
nEnd++;
if (nEnd < nLength)
nEnd = workingString.indexOf('"', nEnd);
nEnd = workingString.indexOf(quoteChar, nEnd);
else
nEnd = -1;
}
@ -909,16 +952,11 @@ private void CancelNotification()
// get the substring
workingString2 = workingString.substring(nStart, nEnd);
// if we have escaped quotes
if (workingString2.contains("\\\""))
// if we have escaped quotes, convert them into standard ones
while (workingString2.contains("\\\"") || workingString2.contains("\\'"))
{
do
{
// replace escaped quote with embedded quote
workingString3 = workingString2.replace("\\\"", "\"");
workingString2 = workingString3;
}
while(workingString2.contains("\\\""));
workingString2 = workingString2.replace("\\\"", "\"");
workingString2 = workingString2.replace("\\'", "'");
}
// add it to the list
@ -3517,14 +3555,35 @@ private void CancelNotification()
return (sRet);
}
public String StartPrg(String [] progArray, OutputStream out)
public String StartPrg(String [] progArray, OutputStream out, boolean startAsRoot)
{
String sRet = "";
int lcv = 0;
try
{
pProc = Runtime.getRuntime().exec(progArray);
try {
if (startAsRoot)
{
// we need to requote the program string here, in case
// there's spaces or other characters which need quoting
// before being passed to su
List<String> quotedProgList = new ArrayList<String>();
for (String arg : progArray)
{
String quotedArg = arg;
quotedArg = quotedArg.replace("\"", "\\\"");
quotedArg = quotedArg.replace("\'", "\\\'");
if (quotedArg.contains(" "))
{
quotedArg = "\"" + quotedArg + "\"";
}
quotedProgList.add(quotedArg);
}
pProc = Runtime.getRuntime().exec(this.getSuArgs(TextUtils.join(" ", quotedProgList)));
}
else
{
pProc = Runtime.getRuntime().exec(progArray);
}
RedirOutputThread outThrd = new RedirOutputThread(pProc, out);
outThrd.start();
while (lcv < 30) {
@ -3552,7 +3611,7 @@ private void CancelNotification()
return (sRet);
}
public String StartPrg2(String [] progArray, OutputStream out, String cwd)
public String StartPrg2(String [] progArray, OutputStream out, String cwd, boolean startAsRoot)
{
String sRet = "";
@ -3566,7 +3625,7 @@ private void CancelNotification()
if (!sEnvString.contains("=") && (sEnvString.length() > 0))
{
if (sEnvString.contains("/") || sEnvString.contains("\\") || !sEnvString.contains("."))
sRet = StartPrg(progArray, out);
sRet = StartPrg(progArray, out, startAsRoot);
else
sRet = StartJavaPrg(progArray, null);
return(sRet);
@ -3772,65 +3831,68 @@ private void CancelNotification()
private String PrintUsage()
{
String sRet =
"run [cmdline] - start program no wait\n" +
"exec [env pairs] [cmdline] - start program no wait optionally pass env\n" +
" key=value pairs (comma separated)\n" +
"kill [program name] - kill program no path\n" +
"killall - kill all processes started\n" +
"ps - list of running processes\n" +
"info - list of device info\n" +
" [os] - os version for device\n" +
" [id] - unique identifier for device\n" +
" [uptime] - uptime for device\n" +
" [uptimemillis] - uptime for device in milliseconds\n" +
" [systime] - current system time\n" +
" [screen] - width, height and bits per pixel for device\n" +
" [memory] - physical, free, available, storage memory\n" +
" for device\n" +
" [processes] - list of running processes see 'ps'\n" +
"deadman timeout - set the duration for the deadman timer\n" +
"alrt [on/off] - start or stop sysalert behavior\n" +
"disk [arg] - prints disk space info\n" +
"cp file1 file2 - copy file1 to file2\n" +
"time file - timestamp for file\n" +
"hash file - generate hash for file\n" +
"cd directory - change cwd\n" +
"cat file - cat file\n" +
"cwd - display cwd\n" +
"mv file1 file2 - move file1 to file2\n" +
"push filename - push file to device\n" +
"rm file - delete file\n" +
"rmdr directory - delete directory even if not empty\n" +
"mkdr directory - create directory\n" +
"dirw directory - tests whether the directory is writable\n" +
"isdir directory - test whether the directory exists\n" +
"chmod directory|file - change permissions of directory and contents (or file) to 777\n" +
"stat processid - stat process\n" +
"dead processid - print whether the process is alive or hung\n" +
"mems - dump memory stats\n" +
"ls - print directory\n" +
"tmpd - print temp directory\n" +
"ping [hostname/ipaddr] - ping a network device\n" +
"unzp zipfile destdir - unzip the zipfile into the destination dir\n" +
"zip zipfile src - zip the source file/dir into zipfile\n" +
"rebt - reboot device\n" +
"inst /path/filename.apk - install the referenced apk file\n" +
"uninst packagename - uninstall the referenced package and reboot\n" +
"uninstall packagename - uninstall the referenced package without a reboot\n" +
"updt pkgname pkgfile - unpdate the referenced package\n" +
"clok - the current device time expressed as the" +
" number of millisecs since epoch\n" +
"settime date time - sets the device date and time\n" +
" (YYYY/MM/DD HH:MM:SS)\n" +
"tzset timezone - sets the device timezone format is\n" +
" GMTxhh:mm x = +/- or a recognized Olsen string\n" +
"tzget - returns the current timezone set on the device\n" +
"rebt - reboot device\n" +
"adb ip|usb - set adb to use tcp/ip on port 5555 or usb\n" +
"quit - disconnect SUTAgent\n" +
"exit - close SUTAgent\n" +
"ver - SUTAgent version\n" +
"help - you're reading it";
"run [cmdline] - start program no wait\n" +
"exec [env pairs] [cmdline] - start program no wait optionally pass env\n" +
" key=value pairs (comma separated)\n" +
"execcwd [env pairs] [cmdline] - start program from specified directory\n" +
"execsu [env pairs] [cmdline] - start program as privileged user\n" +
"execcwdsu [env pairs] [cmdline] - start program from specified directory as privileged user\n" +
"kill [program name] - kill program no path\n" +
"killall - kill all processes started\n" +
"ps - list of running processes\n" +
"info - list of device info\n" +
" [os] - os version for device\n" +
" [id] - unique identifier for device\n" +
" [uptime] - uptime for device\n" +
" [uptimemillis] - uptime for device in milliseconds\n" +
" [systime] - current system time\n" +
" [screen] - width, height and bits per pixel for device\n" +
" [memory] - physical, free, available, storage memory\n" +
" for device\n" +
" [processes] - list of running processes see 'ps'\n" +
"deadman timeout - set the duration for the deadman timer\n" +
"alrt [on/off] - start or stop sysalert behavior\n" +
"disk [arg] - prints disk space info\n" +
"cp file1 file2 - copy file1 to file2\n" +
"time file - timestamp for file\n" +
"hash file - generate hash for file\n" +
"cd directory - change cwd\n" +
"cat file - cat file\n" +
"cwd - display cwd\n" +
"mv file1 file2 - move file1 to file2\n" +
"push filename - push file to device\n" +
"rm file - delete file\n" +
"rmdr directory - delete directory even if not empty\n" +
"mkdr directory - create directory\n" +
"dirw directory - tests whether the directory is writable\n" +
"isdir directory - test whether the directory exists\n" +
"chmod directory|file - change permissions of directory and contents (or file) to 777\n" +
"stat processid - stat process\n" +
"dead processid - print whether the process is alive or hung\n" +
"mems - dump memory stats\n" +
"ls - print directory\n" +
"tmpd - print temp directory\n" +
"ping [hostname/ipaddr] - ping a network device\n" +
"unzp zipfile destdir - unzip the zipfile into the destination dir\n" +
"zip zipfile src - zip the source file/dir into zipfile\n" +
"rebt - reboot device\n" +
"inst /path/filename.apk - install the referenced apk file\n" +
"uninst packagename - uninstall the referenced package and reboot\n" +
"uninstall packagename - uninstall the referenced package without a reboot\n" +
"updt pkgname pkgfile - unpdate the referenced package\n" +
"clok - the current device time expressed as the" +
" number of millisecs since epoch\n" +
"settime date time - sets the device date and time\n" +
" (YYYY/MM/DD HH:MM:SS)\n" +
"tzset timezone - sets the device timezone format is\n" +
" GMTxhh:mm x = +/- or a recognized Olsen string\n" +
"tzget - returns the current timezone set on the device\n" +
"rebt - reboot device\n" +
"adb ip|usb - set adb to use tcp/ip on port 5555 or usb\n" +
"quit - disconnect SUTAgent\n" +
"exit - close SUTAgent\n" +
"ver - SUTAgent version\n" +
"help - you're reading it";
return (sRet);
}
}

View File

@ -166,7 +166,7 @@ public class SUTAgentAndroid extends Activity
SUTAgentAndroid.RegSvrIPPort = dc.GetIniData("Registration Server", "PORT", sIniFile);
SUTAgentAndroid.HardwareID = dc.GetIniData("Registration Server", "HARDWARE", sIniFile);
SUTAgentAndroid.Pool = dc.GetIniData("Registration Server", "POOL", sIniFile);
logToFile(dc, "onCreate");
log(dc, "onCreate");
tv = (TextView) this.findViewById(R.id.Textview01);
@ -362,7 +362,7 @@ public class SUTAgentAndroid extends Activity
super.onDestroy();
if (isFinishing())
{
logToFile(dc, "onDestroy - finishing");
log(dc, "onDestroy - finishing");
Intent listenerSvc = new Intent(this, ASMozStub.class);
listenerSvc.setAction("com.mozilla.SUTAgentAndroid.service.LISTENER_SERVICE");
stopService(listenerSvc);
@ -377,7 +377,7 @@ public class SUTAgentAndroid extends Activity
}
else
{
logToFile(dc, "onDestroy - not finishing");
log(dc, "onDestroy - not finishing");
}
}
@ -388,8 +388,8 @@ public class SUTAgentAndroid extends Activity
DoCommand dc = new DoCommand(getApplication());
if (dc != null)
{
logToFile(dc, "onLowMemory");
logToFile(dc, dc.GetMemoryInfo());
log(dc, "onLowMemory");
log(dc, dc.GetMemoryInfo());
String procInfo = dc.GetProcessInfo();
if (procInfo != null)
{
@ -398,11 +398,11 @@ public class SUTAgentAndroid extends Activity
{
if (line.contains("mozilla"))
{
logToFile(dc, line);
log(dc, line);
String words[] = line.split("\t");
if ((words != null) && (words.length > 1))
{
logToFile(dc, dc.StatProcess(words[1]));
log(dc, dc.StatProcess(words[1]));
}
}
}
@ -762,8 +762,10 @@ public class SUTAgentAndroid extends Activity
return null;
}
public static void logToFile(DoCommand dc, String message)
public static void log(DoCommand dc, String message)
{
Log.i("SUTAgentAndroid", message);
if (SUTAgentAndroid.LogCommands == false)
{
return;
@ -771,16 +773,15 @@ public class SUTAgentAndroid extends Activity
if (message == null)
{
Log.e("SUTAgentAndroid", "bad arguments in logToFile()!");
Log.e("SUTAgentAndroid", "bad arguments in log()!");
return;
}
Log.i("SUTAgentAndroid", message);
String fileDateStr = "00";
String testRoot = dc.GetTestRoot();
String datestamp = dc.GetSystemTime();
if (testRoot == null || datestamp == null)
{
Log.e("SUTAgentAndroid", "Unable to get testRoot or datestamp in logToFile!");
Log.e("SUTAgentAndroid", "Unable to get testRoot or datestamp in log!");
return;
}

View File

@ -1136,7 +1136,7 @@ endif
ifdef AUTOUPDATE_CONFIGURE
$(topsrcdir)/configure: $(topsrcdir)/configure.in
(cd $(topsrcdir) && $(AUTOCONF)) && $(PYTHON) $(DEPTH)/config.status -n --recheck)
(cd $(topsrcdir) && $(AUTOCONF)) && $(PYTHON) $(DEPTH)/config.status -n --recheck
endif
$(DEPTH)/config/autoconf.mk: $(topsrcdir)/config/autoconf.mk.in

View File

@ -16,7 +16,6 @@
#include "nsCOMPtr.h" // member
#include "nsCycleCollectionParticipant.h" // NS_DECL_CYCLE_*
#include "nsIContent.h" // base class
#include "nsIDOMNodeSelector.h" // base class
#include "nsIDOMTouchEvent.h" // base class (nsITouchEventReceiver)
#include "nsIDOMXPathNSResolver.h" // base class
#include "nsIInlineEventHandlers.h" // base class
@ -154,29 +153,6 @@ private:
nsCOMPtr<nsINode> mNode;
};
/**
* A tearoff class for FragmentOrElement to implement NodeSelector
*/
class nsNodeSelectorTearoff MOZ_FINAL : public nsIDOMNodeSelector
{
public:
NS_DECL_CYCLE_COLLECTING_ISUPPORTS
NS_DECL_NSIDOMNODESELECTOR
NS_DECL_CYCLE_COLLECTION_CLASS(nsNodeSelectorTearoff)
nsNodeSelectorTearoff(nsINode *aNode) : mNode(aNode)
{
}
private:
~nsNodeSelectorTearoff() {}
private:
nsCOMPtr<nsINode> mNode;
};
// Forward declare to allow being a friend
class nsTouchEventReceiverTearoff;
class nsInlineEventHandlersTearoff;
@ -307,15 +283,6 @@ public:
nsINode* aParent,
nsTArray<nsCOMPtr<nsIContent> >& aNodes);
/**
* Helper methods for implementing querySelector/querySelectorAll
*/
static nsIContent* doQuerySelector(nsINode* aRoot, const nsAString& aSelector,
nsresult *aResult);
static nsresult doQuerySelectorAll(nsINode* aRoot,
const nsAString& aSelector,
nsIDOMNodeList **aReturn);
NS_DECL_CYCLE_COLLECTION_SKIPPABLE_SCRIPT_HOLDER_CLASS(FragmentOrElement)
/**

View File

@ -9,6 +9,7 @@
#include "nsCOMPtr.h" // for member, local
#include "nsGkAtoms.h" // for nsGkAtoms::baseURIProperty
#include "nsIDOMEventTarget.h" // for base class
#include "nsIDOMNodeSelector.h" // base class
#include "nsINodeInfo.h" // member (in nsCOMPtr)
#include "nsIVariant.h" // for use in GetUserData()
#include "nsNodeInfoManager.h" // for use in NodePrincipal()
@ -1051,6 +1052,14 @@ public:
return NS_OK;
}
/**
* Helper methods for implementing querySelector/querySelectorAll
*/
nsIContent* QuerySelector(const nsAString& aSelector,
nsresult *aResult);
nsresult QuerySelectorAll(const nsAString& aSelector,
nsIDOMNodeList **aReturn);
/**
* Associate an object aData to aKey on this node. If aData is null any
* previously registered object and UserDataHandler associated to aKey on
@ -1571,6 +1580,28 @@ inline nsINode* NODE_FROM(C& aContent, D& aDocument)
return static_cast<nsINode*>(aDocument);
}
/**
* A tearoff class for FragmentOrElement to implement NodeSelector
*/
class nsNodeSelectorTearoff MOZ_FINAL : public nsIDOMNodeSelector
{
public:
NS_DECL_CYCLE_COLLECTING_ISUPPORTS
NS_DECL_NSIDOMNODESELECTOR
NS_DECL_CYCLE_COLLECTION_CLASS(nsNodeSelectorTearoff)
nsNodeSelectorTearoff(nsINode *aNode) : mNode(aNode)
{
}
private:
~nsNodeSelectorTearoff() {}
private:
nsCOMPtr<nsINode> mNode;
};
extern const nsIID kThisPtrOffsetsSID;

View File

@ -96,7 +96,6 @@
#include "nsIScrollableFrame.h"
#include "nsXBLInsertionPoint.h"
#include "mozilla/css/StyleRule.h" /* For nsCSSSelectorList */
#include "nsCSSRuleProcessor.h"
#include "nsRuleProcessorData.h"
#include "nsAsyncDOMEvent.h"
#include "nsTextNode.h"
@ -111,7 +110,6 @@
#include "mozAutoDocUpdate.h"
#include "nsCSSParser.h"
#include "prprf.h"
#include "nsDOMMutationObserver.h"
#include "nsSVGFeatures.h"
@ -519,33 +517,6 @@ nsNodeSupportsWeakRefTearoff::GetWeakReference(nsIWeakReference** aInstancePtr)
//----------------------------------------------------------------------
NS_IMPL_CYCLE_COLLECTION_1(nsNodeSelectorTearoff, mNode)
NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION(nsNodeSelectorTearoff)
NS_INTERFACE_MAP_ENTRY(nsIDOMNodeSelector)
NS_INTERFACE_MAP_END_AGGREGATED(mNode)
NS_IMPL_CYCLE_COLLECTING_ADDREF(nsNodeSelectorTearoff)
NS_IMPL_CYCLE_COLLECTING_RELEASE(nsNodeSelectorTearoff)
NS_IMETHODIMP
nsNodeSelectorTearoff::QuerySelector(const nsAString& aSelector,
nsIDOMElement **aReturn)
{
nsresult rv;
nsIContent* result = FragmentOrElement::doQuerySelector(mNode, aSelector, &rv);
return result ? CallQueryInterface(result, aReturn) : rv;
}
NS_IMETHODIMP
nsNodeSelectorTearoff::QuerySelectorAll(const nsAString& aSelector,
nsIDOMNodeList **aReturn)
{
return FragmentOrElement::doQuerySelectorAll(mNode, aSelector, aReturn);
}
//----------------------------------------------------------------------
NS_IMPL_CYCLE_COLLECTION_1(nsTouchEventReceiverTearoff, mElement)
NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION(nsTouchEventReceiverTearoff)
@ -1976,164 +1947,6 @@ FragmentOrElement::FireNodeRemovedForChildren()
}
}
// NOTE: The aPresContext pointer is NOT addrefed.
// *aSelectorList might be null even if NS_OK is returned; this
// happens when all the selectors were pseudo-element selectors.
static nsresult
ParseSelectorList(nsINode* aNode,
const nsAString& aSelectorString,
nsCSSSelectorList** aSelectorList)
{
NS_ENSURE_ARG(aNode);
nsIDocument* doc = aNode->OwnerDoc();
nsCSSParser parser(doc->CSSLoader());
nsCSSSelectorList* selectorList;
nsresult rv = parser.ParseSelectorString(aSelectorString,
doc->GetDocumentURI(),
0, // XXXbz get the line number!
&selectorList);
NS_ENSURE_SUCCESS(rv, rv);
// Filter out pseudo-element selectors from selectorList
nsCSSSelectorList** slot = &selectorList;
do {
nsCSSSelectorList* cur = *slot;
if (cur->mSelectors->IsPseudoElement()) {
*slot = cur->mNext;
cur->mNext = nullptr;
delete cur;
} else {
slot = &cur->mNext;
}
} while (*slot);
*aSelectorList = selectorList;
return NS_OK;
}
// Actually find elements matching aSelectorList (which must not be
// null) and which are descendants of aRoot and put them in aList. If
// onlyFirstMatch, then stop once the first one is found.
template<bool onlyFirstMatch, class T>
inline static nsresult FindMatchingElements(nsINode* aRoot,
const nsAString& aSelector,
T &aList)
{
nsAutoPtr<nsCSSSelectorList> selectorList;
nsresult rv = ParseSelectorList(aRoot, aSelector,
getter_Transfers(selectorList));
NS_ENSURE_SUCCESS(rv, rv);
NS_ENSURE_TRUE(selectorList, NS_OK);
NS_ASSERTION(selectorList->mSelectors,
"How can we not have any selectors?");
nsIDocument* doc = aRoot->OwnerDoc();
TreeMatchContext matchingContext(false, nsRuleWalker::eRelevantLinkUnvisited,
doc, TreeMatchContext::eNeverMatchVisited);
doc->FlushPendingLinkUpdates();
// Fast-path selectors involving IDs. We can only do this if aRoot
// is in the document and the document is not in quirks mode, since
// ID selectors are case-insensitive in quirks mode. Also, only do
// this if selectorList only has one selector, because otherwise
// ordering the elements correctly is a pain.
NS_ASSERTION(aRoot->IsElement() || aRoot->IsNodeOfType(nsINode::eDOCUMENT) ||
!aRoot->IsInDoc(),
"The optimization below to check ContentIsDescendantOf only for "
"elements depends on aRoot being either an element or a "
"document if it's in the document.");
if (aRoot->IsInDoc() &&
doc->GetCompatibilityMode() != eCompatibility_NavQuirks &&
!selectorList->mNext &&
selectorList->mSelectors->mIDList) {
nsIAtom* id = selectorList->mSelectors->mIDList->mAtom;
const nsSmallVoidArray* elements =
doc->GetAllElementsForId(nsDependentAtomString(id));
// XXXbz: Should we fall back to the tree walk if aRoot is not the
// document and |elements| is long, for some value of "long"?
if (elements) {
for (int32_t i = 0; i < elements->Count(); ++i) {
Element *element = static_cast<Element*>(elements->ElementAt(i));
if (!aRoot->IsElement() ||
(element != aRoot &&
nsContentUtils::ContentIsDescendantOf(element, aRoot))) {
// We have an element with the right id and it's a strict descendant
// of aRoot. Make sure it really matches the selector.
if (nsCSSRuleProcessor::SelectorListMatches(element, matchingContext,
selectorList)) {
aList.AppendElement(element);
if (onlyFirstMatch) {
return NS_OK;
}
}
}
}
}
// No elements with this id, or none of them are our descendants,
// or none of them match. We're done here.
return NS_OK;
}
for (nsIContent* cur = aRoot->GetFirstChild();
cur;
cur = cur->GetNextNode(aRoot)) {
if (cur->IsElement() &&
nsCSSRuleProcessor::SelectorListMatches(cur->AsElement(),
matchingContext,
selectorList)) {
aList.AppendElement(cur->AsElement());
if (onlyFirstMatch) {
return NS_OK;
}
}
}
return NS_OK;
}
struct ElementHolder {
ElementHolder() : mElement(nullptr) {}
void AppendElement(Element* aElement) {
NS_ABORT_IF_FALSE(!mElement, "Should only get one element");
mElement = aElement;
}
Element* mElement;
};
/* static */
nsIContent*
FragmentOrElement::doQuerySelector(nsINode* aRoot, const nsAString& aSelector,
nsresult *aResult)
{
NS_PRECONDITION(aResult, "Null out param?");
ElementHolder holder;
*aResult = FindMatchingElements<true>(aRoot, aSelector, holder);
return holder.mElement;
}
/* static */
nsresult
FragmentOrElement::doQuerySelectorAll(nsINode* aRoot,
const nsAString& aSelector,
nsIDOMNodeList **aReturn)
{
NS_PRECONDITION(aReturn, "Null out param?");
nsSimpleContentList* contentList = new nsSimpleContentList(aRoot);
NS_ENSURE_TRUE(contentList, NS_ERROR_OUT_OF_MEMORY);
NS_ADDREF(*aReturn = contentList);
return FindMatchingElements<false>(aRoot, aSelector, *contentList);
}
size_t
FragmentOrElement::SizeOfExcludingThis(nsMallocSizeOfFun aMallocSizeOf) const
{

View File

@ -494,7 +494,7 @@ nsDOMFileFile::GetMozFullPathInternal(nsAString &aFilename)
NS_IMETHODIMP
nsDOMFileFile::GetLastModifiedDate(JSContext* cx, JS::Value *aLastModifiedDate)
{
int64_t msecs;
PRTime msecs;
mFile->GetLastModifiedTime(&msecs);
JSObject* date = JS_NewDateObjectMsec(cx, msecs);
if (date) {

View File

@ -97,7 +97,8 @@
#include "nsXBLPrototypeBinding.h"
#include "prprf.h"
#include "xpcpublic.h"
#include "nsCSSRuleProcessor.h"
#include "nsCSSParser.h"
#include "nsWrapperCacheInlines.h"
using namespace mozilla;
@ -2053,3 +2054,184 @@ nsINode::Length() const
return GetChildCount();
}
}
NS_IMPL_CYCLE_COLLECTION_1(nsNodeSelectorTearoff, mNode)
NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION(nsNodeSelectorTearoff)
NS_INTERFACE_MAP_ENTRY(nsIDOMNodeSelector)
NS_INTERFACE_MAP_END_AGGREGATED(mNode)
NS_IMPL_CYCLE_COLLECTING_ADDREF(nsNodeSelectorTearoff)
NS_IMPL_CYCLE_COLLECTING_RELEASE(nsNodeSelectorTearoff)
NS_IMETHODIMP
nsNodeSelectorTearoff::QuerySelector(const nsAString& aSelector,
nsIDOMElement **aReturn)
{
nsresult rv;
nsIContent* result = mNode->QuerySelector(aSelector, &rv);
return result ? CallQueryInterface(result, aReturn) : rv;
}
NS_IMETHODIMP
nsNodeSelectorTearoff::QuerySelectorAll(const nsAString& aSelector,
nsIDOMNodeList **aReturn)
{
return mNode->QuerySelectorAll(aSelector, aReturn);
}
// NOTE: The aPresContext pointer is NOT addrefed.
// *aSelectorList might be null even if NS_OK is returned; this
// happens when all the selectors were pseudo-element selectors.
static nsresult
ParseSelectorList(nsINode* aNode,
const nsAString& aSelectorString,
nsCSSSelectorList** aSelectorList)
{
NS_ENSURE_ARG(aNode);
nsIDocument* doc = aNode->OwnerDoc();
nsCSSParser parser(doc->CSSLoader());
nsCSSSelectorList* selectorList;
nsresult rv = parser.ParseSelectorString(aSelectorString,
doc->GetDocumentURI(),
0, // XXXbz get the line number!
&selectorList);
NS_ENSURE_SUCCESS(rv, rv);
// Filter out pseudo-element selectors from selectorList
nsCSSSelectorList** slot = &selectorList;
do {
nsCSSSelectorList* cur = *slot;
if (cur->mSelectors->IsPseudoElement()) {
*slot = cur->mNext;
cur->mNext = nullptr;
delete cur;
} else {
slot = &cur->mNext;
}
} while (*slot);
*aSelectorList = selectorList;
return NS_OK;
}
// Actually find elements matching aSelectorList (which must not be
// null) and which are descendants of aRoot and put them in aList. If
// onlyFirstMatch, then stop once the first one is found.
template<bool onlyFirstMatch, class T>
inline static nsresult FindMatchingElements(nsINode* aRoot,
const nsAString& aSelector,
T &aList)
{
nsAutoPtr<nsCSSSelectorList> selectorList;
nsresult rv = ParseSelectorList(aRoot, aSelector,
getter_Transfers(selectorList));
NS_ENSURE_SUCCESS(rv, rv);
NS_ENSURE_TRUE(selectorList, NS_OK);
NS_ASSERTION(selectorList->mSelectors,
"How can we not have any selectors?");
nsIDocument* doc = aRoot->OwnerDoc();
TreeMatchContext matchingContext(false, nsRuleWalker::eRelevantLinkUnvisited,
doc, TreeMatchContext::eNeverMatchVisited);
doc->FlushPendingLinkUpdates();
// Fast-path selectors involving IDs. We can only do this if aRoot
// is in the document and the document is not in quirks mode, since
// ID selectors are case-insensitive in quirks mode. Also, only do
// this if selectorList only has one selector, because otherwise
// ordering the elements correctly is a pain.
NS_ASSERTION(aRoot->IsElement() || aRoot->IsNodeOfType(nsINode::eDOCUMENT) ||
!aRoot->IsInDoc(),
"The optimization below to check ContentIsDescendantOf only for "
"elements depends on aRoot being either an element or a "
"document if it's in the document.");
if (aRoot->IsInDoc() &&
doc->GetCompatibilityMode() != eCompatibility_NavQuirks &&
!selectorList->mNext &&
selectorList->mSelectors->mIDList) {
nsIAtom* id = selectorList->mSelectors->mIDList->mAtom;
const nsSmallVoidArray* elements =
doc->GetAllElementsForId(nsDependentAtomString(id));
// XXXbz: Should we fall back to the tree walk if aRoot is not the
// document and |elements| is long, for some value of "long"?
if (elements) {
for (int32_t i = 0; i < elements->Count(); ++i) {
Element *element = static_cast<Element*>(elements->ElementAt(i));
if (!aRoot->IsElement() ||
(element != aRoot &&
nsContentUtils::ContentIsDescendantOf(element, aRoot))) {
// We have an element with the right id and it's a strict descendant
// of aRoot. Make sure it really matches the selector.
if (nsCSSRuleProcessor::SelectorListMatches(element, matchingContext,
selectorList)) {
aList.AppendElement(element);
if (onlyFirstMatch) {
return NS_OK;
}
}
}
}
}
// No elements with this id, or none of them are our descendants,
// or none of them match. We're done here.
return NS_OK;
}
for (nsIContent* cur = aRoot->GetFirstChild();
cur;
cur = cur->GetNextNode(aRoot)) {
if (cur->IsElement() &&
nsCSSRuleProcessor::SelectorListMatches(cur->AsElement(),
matchingContext,
selectorList)) {
aList.AppendElement(cur->AsElement());
if (onlyFirstMatch) {
return NS_OK;
}
}
}
return NS_OK;
}
struct ElementHolder {
ElementHolder() : mElement(nullptr) {}
void AppendElement(Element* aElement) {
NS_ABORT_IF_FALSE(!mElement, "Should only get one element");
mElement = aElement;
}
Element* mElement;
};
nsIContent*
nsINode::QuerySelector(const nsAString& aSelector,
nsresult *aResult)
{
NS_PRECONDITION(aResult, "Null out param?");
ElementHolder holder;
*aResult = FindMatchingElements<true>(this, aSelector, holder);
return holder.mElement;
}
/* static */
nsresult
nsINode::QuerySelectorAll(const nsAString& aSelector,
nsIDOMNodeList **aReturn)
{
NS_PRECONDITION(aReturn, "Null out param?");
nsSimpleContentList* contentList = new nsSimpleContentList(this);
NS_ENSURE_TRUE(contentList, NS_ERROR_OUT_OF_MEMORY);
NS_ADDREF(*aReturn = contentList);
return FindMatchingElements<false>(this, aSelector, *contentList);
}

View File

@ -180,6 +180,7 @@ NS_IMPL_STRING_ATTR(nsHTMLLinkElement, Rel, rel)
NS_IMPL_STRING_ATTR(nsHTMLLinkElement, Rev, rev)
NS_IMPL_STRING_ATTR(nsHTMLLinkElement, Target, target)
NS_IMPL_STRING_ATTR(nsHTMLLinkElement, Type, type)
NS_IMPL_STRING_ATTR(nsHTMLLinkElement, CrossOrigin, crossorigin)
void
nsHTMLLinkElement::GetItemValueText(nsAString& aValue)

View File

@ -326,6 +326,7 @@ MOCHITEST_FILES = \
test_iframe_sandbox_workers.html \
file_iframe_sandbox_g_if1.html \
file_iframe_sandbox_worker.js \
test_bug786564.html \
$(NULL)
MOCHITEST_BROWSER_FILES = \

View File

@ -0,0 +1,35 @@
<!DOCTYPE HTML>
<html>
<!--
https://bugzilla.mozilla.org/show_bug.cgi?id=786564
-->
<head>
<meta charset="utf-8">
<title>Test for Bug 742549</title>
<script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
<script type="application/javascript" src="reflect.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=786564">Mozilla Bug 786564</a>
<p id="display"></p>
<div id="content" style="display: none">
</div>
<pre id="test">
<script type="application/javascript">
/** Test for Bug 786564 **/
reflectString({
element: document.createElement("link"),
attribute: { content: "crossorigin", idl: "crossOrigin" },
otherValues: [ "anonymous", "use-credentials" ]
})
</script>
</pre>
</body>
</html>

View File

@ -604,7 +604,7 @@ nsSVGSVGElement::GetElementById(const nsAString & elementId, nsIDOMElement **_re
nsresult rv = NS_OK;
nsAutoString selector(NS_LITERAL_STRING("#"));
nsStyleUtil::AppendEscapedCSSIdent(PromiseFlatString(elementId), selector);
nsIContent* element = nsGenericElement::doQuerySelector(this, selector, &rv);
nsIContent* element = QuerySelector(selector, &rv);
if (NS_SUCCEEDED(rv) && element) {
return CallQueryInterface(element, _retval);
}

View File

@ -244,7 +244,7 @@ nsXULContentUtils::GetTextForNode(nsIRDFNode* aNode, nsAString& aResult)
nsCOMPtr<nsIRDFDate> dateLiteral = do_QueryInterface(aNode);
if (dateLiteral) {
int64_t value;
PRTime value;
rv = dateLiteral->GetValue(&value);
if (NS_FAILED(rv)) return rv;
@ -252,7 +252,7 @@ nsXULContentUtils::GetTextForNode(nsIRDFNode* aNode, nsAString& aResult)
rv = gFormat->FormatPRTime(nullptr /* nsILocale* locale */,
kDateFormatShort,
kTimeFormatSeconds,
PRTime(value),
value,
str);
aResult.Assign(str);

View File

@ -2518,7 +2518,7 @@ nsGlobalWindow::DialogsAreBlocked(bool *aBeingAbused)
nsGlobalWindow *topWindow = GetScriptableTop();
if (!topWindow) {
NS_ERROR("DialogsAreBlocked() called without a top window?");
NS_ASSERTION(!mDocShell, "DialogsAreBlocked() called without a top window?");
return true;
}
@ -7652,9 +7652,11 @@ nsGlobalWindow::ActivateOrDeactivate(bool aActivate)
// widgetListener should be a nsXULWindow
nsIWidgetListener* listener = topLevelWidget->GetWidgetListener();
nsCOMPtr<nsIXULWindow> window = listener->GetXULWindow();
nsCOMPtr<nsIInterfaceRequestor> req(do_QueryInterface(window));
topLevelWindow = do_GetInterface(req);
if (listener) {
nsCOMPtr<nsIXULWindow> window = listener->GetXULWindow();
nsCOMPtr<nsIInterfaceRequestor> req(do_QueryInterface(window));
topLevelWindow = do_GetInterface(req);
}
}
if (topLevelWindow) {
nsCOMPtr<nsPIDOMWindow> piWin(do_QueryInterface(topLevelWindow));

View File

@ -170,9 +170,9 @@ function Contact() {
Contact.prototype = {
__exposedProps__: {
id: 'rw',
updated: 'rw',
published: 'rw',
id: 'r',
updated: 'r',
published: 'r',
name: 'rw',
honorificPrefix: 'rw',
givenName: 'rw',

View File

@ -316,7 +316,7 @@ DeviceStorageFile::collectFilesInternal(nsTArray<nsRefPtr<DeviceStorageFile> > &
while (NS_SUCCEEDED(files->GetNextFile(getter_AddRefs(f))) && f) {
int64_t msecs;
PRTime msecs;
f->GetLastModifiedTime(&msecs);
if (msecs < aSince) {

View File

@ -306,27 +306,6 @@ interface nsIDOMMozStkCommandEvent : nsIDOMEvent
dictionary MozStkResponse
{
/**
* commandNumber from MozStkCommand.
*
* @see MozStkCommand.commandNumber
*/
unsigned short commandNumber;
/**
* One of MozStkCommand.typeOfCommand
*
* @see MozStkCommand.typeOfCommand
*/
unsigned short typeOfCommand;
/**
* Qualifiers specific to the command.
*
* @see MozStkCommand.commandQualifier
*/
unsigned short commandQualifier;
/**
* One of RESULT_*
*/

View File

@ -144,11 +144,13 @@ interface nsIDOMMozIccManager : nsIDOMEventTarget
* Send the response back to ICC after an attempt to execute STK Proactive
* Command.
*
* @param command
* Command received from ICC. See MozStkCommand.
* @param response
* The response that will be sent to ICC.
* @see MozStkResponse for the detail of response.
*/
void sendStkResponse(in jsval response);
void sendStkResponse(in jsval command, in jsval response);
/**
* Send the "Menu Selection" Envelope command to ICC for menu selection.

View File

@ -119,13 +119,14 @@ IccManager::Observe(nsISupports* aSubject,
// nsIDOMMozIccManager
NS_IMETHODIMP
IccManager::SendStkResponse(const JS::Value& aResponse)
IccManager::SendStkResponse(const JS::Value& aCommand,
const JS::Value& aResponse)
{
if (!mProvider) {
return NS_ERROR_FAILURE;
}
mProvider->SendStkResponse(GetOwner(), aResponse);
mProvider->SendStkResponse(GetOwner(), aCommand, aResponse);
return NS_OK;
}

View File

@ -16,7 +16,7 @@
* http://www.whatwg.org/specs/web-apps/current-work/
*/
[scriptable, uuid(59AE3529-170A-41E4-8D7A-241DCA6B5760)]
[scriptable, uuid(5b639ece-7b49-4507-9d38-550beb71955b)]
interface nsIDOMHTMLLinkElement : nsIDOMHTMLElement
{
attribute boolean disabled;
@ -28,4 +28,5 @@ interface nsIDOMHTMLLinkElement : nsIDOMHTMLElement
attribute DOMString rev;
attribute DOMString target;
attribute DOMString type;
attribute DOMString crossOrigin;
};

View File

@ -33,6 +33,7 @@ interface nsIMobileConnectionProvider : nsISupports
nsIDOMDOMRequest cancelUSSD(in nsIDOMWindow window);
void sendStkResponse(in nsIDOMWindow window,
in jsval command,
in jsval response);
void sendStkMenuSelection(in nsIDOMWindow window,
in unsigned short itemIdentifier,

View File

@ -231,11 +231,11 @@ TCPSocket.prototype = {
self._multiplexStream.removeStream(0);
if (status) {
this._readyState = kCLOSED;
self._readyState = kCLOSED;
let err = new Error("Connection closed while writing: " + status);
err.status = status;
this.callListener("onerror", err);
this.callListener("onclose");
self.callListener("onerror", err);
self.callListener("onclose");
return;
}

View File

@ -243,46 +243,6 @@ nsNPAPIPlugin::PluginCrashed(const nsAString& pluginDumpID,
host->PluginCrashed(this, pluginDumpID, browserDumpID);
}
#if defined(XP_MACOSX) && defined(__i386__)
static int32_t OSXVersion()
{
static int32_t gOSXVersion = 0x0;
if (gOSXVersion == 0x0) {
OSErr err = ::Gestalt(gestaltSystemVersion, (SInt32*)&gOSXVersion);
if (err != noErr) {
// This should probably be changed when our minimum version changes
NS_ERROR("Couldn't determine OS X version, assuming 10.5");
gOSXVersion = 0x00001050;
}
}
return gOSXVersion;
}
// Detects machines with Intel GMA9xx GPUs.
// kCGLRendererIDMatchingMask and kCGLRendererIntel900ID are only defined in the 10.6 SDK.
#define CGLRendererIDMatchingMask 0x00FE7F00
#define CGLRendererIntel900ID 0x00024000
static bool GMA9XXGraphics()
{
bool hasIntelGMA9XX = false;
CGLRendererInfoObj renderer = 0;
GLint rendererCount = 0;
if (::CGLQueryRendererInfo(0xffffffff, &renderer, &rendererCount) == kCGLNoError) {
for (GLint c = 0; c < rendererCount; c++) {
GLint rendProp = 0;
if (::CGLDescribeRenderer(renderer, c, kCGLRPRendererID, &rendProp) == kCGLNoError) {
if ((rendProp & CGLRendererIDMatchingMask) == CGLRendererIntel900ID) {
hasIntelGMA9XX = true;
break;
}
}
}
::CGLDestroyRendererInfo(renderer);
}
return hasIntelGMA9XX;
}
#endif
bool
nsNPAPIPlugin::RunPluginOOP(const nsPluginTag *aPluginTag)
{
@ -302,34 +262,6 @@ nsNPAPIPlugin::RunPluginOOP(const nsPluginTag *aPluginTag)
}
#endif
#if defined(XP_MACOSX) && defined(__i386__)
// Only allow on Mac OS X 10.6 or higher.
if (OSXVersion() < 0x00001060) {
return false;
}
// Blacklist Flash 10.0 or lower since it may try to negotiate Carbon/Quickdraw
// which are not supported out of process. Also blacklist Flash 10.1 if this
// machine has an Intel GMA9XX GPU because Flash will negotiate Quickdraw graphics.
// Never blacklist Flash >= 10.2.
if (aPluginTag->mFileName.EqualsIgnoreCase("flash player.plugin")) {
// If the first '.' is before position 2 or the version
// starts with 10.0 then we are dealing with Flash 10 or less.
if (aPluginTag->mVersion.FindChar('.') < 2) {
return false;
}
if (aPluginTag->mVersion.Length() >= 4) {
nsCString versionPrefix;
aPluginTag->mVersion.Left(versionPrefix, 4);
if (versionPrefix.EqualsASCII("10.0")) {
return false;
}
if (versionPrefix.EqualsASCII("10.1") && GMA9XXGraphics()) {
return false;
}
}
}
#endif
nsIPrefBranch* prefs = Preferences::GetRootBranch();
if (!prefs) {
return false;
@ -2145,7 +2077,7 @@ _getvalue(NPP npp, NPNVariable variable, void *result)
#ifndef NP_NO_QUICKDRAW
case NPNVsupportsQuickDrawBool: {
*(NPBool*)result = true;
*(NPBool*)result = false;
return NPERR_NO_ERROR;
}

View File

@ -41,7 +41,7 @@ const NPDrawingModel kDefaultDrawingModel = NPDrawingModelSyncWin;
const NPDrawingModel kDefaultDrawingModel = NPDrawingModelSyncX;
#elif defined(XP_MACOSX)
#ifndef NP_NO_QUICKDRAW
const NPDrawingModel kDefaultDrawingModel = NPDrawingModelQuickDraw;
const NPDrawingModel kDefaultDrawingModel = NPDrawingModelQuickDraw; // Not supported
#else
const NPDrawingModel kDefaultDrawingModel = NPDrawingModelCoreGraphics;
#endif

View File

@ -2004,7 +2004,7 @@ namespace {
int64_t GetPluginLastModifiedTime(const nsCOMPtr<nsIFile>& localfile)
{
int64_t fileModTime = LL_ZERO;
PRTime fileModTime = LL_ZERO;
#if defined(XP_MACOSX)
// On OS X the date of a bundle's "contents" (i.e. of its Info.plist file)

View File

@ -309,9 +309,6 @@ nsPluginInstanceOwner::nsPluginInstanceOwner()
mWidgetCreationComplete = false;
#ifdef XP_MACOSX
memset(&mCGPluginPortCopy, 0, sizeof(NP_CGContext));
#ifndef NP_NO_QUICKDRAW
memset(&mQDPluginPortCopy, 0, sizeof(NP_Port));
#endif
mInCGPaintLevel = 0;
mSentInitialTopLevelWindowEvent = false;
mColorProfile = nullptr;
@ -327,7 +324,7 @@ nsPluginInstanceOwner::nsPluginInstanceOwner()
mCachedAttrParamValues = nullptr;
#ifdef XP_MACOSX
#ifndef NP_NO_QUICKDRAW
#ifndef NP_NO_CARBON
mEventModel = NPEventModelCarbon;
#else
mEventModel = NPEventModelCocoa;
@ -1377,6 +1374,8 @@ static void InitializeNPCocoaEvent(NPCocoaEvent* event)
NPDrawingModel nsPluginInstanceOwner::GetDrawingModel()
{
#ifndef NP_NO_QUICKDRAW
// We don't support the Quickdraw drawing model any more but it's still
// the default model for i386 per NPAPI.
NPDrawingModel drawingModel = NPDrawingModelQuickDraw;
#else
NPDrawingModel drawingModel = NPDrawingModelCoreGraphics;
@ -1558,10 +1557,6 @@ void nsPluginInstanceOwner::RenderCoreAnimation(CGContextRef aCGContext,
void* nsPluginInstanceOwner::GetPluginPortCopy()
{
#ifndef NP_NO_QUICKDRAW
if (GetDrawingModel() == NPDrawingModelQuickDraw)
return &mQDPluginPortCopy;
#endif
if (GetDrawingModel() == NPDrawingModelCoreGraphics ||
GetDrawingModel() == NPDrawingModelCoreAnimation ||
GetDrawingModel() == NPDrawingModelInvalidatingCoreAnimation)
@ -1590,31 +1585,18 @@ void* nsPluginInstanceOwner::SetPluginPortAndDetectChange()
return nullptr;
mPluginWindow->window = pluginPort;
#ifndef NP_NO_QUICKDRAW
NPDrawingModel drawingModel = GetDrawingModel();
if (drawingModel == NPDrawingModelQuickDraw) {
NP_Port* windowQDPort = static_cast<NP_Port*>(mPluginWindow->window);
if (windowQDPort->port != mQDPluginPortCopy.port) {
mQDPluginPortCopy.port = windowQDPort->port;
#ifndef NP_NO_CARBON
if (GetEventModel() == NPEventModelCarbon &&
GetDrawingModel() == NPDrawingModelCoreGraphics) {
NP_CGContext* windowCGPort = static_cast<NP_CGContext*>(mPluginWindow->window);
if ((windowCGPort->context != mCGPluginPortCopy.context) ||
(windowCGPort->window != mCGPluginPortCopy.window)) {
mCGPluginPortCopy.context = windowCGPort->context;
mCGPluginPortCopy.window = windowCGPort->window;
mPluginPortChanged = true;
}
} else if (drawingModel == NPDrawingModelCoreGraphics ||
drawingModel == NPDrawingModelCoreAnimation ||
drawingModel == NPDrawingModelInvalidatingCoreAnimation)
#endif
{
#ifndef NP_NO_CARBON
if (GetEventModel() == NPEventModelCarbon) {
NP_CGContext* windowCGPort = static_cast<NP_CGContext*>(mPluginWindow->window);
if ((windowCGPort->context != mCGPluginPortCopy.context) ||
(windowCGPort->window != mCGPluginPortCopy.window)) {
mCGPluginPortCopy.context = windowCGPort->context;
mCGPluginPortCopy.window = windowCGPort->window;
mPluginPortChanged = true;
}
}
#endif
}
#endif
return mPluginWindow->window;
}
@ -3479,39 +3461,26 @@ void* nsPluginInstanceOwner::FixUpPluginWindow(int32_t inPaintState)
// printf("GetPluginClipRect returning visible %d\n", widgetVisible);
#ifndef NP_NO_QUICKDRAW
// set the port coordinates
NPDrawingModel drawingModel = GetDrawingModel();
if (drawingModel == NPDrawingModelQuickDraw) {
mPluginWindow->x = -static_cast<NP_Port*>(pluginPort)->portx;
mPluginWindow->y = -static_cast<NP_Port*>(pluginPort)->porty;
}
else if (drawingModel == NPDrawingModelCoreGraphics ||
drawingModel == NPDrawingModelCoreAnimation ||
drawingModel == NPDrawingModelInvalidatingCoreAnimation)
// This would be a lot easier if we could use obj-c here,
// but we can't. Since we have only nsIWidget and we can't
// use its native widget (an obj-c object) we have to go
// from the widget's screen coordinates to its window coords
// instead of straight to window coords.
nsIntPoint geckoScreenCoords = mWidget->WidgetToScreenOffset();
nsRect windowRect;
#ifndef NP_NO_CARBON
if (eventModel == NPEventModelCarbon) {
NS_NPAPI_CarbonWindowFrame(static_cast<WindowRef>(static_cast<NP_CGContext*>(pluginPort)->window), windowRect);
} else
#endif
{
// This would be a lot easier if we could use obj-c here,
// but we can't. Since we have only nsIWidget and we can't
// use its native widget (an obj-c object) we have to go
// from the widget's screen coordinates to its window coords
// instead of straight to window coords.
nsIntPoint geckoScreenCoords = mWidget->WidgetToScreenOffset();
nsRect windowRect;
#ifndef NP_NO_CARBON
if (eventModel == NPEventModelCarbon)
NS_NPAPI_CarbonWindowFrame(static_cast<WindowRef>(static_cast<NP_CGContext*>(pluginPort)->window), windowRect);
else
#endif
{
NS_NPAPI_CocoaWindowFrame(cocoaTopLevelWindow, windowRect);
}
mPluginWindow->x = geckoScreenCoords.x - windowRect.x;
mPluginWindow->y = geckoScreenCoords.y - windowRect.y;
NS_NPAPI_CocoaWindowFrame(cocoaTopLevelWindow, windowRect);
}
mPluginWindow->x = geckoScreenCoords.x - windowRect.x;
mPluginWindow->y = geckoScreenCoords.y - windowRect.y;
NPRect oldClipRect = mPluginWindow->clipRect;
// fix up the clipping region
@ -3578,13 +3547,8 @@ void* nsPluginInstanceOwner::FixUpPluginWindow(int32_t inPaintState)
ProcessEvent(pluginEvent);
}
#ifndef NP_NO_QUICKDRAW
if (drawingModel == NPDrawingModelQuickDraw)
return ::GetWindowFromPort(static_cast<NP_Port*>(pluginPort)->port);
#endif
#ifdef MAC_CARBON_PLUGINS
if (drawingModel == NPDrawingModelCoreGraphics && eventModel == NPEventModelCarbon)
if (GetDrawingModel() == NPDrawingModelCoreGraphics && eventModel == NPEventModelCarbon)
return static_cast<NP_CGContext*>(pluginPort)->window;
#endif
@ -3735,14 +3699,16 @@ void nsPluginInstanceOwner::SetFrame(nsObjectFrame *aFrame)
}
// Scroll position listening is only required for Carbon event model plugins on Mac OS X.
#if defined(XP_MACOSX) && !defined(NP_NO_QUICKDRAW)
#if defined(XP_MACOSX) && !defined(NP_NO_CARBON)
// Our frame is changing or going away, unregister for a scroll position listening.
// It's OK to unregister when we didn't register, so don't be strict about unregistering.
// Better to unregister when we didn't have to than to not unregister when we should.
for (nsIFrame* f = mObjectFrame; f; f = nsLayoutUtils::GetCrossDocParentFrame(f)) {
nsIScrollableFrame* sf = do_QueryFrame(f);
if (sf) {
sf->RemoveScrollPositionListener(this);
if (GetEventModel() == NPEventModelCarbon) {
for (nsIFrame* f = mObjectFrame; f; f = nsLayoutUtils::GetCrossDocParentFrame(f)) {
nsIScrollableFrame* sf = do_QueryFrame(f);
if (sf) {
sf->RemoveScrollPositionListener(this);
}
}
}
#endif
@ -3766,7 +3732,7 @@ void nsPluginInstanceOwner::SetFrame(nsObjectFrame *aFrame)
mObjectFrame->Invalidate(mObjectFrame->GetContentRectRelativeToSelf());
// Scroll position listening is only required for Carbon event model plugins on Mac OS X.
#if defined(XP_MACOSX) && !defined(NP_NO_QUICKDRAW)
#if defined(XP_MACOSX) && !defined(NP_NO_CARBON)
// We need to register as a scroll position listener on every scrollable frame up to the top.
if (GetEventModel() == NPEventModelCarbon) {
for (nsIFrame* f = aFrame; f; f = nsLayoutUtils::GetCrossDocParentFrame(f)) {

View File

@ -301,9 +301,6 @@ private:
#ifdef XP_MACOSX
NP_CGContext mCGPluginPortCopy;
#ifndef NP_NO_QUICKDRAW
NP_Port mQDPluginPortCopy;
#endif
int32_t mInCGPaintLevel;
mozilla::RefPtr<MacIOSurface> mIOSurface;
mozilla::RefPtr<nsCARenderer> mCARenderer;

View File

@ -430,9 +430,6 @@ PluginInstanceParent::AnswerNPN_SetValue_NPPVpluginDrawingModel(
#if defined(XP_WIN)
drawingModel == NPDrawingModelSyncWin
#elif defined(XP_MACOSX)
#ifndef NP_NO_QUICKDRAW
drawingModel == NPDrawingModelQuickDraw ||
#endif
drawingModel == NPDrawingModelOpenGL ||
drawingModel == NPDrawingModelCoreGraphics
#elif defined(MOZ_X11)

View File

@ -156,7 +156,19 @@ NetworkManager.prototype = {
debug("Network " + network.name + " changed state to " + network.state);
switch (network.state) {
case Ci.nsINetworkInterface.NETWORK_STATE_CONNECTED:
// Add host route on secondary APN
if (network.type == Ci.nsINetworkInterface.NETWORK_TYPE_MOBILE_MMS ||
network.type == Ci.nsINetworkInterface.NETWORK_TYPE_MOBILE_SUPL) {
this.addHostRoute(network);
}
this.setAndConfigureActive();
break;
case Ci.nsINetworkInterface.NETWORK_STATE_DISCONNECTED:
// Remove host route on secondary APN
if (network.type == Ci.nsINetworkInterface.NETWORK_TYPE_MOBILE_MMS ||
network.type == Ci.nsINetworkInterface.NETWORK_TYPE_MOBILE_SUPL) {
this.removeHostRoute(network);
}
this.setAndConfigureActive();
break;
}
@ -185,6 +197,11 @@ NetworkManager.prototype = {
Cr.NS_ERROR_INVALID_ARG);
}
this.networkInterfaces[network.name] = network;
// Add host route on secondary APN
if (network.type == Ci.nsINetworkInterface.NETWORK_TYPE_MOBILE_MMS ||
network.type == Ci.nsINetworkInterface.NETWORK_TYPE_MOBILE_SUPL) {
this.addHostRoute(network);
}
this.setAndConfigureActive();
Services.obs.notifyObservers(network, TOPIC_INTERFACE_REGISTERED, null);
debug("Network '" + network.name + "' registered.");
@ -200,6 +217,11 @@ NetworkManager.prototype = {
Cr.NS_ERROR_INVALID_ARG);
}
delete this.networkInterfaces[network.name];
// Remove host route on secondary APN
if (network.type == Ci.nsINetworkInterface.NETWORK_TYPE_MOBILE_MMS ||
network.type == Ci.nsINetworkInterface.NETWORK_TYPE_MOBILE_SUPL) {
this.removeHostRoute(network);
}
this.setAndConfigureActive();
Services.obs.notifyObservers(network, TOPIC_INTERFACE_UNREGISTERED, null);
debug("Network '" + network.name + "' unregistered.");
@ -263,6 +285,12 @@ NetworkManager.prototype = {
// The override was just set, so reconfigure the network.
if (this.active != this._overriddenActive) {
this.active = this._overriddenActive;
// Don't set default route and DNS on secondary APN
if (oldActive &&
(oldActive.type == Ci.nsINetworkInterface.NETWORK_TYPE_MOBILE_MMS ||
oldActive.type == Ci.nsINetworkInterface.NETWORK_TYPE_MOBILE_SUPL)) {
return;
}
this.setDefaultRouteAndDNS(oldActive);
}
return;
@ -289,6 +317,12 @@ NetworkManager.prototype = {
}
}
if (this.active) {
// Don't set default route and DNS on secondary APN
if (oldActive &&
(oldActive.type == Ci.nsINetworkInterface.NETWORK_TYPE_MOBILE_MMS ||
oldActive.type == Ci.nsINetworkInterface.NETWORK_TYPE_MOBILE_SUPL)) {
return;
}
this.setDefaultRouteAndDNS(oldActive);
}
Services.io.offline = !this.active;
@ -305,6 +339,34 @@ NetworkManager.prototype = {
this.setNetworkProxy();
},
addHostRoute: function addHostRoute(network) {
debug("Going to add host route on " + network.name);
let options = {
cmd: "addHostRoute",
ifname: network.name,
dns1: network.dns1,
dns2: network.dns2,
gateway: network.gateway,
httpproxy: network.httpProxyHost,
mmsproxy: Services.prefs.getCharPref("ril.data.mmsproxy")
};
this.worker.postMessage(options);
},
removeHostRoute: function removeHostRoute(network) {
debug("Going to remove host route on " + network.name);
let options = {
cmd: "removeHostRoute",
ifname: network.name,
dns1: network.dns1,
dns2: network.dns2,
gateway: network.gateway,
httpproxy: network.httpProxyHost,
mmsproxy: Services.prefs.getCharPref("ril.data.mmsproxy")
};
this.worker.postMessage(options);
},
setNetworkProxy: function setNetworkProxy() {
try {
if (!this.active.httpProxyHost || this.active.httpProxyHost == "") {

View File

@ -381,11 +381,12 @@ RILContentHelper.prototype = {
return request;
},
sendStkResponse: function sendStkResponse(window, response) {
sendStkResponse: function sendStkResponse(window, command, response) {
if (window == null) {
throw Components.Exception("Can't get window object",
Cr.NS_ERROR_UNEXPECTED);
}
response.command = command;
cpmm.sendAsyncMessage("RIL:SendStkResponse", response);
},

View File

@ -589,21 +589,7 @@ RadioInterfaceLayer.prototype = {
if (!newInfo.batch) {
ppmm.broadcastAsyncMessage("RIL:DataInfoChanged", dataInfo);
}
if (!this.dataCallSettings["enabled"]) {
return;
}
let isRegistered =
newInfo.state == RIL.GECKO_MOBILE_CONNECTION_STATE_REGISTERED &&
(!newInfo.roaming || this._isDataRoamingEnabled());
let haveDataConnection =
newInfo.type != RIL.GECKO_MOBILE_CONNECTION_STATE_UNKNOWN;
if (isRegistered && haveDataConnection) {
debug("Radio is ready for data connection.");
this.updateRILNetworkInterface();
}
this.updateRILNetworkInterface();
},
handleSignalStrengthChange: function handleSignalStrengthChange(message) {
@ -693,6 +679,7 @@ RadioInterfaceLayer.prototype = {
// This check avoids data call connection if the radio is not ready
// yet after toggling off airplane mode.
if (this.rilContext.radioState != RIL.GECKO_RADIOSTATE_READY) {
debug("RIL is not ready for data connection: radio's not ready");
return;
}
@ -709,11 +696,29 @@ RadioInterfaceLayer.prototype = {
if (!this.dataCallSettings["enabled"] && RILNetworkInterface.connected) {
debug("Data call settings: disconnect data call.");
RILNetworkInterface.disconnect();
return;
}
if (this.dataCallSettings["enabled"] && !RILNetworkInterface.connected) {
debug("Data call settings connect data call.");
RILNetworkInterface.connect(this.dataCallSettings);
if (!this.dataCallSettings["enabled"] || RILNetworkInterface.connected) {
debug("Data call settings: nothing to do.");
return;
}
let dataInfo = this.rilContext.data;
let isRegistered =
dataInfo.state == RIL.GECKO_MOBILE_CONNECTION_STATE_REGISTERED;
let haveDataConnection =
dataInfo.type != RIL.GECKO_MOBILE_CONNECTION_STATE_UNKNOWN;
if (!isRegistered || !haveDataConnection) {
debug("RIL is not ready for data connection: Phone's not registered " +
"or doesn't have data connection.");
return;
}
if (dataInfo.roaming && !this.dataCallSettings["roaming_enabled"]) {
debug("We're roaming, but data roaming is disabled.");
return;
}
debug("Data call settings: connect data call.");
RILNetworkInterface.connect(this.dataCallSettings);
},
/**
@ -1757,9 +1762,10 @@ let RILNetworkInterface = {
state: Ci.nsINetworkInterface.NETWORK_STATE_UNKNOWN,
NETWORK_TYPE_WIFI: Ci.nsINetworkInterface.NETWORK_TYPE_WIFI,
NETWORK_TYPE_MOBILE: Ci.nsINetworkInterface.NETWORK_TYPE_MOBILE,
NETWORK_TYPE_MOBILE_MMS: Ci.nsINetworkInterface.NETWORK_TYPE_MOBILE_MMS,
NETWORK_TYPE_WIFI: Ci.nsINetworkInterface.NETWORK_TYPE_WIFI,
NETWORK_TYPE_MOBILE: Ci.nsINetworkInterface.NETWORK_TYPE_MOBILE,
NETWORK_TYPE_MOBILE_MMS: Ci.nsINetworkInterface.NETWORK_TYPE_MOBILE_MMS,
NETWORK_TYPE_MOBILE_SUPL: Ci.nsINetworkInterface.NETWORK_TYPE_MOBILE_SUPL,
/**
* Standard values for the APN connection retry process

View File

@ -166,6 +166,26 @@ function runDHCPAndSetDefaultRouteAndDNS(options) {
setDefaultRouteAndDNS(dhcp);
}
/**
* Add host route for given network interface.
*/
function addHostRoute(options) {
libnetutils.ifc_add_route(options.ifname, options.dns1, 32, options.gateway);
libnetutils.ifc_add_route(options.ifname, options.dns2, 32, options.gateway);
libnetutils.ifc_add_route(options.ifname, options.httpproxy, 32, options.gateway);
libnetutils.ifc_add_route(options.ifname, options.mmsproxy, 32, options.gateway);
}
/**
* Remove host route for given network interface.
*/
function removeHostRoute(options) {
libnetutils.ifc_remove_route(options.ifname, options.dns1, 32, options.gateway);
libnetutils.ifc_remove_route(options.ifname, options.dns2, 32, options.gateway);
libnetutils.ifc_remove_route(options.ifname, options.httpproxy, 32, options.gateway);
libnetutils.ifc_remove_route(options.ifname, options.mmsproxy, 32, options.gateway);
}
let gCommandQueue = [];
let gCurrentCommand = null;
let gCurrentCallback = null;

View File

@ -7,7 +7,7 @@
/**
* Information about networks that is exposed to network manager API consumers.
*/
[scriptable, uuid(463ed2f3-1739-41bc-a967-1e816764f915)]
[scriptable, uuid(d70b9d95-87d5-4ce9-aff7-4323dac79b07)]
interface nsINetworkInterface : nsISupports
{
const long NETWORK_STATE_UNKNOWN = -1;
@ -27,6 +27,7 @@ interface nsINetworkInterface : nsISupports
const long NETWORK_TYPE_WIFI = 0;
const long NETWORK_TYPE_MOBILE = 1;
const long NETWORK_TYPE_MOBILE_MMS = 2;
const long NETWORK_TYPE_MOBILE_SUPL = 3;
/**
* Network type. One of the NETWORK_TYPE_* constants.

View File

@ -1938,9 +1938,7 @@ let RIL = {
/**
* Send STK terminal response.
*
* @param commandNumber
* @param typeOfCommand
* @param commandQualifier
* @param command
* @param resultCode
* @param [optional] itemIdentifier
* @param [optional] input
@ -1984,9 +1982,15 @@ let RIL = {
GsmPDUHelper.writeHexOctet(COMPREHENSIONTLV_TAG_COMMAND_DETAILS |
COMPREHENSIONTLV_FLAG_CR);
GsmPDUHelper.writeHexOctet(3);
GsmPDUHelper.writeHexOctet(response.commandNumber);
GsmPDUHelper.writeHexOctet(response.typeOfCommand);
GsmPDUHelper.writeHexOctet(response.commandQualifier);
if (response.command) {
GsmPDUHelper.writeHexOctet(response.command.commandNumber);
GsmPDUHelper.writeHexOctet(response.command.typeOfCommand);
GsmPDUHelper.writeHexOctet(response.command.commandQualifier);
} else {
GsmPDUHelper.writeHexOctet(0x00);
GsmPDUHelper.writeHexOctet(0x00);
GsmPDUHelper.writeHexOctet(0x00);
}
// Device Identifier
// According to TS102.223/TS31.111 section 6.8 Structure of
@ -3070,9 +3074,6 @@ let RIL = {
COMPREHENSIONTLV_TAG_COMMAND_DETAILS, ctlvs);
if (!ctlv) {
RIL.sendStkTerminalResponse({
commandNumber: 0,
typeOfCommand: 0,
commandQualifier: 0,
resultCode: STK_RESULT_CMD_DATA_NOT_UNDERSTOOD});
throw new Error("Can't find COMMAND_DETAILS ComprehensionTlv");
}
@ -3086,11 +3087,9 @@ let RIL = {
let param = StkCommandParamsFactory.createParam(cmdDetails, ctlvs);
if (param) {
RIL.sendDOMMessage({rilMessageType: "stkcommand",
commandNumber: cmdDetails.commandNumber,
typeOfCommand: cmdDetails.typeOfCommand,
commandQualifier: cmdDetails.commandQualifier,
options: param});
cmdDetails.rilMessageType = "stkcommand";
cmdDetails.options = param;
RIL.sendDOMMessage(cmdDetails);
}
},
@ -5426,10 +5425,8 @@ let StkCommandParamsFactory = {
if (menu.items.length == 0) {
RIL.sendStkTerminalResponse({
commandNumber: cmdDetails.commandNumber,
typeOfCommand: cmdDetails.typeOfCommand,
commandQualifier: cmdDetails.commandQualifier,
resultCode: STK_RESULT_REQUIRED_VALUES_MISSING});
command: cmdDetails,
resultCode: STK_RESULT_REQUIRED_VALUES_MISSING});
throw new Error("Stk Menu: Required value missing : items");
}
@ -5455,9 +5452,7 @@ let StkCommandParamsFactory = {
let ctlv = StkProactiveCmdHelper.searchForTag(COMPREHENSIONTLV_TAG_TEXT_STRING, ctlvs);
if (!ctlv) {
RIL.sendStkTerminalResponse({
commandNumber: cmdDetails.commandNumber,
typeOfCommand: cmdDetails.typeOfCommand,
commandQualifier: cmdDetails.commandQualifier,
command: cmdDetails,
resultCode: STK_RESULT_REQUIRED_VALUES_MISSING});
throw new Error("Stk Display Text: Required value missing : Text String");
}
@ -5487,9 +5482,7 @@ let StkCommandParamsFactory = {
let ctlv = StkProactiveCmdHelper.searchForTag(COMPREHENSIONTLV_TAG_TEXT_STRING, ctlvs);
if (!ctlv) {
RIL.sendStkTerminalResponse({
commandNumber: cmdDetails.commandNumber,
typeOfCommand: cmdDetails.typeOfCommand,
commandQualifier: cmdDetails.commandQualifier,
command: cmdDetails,
resultCode: STK_RESULT_REQUIRED_VALUES_MISSING});
throw new Error("Stk Set Up Idle Text: Required value missing : Text String");
}
@ -5504,9 +5497,7 @@ let StkCommandParamsFactory = {
let ctlv = StkProactiveCmdHelper.searchForTag(COMPREHENSIONTLV_TAG_TEXT_STRING, ctlvs);
if (!ctlv) {
RIL.sendStkTerminalResponse({
commandNumber: cmdDetails.commandNumber,
typeOfCommand: cmdDetails.typeOfCommand,
commandQualifier: cmdDetails.commandQualifier,
command: cmdDetails,
resultCode: STK_RESULT_REQUIRED_VALUES_MISSING});
throw new Error("Stk Get InKey: Required value missing : Text String");
}
@ -5545,9 +5536,7 @@ let StkCommandParamsFactory = {
let ctlv = StkProactiveCmdHelper.searchForTag(COMPREHENSIONTLV_TAG_TEXT_STRING, ctlvs);
if (!ctlv) {
RIL.sendStkTerminalResponse({
commandNumber: cmdDetails.commandNumber,
typeOfCommand: cmdDetails.typeOfCommand,
commandQualifier: cmdDetails.commandQualifier,
command: cmdDetails,
resultCode: STK_RESULT_REQUIRED_VALUES_MISSING});
throw new Error("Stk Get Input: Required value missing : Text String");
}
@ -5598,9 +5587,7 @@ let StkCommandParamsFactory = {
let ctlv = StkProactiveCmdHelper.searchForTag(COMPREHENSIONTLV_TAG_ALPHA_ID, ctlvs);
if (!ctlv) {
RIL.sendStkTerminalResponse({
commandNumber: cmdDetails.commandNumber,
typeOfCommand: cmdDetails.typeOfCommand,
commandQualifier: cmdDetails.commandQualifier,
command: cmdDetails,
resultCode: STK_RESULT_REQUIRED_VALUES_MISSING});
throw new Error("Stk Event Notfiy: Required value missing : Alpha ID");
}
@ -5627,9 +5614,7 @@ let StkCommandParamsFactory = {
let ctlv = StkProactiveCmdHelper.searchForTag(COMPREHENSIONTLV_TAG_ADDRESS, ctlvs);
if (!ctlv) {
RIL.sendStkTerminalResponse({
commandNumber: cmdDetails.commandNumber,
typeOfCommand: cmdDetails.typeOfCommand,
commandQualifier: cmdDetails.commandQualifier,
command: cmdDetails,
resultCode: STK_RESULT_REQUIRED_VALUES_MISSING});
throw new Error("Stk Set Up Call: Required value missing : Adress");
}
@ -5644,9 +5629,7 @@ let StkCommandParamsFactory = {
let ctlv = StkProactiveCmdHelper.searchForTag(COMPREHENSIONTLV_TAG_URL, ctlvs);
if (!ctlv) {
RIL.sendStkTerminalResponse({
commandNumber: cmdDetails.commandNumber,
typeOfCommand: cmdDetails.typeOfCommand,
commandQualifier: cmdDetails.commandQualifier,
command: cmdDetails,
resultCode: STK_RESULT_REQUIRED_VALUES_MISSING});
throw new Error("Stk Launch Browser: Required value missing : URL");
}
@ -5914,9 +5897,6 @@ let ComprehensionTlvHelper = {
case 0xff: // Not used.
case 0x80: // Reserved for future use.
RIL.sendStkTerminalResponse({
commandNumber: 0,
typeOfCommand: 0,
commandQualifier: 0,
resultCode: STK_RESULT_CMD_DATA_NOT_UNDERSTOOD});
throw new Error("Invalid octet when parsing Comprehension TLV :" + temp);
break;
@ -5959,9 +5939,6 @@ let ComprehensionTlvHelper = {
hlen++;
if (length < 0x80) {
RIL.sendStkTerminalResponse({
commandNumber: 0,
typeOfCommand: 0,
commandQualifier: 0,
resultCode: STK_RESULT_CMD_DATA_NOT_UNDERSTOOD});
throw new Error("Invalid length in Comprehension TLV :" + length);
}
@ -5970,9 +5947,6 @@ let ComprehensionTlvHelper = {
hlen += 2;
if (lenth < 0x0100) {
RIL.sendStkTerminalResponse({
commandNumber: 0,
typeOfCommand: 0,
commandQualifier: 0,
resultCode: STK_RESULT_CMD_DATA_NOT_UNDERSTOOD});
throw new Error("Invalid length in 3-byte Comprehension TLV :" + length);
}
@ -5983,17 +5957,11 @@ let ComprehensionTlvHelper = {
hlen += 3;
if (length < 0x010000) {
RIL.sendStkTerminalResponse({
commandNumber: 0,
typeOfCommand: 0,
commandQualifier: 0,
resultCode: STK_RESULT_CMD_DATA_NOT_UNDERSTOOD});
throw new Error("Invalid length in 4-byte Comprehension TLV :" + length);
}
} else {
RIL.sendStkTerminalResponse({
commandNumber: 0,
typeOfCommand: 0,
commandQualifier: 0,
resultCode: STK_RESULT_CMD_DATA_NOT_UNDERSTOOD});
throw new Error("Invalid octet in Comprehension TLV :" + length);
}
@ -6047,25 +6015,16 @@ let BerTlvHelper = {
length = GsmPDUHelper.readHexOctet();
if (length < 0x80) {
RIL.sendStkTerminalResponse({
commandNumber: 0,
typeOfCommand: 0,
commandQualifier: 0,
resultCode: STK_RESULT_CMD_DATA_NOT_UNDERSTOOD});
throw new Error("Invalid length " + length);
}
} else {
RIL.sendStkTerminalResponse({
commandNumber: 0,
typeOfCommand: 0,
commandQualifier: 0,
resultCode: STK_RESULT_CMD_DATA_NOT_UNDERSTOOD});
throw new Error("Invalid length octet " + temp);
}
} else {
RIL.sendStkTerminalResponse({
commandNumber: 0,
typeOfCommand: 0,
commandQualifier: 0,
resultCode: STK_RESULT_CMD_DATA_NOT_UNDERSTOOD});
throw new Error("Unknown BER tag");
}
@ -6073,9 +6032,6 @@ let BerTlvHelper = {
// If the value length of the BerTlv is larger than remaining value on Parcel.
if (dataLen - hlen < length) {
RIL.sendStkTerminalResponse({
commandNumber: 0,
typeOfCommand: 0,
commandQualifier: 0,
resultCode: STK_RESULT_CMD_DATA_NOT_UNDERSTOOD});
throw new Error("BerTlvHelper value length too long!!");
return;

View File

@ -153,6 +153,18 @@ let libnetutils = (function () {
ctypes.int,
ctypes.int,
ctypes.int),
ifc_add_route: library.declare("ifc_add_route", ctypes.default_abi,
ctypes.int, // return value
ctypes.char.ptr, // ifname
ctypes.char.ptr, // dst
ctypes.int, // prefix_length
ctypes.char.ptr), // gw
ifc_remove_route: library.declare("ifc_remove_route", ctypes.default_abi,
ctypes.int, // return value
ctypes.char.ptr, // ifname
ctypes.char.ptr, // dst
ctypes.int, // prefix_length
ctypes.char.ptr), // gw
dhcp_stop: library.declare("dhcp_stop", ctypes.default_abi,
ctypes.int,
ctypes.char.ptr),

View File

@ -1322,9 +1322,10 @@ let WifiNetworkInterface = {
state: Ci.nsINetworkInterface.NETWORK_STATE_UNKNOWN,
NETWORK_TYPE_WIFI: Ci.nsINetworkInterface.NETWORK_TYPE_WIFI,
NETWORK_TYPE_MOBILE: Ci.nsINetworkInterface.NETWORK_TYPE_MOBILE,
NETWORK_TYPE_MOBILE_MMS: Ci.nsINetworkInterface.NETWORK_TYPE_MOBILE_MMS,
NETWORK_TYPE_WIFI: Ci.nsINetworkInterface.NETWORK_TYPE_WIFI,
NETWORK_TYPE_MOBILE: Ci.nsINetworkInterface.NETWORK_TYPE_MOBILE,
NETWORK_TYPE_MOBILE_MMS: Ci.nsINetworkInterface.NETWORK_TYPE_MOBILE_MMS,
NETWORK_TYPE_MOBILE_SUPL: Ci.nsINetworkInterface.NETWORK_TYPE_MOBILE_SUPL,
type: Ci.nsINetworkInterface.NETWORK_TYPE_WIFI,

View File

@ -358,104 +358,6 @@ nsCookiePermission::CanSetCookie(nsIURI *aURI,
return NS_OK;
}
NS_IMETHODIMP
nsCookiePermission::GetOriginatingURI(nsIChannel *aChannel,
nsIURI **aURI)
{
/* to find the originating URI, we use the loadgroup of the channel to obtain
* the window owning the load, and from there, we find the top same-type
* window and its URI. there are several possible cases:
*
* 1) no channel.
*
* 2) a channel with the "force allow third party cookies" option set.
* since we may not have a window, we return the channel URI in this case.
*
* 3) a channel, but no window. this can occur when the consumer kicking
* off the load doesn't provide one to the channel, and should be limited
* to loads of certain types of resources.
*
* 4) a window equal to the top window of same type, with the channel its
* document channel. this covers the case of a freshly kicked-off load
* (e.g. the user typing something in the location bar, or clicking on a
* bookmark), where the window's URI hasn't yet been set, and will be
* bogus. we return the channel URI in this case.
*
* 5) Anything else. this covers most cases for an ordinary page load from
* the location bar, and will catch nested frames within a page, image
* loads, etc. we return the URI of the root window's document's principal
* in this case.
*/
*aURI = nullptr;
// case 1)
if (!aChannel)
return NS_ERROR_NULL_POINTER;
// case 2)
nsCOMPtr<nsIHttpChannelInternal> httpChannelInternal = do_QueryInterface(aChannel);
if (httpChannelInternal)
{
bool doForce = false;
if (NS_SUCCEEDED(httpChannelInternal->GetForceAllowThirdPartyCookie(&doForce)) && doForce)
{
// return the channel's URI (we may not have a window)
aChannel->GetURI(aURI);
if (!*aURI)
return NS_ERROR_NULL_POINTER;
return NS_OK;
}
}
// find the associated window and its top window
nsCOMPtr<nsILoadContext> ctx;
NS_QueryNotificationCallbacks(aChannel, ctx);
nsCOMPtr<nsIDOMWindow> topWin, ourWin;
if (ctx) {
ctx->GetTopWindow(getter_AddRefs(topWin));
ctx->GetAssociatedWindow(getter_AddRefs(ourWin));
}
// case 3)
if (!topWin)
return NS_ERROR_INVALID_ARG;
// case 4)
if (ourWin == topWin) {
// Check whether this is the document channel for this window (representing
// a load of a new page). This is a bit of a nasty hack, but we will
// hopefully flag these channels better later.
nsLoadFlags flags;
aChannel->GetLoadFlags(&flags);
if (flags & nsIChannel::LOAD_DOCUMENT_URI) {
// get the channel URI - the window's will be bogus
aChannel->GetURI(aURI);
if (!*aURI)
return NS_ERROR_NULL_POINTER;
return NS_OK;
}
}
// case 5) - get the originating URI from the top window's principal
nsCOMPtr<nsIScriptObjectPrincipal> scriptObjPrin = do_QueryInterface(topWin);
NS_ENSURE_TRUE(scriptObjPrin, NS_ERROR_UNEXPECTED);
nsIPrincipal* prin = scriptObjPrin->GetPrincipal();
NS_ENSURE_TRUE(prin, NS_ERROR_UNEXPECTED);
prin->GetURI(aURI);
if (!*aURI)
return NS_ERROR_NULL_POINTER;
// all done!
return NS_OK;
}
NS_IMETHODIMP
nsCookiePermission::Observe(nsISupports *aSubject,
const char *aTopic,

View File

@ -724,13 +724,19 @@ GLContext::CreateTextureImage(const nsIntSize& aSize,
}
void GLContext::ApplyFilterToBoundTexture(gfxPattern::GraphicsFilter aFilter)
{
ApplyFilterToBoundTexture(LOCAL_GL_TEXTURE_2D, aFilter);
}
void GLContext::ApplyFilterToBoundTexture(GLuint aTarget,
gfxPattern::GraphicsFilter aFilter)
{
if (aFilter == gfxPattern::FILTER_NEAREST) {
fTexParameteri(LOCAL_GL_TEXTURE_2D, LOCAL_GL_TEXTURE_MIN_FILTER, LOCAL_GL_NEAREST);
fTexParameteri(LOCAL_GL_TEXTURE_2D, LOCAL_GL_TEXTURE_MAG_FILTER, LOCAL_GL_NEAREST);
fTexParameteri(aTarget, LOCAL_GL_TEXTURE_MIN_FILTER, LOCAL_GL_NEAREST);
fTexParameteri(aTarget, LOCAL_GL_TEXTURE_MAG_FILTER, LOCAL_GL_NEAREST);
} else {
fTexParameteri(LOCAL_GL_TEXTURE_2D, LOCAL_GL_TEXTURE_MIN_FILTER, LOCAL_GL_LINEAR);
fTexParameteri(LOCAL_GL_TEXTURE_2D, LOCAL_GL_TEXTURE_MAG_FILTER, LOCAL_GL_LINEAR);
fTexParameteri(aTarget, LOCAL_GL_TEXTURE_MIN_FILTER, LOCAL_GL_LINEAR);
fTexParameteri(aTarget, LOCAL_GL_TEXTURE_MAG_FILTER, LOCAL_GL_LINEAR);
}
}

View File

@ -770,6 +770,12 @@ public:
*/
void ApplyFilterToBoundTexture(gfxPattern::GraphicsFilter aFilter);
/**
* Applies aFilter to the texture currently bound to aTarget.
*/
void ApplyFilterToBoundTexture(GLuint aTarget,
gfxPattern::GraphicsFilter aFilter);
virtual bool BindExternalBuffer(GLuint texture, void* buffer) { return false; }
virtual bool UnbindExternalBuffer(GLuint texture) { return false; }

View File

@ -19,6 +19,7 @@
#define GET_NATIVE_WINDOW(aWidget) (EGLNativeWindowType)static_cast<QWidget*>(aWidget->GetNativeData(NS_NATIVE_SHELLWIDGET))->winId()
#elif defined(MOZ_WIDGET_GONK)
#define GET_NATIVE_WINDOW(aWidget) ((EGLNativeWindowType)aWidget->GetNativeData(NS_NATIVE_WINDOW))
#include "HWComposer.h"
#endif
#if defined(MOZ_X11)
@ -267,6 +268,15 @@ public:
#ifdef DEBUG
printf_stderr("Initializing context %p surface %p on display %p\n", mContext, mSurface, EGL_DISPLAY());
#endif
#ifdef MOZ_WIDGET_GONK
if (!aIsOffscreen)
mHwc = new HWComposer();
if (mHwc && mHwc->init()) {
NS_WARNING("HWComposer initialization failed!");
mHwc = nullptr;
}
#endif
}
@ -567,7 +577,13 @@ public:
bool SwapBuffers()
{
if (mSurface && !mPlatformContext) {
return sEGLLibrary.fSwapBuffers(EGL_DISPLAY(), mSurface);
#ifdef MOZ_WIDGET_GONK
if (mHwc)
return !mHwc->swapBuffers((hwc_display_t)EGL_DISPLAY(),
(hwc_surface_t)mSurface);
else
#endif
return sEGLLibrary.fSwapBuffers(EGL_DISPLAY(), mSurface);
} else {
return false;
}
@ -679,6 +695,9 @@ protected:
bool mIsDoubleBuffered;
bool mCanBindToTexture;
bool mShareWithEGLImage;
#ifdef MOZ_WIDGET_GONK
nsAutoPtr<HWComposer> mHwc;
#endif
// A dummy texture ID that can be used when we need a texture object whose
// images we're going to define with EGLImageTargetTexture2D.

View File

@ -86,6 +86,7 @@ endif
ifeq ($(MOZ_WIDGET_TOOLKIT),gonk)
GL_PROVIDER = EGL
LOCAL_INCLUDES = -I$(topsrcdir)/widget/gonk
endif
ifdef MOZ_GL_PROVIDER

View File

@ -136,7 +136,7 @@ BasicTiledLayerBuffer::ValidateTileInternal(BasicTiledLayerTile aTile,
const nsIntPoint& aTileOrigin,
const nsIntRect& aDirtyRect)
{
if (aTile == GetPlaceholderTile()) {
if (aTile == GetPlaceholderTile() || aTile.mSurface->Format() != GetFormat()) {
gfxImageSurface* tmpTile = new gfxImageSurface(gfxIntSize(GetTileLength(), GetTileLength()),
GetFormat(), !mThebesLayer->CanUseOpaqueSurface());
aTile = BasicTiledLayerTile(tmpTile);

View File

@ -959,7 +959,7 @@ ShadowImageLayerOGL::RenderLayer(int aPreviousFrameBuffer,
ShaderProgramOGL *program = mOGLManager->GetProgram(RGBAExternalLayerProgramType, GetMaskLayer());
gl()->ApplyFilterToBoundTexture(mFilter);
gl()->ApplyFilterToBoundTexture(LOCAL_GL_TEXTURE_EXTERNAL, mFilter);
program->Activate();
program->SetLayerQuadRect(nsIntRect(0, 0,

View File

@ -1284,7 +1284,7 @@ bool imgLoader::ValidateEntry(imgCacheEntry *aEntry,
nsCOMPtr<nsIFile> theFile;
rv = fileUrl->GetFile(getter_AddRefs(theFile));
if (NS_SUCCEEDED(rv)) {
int64_t fileLastMod;
PRTime fileLastMod;
rv = theFile->GetLastModifiedTime(&fileLastMod);
if (NS_SUCCEEDED(rv)) {
// nsIFile uses millisec, NSPR usec

View File

@ -1136,7 +1136,7 @@ endif
ifdef AUTOUPDATE_CONFIGURE
$(topsrcdir)/configure: $(topsrcdir)/configure.in
(cd $(topsrcdir) && $(AUTOCONF)) && $(PYTHON) $(DEPTH)/config.status -n --recheck)
(cd $(topsrcdir) && $(AUTOCONF)) && $(PYTHON) $(DEPTH)/config.status -n --recheck
endif
$(DEPTH)/config/autoconf.mk: $(topsrcdir)/config/autoconf.mk.in

View File

@ -0,0 +1,5 @@
// Forward to the target if the trap is undefined
var target = function (x, y) {
return x + y;
}
assertEq(new Proxy(target, {})(2, 3), 5);

View File

@ -0,0 +1,18 @@
/*
* Call the trap with the handler as the this value, the target as the first
* argument, the original this value as the second argument, and the original
* arguments as the third argument.
*/
var target = function () {};
var receiver = {};
var handler = {
apply: function (target1, receiver1, args) {
assertEq(this, handler);
assertEq(target1, target);
assertEq(receiver1, receiver);
assertEq(args.length, 2);
assertEq(args[0], 2);
assertEq(args[1], 3);
}
}
new Proxy(target, handler).call(receiver, 2, 3);

View File

@ -0,0 +1,8 @@
// Return the trap result
assertEq(new Proxy(function (x, y) {
return x + y;
}, {
apply: function (target, receiver, args) {
return args[0] * args[1];
}
})(2, 3), 6);

View File

@ -0,0 +1,7 @@
// Forward to the target if the trap is undefined
var target = function (x, y) {
this.foo = x + y;
}
var obj = new (new Proxy(target, {}))(2, 3);
assertEq(obj.foo, 5);
assertEq(Object.getPrototypeOf(obj), target.prototype);

View File

@ -0,0 +1,15 @@
/*
* Call the trap with the handler as the this value, the target as the first
* argument, and the original arguments as the third argument.
*/
var target = function () {};
var handler = {
construct: function (target1, args) {
assertEq(this, handler);
assertEq(target1, target);
assertEq(args.length, 2);
assertEq(args[0], 2);
assertEq(args[1], 3);
}
}
assertEq(new (new Proxy(target, handler))(2, 3), undefined);

View File

@ -0,0 +1,15 @@
// Return the trap result
var proxy = (new Proxy(function (x, y) {
this.foo = x + y;
}, {
construct: function (target, args) {
return {
foo: args[0] * args[1]
};
}
}));
var obj1 = new proxy(2, 3);
assertEq(obj1.foo, 6);
obj1.bar = proxy;
var obj2 = new obj1.bar(2, 3);
assertEq(obj2.foo, 6);

View File

@ -0,0 +1,19 @@
load(libdir + "asserts.js");
// Throw a TypeError if Proxy is called as a function
assertThrowsInstanceOf(function () { Proxy(); }, TypeError);
// Throw a TypeError if Proxy is called with less than two arguments
assertThrowsInstanceOf(function () { new Proxy(); }, TypeError);
assertThrowsInstanceOf(function () { new Proxy({}); }, TypeError);
// Throw a TypeError if the first argument is not a non-null object
assertThrowsInstanceOf(function () { new Proxy(0, {}); }, TypeError);
assertThrowsInstanceOf(function () { new Proxy(null, {}); }, TypeError);
// Throw a TypeError if the second argument is not a non-null object
assertThrowsInstanceOf(function () { new Proxy({}, 0); }, TypeError);
assertThrowsInstanceOf(function () { new Proxy({}, null); }, TypeError);
// Result of the call should be an object
assertEq(typeof new Proxy({}, {}), 'object');

View File

@ -0,0 +1,13 @@
// Forward to the target if the trap is not defined
var target = {};
Object.defineProperty(new Proxy(target, {}), 'foo', {
value: 'bar',
writable: true,
enumerable: false,
configurable: true
});
var desc = Object.getOwnPropertyDescriptor(target, 'foo');
assertEq(desc.value, 'bar');
assertEq(desc.writable, true);
assertEq(desc.enumerable, false);
assertEq(desc.configurable, true);

View File

@ -0,0 +1,28 @@
/*
* Call the trap with the handler as the this value, the target as the first
* argument, the name of the property as the second argument, and the descriptor
* as the third argument.
*/
var target = {};
var called = false;
var handler = {
defineProperty: function (target1, name, desc1) {
assertEq(this, handler);
assertEq(target1, target);
assertEq(name, 'foo');
assertEq(desc1 == desc, false);
assertEq(desc1.value, 'bar');
assertEq(desc1.writable, true);
assertEq(desc1.enumerable, false);
assertEq(desc1.configurable, true);
called = true;
}
}
var desc = {
value: 'bar',
writable: true,
enumerable: false,
configurable: true
};
Object.defineProperty(new Proxy(target, handler), 'foo', desc);
assertEq(called, true);

View File

@ -0,0 +1,17 @@
load(libdir + "asserts.js");
/*
* Throw a TypeError if the trap defines a new property on a non-extensible
* object
*/
var target = {};
Object.preventExtensions(target);
assertThrowsInstanceOf(function () {
Object.defineProperty(new Proxy(target, {
defineProperty: function (target, name, desc) {
return true;
}
}), 'foo', {
configurable: true
});
}, TypeError);

View File

@ -0,0 +1,15 @@
load(libdir + "asserts.js");
/*
* Throw a TypeError if the trap defines a non-configurable property that does
* not exist on the target
*/
assertThrowsInstanceOf(function () {
Object.defineProperty(new Proxy({}, {
defineProperty: function (target, name, desc) {
return true;
}
}), 'foo', {
configurable: false
});
}, TypeError);

View File

@ -0,0 +1,8 @@
// Forward to the target if the trap is not defined
assertEq(new Proxy({
foo: 'bar'
}, {}).foo, 'bar');
assertEq(new Proxy({
foo: 'bar'
}, {})['foo'], 'bar');

View File

@ -0,0 +1,19 @@
/*
* Call the trap with the handler as the this value, the target as the first
* argument, the name of the property as the second argument, and the receiver
* as the third argument
*/
var target = {};
var called = false;
var handler = {
get: function (target1, name, receiver) {
assertEq(this, handler);
assertEq(target1, target);
assertEq(name, 'foo');
assertEq(receiver, proxy);
called = true;
}
};
var proxy = new Proxy(target, handler);
proxy['foo'];
assertEq(called, true);

View File

@ -0,0 +1,19 @@
load(libdir + "asserts.js");
/*
* Throw a TypeError if the trap reports a different value for a non-writable,
* non-configurable property
*/
var target = {};
Object.defineProperty(target, 'foo', {
value: 'bar',
writable: false,
configurable: false
});
assertThrowsInstanceOf(function () {
new Proxy(target, {
get: function (target, name, receiver) {
return 'baz';
}
})['foo'];
}, TypeError);

View File

@ -0,0 +1,18 @@
load(libdir + "asserts.js");
/*
* Throw a TypeError if the trap does not report undefined for a non-configurable
* accessor property that does not have a getter
*/
var target = {};
Object.defineProperty(target, 'foo', {
set: function (value) {},
configurable: false
});
assertThrowsInstanceOf(function () {
new Proxy(target, {
get: function (target, name, receiver) {
return 'baz';
}
})['foo'];
}, TypeError);

View File

@ -0,0 +1,16 @@
// Return the trap result
assertEq(new Proxy({
foo: 'bar'
}, {
get: function (target, name, receiver) {
return 'baz';
}
}).foo, 'baz');
assertEq(new Proxy({
foo: 'bar'
}, {
get: function (target, name, receiver) {
return undefined;
}
}).foo, undefined);

View File

@ -0,0 +1,23 @@
// Forward to the target if the trap is not defined
var target = {};
Object.defineProperty(target, 'foo', {
value: 'bar',
writable: true,
enumerable: false,
configurable: true
});
var desc = Object.getOwnPropertyDescriptor(new Proxy(target, {}), 'foo');
assertEq(desc.value, 'bar');
assertEq(desc.writable, true);
assertEq(desc.enumerable, false);
assertEq(desc.configurable, true);
var proto = {};
Object.defineProperty(proto, 'foo', {
value: 'bar',
writable: true,
enumerable: false,
configurable: true
});
var target = Object.create(proto);
assertEq(Object.getOwnPropertyDescriptor(new Proxy(target, {}), 'foo'), undefined);

View File

@ -0,0 +1,36 @@
// Return the descriptor returned by the trap
var target = {};
Object.defineProperty(target, 'foo', {
value: 'bar',
writable: true,
enumerable: false,
configurable: true
});
var desc = {
value: 'baz',
writable: false,
enumerable: true,
configurable: true
};
var desc1 = Object.getOwnPropertyDescriptor(new Proxy(target, {
getOwnPropertyDescriptor: function (target, name) {
return desc;
}
}), 'foo');
assertEq(desc1 == desc, false);
assertEq(desc1.value, 'baz');
assertEq(desc1.writable, false);
assertEq(desc1.enumerable, true);
assertEq(desc1.configurable, true);
var desc = {};
var desc1 = Object.getOwnPropertyDescriptor(new Proxy(target, {
getOwnPropertyDescriptor: function (target, name) {
return desc;
}
}), 'foo');
assertEq(desc1 == desc, false);
assertEq(desc1.value, undefined);
assertEq(desc1.writable, false);
assertEq(desc1.enumerable, false);
assertEq(desc1.configurable, false);

View File

@ -0,0 +1,16 @@
/*
* Call the trap with the handler as the this value, the target as the first
* argument, and the name of the property as the second argument
*/
var target = {};
var called = false;
var handler = {
getOwnPropertyDescriptor: function (target1, name) {
assertEq(this, handler);
assertEq(target1, target);
assertEq(name, 'foo');
called = true;
}
};
Object.getOwnPropertyDescriptor(new Proxy(target, handler), 'foo');
assertEq(called, true);

View File

@ -0,0 +1,16 @@
/*
* Call the trap with the handler as the this value, the target as the first
* argument, and the name of the property as the second argument
*/
var target = {};
var called = false;
var handler = {
getOwnPropertyDescriptor: function (target1, name) {
assertEq(this, handler);
assertEq(target1, target);
assertEq(name, 'foo');
called = true;
}
};
Object.getOwnPropertyDescriptor(new Proxy(target, handler), 'foo');
assertEq(called, true);

View File

@ -0,0 +1,17 @@
load(libdir + "asserts.js");
/*
* Throw a TypeError if the trap reports a non-configurable property as
* non-existent
*/
var target = {};
Object.defineProperty(target, 'foo', {
configurable: false
});
assertThrowsInstanceOf(function () {
Object.getOwnPropertyDescriptor(new Proxy(target, {
getOwnPropertyDescriptor: function (target, name) {
return undefined;
}
}), 'foo');
}, TypeError);

View File

@ -0,0 +1,18 @@
load(libdir + "asserts.js");
/*
* Throw a TypeError if the trap reports an existing own property as
* non-existent on a non-extensible object
*/
var target = {};
Object.defineProperty(target, 'foo', {
configurable: true
});
Object.preventExtensions(target);
assertThrowsInstanceOf(function () {
Object.getOwnPropertyDescriptor(new Proxy(target, {
getOwnPropertyDescriptor: function (target, name) {
return undefined;
}
}), 'foo');
}, TypeError);

View File

@ -0,0 +1,10 @@
// Return undefined if the trap returns undefined
var target = {};
Object.defineProperty(target, 'foo', {
configurable: true
});
assertEq(Object.getOwnPropertyDescriptor(new Proxy(target, {
getOwnPropertyDescriptor: function (target, name) {
return undefined;
}
}), 'foo'), undefined);

View File

@ -0,0 +1,15 @@
load(libdir + "asserts.js");
/*
* Throw a TypeError if the trap reports a new own property on a non-extensible
* object
*/
var target = {};
Object.preventExtensions(target);
assertThrowsInstanceOf(function () {
Object.getOwnPropertyDescriptor(new Proxy(target, {
getOwnPropertyDescriptor: function (target, name) {
return {};
}
}), 'foo');
}, TypeError);

View File

@ -0,0 +1,15 @@
load(libdir + "asserts.js");
/*
* Throw a TypeError if the trap reports a new own property on a non-extensible
* object
*/
var target = {};
Object.preventExtensions(target);
assertThrowsInstanceOf(function () {
Object.getOwnPropertyDescriptor(new Proxy(target, {
getOwnPropertyDescriptor: function (target, name) {
return {};
}
}), 'foo');
}, TypeError);

View File

@ -0,0 +1,15 @@
load(libdir + "asserts.js");
/*
* Throw a TypeError if the trap returns a non-configurable descriptor for a
* non-existent property
*/
assertThrowsInstanceOf(function () {
Object.getOwnPropertyDescriptor(new Proxy({}, {
getOwnPropertyDescriptor: function (target, name) {
return {
configurable: false
};
}
}), 'foo');
}, TypeError);

View File

@ -0,0 +1,23 @@
// Forward to the target if the trap is not defined
var names = Object.getOwnPropertyNames(new Proxy(Object.create(Object.create(null, {
a: {
enumerable: true,
configurable: true
},
b: {
enumerable: false,
configurable: true
}
}), {
c: {
enumerable: true,
configurable: true
},
d: {
enumerable: false,
configurable: true
}
}), {}));
assertEq(names.length, 2);
assertEq(names[0], 'c');
assertEq(names[1], 'd');

View File

@ -0,0 +1,16 @@
/*
* Call the trap with the handler as the this value, and the target as the first
* argument
*/
var target = {};
var called = false;
var handler = {
getOwnPropertyNames: function (target1) {
assertEq(this, handler);
assertEq(target1, target);
called = true;
return [];
}
};
assertEq(Object.getOwnPropertyNames(new Proxy(target, handler)).length, 0);
assertEq(called, true);

View File

@ -0,0 +1,10 @@
load(libdir + "asserts.js");
// Throw a TypeError if the trap does not return an object
assertThrowsInstanceOf(function () {
Object.getOwnPropertyNames(new Proxy({}, {
getOwnPropertyNames: function (target) {
return;
}
}));
}, TypeError);

View File

@ -0,0 +1,10 @@
load(libdir + "asserts.js");
// Throw a TypeError if the trap reports the same property twice
assertThrowsInstanceOf(function () {
Object.getOwnPropertyNames(new Proxy({}, {
getOwnPropertyNames: function (target) {
return [ 'foo', 'foo' ];
}
}));
}, TypeError);

View File

@ -0,0 +1,15 @@
load(libdir + "asserts.js");
/*
* Throw a TypeError if the trap reports a new own property on a non-extensible
* object
*/
var target = {};
Object.preventExtensions(target);
assertThrowsInstanceOf(function () {
Object.getOwnPropertyNames(new Proxy(target, {
getOwnPropertyNames: function (target) {
return [ 'foo' ];
}
}));
}, TypeError);

Some files were not shown because too many files have changed in this diff Show More