Merging mozilla-central to services-central.

This commit is contained in:
Richard Newman 2011-06-12 14:23:51 -07:00
commit 69184b7e5c
169 changed files with 3032 additions and 2339 deletions

View File

@ -1,193 +1,201 @@
<?xml version="1.0"?>
<blocklist xmlns="http://www.mozilla.org/2006/addons-blocklist">
<blocklist xmlns="http://www.mozilla.org/2006/addons-blocklist" lastupdate="1306529826000">
<emItems>
<emItem id="fdm_ffext@freedownloadmanager.org">
<versionRange minVersion="1.0" maxVersion="1.3.1">
<targetApplication id="{ec8030f7-c20a-464f-9b0e-13a3a9e97384}">
<versionRange minVersion="3.0a1" maxVersion="*"/>
</targetApplication>
</versionRange>
</emItem>
<emItem id="firefox@bandoo.com">
<versionRange minVersion="5.0" maxVersion="5.0" severity="1">
<targetApplication id="{ec8030f7-c20a-464f-9b0e-13a3a9e97384}">
<versionRange minVersion="3.7a1pre" maxVersion="*"/>
</targetApplication>
</versionRange>
</emItem>
<emItem id="langpack-vi-VN@firefox.mozilla.org">
<versionRange minVersion="2.0" maxVersion="2.0"/>
</emItem>
<emItem id="masterfiler@gmail.com">
<versionRange severity="3"/>
</emItem>
<emItem id="mozilla_cc@internetdownloadmanager.com">
<versionRange minVersion=" " maxVersion="6.9.8">
<targetApplication id="{ec8030f7-c20a-464f-9b0e-13a3a9e97384}">
<versionRange minVersion="3.7a1pre" maxVersion="*"/>
</targetApplication>
</versionRange>
<versionRange minVersion="2.1" maxVersion="3.3">
<targetApplication id="{ec8030f7-c20a-464f-9b0e-13a3a9e97384}">
<versionRange minVersion="3.0a1" maxVersion="*"/>
</targetApplication>
</versionRange>
</emItem>
<emItem id="msntoolbar@msn.com">
<versionRange minVersion=" " maxVersion="6.*"/>
</emItem>
<emItem id="personas@christopher.beard">
<versionRange minVersion="1.6" maxVersion="1.6">
<targetApplication id="{ec8030f7-c20a-464f-9b0e-13a3a9e97384}">
<versionRange minVersion="3.6" maxVersion="3.6.*"/>
</targetApplication>
</versionRange>
</emItem>
<emItem id="ShopperReports@ShopperReports.com">
<versionRange minVersion="3.1.22.0" maxVersion="3.1.22.0"/>
</emItem>
<emItem id="support@daemon-tools.cc">
<versionRange minVersion=" " maxVersion="1.0.0.5"/>
</emItem>
<emItem id="support@update-firefox.com"/>
<emItem id="yslow@yahoo-inc.com">
<versionRange minVersion="2.0.5" maxVersion="2.0.5">
<targetApplication id="{ec8030f7-c20a-464f-9b0e-13a3a9e97384}">
<versionRange minVersion="3.5.7" maxVersion="*"/>
</targetApplication>
</versionRange>
</emItem>
<emItem id="{2224e955-00e9-4613-a844-ce69fccaae91}"/>
<emItem id="{27182e60-b5f3-411c-b545-b44205977502}">
<versionRange minVersion="1.0" maxVersion="1.0"/>
</emItem>
<emItem id="{3252b9ae-c69a-4eaf-9502-dc9c1f6c009e}">
<versionRange minVersion="2.2" maxVersion="2.2"/>
</emItem>
<emItem id="{3f963a5b-e555-4543-90e2-c3908898db71}">
<versionRange minVersion=" " maxVersion="8.5"/>
</emItem>
<emItem id="{46551EC9-40F0-4e47-8E18-8E5CF550CFB8}">
<versionRange minVersion="1.1b1" maxVersion="1.1b1"/>
</emItem>
<emItem id="{4B3803EA-5230-4DC3-A7FC-33638F3D3542}">
<versionRange minVersion="1.2" maxVersion="1.2">
<targetApplication id="{ec8030f7-c20a-464f-9b0e-13a3a9e97384}">
<versionRange minVersion="3.0a1" maxVersion="*"/>
</targetApplication>
</versionRange>
</emItem>
<emItem id="{6E19037A-12E3-4295-8915-ED48BC341614}">
<versionRange minVersion="0.1" maxVersion="1.3.328.4" severity="1">
<targetApplication id="{ec8030f7-c20a-464f-9b0e-13a3a9e97384}">
<versionRange minVersion="3.7a1pre" maxVersion="*"/>
</targetApplication>
</versionRange>
</emItem>
<emItem id="{8CE11043-9A15-4207-A565-0C94C42D590D}"/>
<emItem id="{AB2CE124-6272-4b12-94A9-7303C7397BD1}">
<versionRange minVersion="0.1" maxVersion="5.2.0.7164" severity="1"/>
</emItem>
<emItem id="{B13721C7-F507-4982-B2E5-502A71474FED}">
<versionRange severity="1"/>
</emItem>
<emItem id="{B7082FAA-CB62-4872-9106-E42DD88EDE45}">
<versionRange minVersion="0.1" maxVersion="3.3.0.*">
<targetApplication id="{ec8030f7-c20a-464f-9b0e-13a3a9e97384}">
<versionRange minVersion="3.7a1" maxVersion="*"/>
</targetApplication>
</versionRange>
<versionRange minVersion="3.3.1" maxVersion="*">
<targetApplication id="{ec8030f7-c20a-464f-9b0e-13a3a9e97384}">
<versionRange minVersion="5.0a1" maxVersion="*"/>
</targetApplication>
</versionRange>
</emItem>
<emItem id="{E8E88AB0-7182-11DF-904E-6045E0D72085}"/>
</emItems>
<pluginItems>
<pluginItem>
<match name="name" exp="^Yahoo Application State Plugin$"/>
<match name="description" exp="^Yahoo Application State Plugin$"/>
<match name="filename" exp="npYState.dll"/>
<versionRange>
<targetApplication id="{ec8030f7-c20a-464f-9b0e-13a3a9e97384}">
<versionRange minVersion="3.0a1" maxVersion="3.*"/>
</targetApplication>
</versionRange>
</pluginItem>
<pluginItem>
<match name="name" exp="QuickTime Plug-in 7[.]1[.]"/>
<match name="filename" exp="npqtplugin.?[.]dll"/>
<versionRange>
<targetApplication id="{ec8030f7-c20a-464f-9b0e-13a3a9e97384}">
<versionRange minVersion="3.0a1" maxVersion="3.*"/>
</targetApplication>
</versionRange>
</pluginItem>
<pluginItem>
<match name="filename" exp="NPFFAddOn.dll"/>
<versionRange>
</versionRange>
</pluginItem>
<pluginItem>
<match name="filename" exp="NPMySrch.dll"/>
<versionRange>
</versionRange>
</pluginItem>
<pluginItem>
<match name="filename" exp="npViewpoint.dll"/>
<versionRange>
<targetApplication id="{ec8030f7-c20a-464f-9b0e-13a3a9e97384}">
<versionRange minVersion="3.0" maxVersion="*"/>
</targetApplication>
</versionRange>
</pluginItem>
<pluginItem>
<match name="name" exp="[0-6]\.0\.[01]\d{2}\.\d+"/>
<match name="filename" exp="npdeploytk.dll"/>
<versionRange severity="1">
</versionRange>
</pluginItem>
<pluginItem>
<match name="filename" exp="[Nn][Pp][Jj][Pp][Ii]1[56]0_[0-9]+\.[Dd][Ll][Ll]"/>
<versionRange>
<targetApplication id="{ec8030f7-c20a-464f-9b0e-13a3a9e97384}">
<versionRange minVersion="3.6a1pre" maxVersion="*"/>
</targetApplication>
</versionRange>
</pluginItem>
</pluginItems>
<gfxItems>
<gfxBlacklistEntry>
<os>WINNT 6.1</os>
<vendor>0x10de</vendor>
<devices>
<device>0x0a6c</device>
</devices>
<feature>DIRECT2D</feature>
<featureStatus>BLOCKED_DRIVER_VERSION</featureStatus>
<driverVersion>8.17.12.5896</driverVersion>
<driverVersionComparator>LESS_THAN_OR_EQUAL</driverVersionComparator>
</gfxBlacklistEntry>
<gfxBlacklistEntry>
<os>WINNT 6.1</os>
<vendor>0x10de</vendor>
<devices>
<device>0x0a6c</device>
</devices>
<feature>DIRECT3D_9_LAYERS</feature>
<featureStatus>BLOCKED_DRIVER_VERSION</featureStatus>
<driverVersion>8.17.12.5896</driverVersion>
<driverVersionComparator>LESS_THAN_OR_EQUAL</driverVersionComparator>
</gfxBlacklistEntry>
<gfxBlacklistEntry>
<os>WINNT 5.1</os>
<vendor>0x10de</vendor>
<feature>DIRECT3D_9_LAYERS</feature>
<featureStatus>BLOCKED_DRIVER_VERSION</featureStatus>
<driverVersion>7.0.0.0</driverVersion>
<driverVersionComparator>GREATER_THAN_OR_EQUAL</driverVersionComparator>
</gfxBlacklistEntry>
</gfxItems>
</blocklist>
<emItem blockID="i8" id="{B13721C7-F507-4982-B2E5-502A71474FED}">
<versionRange minVersion=" " severity="1">
</versionRange>
</emItem>
<emItem blockID="i38" id="{B7082FAA-CB62-4872-9106-E42DD88EDE45}">
<versionRange minVersion="0.1" maxVersion="3.3.0.*" severity="0">
<targetApplication id="{ec8030f7-c20a-464f-9b0e-13a3a9e97384}">
<versionRange minVersion="3.7a1" maxVersion="*" />
</targetApplication>
</versionRange>
<versionRange minVersion="3.3.1" maxVersion="*" severity="0">
<targetApplication id="{ec8030f7-c20a-464f-9b0e-13a3a9e97384}">
<versionRange minVersion="5.0a1" maxVersion="*" />
</targetApplication>
</versionRange>
</emItem>
<emItem blockID="i19" id="{46551EC9-40F0-4e47-8E18-8E5CF550CFB8}">
<versionRange minVersion="1.1b1" maxVersion="1.1b1" severity="0">
</versionRange>
</emItem>
<emItem blockID="i16" id="{27182e60-b5f3-411c-b545-b44205977502}">
<versionRange minVersion="1.0" maxVersion="1.0" severity="0">
</versionRange>
</emItem>
<emItem blockID="i10" id="{8CE11043-9A15-4207-A565-0C94C42D590D}">
</emItem>
<emItem blockID="i1" id="mozilla_cc@internetdownloadmanager.com">
<versionRange minVersion="2.1" maxVersion="3.3" severity="0">
<targetApplication id="{ec8030f7-c20a-464f-9b0e-13a3a9e97384}">
<versionRange minVersion="3.0a1" maxVersion="*" />
</targetApplication>
</versionRange>
<versionRange minVersion=" " maxVersion="6.9.8" severity="0">
<targetApplication id="{ec8030f7-c20a-464f-9b0e-13a3a9e97384}">
<versionRange minVersion="3.7a1pre" maxVersion="*" />
</targetApplication>
</versionRange>
</emItem>
<emItem blockID="i18" id="msntoolbar@msn.com">
<versionRange minVersion=" " maxVersion="6.*" severity="0">
</versionRange>
</emItem>
<emItem blockID="i13" id="{E8E88AB0-7182-11DF-904E-6045E0D72085}">
</emItem>
<emItem blockID="i4" id="{4B3803EA-5230-4DC3-A7FC-33638F3D3542}">
<versionRange minVersion="1.2" maxVersion="1.2" severity="0">
<targetApplication id="{ec8030f7-c20a-464f-9b0e-13a3a9e97384}">
<versionRange minVersion="3.0a1" maxVersion="*" />
</targetApplication>
</versionRange>
</emItem>
<emItem blockID="i23" id="firefox@bandoo.com">
<versionRange minVersion="5.0" maxVersion="5.0" severity="1">
<targetApplication id="{ec8030f7-c20a-464f-9b0e-13a3a9e97384}">
<versionRange minVersion="3.7a1pre" maxVersion="*" />
</targetApplication>
</versionRange>
</emItem>
<emItem blockID="i22" id="ShopperReports@ShopperReports.com">
<versionRange minVersion="3.1.22.0" maxVersion="3.1.22.0" severity="0">
</versionRange>
</emItem>
<emItem blockID="i2" id="fdm_ffext@freedownloadmanager.org">
<versionRange minVersion="1.0" maxVersion="1.3.1" severity="0">
<targetApplication id="{ec8030f7-c20a-464f-9b0e-13a3a9e97384}">
<versionRange minVersion="3.0a1" maxVersion="*" />
</targetApplication>
</versionRange>
</emItem>
<emItem blockID="i5" id="support@daemon-tools.cc">
<versionRange minVersion=" " maxVersion="1.0.0.5" severity="0">
</versionRange>
</emItem>
<emItem blockID="i6" id="{3f963a5b-e555-4543-90e2-c3908898db71}">
<versionRange minVersion=" " maxVersion="8.5" severity="0">
</versionRange>
</emItem>
<emItem blockID="i12" id="masterfiler@gmail.com">
<versionRange severity="3">
</versionRange>
</emItem>
<emItem blockID="i20" id="{AB2CE124-6272-4b12-94A9-7303C7397BD1}">
<versionRange minVersion="0.1" maxVersion="5.2.0.7164" severity="1">
</versionRange>
</emItem>
<emItem blockID="i11" id="yslow@yahoo-inc.com">
<versionRange minVersion="2.0.5" maxVersion="2.0.5" severity="0">
<targetApplication id="{ec8030f7-c20a-464f-9b0e-13a3a9e97384}">
<versionRange minVersion="3.5.7" maxVersion="*" />
</targetApplication>
</versionRange>
</emItem>
<emItem blockID="i17" id="{3252b9ae-c69a-4eaf-9502-dc9c1f6c009e}">
<versionRange minVersion="2.2" maxVersion="2.2" severity="0">
</versionRange>
</emItem>
<emItem blockID="i3" id="langpack-vi-VN@firefox.mozilla.org">
<versionRange minVersion="2.0" maxVersion="2.0" severity="0">
</versionRange>
</emItem>
<emItem blockID="i7" id="{2224e955-00e9-4613-a844-ce69fccaae91}">
</emItem>
<emItem blockID="i24" id="{6E19037A-12E3-4295-8915-ED48BC341614}">
<versionRange minVersion="0.1" maxVersion="1.3.328.4" severity="1">
<targetApplication id="{ec8030f7-c20a-464f-9b0e-13a3a9e97384}">
<versionRange minVersion="3.7a1pre" maxVersion="*" />
</targetApplication>
</versionRange>
</emItem>
<emItem blockID="i15" id="personas@christopher.beard">
<versionRange minVersion="1.6" maxVersion="1.6" severity="0">
<targetApplication id="{ec8030f7-c20a-464f-9b0e-13a3a9e97384}">
<versionRange minVersion="3.6" maxVersion="3.6.*" />
</targetApplication>
</versionRange>
</emItem>
<emItem blockID="i21" id="support@update-firefox.com">
</emItem>
</emItems>
<pluginItems>
<pluginItem blockID="p26">
<match name="name" exp="^Yahoo Application State Plugin$" /> <match name="description" exp="^Yahoo Application State Plugin$" /> <match name="filename" exp="npYState.dll" /> <versionRange severity="0">
<targetApplication id="{ec8030f7-c20a-464f-9b0e-13a3a9e97384}">
<versionRange minVersion="3.0a1" maxVersion="3.*" />
</targetApplication>
</versionRange>
</pluginItem>
<pluginItem blockID="p27">
<match name="name" exp="QuickTime Plug-in 7[.]1[.]" /> <match name="filename" exp="npqtplugin.?[.]dll" /> <versionRange severity="0">
<targetApplication id="{ec8030f7-c20a-464f-9b0e-13a3a9e97384}">
<versionRange minVersion="3.0a1" maxVersion="3.*" />
</targetApplication>
</versionRange>
</pluginItem>
<pluginItem blockID="p28">
<match name="filename" exp="NPFFAddOn.dll" /> <versionRange severity="0">
</versionRange>
</pluginItem>
<pluginItem blockID="p31">
<match name="filename" exp="NPMySrch.dll" /> <versionRange severity="0">
</versionRange>
</pluginItem>
<pluginItem blockID="p32">
<match name="filename" exp="npViewpoint.dll" /> <versionRange severity="0">
<targetApplication id="{ec8030f7-c20a-464f-9b0e-13a3a9e97384}">
<versionRange minVersion="3.0" maxVersion="*" />
</targetApplication>
</versionRange>
</pluginItem>
<pluginItem blockID="p33">
<match name="name" exp="[0-6]\.0\.[01]\d{2}\.\d+" /> <match name="filename" exp="npdeploytk.dll" /> <versionRange severity="1">
</versionRange>
</pluginItem>
<pluginItem blockID="p34">
<match name="filename" exp="[Nn][Pp][Jj][Pp][Ii]1[56]0_[0-9]+\.[Dd][Ll][Ll]" /> <versionRange severity="0">
<targetApplication id="{ec8030f7-c20a-464f-9b0e-13a3a9e97384}">
<versionRange minVersion="3.6a1pre" maxVersion="*" />
</targetApplication>
</versionRange>
</pluginItem>
</pluginItems>
<gfxItems>
<gfxBlacklistEntry blockID="g35">
<os>WINNT 6.1</os>
<vendor>0x10de</vendor>
<devices>
<device>0x0a6c</device>
</devices>
<feature>DIRECT2D</feature>
<featureStatus>BLOCKED_DRIVER_VERSION</featureStatus>
<driverVersion>8.17.12.5896</driverVersion>
<driverVersionComparator>LESS_THAN_OR_EQUAL</driverVersionComparator>
</gfxBlacklistEntry>
<gfxBlacklistEntry blockID="g36">
<os>WINNT 6.1</os>
<vendor>0x10de</vendor>
<devices>
<device>0x0a6c</device>
</devices>
<feature>DIRECT3D_9_LAYERS</feature>
<featureStatus>BLOCKED_DRIVER_VERSION</featureStatus>
<driverVersion>8.17.12.5896</driverVersion>
<driverVersionComparator>LESS_THAN_OR_EQUAL</driverVersionComparator>
</gfxBlacklistEntry>
<gfxBlacklistEntry blockID="g37">
<os>WINNT 5.1</os>
<vendor>0x10de</vendor>
<feature>DIRECT3D_9_LAYERS</feature>
<featureStatus>BLOCKED_DRIVER_VERSION</featureStatus>
<driverVersion>7.0.0.0</driverVersion>
<driverVersionComparator>GREATER_THAN_OR_EQUAL</driverVersionComparator>
</gfxBlacklistEntry>
</gfxItems>
</blocklist>

View File

@ -864,9 +864,6 @@ pref("breakpad.reportURL", "http://crash-stats.mozilla.com/report/index/");
// base URL for web-based support pages
pref("app.support.baseURL", "http://support.mozilla.com/1/firefox/%VERSION%/%OS%/%LOCALE%/");
// URL for web-based support page on how to upgrade a graphics driver
pref("app.support.updateGraphicsDriverURL", "http://support.mozilla.com/%LOCALE%/kb/how-do-i-upgrade-my-graphics-drivers");
// Name of alternate about: page for certificate errors (when undefined, defaults to about:neterror)
pref("security.alternate_certificate_error_page", "certerror");

View File

@ -38,9 +38,6 @@
*
* ***** END LICENSE BLOCK ***** */
const Ci = Components.interfaces;
const Cc = Components.classes;
const kTestString = " hello hello \n world\nworld ";
var gTests = [
@ -87,8 +84,7 @@ function test_paste(aCurrentTest) {
var inputListener = {
test: aCurrentTest,
handleEvent: function(event) {
var element = event.target;
element.removeEventListener("input", this, false);
element.removeEventListener(event.type, this, false);
is(element.value, this.test.expected, this.test.desc);

View File

@ -2,10 +2,6 @@
/* Any copyright is dedicated to the Public Domain.
http://creativecommons.org/publicdomain/zero/1.0/ */
const Cc = Components.classes;
const Ci = Components.interfaces;
const Cu = Components.utils;
Cu.import("resource://gre/modules/NetUtil.jsm");
Cu.import("resource://gre/modules/FileUtils.jsm");

View File

@ -36,8 +36,6 @@
*
* ***** END LICENSE BLOCK ***** */
Components.utils.import("resource://gre/modules/XPCOMUtils.jsm");
const TEST_URL_BASES = [
"http://example.org/browser/browser/base/content/test/dummy_page.html#tabmatch",
"http://example.org/browser/browser/base/content/test/moz.png#tabmatch"

View File

@ -11,8 +11,6 @@ const PAGE_URL = BASE_URL + "/framedPage.html";
const LEFT_URL = BASE_URL + "/frameLeft.html";
const RIGHT_URL = BASE_URL + "/frameRight.html";
Components.utils.import("resource://gre/modules/XPCOMUtils.jsm");
let gTabLoaded = false;
let gLeftFrameVisited = false;

View File

@ -52,16 +52,6 @@ waitForExplicitFinish();
const TEST_IDENTIFIER = "ui-perf-test";
const TEST_SUITE = "places";
const Cc = Components.classes;
const Ci = Components.interfaces;
const Cr = Components.results;
var wm = Cc["@mozilla.org/appshell/window-mediator;1"].
getService(Ci.nsIWindowMediator);
var win = wm.getMostRecentWindow("navigator:browser");
var ios = Cc["@mozilla.org/network/io-service;1"].
getService(Ci.nsIIOService);
var hs = Cc["@mozilla.org/browser/nav-history-service;1"].
getService(Ci.nsINavHistoryService);
var bs = Cc["@mozilla.org/browser/nav-bookmarks-service;1"].
@ -112,7 +102,7 @@ ptests.push({
visit_date_microsec -= 86400 * 1000 * 1000; // remove a day
var spec = "http://example.com/" + visit_date_microsec;
for (var j = 0; j < visits_per_day; j++) {
var uri = ios.newURI(spec + j, null, null);
var uri = Services.io.newURI(spec + j, null, null);
add_visit(uri, visit_date_microsec);
}
}
@ -132,7 +122,7 @@ ptests.push({
visit_date_microsec -= 86400 * 1000 * 1000; // remove a day
var spec = "http://example.com/" + visit_date_microsec;
for (var j = 0; j < visits_per_day; j++) {
var uri = ios.newURI(spec + j, null, null);
var uri = Services.io.newURI(spec + j, null, null);
if (bookmark_counter < bookmarks_per_day) {
add_bookmark(uri);
bookmark_counter++;

View File

@ -47,16 +47,6 @@ waitForExplicitFinish();
const TEST_IDENTIFIER = "ui-perf-test";
const TEST_SUITE = "places";
const Cc = Components.classes;
const Ci = Components.interfaces;
const Cr = Components.results;
var wm = Cc["@mozilla.org/appshell/window-mediator;1"].
getService(Ci.nsIWindowMediator);
var win = wm.getMostRecentWindow("navigator:browser");
var ios = Cc["@mozilla.org/network/io-service;1"].
getService(Ci.nsIIOService);
var hs = Cc["@mozilla.org/browser/nav-history-service;1"].
getService(Ci.nsINavHistoryService);
var bs = Cc["@mozilla.org/browser/nav-bookmarks-service;1"].

View File

@ -44,16 +44,6 @@ Tests the performance of opening the history menu.
const TEST_IDENTIFIER = "ui-perf-test";
const TEST_SUITE = "places";
const Cc = Components.classes;
const Ci = Components.interfaces;
const Cr = Components.results;
var wm = Cc["@mozilla.org/appshell/window-mediator;1"].
getService(Ci.nsIWindowMediator);
var win = wm.getMostRecentWindow("navigator:browser");
var ios = Cc["@mozilla.org/network/io-service;1"].
getService(Ci.nsIIOService);
var hs = Cc["@mozilla.org/browser/nav-history-service;1"].
getService(Ci.nsINavHistoryService);
var bs = Cc["@mozilla.org/browser/nav-bookmarks-service;1"].

View File

@ -47,15 +47,6 @@ waitForExplicitFinish();
const TEST_IDENTIFIER = "ui-perf-test";
const TEST_SUITE = "places";
const Cc = Components.classes;
const Ci = Components.interfaces;
const Cr = Components.results;
var wm = Cc["@mozilla.org/appshell/window-mediator;1"].
getService(Ci.nsIWindowMediator);
var win = wm.getMostRecentWindow("navigator:browser");
var ios = Cc["@mozilla.org/network/io-service;1"].
getService(Ci.nsIIOService);
var hs = Cc["@mozilla.org/browser/nav-history-service;1"].
getService(Ci.nsINavHistoryService);
var bs = Cc["@mozilla.org/browser/nav-bookmarks-service;1"].

View File

@ -47,15 +47,6 @@ waitForExplicitFinish();
const TEST_IDENTIFIER = "ui-perf-test";
const TEST_SUITE = "places";
const Cc = Components.classes;
const Ci = Components.interfaces;
const Cr = Components.results;
var wm = Cc["@mozilla.org/appshell/window-mediator;1"].
getService(Ci.nsIWindowMediator);
var win = wm.getMostRecentWindow("navigator:browser");
var ios = Cc["@mozilla.org/network/io-service;1"].
getService(Ci.nsIIOService);
var hs = Cc["@mozilla.org/browser/nav-history-service;1"].
getService(Ci.nsINavHistoryService);
var bs = Cc["@mozilla.org/browser/nav-bookmarks-service;1"].

View File

@ -47,15 +47,6 @@ waitForExplicitFinish();
const TEST_IDENTIFIER = "ui-perf-test";
const TEST_SUITE = "places";
const Cc = Components.classes;
const Ci = Components.interfaces;
const Cr = Components.results;
var wm = Cc["@mozilla.org/appshell/window-mediator;1"].
getService(Ci.nsIWindowMediator);
var win = wm.getMostRecentWindow("navigator:browser");
var ios = Cc["@mozilla.org/network/io-service;1"].
getService(Ci.nsIIOService);
var hs = Cc["@mozilla.org/browser/nav-history-service;1"].
getService(Ci.nsINavHistoryService);
var bs = Cc["@mozilla.org/browser/nav-bookmarks-service;1"].

View File

@ -46,24 +46,12 @@ waitForExplicitFinish();
const TEST_IDENTIFIER = "ui-perf-test";
const TEST_SUITE = "places";
const Cc = Components.classes;
const Ci = Components.interfaces;
const Cr = Components.results;
var wm = Cc["@mozilla.org/appshell/window-mediator;1"].
getService(Ci.nsIWindowMediator);
var win = wm.getMostRecentWindow("navigator:browser");
var ios = Cc["@mozilla.org/network/io-service;1"].
getService(Ci.nsIIOService);
var hs = Cc["@mozilla.org/browser/nav-history-service;1"].
getService(Ci.nsINavHistoryService);
var bs = Cc["@mozilla.org/browser/nav-bookmarks-service;1"].
getService(Ci.nsINavBookmarksService);
var prefs = Cc["@mozilla.org/preferences-service;1"].
getService(Ci.nsIPrefBranch);
var maxResults = prefs.getIntPref("browser.urlbar.maxRichResults");
var maxResults = Services.prefs.getIntPref("browser.urlbar.maxRichResults");
var onSearchComplete = gURLBar.onSearchComplete;
function add_visit(aURI, aDate) {

View File

@ -1,7 +1,6 @@
/* Any copyright is dedicated to the Public Domain.
http://creativecommons.org/publicdomain/zero/1.0/ */
Components.utils.import("resource://gre/modules/Services.jsm");
Components.utils.import("resource://gre/modules/PlacesUtils.jsm");
Components.utils.import("resource://gre/modules/NetUtil.jsm");

View File

@ -53,14 +53,9 @@
<!ENTITY netInterrupt.longDesc "&sharedLongDesc;">
<!ENTITY netOffline.title "Offline mode">
<!-- LOCALIZATION NOTE (netOffline.overrideLongDesc) - This string should
indicate that "Work Offline" is a menu item without being too specific,
since it could be in either the normal menu (Mac/Linux) or the Firefox button
menu (Windows).
-->
<!ENTITY netOffline.overrideLongDesc "
<!ENTITY netOffline.longDesc2 "
<ul>
<li>Uncheck the &quot;Work Offline&quot; menu item, then try again.</li>
<li>Press &quot;Try Again&quot; to switch to online mode and reload the page.</li>
</ul>
">

View File

@ -335,6 +335,7 @@ class Automation(object):
user_pref("browser.console.showInPanel", true);
user_pref("browser.dom.window.dump.enabled", true);
user_pref("browser.firstrun.show.localepicker", false);
user_pref("browser.firstrun.show.uidiscovery", false);
user_pref("dom.allow_scripts_to_close_windows", true);
user_pref("dom.disable_open_during_load", false);
user_pref("dom.max_script_run_time", 0); // no slow script dialogs

View File

@ -1300,7 +1300,9 @@ nsWebSocket::Close()
// before calling it
nsRefPtr<nsWebSocket> kungfuDeathGrip = this;
mConnection->FailConnection();
if (mConnection) {
mConnection->FailConnection();
}
return NS_OK;
}

View File

@ -1,4 +1,4 @@
// this will take strings_to_send.length*5000 ms = 50 sec
// this will take strings_to_send.length*500 ms = 5 sec
var timer = null;
var strings_to_send = ["data\r\n\nda", "ta", ":", "de", "layed1\n\n",
@ -38,5 +38,5 @@ function handleRequest(request, response)
resp = response;
timer = Components.classes["@mozilla.org/timer;1"].createInstance(Components.interfaces.nsITimer);
timer.initWithCallback(sendNextString, 5000, Components.interfaces.nsITimer.TYPE_REPEATING_SLACK);
timer.initWithCallback(sendNextString, 500, Components.interfaces.nsITimer.TYPE_REPEATING_SLACK);
}

View File

@ -19,8 +19,7 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=338583
</div>
<pre id="test">
<script class="testbody" type="text/javascript">
/** Test for Bug 338583 **/
/** Tests for Bug 338583 **/
// we test:
// 1) the EventSource behaviour
@ -33,6 +32,26 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=338583
// --
function runAllTests() {
// these tests run asynchronously
doTest1(); // this will take 8000 ms
doTest2(); // this will take 5000 ms
doTest3(); // this will take 1500 ms
doTest3_b(); // this will take 1500 ms
doTest3_c(); // this will take 1500 ms
doTest3_d(); // this will take 1500 ms
doTest3_e(); // this will take 1500 ms
doTest3_f(); // this will take 1500 ms
doTest3_g(); // this will take 1500 ms
doTest3_h(); // this will take 1500 ms
doTest4(); // this will take 3000 ms
doTest4_b(); // this will take 3000 ms
doTest5(); // this will take 3000 ms
doTest5_b(); // this will take 3000 ms
doTest6(); // this will take 2500 ms
doTest7(); // this will take 8000 ms
}
function fn_onmessage(e) {
if (e.currentTarget == e.target && e.target.hits != null)
e.target.hits['fn_onmessage']++;
@ -53,9 +72,12 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=338583
var gEventSourceObj1 = null;
var gEventSourceObj2 = null;
var gEventSourceObj3 = null;
var gEventSourceObj4 = null;
var gEventSourceObj5 = null;
var gEventSourceObj3_a = null, gEventSourceObj3_b = null,
gEventSourceObj3_c = null, gEventSourceObj3_d = null,
gEventSourceObj3_e = null, gEventSourceObj3_f = null,
gEventSourceObj3_g = null, gEventSourceObj3_h = null;
var gEventSourceObj4_a = null, gEventSourceObj4_b = null;
var gEventSourceObj5_a = null, gEventSourceObj5_b = null;
var gEventSourceObj6 = null;
var gEventSourceObj7 = null;
var stress_factor; // used in the setTimeouts in order to help
@ -92,13 +114,13 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=338583
gEventSourceObj1.hits['fn_other_event_name'] = 0;
gEventSourceObj1.addEventListener('other_event_name', fn_other_event_name, true);
// the eventsources.res always use a retry of 0.5 second, so for four hits a timeout of 3 seconds is enough
// the eventsources.res always use a retry of 0.5 second, so for four hits a timeout of 6 seconds is enough
setTimeout(function(){
bhits = hasBeenHitFor1And2(gEventSourceObj1, 4);
ok(bhits, "Test 1.b failed.");
doTest1_c();
}, parseInt(3000*stress_factor));
}, parseInt(6000*stress_factor));
}
function doTest1_c() {
@ -117,8 +139,6 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=338583
bhits = hasBeenHitFor1And2(gEventSourceObj1, 1);
ok(!bhits, "Test 1.d failed.");
gEventSourceObj1.close();
doTest2();
}, parseInt(2000*stress_factor));
}
@ -138,13 +158,11 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=338583
setTimeout(function(){ // just to clean...
gEventSourceObj2.close();
}, parseInt(5000*stress_factor));
doTest3();
}
// in order to test (3)
// a) XSite domain error test
// b) protocol file:/// test
// b) protocol file:// test
// c) protocol javascript: test
// d) wrong Content-Type test
// e) bad http response code test
@ -153,32 +171,33 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=338583
// h) DNS error
function doTest3() {
gEventSourceObj3 = new EventSource("http://example.org/tests/content/base/test/eventsource.resource");
gEventSourceObj3_a = new EventSource("http://example.org/tests/content/base/test/eventsource.resource");
gEventSourceObj3.onmessage = fn_onmessage;
gEventSourceObj3.hits = [];
gEventSourceObj3.hits['fn_onmessage'] = 0;
gEventSourceObj3_a.onmessage = fn_onmessage;
gEventSourceObj3_a.hits = [];
gEventSourceObj3_a.hits['fn_onmessage'] = 0;
setTimeout(function() {
ok(gEventSourceObj3.hits['fn_onmessage'] == 0, "Test 3.a failed");
gEventSourceObj3.close();
doTest3_b();
ok(gEventSourceObj3_a.hits['fn_onmessage'] == 0, "Test 3.a failed");
gEventSourceObj3_a.close();
}, parseInt(1500*stress_factor));
}
function doTest3_b() {
gEventSourceObj3 = new EventSource("file:///home/wellington/src/content/base/test/eventsource.resource");
var xhr = new XMLHttpRequest;
xhr.open("GET", "/dynamic/getMyDirectory.sjs", false);
xhr.send();
var basePath = xhr.responseText;
gEventSourceObj3.onmessage = fn_onmessage;
gEventSourceObj3.hits = [];
gEventSourceObj3.hits['fn_onmessage'] = 0;
gEventSourceObj3_b = new EventSource("file://" + basePath + "eventsource.resource");
gEventSourceObj3_b.onmessage = fn_onmessage;
gEventSourceObj3_b.hits = [];
gEventSourceObj3_b.hits['fn_onmessage'] = 0;
setTimeout(function() {
ok(gEventSourceObj3.hits['fn_onmessage'] == 0, "Test 3.b failed");
gEventSourceObj3.close();
doTest3_c();
ok(gEventSourceObj3_b.hits['fn_onmessage'] == 0, "Test 3.b failed");
gEventSourceObj3_b.close();
}, parseInt(1500*stress_factor));
}
@ -189,62 +208,54 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=338583
}
function doTest3_c() {
gEventSourceObj3 = new EventSource("javascript: return jsEvtSource()");
gEventSourceObj3_c = new EventSource("javascript: return jsEvtSource()");
gEventSourceObj3.onmessage = fn_onmessage;
gEventSourceObj3.hits = [];
gEventSourceObj3.hits['fn_onmessage'] = 0;
gEventSourceObj3_c.onmessage = fn_onmessage;
gEventSourceObj3_c.hits = [];
gEventSourceObj3_c.hits['fn_onmessage'] = 0;
setTimeout(function() {
ok(gEventSourceObj3.hits['fn_onmessage'] == 0, "Test 3.c failed");
gEventSourceObj3.close();
doTest3_d();
ok(gEventSourceObj3_c.hits['fn_onmessage'] == 0, "Test 3.c failed");
gEventSourceObj3_c.close();
}, parseInt(1500*stress_factor));
}
function doTest3_d() {
gEventSourceObj3 = new EventSource("badContentType.eventsource");
gEventSourceObj3_d = new EventSource("badContentType.eventsource");
gEventSourceObj3.onmessage = fn_onmessage;
gEventSourceObj3.hits = [];
gEventSourceObj3.hits['fn_onmessage'] = 0;
gEventSourceObj3_d.onmessage = fn_onmessage;
gEventSourceObj3_d.hits = [];
gEventSourceObj3_d.hits['fn_onmessage'] = 0;
setTimeout(function() {
ok(gEventSourceObj3.hits['fn_onmessage'] == 0, "Test 3.d failed");
gEventSourceObj3.close();
doTest3_e();
ok(gEventSourceObj3_d.hits['fn_onmessage'] == 0, "Test 3.d failed");
gEventSourceObj3_d.close();
}, parseInt(1500*stress_factor));
}
function doTest3_e() {
gEventSourceObj3 = new EventSource("badHTTPResponseCode.eventsource");
gEventSourceObj3_e = new EventSource("badHTTPResponseCode.eventsource");
gEventSourceObj3.onmessage = fn_onmessage;
gEventSourceObj3.hits = [];
gEventSourceObj3.hits['fn_onmessage'] = 0;
gEventSourceObj3_e.onmessage = fn_onmessage;
gEventSourceObj3_e.hits = [];
gEventSourceObj3_e.hits['fn_onmessage'] = 0;
setTimeout(function() {
ok(gEventSourceObj3.hits['fn_onmessage'] == 0, "Test 3.e failed");
gEventSourceObj3.close();
doTest3_f();
ok(gEventSourceObj3_e.hits['fn_onmessage'] == 0, "Test 3.e failed");
gEventSourceObj3_e.close();
}, parseInt(1500*stress_factor));
}
function doTest3_f() {
gEventSourceObj3 = new EventSource("badMessageEvent.eventsource");
gEventSourceObj3_f = new EventSource("badMessageEvent.eventsource");
gEventSourceObj3.onmessage = fn_onmessage;
gEventSourceObj3.hits = [];
gEventSourceObj3.hits['fn_onmessage'] = 0;
gEventSourceObj3_f.onmessage = fn_onmessage;
gEventSourceObj3_f.hits = [];
gEventSourceObj3_f.hits['fn_onmessage'] = 0;
setTimeout(function() {
ok(gEventSourceObj3.hits['fn_onmessage'] == 0, "Test 3.f failed");
gEventSourceObj3.close();
doTest3_g();
ok(gEventSourceObj3_f.hits['fn_onmessage'] == 0, "Test 3.f failed");
gEventSourceObj3_f.close();
}, parseInt(1500*stress_factor));
}
@ -253,31 +264,27 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=338583
}
function doTest3_g() {
gEventSourceObj3 = new EventSource("badEventFieldName.eventsource");
gEventSourceObj3_g = new EventSource("badEventFieldName.eventsource");
fnInvalidNCName.hits = 0;
gEventSourceObj3.addEventListener('message event', fnInvalidNCName, true);
gEventSourceObj3_g.addEventListener('message event', fnInvalidNCName, true);
setTimeout(function() {
ok(fnInvalidNCName.hits != 0, "Test 3.g failed");
gEventSourceObj3.close();
doTest3_h();
gEventSourceObj3_g.close();
}, parseInt(1500*stress_factor));
}
function doTest3_h() {
gEventSourceObj3 = new EventSource("http://hdfskjghsbg.jtiyoejowe.dafsgbhjab.com");
gEventSourceObj3_h = new EventSource("http://hdfskjghsbg.jtiyoejowe.dafsgbhjab.com");
gEventSourceObj3.onmessage = fn_onmessage;
gEventSourceObj3.hits = [];
gEventSourceObj3.hits['fn_onmessage'] = 0;
gEventSourceObj3_h.onmessage = fn_onmessage;
gEventSourceObj3_h.hits = [];
gEventSourceObj3_h.hits['fn_onmessage'] = 0;
setTimeout(function() {
ok(gEventSourceObj3.hits['fn_onmessage'] == 0, "Test 3.h failed");
gEventSourceObj3.close();
doTest4();
ok(gEventSourceObj3_h.hits['fn_onmessage'] == 0, "Test 3.h failed");
gEventSourceObj3_h.close();
}, parseInt(1500*stress_factor));
}
@ -288,44 +295,40 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=338583
function fn_onmessage4_a(e)
{
if (e.data > gEventSourceObj4.lastData)
gEventSourceObj4.lastData = e.data;
if (e.data > gEventSourceObj4_a.lastData)
gEventSourceObj4_a.lastData = e.data;
if (e.data == 2)
gEventSourceObj4.close();
gEventSourceObj4_a.close();
}
function fn_onmessage4_b(e)
{
if (e.data > gEventSourceObj4.lastData)
gEventSourceObj4.lastData = e.data;
if (e.data > gEventSourceObj4_b.lastData)
gEventSourceObj4_b.lastData = e.data;
if (e.data == 2)
gEventSourceObj4.removeEventListener('message', fn_onmessage4_b, true);
gEventSourceObj4_b.removeEventListener('message', fn_onmessage4_b, true);
}
function doTest4() {
gEventSourceObj4 = new EventSource("forRemoval.resource");
gEventSourceObj4.lastData = 0;
gEventSourceObj4.onmessage = fn_onmessage4_a;
gEventSourceObj4_a = new EventSource("forRemoval.resource");
gEventSourceObj4_a.lastData = 0;
gEventSourceObj4_a.onmessage = fn_onmessage4_a;
setTimeout(function() {
ok(gEventSourceObj4.lastData == 2, "Test 4.a failed");
gEventSourceObj4.close();
doTest4_b();
ok(gEventSourceObj4_a.lastData == 2, "Test 4.a failed");
gEventSourceObj4_a.close();
}, parseInt(3000*stress_factor));
}
function doTest4_b()
{
gEventSourceObj4 = new EventSource("forRemoval.resource");
gEventSourceObj4.lastData = 0;
gEventSourceObj4.addEventListener('message', fn_onmessage4_b, true);
gEventSourceObj4_b = new EventSource("forRemoval.resource");
gEventSourceObj4_b.lastData = 0;
gEventSourceObj4_b.addEventListener('message', fn_onmessage4_b, true);
setTimeout(function() {
ok(gEventSourceObj4.lastData == 2, "Test 4.b failed");
gEventSourceObj4.close();
doTest5();
ok(gEventSourceObj4_b.lastData == 2, "Test 4.b failed");
gEventSourceObj4_b.close();
}, parseInt(3000*stress_factor));
}
@ -335,33 +338,29 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=338583
function doTest5()
{
gEventSourceObj5 = new EventSource("http://example.org/tests/content/base/test/accesscontrol.resource");
gEventSourceObj5_a = new EventSource("http://example.org/tests/content/base/test/accesscontrol.resource");
gEventSourceObj5.onmessage = fn_onmessage;
gEventSourceObj5.hits = [];
gEventSourceObj5.hits['fn_onmessage'] = 0;
gEventSourceObj5_a.onmessage = fn_onmessage;
gEventSourceObj5_a.hits = [];
gEventSourceObj5_a.hits['fn_onmessage'] = 0;
setTimeout(function() {
ok(gEventSourceObj5.hits['fn_onmessage'] == 0, "Test 5.a failed");
gEventSourceObj5.close();
doTest5_b();
ok(gEventSourceObj5_a.hits['fn_onmessage'] == 0, "Test 5.a failed");
gEventSourceObj5_a.close();
}, parseInt(3000*stress_factor));
}
function doTest5_b()
{
gEventSourceObj5 = new EventSource("http://example.org/tests/content/base/test/invalid_accesscontrol.resource");
gEventSourceObj5_b = new EventSource("http://example.org/tests/content/base/test/invalid_accesscontrol.resource");
gEventSourceObj5.onmessage = fn_onmessage;
gEventSourceObj5.hits = [];
gEventSourceObj5.hits['fn_onmessage'] = 0;
gEventSourceObj5_b.onmessage = fn_onmessage;
gEventSourceObj5_b.hits = [];
gEventSourceObj5_b.hits['fn_onmessage'] = 0;
setTimeout(function() {
ok(gEventSourceObj5.hits['fn_onmessage'] == 0, "Test 5.b failed");
gEventSourceObj5.close();
doTest6();
ok(gEventSourceObj5_b.hits['fn_onmessage'] == 0, "Test 5.b failed");
gEventSourceObj5_b.close();
}, parseInt(3000*stress_factor));
}
@ -388,8 +387,6 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=338583
setTimeout(function() {
gEventSourceObj6.close();
doTest7();
}, parseInt(2500*stress_factor));
}
@ -412,7 +409,7 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=338583
SpecialPowers.setBoolPref("dom.server-events.enabled", oldPrefVal);
document.getElementById('waitSpan').innerHTML = '';
SimpleTest.finish();
}, parseInt(50000*stress_factor));
}, parseInt(8000*stress_factor));
}
function doTest()
@ -435,7 +432,7 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=338583
stress_factor = ((new Date()).getTime()-begin_time)*1/589;
stress_factor *= 1.10; // also, a margin of 10%
doTest1();
runAllTests();
}
}
f.i = 0;

View File

@ -2028,6 +2028,9 @@ nsCanvasRenderingContext2D::FillRect(float x, float y, float w, float h)
NS_IMETHODIMP
nsCanvasRenderingContext2D::StrokeRect(float x, float y, float w, float h)
{
if (w == 0.f && h == 0.f) {
return NS_OK;
}
return DrawRect(gfxRect(x, y, w, h), STYLE_STROKE);
}
@ -3291,8 +3294,14 @@ nsCanvasRenderingContext2D::DrawImage(nsIDOMElement *imgElt, float a1,
return NS_ERROR_DOM_TYPE_MISMATCH_ERR;
}
double sx,sy,sw,sh;
double dx,dy,dw,dh;
nsCOMPtr<nsIContent> content = do_QueryInterface(imgElt);
nsHTMLCanvasElement* canvas = nsHTMLCanvasElement::FromContent(content);
if (canvas) {
nsIntSize size = canvas->GetSize();
if (size.width == 0 || size.height == 0) {
return NS_ERROR_DOM_INVALID_STATE_ERR;
}
}
gfxMatrix matrix;
nsRefPtr<gfxPattern> pattern;
@ -3334,6 +3343,8 @@ nsCanvasRenderingContext2D::DrawImage(nsIDOMElement *imgElt, float a1,
}
}
double sx,sy,sw,sh;
double dx,dy,dw,dh;
if (optional_argc == 0) {
dx = a1;
dy = a2;

View File

@ -79,6 +79,7 @@ _TEST_FILES_0 = \
test_2d.composite.uncovered.image.destination-in.html \
test_2d.composite.uncovered.image.source-in.html \
test_2d.composite.uncovered.image.source-out.html \
test_2d.drawImage.zerocanvas.html \
test_toDataURL_lowercase_ascii.html \
test_toDataURL_parameters.html \
test_mozGetAsFile.html \

View File

@ -0,0 +1,56 @@
<!DOCTYPE HTML>
<title>Canvas test: 2d.drawImage.zerocanvas</title>
<script src="/MochiKit/MochiKit.js"></script>
<script src="/tests/SimpleTest/SimpleTest.js"></script>
<link rel="stylesheet" href="/tests/SimpleTest/test.css">
<body>
<canvas id="c" width="100" height="50"><p class="fallback">FAIL (fallback content)</p></canvas>
<script>
function isPixel(ctx, x,y, r,g,b,a, pos, colour, d) {
var pixel = ctx.getImageData(x, y, 1, 1);
var pr = pixel.data[0],
pg = pixel.data[1],
pb = pixel.data[2],
pa = pixel.data[3];
ok(r-d <= pr && pr <= r+d &&
g-d <= pg && pg <= g+d &&
b-d <= pb && pb <= b+d &&
a-d <= pa && pa <= a+d,
"pixel "+pos+" is "+pr+","+pg+","+pb+","+pa+"; expected "+colour+" +/- "+d);
}
SimpleTest.waitForExplicitFinish();
MochiKit.DOM.addLoadEvent(function () {
var canvas = document.getElementById('c');
var ctx = canvas.getContext('2d');
ctx.fillStyle = '#0f0';
ctx.fillRect(0, 0, 100, 50);
var canvas2 = document.createElement('canvas');
canvas2.width = 0;
canvas2.height = 10;
var _thrown = undefined; try {
ctx.drawImage(canvas2, 0, 0);
} catch (e) { _thrown = e }; ok(_thrown && _thrown.code == DOMException.INVALID_STATE_ERR, "should throw INVALID_STATE_ERR");
canvas2.width = 10;
canvas2.height = 0;
var _thrown = undefined; try {
ctx.drawImage(canvas2, 0, 0);
} catch (e) { _thrown = e }; ok(_thrown && _thrown.code == DOMException.INVALID_STATE_ERR, "should throw INVALID_STATE_ERR");
canvas2.width = 0;
canvas2.height = 0;
var _thrown = undefined; try {
ctx.drawImage(canvas2, 0, 0);
} catch (e) { _thrown = e }; ok(_thrown && _thrown.code == DOMException.INVALID_STATE_ERR, "should throw INVALID_STATE_ERR");
isPixel(ctx, 50,25, 0,255,0,255, "50,25", "0,255,0,255", 2);
SimpleTest.finish();
});
</script>

View File

@ -18395,7 +18395,7 @@ ctx.lineWidth = 250;
ctx.lineCap = 'round';
ctx.lineJoin = 'round';
ctx.strokeRect(50, 25, 0, 0);
todo_isPixel(ctx, 50,25, 0,0,0,0, 0);
isPixel(ctx, 50,25, 0,0,0,0, 0);
}

View File

@ -68,6 +68,13 @@ public:
nsHTMLCanvasElement(already_AddRefed<nsINodeInfo> aNodeInfo);
virtual ~nsHTMLCanvasElement();
static nsHTMLCanvasElement* FromContent(nsIContent* aPossibleCanvas)
{
if (!aPossibleCanvas || !aPossibleCanvas->IsHTML(nsGkAtoms::canvas)) {
return nsnull;
}
return static_cast<nsHTMLCanvasElement*>(aPossibleCanvas);
}
// nsISupports
NS_DECL_ISUPPORTS_INHERITED

View File

@ -169,4 +169,4 @@ private:
nsAutoArrayPtr<nsFramesetSpec> mColSpecs; // parsed, non-computed dimensions
};
#endif nsHTMLFrameSetElement_h
#endif // nsHTMLFrameSetElement_h

View File

@ -36,8 +36,8 @@
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
#include "nsIDOMHTMLTextAreaElement.h"
#include "nsIDOMNSHTMLTextAreaElement.h"
#include "nsITextControlElement.h"
#include "nsIDOMNSEditableElement.h"
#include "nsIControllers.h"
@ -90,7 +90,6 @@ static NS_DEFINE_CID(kXULControllersCID, NS_XULCONTROLLERS_CID);
class nsHTMLTextAreaElement : public nsGenericHTMLFormElement,
public nsIDOMHTMLTextAreaElement,
public nsIDOMNSHTMLTextAreaElement,
public nsITextControlElement,
public nsIDOMNSEditableElement,
public nsStubMutationObserver,
@ -117,9 +116,6 @@ public:
// nsIDOMHTMLTextAreaElement
NS_DECL_NSIDOMHTMLTEXTAREAELEMENT
// nsIDOMNSHTMLTextAreaElement
NS_DECL_NSIDOMNSHTMLTEXTAREAELEMENT
// nsIDOMNSEditableElement
NS_IMETHOD GetEditor(nsIEditor** aEditor)
{
@ -352,9 +348,8 @@ DOMCI_NODE_DATA(HTMLTextAreaElement, nsHTMLTextAreaElement)
// QueryInterface implementation for nsHTMLTextAreaElement
NS_INTERFACE_TABLE_HEAD_CYCLE_COLLECTION_INHERITED(nsHTMLTextAreaElement)
NS_HTML_CONTENT_INTERFACE_TABLE6(nsHTMLTextAreaElement,
NS_HTML_CONTENT_INTERFACE_TABLE5(nsHTMLTextAreaElement,
nsIDOMHTMLTextAreaElement,
nsIDOMNSHTMLTextAreaElement,
nsITextControlElement,
nsIDOMNSEditableElement,
nsIMutationObserver,

View File

@ -49,7 +49,7 @@
#include "nsTextControlFrame.h"
#include "nsIControllers.h"
#include "nsIDOMHTMLInputElement.h"
#include "nsIDOMNSHTMLTextAreaElement.h"
#include "nsIDOMHTMLTextAreaElement.h"
#include "nsITransactionManager.h"
#include "nsIControllerContext.h"
#include "nsAttrValue.h"
@ -782,7 +782,7 @@ DoCommandCallback(const char *aCommand, void *aData)
if (input) {
input->GetControllers(getter_AddRefs(controllers));
} else {
nsCOMPtr<nsIDOMNSHTMLTextAreaElement> textArea =
nsCOMPtr<nsIDOMHTMLTextAreaElement> textArea =
do_QueryInterface(content);
if (textArea) {
@ -1249,7 +1249,7 @@ nsTextEditorState::PrepareEditor(const nsAString *aValue)
if (inputElement) {
rv = inputElement->GetControllers(getter_AddRefs(controllers));
} else {
nsCOMPtr<nsIDOMNSHTMLTextAreaElement> textAreaElement =
nsCOMPtr<nsIDOMHTMLTextAreaElement> textAreaElement =
do_QueryInterface(mTextCtrlElement);
if (!textAreaElement)
@ -1460,7 +1460,7 @@ nsTextEditorState::UnbindFromFrame(nsTextControlFrame* aFrame)
inputElement->GetControllers(getter_AddRefs(controllers));
else
{
nsCOMPtr<nsIDOMNSHTMLTextAreaElement> textAreaElement =
nsCOMPtr<nsIDOMHTMLTextAreaElement> textAreaElement =
do_QueryInterface(mTextCtrlElement);
if (textAreaElement) {
textAreaElement->GetControllers(getter_AddRefs(controllers));

View File

@ -582,6 +582,9 @@ nsBindingManager::SetBinding(nsIContent* aContent, nsXBLBinding* aBinding)
SetWrappedJS(aContent, nsnull);
SetContentListFor(aContent, nsnull);
SetAnonymousNodesFor(aContent, nsnull);
if (oldBinding) {
oldBinding->SetBoundElement(nsnull);
}
}
return result ? NS_OK : NS_ERROR_FAILURE;

View File

@ -974,9 +974,7 @@ nsXBLBinding::ExecuteAttachedHandler()
if (mNextBinding)
mNextBinding->ExecuteAttachedHandler();
// Executing mNextBindings constructor might have caused us to loose our
// bound element
if (mBoundElement && AllowScripts())
if (AllowScripts())
mPrototypeBinding->BindingAttached(mBoundElement);
}
@ -1408,7 +1406,7 @@ nsXBLBinding::AllowScripts()
return PR_FALSE;
}
nsIDocument* doc = mBoundElement->GetOwnerDoc();
nsIDocument* doc = mBoundElement ? mBoundElement->GetOwnerDoc() : nsnull;
if (!doc) {
return PR_FALSE;
}

View File

@ -54,7 +54,7 @@
#include "nsIDOMXULElement.h"
#include "nsIDOMNSUIEvent.h"
#include "nsIURI.h"
#include "nsIDOMNSHTMLTextAreaElement.h"
#include "nsIDOMHTMLTextAreaElement.h"
#include "nsIDOMHTMLInputElement.h"
#include "nsIDOMText.h"
#include "nsFocusManager.h"
@ -558,7 +558,7 @@ nsXBLPrototypeHandler::GetController(nsPIDOMEventTarget* aTarget)
xulElement->GetControllers(getter_AddRefs(controllers));
if (!controllers) {
nsCOMPtr<nsIDOMNSHTMLTextAreaElement> htmlTextArea(do_QueryInterface(aTarget));
nsCOMPtr<nsIDOMHTMLTextAreaElement> htmlTextArea(do_QueryInterface(aTarget));
if (htmlTextArea)
htmlTextArea->GetControllers(getter_AddRefs(controllers));
}

View File

@ -50,7 +50,6 @@
#include "nsIDOMXULDocument.h"
#include "nsIDOMHTMLDocument.h"
#include "nsIDOMElement.h"
#include "nsIDOMNSHTMLTextAreaElement.h"
#include "nsIDOMWindowInternal.h"
#include "nsIDOMXULElement.h"
#include "nsIDocument.h"

View File

@ -8,8 +8,6 @@
<!ENTITY % netErrorDTD
SYSTEM "chrome://global/locale/netError.dtd">
%netErrorDTD;
<!-- Fallback in case netOffline.overrideLongDesc is not defined -->
<!ENTITY netOffline.overrideLongDesc "&netOffline.longDesc;">
<!ENTITY % globalDTD
SYSTEM "chrome://global/locale/global.dtd">
%globalDTD;
@ -42,6 +40,7 @@
- Jeff Walden <jwalden+code@mit.edu>
- Johnathan Nightingale <johnath@mozilla.com>
- Ehsan Akhgari <ehsan.akhgari@gmail.com>
- Steffen Wilberg <steffen.wilberg@web.de>
-
- Alternatively, the contents of this file may be used under the terms of
- either the GNU General Public License Version 2 or later (the "GPL"), or
@ -115,6 +114,13 @@
function retryThis(buttonEl)
{
// If this is the "Offline mode" page, go online!
if (getErrorCode() == "netOffline") {
window.QueryInterface(Components.interfaces.nsIInterfaceRequestor)
.getInterface(Components.interfaces.nsIDOMWindowUtils)
.goOnline();
}
// Session history has the URL of the page that failed
// to load, not the one of the error page. So, just call
// reload(), which will also repost POST data correctly.
@ -342,7 +348,7 @@
<div id="ed_redirectLoop">&redirectLoop.longDesc;</div>
<div id="ed_unknownSocketType">&unknownSocketType.longDesc;</div>
<div id="ed_netReset">&netReset.longDesc;</div>
<div id="ed_netOffline">&netOffline.overrideLongDesc;</div>
<div id="ed_netOffline">&netOffline.longDesc2;</div>
<div id="ed_netInterrupt">&netInterrupt.longDesc;</div>
<div id="ed_deniedPortAccess">&deniedPortAccess.longDesc;</div>
<div id="ed_proxyResolveFailure">&proxyResolveFailure.longDesc;</div>

View File

@ -50,6 +50,7 @@ _BROWSER_TEST_FILES = \
browser_bug349769.js \
browser_bug388121-1.js \
browser_bug388121-2.js \
browser_bug435325.js \
browser_bug441169.js \
browser_bug420605.js \
file_bug420605.html \

View File

@ -0,0 +1,49 @@
/* Any copyright is dedicated to the Public Domain.
http://creativecommons.org/publicdomain/zero/1.0/ */
/* Ensure that clicking the button in the Offline mode neterror page makes the browser go online. See bug 435325. */
/* TEST_PATH=docshell/test/browser/browser_bug435325.js make -C $(OBJDIR) mochitest-browser-chrome */
function test() {
waitForExplicitFinish();
gBrowser.selectedTab = gBrowser.addTab();
window.addEventListener("DOMContentLoaded", checkPage, false);
// Go offline and disable the cache, then try to load the test URL.
Services.io.offline = true;
gPrefService.setBoolPref("browser.cache.disk.enable", false);
gPrefService.setBoolPref("browser.cache.memory.enable", false);
content.location = "http://example.com/";
}
function checkPage() {
if(content.location == "about:blank") {
info("got about:blank, which is expected once, so return");
return;
}
window.removeEventListener("DOMContentLoaded", checkPage, false);
ok(Services.io.offline, "Setting Services.io.offline to true.");
is(gBrowser.contentDocument.documentURI.substring(0,27),
"about:neterror?e=netOffline", "Loading the Offline mode neterror page.");
// Now press the "Try Again" button
ok(gBrowser.contentDocument.getElementById("errorTryAgain"),
"The error page has got a #errorTryAgain element");
gBrowser.contentDocument.getElementById("errorTryAgain").click();
ok(!Services.io.offline, "After clicking the Try Again button, we're back "
+" online. This depends on Components.interfaces.nsIDOMWindowUtils being "
+"available from untrusted content (bug 435325).");
finish();
}
registerCleanupFunction(function() {
gPrefService.setBoolPref("browser.cache.disk.enable", true);
gPrefService.setBoolPref("browser.cache.memory.enable", true);
Services.io.offline = false;
gBrowser.removeCurrentTab();
});

View File

@ -2,8 +2,6 @@
// Globals
var testPath = "http://mochi.test:8888/browser/docshell/test/navigation/";
var Ci = Components.interfaces;
var Cc = Components.classes;
var ctx = {};
// Helper function to check if a window is active
@ -214,9 +212,8 @@ function step7() {
function allDone() {
// Close the tabs we made
gBrowser.removeCurrentTab();
gBrowser.tabContainer.advanceSelectedTab(1, true);
gBrowser.removeCurrentTab();
gBrowser.removeTab(ctx.tab1);
gBrowser.removeTab(ctx.tab2);
// Tell the framework we're done
finish();

View File

@ -308,7 +308,6 @@
#include "nsIDOMHTMLTableRowElement.h"
#include "nsIDOMHTMLTableSectionElem.h"
#include "nsIDOMHTMLTextAreaElement.h"
#include "nsIDOMNSHTMLTextAreaElement.h"
#include "nsIDOMHTMLTitleElement.h"
#include "nsIDOMHTMLUListElement.h"
#include "nsIDOMHTMLUnknownElement.h"
@ -2936,7 +2935,6 @@ nsDOMClassInfo::Init()
DOM_CLASSINFO_MAP_BEGIN(HTMLTextAreaElement, nsIDOMHTMLTextAreaElement)
DOM_CLASSINFO_MAP_ENTRY(nsIDOMHTMLTextAreaElement)
DOM_CLASSINFO_MAP_ENTRY(nsIDOMNSHTMLTextAreaElement)
DOM_CLASSINFO_GENERIC_HTML_MAP_ENTRIES
DOM_CLASSINFO_MAP_END

View File

@ -81,6 +81,7 @@
#include "jsobj.h"
#include "Layers.h"
#include "nsIIOService.h"
#include "mozilla/dom/Element.h"
@ -1770,6 +1771,30 @@ nsDOMWindowUtils::GetCursorType(PRInt16 *aCursor)
return NS_OK;
}
NS_IMETHODIMP
nsDOMWindowUtils::GoOnline()
{
// This is only allowed from about:neterror, which is unprivileged, so it
// can't access the io-service itself.
NS_ENSURE_TRUE(mWindow, NS_ERROR_FAILURE);
nsCOMPtr<nsIDocument> doc(do_QueryInterface(mWindow->GetExtantDocument()));
NS_ENSURE_TRUE(doc, NS_ERROR_FAILURE);
nsCOMPtr<nsIURI> documentURI;
documentURI = doc->GetDocumentURI();
nsCAutoString spec;
documentURI->GetSpec(spec);
if (!StringBeginsWith(spec, NS_LITERAL_CSTRING("about:neterror?")))
return NS_ERROR_DOM_SECURITY_ERR;
nsCOMPtr<nsIIOService> ios = do_GetService("@mozilla.org/network/io-service;1");
if (ios) {
ios->SetOffline(PR_FALSE); // !offline
return NS_OK;
}
return NS_ERROR_NOT_AVAILABLE;
}
NS_IMETHODIMP
nsDOMWindowUtils::GetDisplayDPI(float *aDPI)
{

View File

@ -56,7 +56,7 @@
#include "nsGlobalWindow.h"
#include "nsFocusManager.h"
#include "nsIDOMHTMLInputElement.h"
#include "nsIDOMNSHTMLTextAreaElement.h"
#include "nsIDOMHTMLTextAreaElement.h"
#include "nsIControllers.h"
#include "nsCycleCollectionParticipant.h"
@ -286,7 +286,7 @@ nsWindowRoot::GetControllers(nsIControllers** aResult)
return xulElement->GetControllers(aResult);
#endif
nsCOMPtr<nsIDOMNSHTMLTextAreaElement> htmlTextArea =
nsCOMPtr<nsIDOMHTMLTextAreaElement> htmlTextArea =
do_QueryInterface(focusedContent);
if (htmlTextArea)
return htmlTextArea->GetControllers(aResult);

View File

@ -43,7 +43,7 @@ interface nsIIDBRequest;
interface nsIVariant;
%{C++
#include "jsapi.h"
#include "jspubtd.h"
%}
/**

View File

@ -47,7 +47,7 @@ interface nsIDOMDOMStringList;
interface nsIDOMEventListener;
%{C++
#include "jsapi.h"
#include "jspubtd.h"
%}
/**

View File

@ -45,7 +45,7 @@ interface nsIIDBRequest;
interface nsIVariant;
%{C++
#include "jsapi.h"
#include "jspubtd.h"
%}
/**

View File

@ -47,7 +47,7 @@ interface nsIVariant;
interface nsIDOMDOMStringList;
%{C++
#include "jsapi.h"
#include "jspubtd.h"
%}
/**

View File

@ -66,7 +66,7 @@ interface nsITransferable;
interface nsIQueryContentEventResult;
interface nsIDOMWindow;
[scriptable, uuid(663e33d7-eca2-42e8-af92-5df6a5e222df)]
[scriptable, uuid(b46050ea-6f18-11e0-bf00-f389b7004a12)]
interface nsIDOMWindowUtils : nsISupports {
/**
@ -802,6 +802,13 @@ interface nsIDOMWindowUtils : nsISupports {
void suspendTimeouts();
void resumeTimeouts();
/**
* Set the network status to online from the Offline mode error page.
*
* The caller of this method must be about:neterror.
*/
void goOnline();
/**
* What type of layer manager the widget associated with this window is
* using. "Basic" is unaccelerated; other types are accelerated. Throws an

View File

@ -123,7 +123,6 @@ XPIDLSRCS = \
nsIDOMNSHTMLElement.idl \
nsIDOMNSHTMLFrameElement.idl \
nsIDOMNSHTMLOptionCollectn.idl \
nsIDOMNSHTMLTextAreaElement.idl \
$(NULL)
include $(topsrcdir)/config/rules.mk

View File

@ -39,6 +39,9 @@
#include "nsIDOMHTMLElement.idl"
interface nsIControllers;
interface nsIDOMValidityState;
/**
* The nsIDOMHTMLTextAreaElement interface is the interface to a
* [X]HTML textarea element.
@ -53,16 +56,45 @@
[scriptable, uuid(905edd3e-c0b3-4d54-8a2c-0eaab6ccb3cf)]
interface nsIDOMHTMLTextAreaElement : nsIDOMHTMLElement
{
// Modified in DOM Level 2:
attribute DOMString defaultValue;
readonly attribute nsIDOMHTMLFormElement form;
attribute boolean autofocus;
attribute unsigned long cols;
attribute boolean disabled;
readonly attribute nsIDOMHTMLFormElement form;
attribute long maxLength;
attribute DOMString name;
attribute DOMString placeholder;
attribute boolean readOnly;
attribute boolean required;
attribute unsigned long rows;
attribute long tabIndex;
/**
* Reflects the wrap content attribute. Possible values are "soft", "hard" and
* "off". "soft" is the default.
*/
[Null(Stringify)]
attribute DOMString wrap;
readonly attribute DOMString type;
attribute DOMString defaultValue;
attribute DOMString value;
void select();
readonly attribute long textLength;
// The following lines are part of the constraint validation API, see:
// http://www.whatwg.org/specs/web-apps/current-work/#the-constraint-validation-api
readonly attribute boolean willValidate;
readonly attribute nsIDOMValidityState validity;
readonly attribute DOMString validationMessage;
boolean checkValidity();
void setCustomValidity(in DOMString error);
void select();
attribute long selectionStart;
attribute long selectionEnd;
void setSelectionRange(in long selectionStart, in long selectionEnd);
// Defined on HTMLElement in the specification.
attribute long tabIndex;
// Mozilla extensions
readonly attribute nsIControllers controllers;
};

View File

@ -1,74 +0,0 @@
/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
* The contents of this file are subject to the Mozilla Public License Version
* 1.1 (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
* http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
* for the specific language governing rights and limitations under the
* License.
*
* The Original Code is mozilla.org code.
*
* The Initial Developer of the Original Code is
* Netscape Communications Corporation.
* Portions created by the Initial Developer are Copyright (C) 2000
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
* Vidur Apparao <vidur@netscape.com> (original author)
* Johnny Stenback <jst@netscape.com>
*
* Alternatively, the contents of this file may be used under the terms of
* either of the GNU General Public License Version 2 or later (the "GPL"),
* or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
* in which case the provisions of the GPL or the LGPL are applicable instead
* of those above. If you wish to allow use of your version of this file only
* under the terms of either the GPL or the LGPL, and not to allow others to
* use your version of this file under the terms of the MPL, indicate your
* decision by deleting the provisions above and replace them with the notice
* and other provisions required by the GPL or the LGPL. If you do not delete
* the provisions above, a recipient may use your version of this file under
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
#include "domstubs.idl"
interface nsIControllers;
interface nsIDOMValidityState;
[scriptable, uuid(df5dc23d-cf90-443e-bf56-cd3af021ebc7)]
interface nsIDOMNSHTMLTextAreaElement : nsISupports
{
attribute boolean autofocus;
readonly attribute nsIControllers controllers;
readonly attribute long textLength;
attribute long selectionStart;
attribute long selectionEnd;
attribute long maxLength;
attribute DOMString placeholder;
attribute boolean required;
/**
* Reflects the wrap content attribute. Possible values are "soft, "hard" and
* "off". "soft" is the default.
*/
[Null(Stringify)] attribute DOMString wrap;
// The following lines are parte of the constraint validation API, see:
// http://www.whatwg.org/specs/web-apps/current-work/#the-constraint-validation-api
readonly attribute boolean willValidate;
readonly attribute nsIDOMValidityState validity;
readonly attribute DOMString validationMessage;
boolean checkValidity();
void setCustomValidity(in DOMString error);
void setSelectionRange(in long selectionStart,
in long selectionEnd);
};

View File

@ -25,8 +25,7 @@
<!ENTITY netInterrupt.longDesc "<p>The browser connected successfully, but the connection was interrupted while transferring information. Please try again.</p><ul><li>Are you unable to browse other sites? Check the computer's network connection.</li><li>Still having trouble? Consult your network administrator or Internet provider for assistance.</li></ul>">
<!ENTITY netOffline.title "Offline Mode">
<!ENTITY netOffline.longDesc "<p>The browser is operating in its offline mode and cannot connect to the requested item.</p><ul><li>Is the computer connected to an active network?</li><li>Place the browser in online mode and try again.</li></ul>">
<!ENTITY netOffline.overrideLongDesc "<p>The browser is operating in its offline mode and cannot connect to the requested item.</p><ul><li>Is the computer connected to an active network?</li><li>Place the browser in online mode and try again.</li></ul>">
<!ENTITY netOffline.longDesc2 "<p>The browser is operating in its offline mode and cannot connect to the requested item.</p><ul><li>Is the computer connected to an active network?</li><li>Press &quot;Try Again&quot; to switch to online mode and reload the page.</li></ul>">
<!ENTITY contentEncodingError.title "Content Encoding Error">
<!ENTITY contentEncodingError.longDesc "<p>The page you are trying to view cannot be shown because it uses an invalid or unsupported form of compression.</p><ul><li>Please contact the website owners to inform them of this problem.</li></ul>">

View File

@ -42,6 +42,23 @@ class NSCursor;
#import <Cocoa/Cocoa.h>
#endif
// The header file QuickdrawAPI.h is missing on OS X 10.7 and up (though the
// QuickDraw APIs defined in it are still present) -- so we need to supply the
// relevant parts of its contents here. It's likely that Apple will eventually
// remove the APIs themselves (probably in OS X 10.8), so we need to make them
// weak imports, and test for their presence before using them.
#if !defined(__QUICKDRAWAPI__)
typedef short Bits16[16];
struct Cursor {
Bits16 data;
Bits16 mask;
Point hotSpot;
};
typedef struct Cursor Cursor;
#endif /* __QUICKDRAWAPI__ */
namespace mac_plugin_interposing {
// Class used to serialize NSCursor objects over IPC between processes.

View File

@ -64,6 +64,18 @@
#include <dlfcn.h>
#import <Carbon/Carbon.h>
// The header file QuickdrawAPI.h is missing on OS X 10.7 and up (though the
// QuickDraw APIs defined in it are still present) -- so we need to supply the
// relevant parts of its contents here. It's likely that Apple will eventually
// remove the APIs themselves (probably in OS X 10.8), so we need to make them
// weak imports, and test for their presence before using them.
#if !defined(__QUICKDRAWAPI__)
typedef struct Cursor;
extern "C" void SetCursor(const Cursor * crsr) __attribute__((weak_import));
#endif /* __QUICKDRAWAPI__ */
BOOL (*OnSetThemeCursorPtr) (ThemeCursor) = NULL;
BOOL (*OnSetCursorPtr) (const Cursor*) = NULL;
BOOL (*OnHideCursorPtr) () = NULL;
@ -106,10 +118,12 @@ static OSStatus MacPluginChildSetThemeCursor(ThemeCursor cursor)
static void MacPluginChildSetCursor(const Cursor* cursor)
{
if (loadXULPtrs()) {
OnSetCursorPtr(cursor);
if (::SetCursor) {
if (loadXULPtrs()) {
OnSetCursorPtr(cursor);
}
::SetCursor(cursor);
}
::SetCursor(cursor);
}
static CGError MacPluginChildCGDisplayHideCursor(CGDirectDisplayID display)
@ -142,9 +156,13 @@ struct interpose_substitution {
__attribute__((used)) static const interpose_substitution substitutions[]
__attribute__((section("__DATA, __interpose"))) = {
INTERPOSE_FUNCTION(SetThemeCursor),
INTERPOSE_FUNCTION(SetCursor),
INTERPOSE_FUNCTION(CGDisplayHideCursor),
INTERPOSE_FUNCTION(CGDisplayShowCursor),
// SetCursor() and other QuickDraw APIs will probably be removed in OS X
// 10.8. But this will make 'SetCursor' NULL, which will just stop the OS
// from interposing it (tested using an INTERPOSE_FUNCTION_BROKEN macro
// that just sets the second address of each tuple to NULL).
INTERPOSE_FUNCTION(SetCursor),
};
#endif // !__LP64__

View File

@ -61,6 +61,13 @@
#include FT_LCD_FILTER_H
#endif
#define _GNU_SOURCE /* for RTLD_DEFAULT */
#include <dlfcn.h>
#ifndef RTLD_DEFAULT
#define RTLD_DEFAULT ((void *) 0)
#endif
/* Fontconfig version older than 2.6 didn't have these options */
#ifndef FC_LCD_FILTER
#define FC_LCD_FILTER "lcdfilter"
@ -81,6 +88,9 @@
#define FT_LCD_FILTER_LEGACY 16
#endif
typedef FT_Error (*setLcdFilterFunc)(FT_Library, int);
static setLcdFilterFunc setLcdFilter;
#define DOUBLE_TO_26_6(d) ((FT_F26Dot6)((d) * 64.0))
#define DOUBLE_FROM_26_6(t) ((double)(t) / 64.0)
#define DOUBLE_TO_16_16(d) ((FT_Fixed)((d) * 65536.0))
@ -1332,6 +1342,7 @@ _render_glyph_outline (FT_Face face,
} else {
int bitmap_size;
static int initialized_setLcdFilter = 0;
switch (render_mode) {
case FT_RENDER_MODE_LCD:
@ -1355,15 +1366,18 @@ _render_glyph_outline (FT_Face face,
break;
}
#if HAVE_FT_LIBRARY_SETLCDFILTER
FT_Library_SetLcdFilter (library, lcd_filter);
#endif
if (!initialized_setLcdFilter) {
initialized_setLcdFilter = 1;
setLcdFilter = (setLcdFilterFunc) dlsym(RTLD_DEFAULT, "FT_Library_SetLcdFilter");
}
if (setLcdFilter)
setLcdFilter (library, lcd_filter);
fterror = FT_Render_Glyph (face->glyph, render_mode);
#if HAVE_FT_LIBRARY_SETLCDFILTER
FT_Library_SetLcdFilter (library, FT_LCD_FILTER_NONE);
#endif
if (setLcdFilter)
setLcdFilter (library, FT_LCD_FILTER_NONE);
if (fterror != 0)
return _cairo_error (CAIRO_STATUS_NO_MEMORY);

View File

@ -41,7 +41,6 @@
#include "nsIServiceManager.h"
#include "nsIConsoleService.h"
#include "nsPrintfCString.h"
#include "nsIPrefService.h"
#include "Nv3DVUtils.h"
#include "plstr.h"

View File

@ -46,9 +46,8 @@
#include "gfxWindowsPlatform.h"
#include "nsIGfxInfo.h"
#include "nsServiceManagerUtils.h"
#include "nsIPrefService.h"
#include "nsIPrefBranch2.h"
#include "gfxFailure.h"
#include "mozilla/Preferences.h"
#include "gfxCrashReporterUtils.h"
@ -75,15 +74,9 @@ LayerManagerD3D9::Initialize()
{
ScopedGfxFeatureReporter reporter("D3D9 Layers");
nsCOMPtr<nsIPrefBranch2> prefs = do_GetService(NS_PREFSERVICE_CONTRACTID);
/* XXX: this preference and blacklist code should move out of the layer manager */
PRBool forceAccelerate = PR_FALSE;
if (prefs) {
// we should use Preferences::AddBoolVarCache
prefs->GetBoolPref("layers.acceleration.force-enabled",
&forceAccelerate);
}
PRBool forceAccelerate =
Preferences::GetBool("layers.acceleration.force-enabled", PR_FALSE);
nsCOMPtr<nsIGfxInfo> gfxInfo = do_GetService("@mozilla.org/gfx/info;1");
if (gfxInfo) {

View File

@ -57,8 +57,6 @@
#include "nsIServiceManager.h"
#include "nsIConsoleService.h"
#include "nsIPrefService.h"
#include "nsIPrefBranch2.h"
#include "gfxCrashReporterUtils.h"

View File

@ -45,11 +45,11 @@
#include "nsIWidget.h"
#include "mozilla/Services.h"
#include "mozilla/Preferences.h"
#include "nsIServiceManager.h"
#include "nsILanguageAtomService.h"
#include "nsIObserver.h"
#include "nsIObserverService.h"
#include "nsIPrefService.h"
#include "gfxImageSurface.h"
@ -84,6 +84,7 @@ static nsSystemFontsAndroid *gSystemFonts = nsnull;
#error Need to declare gSystemFonts!
#endif
using namespace mozilla;
using mozilla::services::GetObserverService;
class nsFontCache : public nsIObserver
@ -368,19 +369,11 @@ nsDeviceContext::SetDPI()
mAppUnitsPerDevNotScaledPixel =
NS_lround((AppUnitsPerCSSPixel() * 96) / dpi);
} else {
nsCOMPtr<nsIPrefBranch> prefs = do_GetService(NS_PREFSERVICE_CONTRACTID);
// A value of -1 means use the maximum of 96 and the system DPI.
// A value of 0 means use the system DPI. A positive value is used as the DPI.
// This sets the physical size of a device pixel and thus controls the
// interpretation of physical units.
PRInt32 prefDPI = -1;
if (prefs) {
nsresult rv = prefs->GetIntPref("layout.css.dpi", &prefDPI);
if (NS_FAILED(rv)) {
prefDPI = -1;
}
}
PRInt32 prefDPI = Preferences::GetInt("layout.css.dpi", -1);
if (prefDPI > 0) {
dpi = prefDPI;
@ -399,12 +392,9 @@ nsDeviceContext::SetDPI()
// controls the size of a CSS "px".
float devPixelsPerCSSPixel = -1.0;
if (prefs) {
nsXPIDLCString prefString;
nsresult rv = prefs->GetCharPref("layout.css.devPixelsPerPx", getter_Copies(prefString));
if (NS_SUCCEEDED(rv) && !prefString.IsEmpty()) {
devPixelsPerCSSPixel = static_cast<float>(atof(prefString));
}
nsAdoptingCString prefString = Preferences::GetCString("layout.css.devPixelsPerPx");
if (!prefString.IsEmpty()) {
devPixelsPerCSSPixel = static_cast<float>(atof(prefString));
}
if (devPixelsPerCSSPixel <= 0) {

View File

@ -40,9 +40,7 @@
#include "nsString.h"
#include "nsDependentString.h"
#include "nsServiceManagerUtils.h"
#include "nsIPrefService.h"
#include "nsIPrefBranch.h"
#include "mozilla/Preferences.h"
#include "gfxContext.h"
#include "gfxFont.h"
@ -59,6 +57,8 @@
#include "gtk/gtk.h"
#endif
using namespace mozilla;
enum {
S_UTF8 = 0,
S_ASCII = 1
@ -358,21 +358,7 @@ main (int argc, char **argv) {
if (0) {
nsresult rv;
nsCOMPtr<nsIPrefService> prefsvc = do_GetService(NS_PREFSERVICE_CONTRACTID);
if (!prefsvc) {
printf ("Pref svc get failed!\n");
}
nsCOMPtr<nsIPrefBranch> branch;
rv = prefsvc->GetBranch(nsnull, getter_AddRefs(branch));
if (NS_FAILED(rv))
printf ("Failed 0x%08x\n", rv);
nsXPIDLCString str;
rv = branch->GetCharPref("font.name.sans-serif.x-western", getter_Copies(str));
if (NS_FAILED(rv))
printf ("Failed[2] 0x%08x\n", rv);
nsAdoptingCString str = Preferences::GetCString("font.name.sans-serif.x-western");
printf ("sans-serif.x-western: %s\n", nsPromiseFlatCString(str).get());
}

View File

@ -42,10 +42,6 @@
#include "prinrval.h"
#include "nsServiceManagerUtils.h"
#include "nsIPrefService.h"
#include "nsIPrefBranch.h"
#include "gfxContext.h"
#include "gfxFont.h"
#include "gfxPlatform.h"

View File

@ -42,10 +42,6 @@
#include "prinrval.h"
#include "nsServiceManagerUtils.h"
#include "nsIPrefService.h"
#include "nsIPrefBranch.h"
#include "gfxContext.h"
#include "gfxFont.h"
#include "gfxPlatform.h"

View File

@ -78,8 +78,7 @@ typedef void *EGLNativeWindowType;
#elif defined(XP_WIN)
#include "nsServiceManagerUtils.h"
#include "nsIPrefBranch.h"
#include "mozilla/Preferences.h"
#include "nsILocalFile.h"
#ifndef WIN32_LEAN_AND_MEAN
@ -318,14 +317,10 @@ public:
// Allow for explicitly specifying the location of libEGL.dll and
// libGLESv2.dll.
do {
nsCOMPtr<nsIPrefBranch> prefs = do_GetService("@mozilla.org/preferences-service;1");
nsCOMPtr<nsILocalFile> eglFile, glesv2File;
if (!prefs)
break;
nsresult rv = prefs->GetComplexValue("gfx.angle.egl.path",
NS_GET_IID(nsILocalFile),
getter_AddRefs(eglFile));
nsresult rv = Preferences::GetComplex("gfx.angle.egl.path",
NS_GET_IID(nsILocalFile),
getter_AddRefs(eglFile));
if (NS_FAILED(rv) || !eglFile)
break;

View File

@ -43,7 +43,7 @@
#include "nsDirectoryServiceUtils.h"
#include "nsAppDirectoryServiceDefs.h"
#include "nsIConsoleService.h"
#include "nsIPrefService.h"
#include "mozilla/Preferences.h"
#include "gfxASurface.h"
#include "gfxImageSurface.h"
@ -106,22 +106,8 @@ OSMesaLibrary::EnsureInitialized()
if (mInitialized)
return PR_TRUE;
nsresult rv;
nsCOMPtr<nsIPrefService> prefService = do_GetService(NS_PREFSERVICE_CONTRACTID, &rv);
NS_ENSURE_SUCCESS(rv, PR_FALSE);
nsCOMPtr<nsIPrefBranch> prefBranch;
rv = prefService->GetBranch("webgl.", getter_AddRefs(prefBranch));
NS_ENSURE_SUCCESS(rv, PR_FALSE);
nsCString osmesalib;
rv = prefBranch->GetCharPref("osmesalib", getter_Copies(osmesalib));
if (NS_FAILED(rv) ||
osmesalib.Length() == 0)
{
nsAdoptingCString osmesalib = Preferences::GetCString("webgl.osmesalib");
if (osmesalib.IsEmpty()) {
return PR_FALSE;
}

View File

@ -40,7 +40,6 @@
// Mozilla includes
#include "nscore.h"
#include "nsIPrefService.h"
#include "nsIServiceManager.h"
#include "nsCOMPtr.h"
#include "nsAutoPtr.h"

View File

@ -42,10 +42,9 @@
#include "gfxDWriteFonts.h"
#include "nsUnicharUtils.h"
#include "nsILocaleService.h"
#include "nsIPrefService.h"
#include "nsIPrefBranch2.h"
#include "nsServiceManagerUtils.h"
#include "nsCharSeparatedTokenizer.h"
#include "mozilla/Preferences.h"
#include "gfxGDIFontList.h"
@ -696,15 +695,7 @@ gfxDWriteFontList::InitFontList()
fc->AgeAllGenerations();
}
nsCOMPtr<nsIPrefBranch2> pref = do_GetService(NS_PREFSERVICE_CONTRACTID);
nsresult rv;
rv = pref->GetBoolPref(
"gfx.font_rendering.directwrite.use_gdi_table_loading",
&mGDIFontTableAccess);
if (NS_FAILED(rv)) {
mGDIFontTableAccess = PR_FALSE;
}
mGDIFontTableAccess = Preferences::GetBool("gfx.font_rendering.directwrite.use_gdi_table_loading", PR_FALSE);
gfxPlatformFontList::InitFontList();
@ -953,12 +944,9 @@ gfxDWriteFontList::DelayedInitFontList()
}
}
nsCOMPtr<nsIPrefBranch2> pref = do_GetService(NS_PREFSERVICE_CONTRACTID);
nsXPIDLCString classicFamilies;
nsresult rv = pref->GetCharPref(
"gfx.font_rendering.cleartype_params.force_gdi_classic_for_families",
getter_Copies(classicFamilies));
if (NS_SUCCEEDED(rv)) {
nsAdoptingCString classicFamilies =
Preferences::GetCString("gfx.font_rendering.cleartype_params.force_gdi_classic_for_families");
if (classicFamilies) {
nsCCharSeparatedTokenizer tokenizer(classicFamilies, ',');
while (tokenizer.hasMoreTokens()) {
NS_ConvertUTF8toUTF16 name(tokenizer.nextToken());
@ -969,12 +957,9 @@ gfxDWriteFontList::DelayedInitFontList()
}
}
}
PRInt32 forceGDIClassicMaxFontSize = 0;
rv = pref->GetIntPref("gfx.font_rendering.cleartype_params.force_gdi_classic_max_size",
&forceGDIClassicMaxFontSize);
if (NS_SUCCEEDED(rv)) {
mForceGDIClassicMaxFontSize = forceGDIClassicMaxFontSize;
}
mForceGDIClassicMaxFontSize =
Preferences::GetInt("gfx.font_rendering.cleartype_params.force_gdi_classic_max_size",
mForceGDIClassicMaxFontSize);
StartLoader(kDelayBeforeLoadingFonts, kIntervalBetweenLoadingFonts);

View File

@ -67,13 +67,15 @@
#include "gfxAtoms.h"
#include "nsTArray.h"
#include "nsUnicodeRange.h"
#include "nsIPrefService.h"
#include "nsIPrefLocalizedString.h"
#include "nsServiceManagerUtils.h"
#include "nsCRT.h"
#include "prlog.h"
#include "prinit.h"
#include "mozilla/Preferences.h"
using namespace mozilla;
static PRLogModuleInfo *gFontLog = PR_NewLogModule("ft2fonts");
static const char *sCJKLangGroup[] = {
@ -510,25 +512,9 @@ void gfxFT2FontGroup::GetCJKPrefFonts(nsTArray<nsRefPtr<gfxFontEntry> >& aFontEn
key.AppendInt(mStyle.weight);
if (!platform->GetPrefFontEntries(key, &aFontEntryList)) {
nsCOMPtr<nsIPrefService> prefs = do_GetService(NS_PREFSERVICE_CONTRACTID);
if (!prefs)
return;
nsCOMPtr<nsIPrefBranch> prefBranch;
prefs->GetBranch(0, getter_AddRefs(prefBranch));
if (!prefBranch)
return;
NS_ENSURE_TRUE(Preferences::GetRootBranch(), );
// Add the CJK pref fonts from accept languages, the order should be same order
nsCAutoString list;
nsCOMPtr<nsIPrefLocalizedString> val;
nsresult rv = prefBranch->GetComplexValue("intl.accept_languages", NS_GET_IID(nsIPrefLocalizedString),
getter_AddRefs(val));
if (NS_SUCCEEDED(rv) && val) {
nsAutoString temp;
val->ToString(getter_Copies(temp));
LossyCopyUTF16toASCII(temp, list);
}
nsAdoptingCString list = Preferences::GetLocalizedCString("intl.accept_languages");
if (!list.IsEmpty()) {
const char kComma = ',';
const char *p, *p_end;

View File

@ -43,7 +43,6 @@
#endif
#include "prlog.h"
#include "nsIPrefService.h"
#include "nsServiceManagerUtils.h"
#include "nsReadableUtils.h"
#include "nsExpirationTracker.h"
@ -66,6 +65,7 @@
#include "nsUnicodeRange.h"
#include "nsCompressedCharMap.h"
#include "nsStyleConsts.h"
#include "mozilla/Preferences.h"
#include "cairo.h"
#include "gfxFontTest.h"
@ -2178,8 +2178,6 @@ gfxFontGroup::ForEachFontInternal(const nsAString& aFamilies,
}
groupAtom->ToUTF8String(groupString);
nsCOMPtr<nsIPrefBranch> prefs = do_GetService(NS_PREFSERVICE_CONTRACTID);
nsPromiseFlatString families(aFamilies);
const PRUnichar *p, *p_end;
families.BeginReading(p);
@ -2187,7 +2185,6 @@ gfxFontGroup::ForEachFontInternal(const nsAString& aFamilies,
nsAutoString family;
nsCAutoString lcFamily;
nsAutoString genericFamily;
nsXPIDLCString value;
while (p < p_end) {
while (nsCRT::IsAsciiSpace(*p) || *p == kComma)
@ -2239,12 +2236,10 @@ gfxFontGroup::ForEachFontInternal(const nsAString& aFamilies,
prefName.AppendLiteral(".");
prefName.Append(groupString);
// prefs file always uses (must use) UTF-8 so that we can use
// |GetCharPref| and treat the result as a UTF-8 string.
nsresult rv = prefs->GetCharPref(prefName.get(), getter_Copies(value));
if (NS_SUCCEEDED(rv)) {
nsAdoptingString value = Preferences::GetString(prefName.get());
if (value) {
CopyASCIItoUTF16(lcFamily, genericFamily);
CopyUTF8toUTF16(value, family);
family = value;
}
} else {
generic = PR_FALSE;
@ -2293,10 +2288,9 @@ gfxFontGroup::ForEachFontInternal(const nsAString& aFamilies,
prefName.Append(lcFamily);
prefName.AppendLiteral(".");
prefName.Append(groupString);
nsresult rv = prefs->GetCharPref(prefName.get(), getter_Copies(value));
if (NS_SUCCEEDED(rv)) {
ForEachFontInternal(NS_ConvertUTF8toUTF16(value),
groupAtom, PR_FALSE, aResolveFontName,
nsAdoptingString value = Preferences::GetString(prefName.get());
if (value) {
ForEachFontInternal(value, groupAtom, PR_FALSE, aResolveFontName,
fc, closure);
}
}

View File

@ -41,10 +41,8 @@
#include "nsServiceManagerUtils.h"
#include "nsIPrefBranch.h"
#include "nsIPrefService.h"
#include "nsIPrefLocalizedString.h"
#include "nsISupportsPrimitives.h"
#include "mozilla/Preferences.h"
#include "nsIStreamBufferAccess.h"
#include "nsIUUIDGenerator.h"
#include "nsMemory.h"
@ -862,17 +860,11 @@ void gfxFontUtils::GetPrefsFontList(const char *aPrefName, nsTArray<nsString>& a
aFontList.Clear();
// get the list of single-face font families
nsCOMPtr<nsIPrefBranch> prefs(do_GetService(NS_PREFSERVICE_CONTRACTID));
nsAutoString fontlistValue;
if (prefs) {
nsCOMPtr<nsISupportsString> prefString;
prefs->GetComplexValue(aPrefName, NS_GET_IID(nsISupportsString), getter_AddRefs(prefString));
if (!prefString)
return;
prefString->GetData(fontlistValue);
nsAdoptingString fontlistValue = Preferences::GetString(aPrefName);
if (!fontlistValue) {
return;
}
// append each font name to the list
nsAutoString fontname;
nsPromiseFlatString fonts(fontlistValue);

View File

@ -44,15 +44,16 @@
#include <locale.h>
#include <fontconfig/fontconfig.h>
#include "nsIPrefBranch.h"
#include "nsIPrefService.h"
#include "nsServiceManagerUtils.h"
#include "nsILanguageAtomService.h"
#include "nsTArray.h"
#include "mozilla/Preferences.h"
#include "nsIAtom.h"
#include "nsCRT.h"
using namespace mozilla;
/* static */ gfxFontconfigUtils* gfxFontconfigUtils::sUtils = nsnull;
static nsILanguageAtomService* gLangService = nsnull;
@ -587,17 +588,8 @@ gfxFontconfigUtils::UpdateFontListInternal(PRBool aForce)
// fontconfig converts the non existing font to sans-serif.
// This is not good if the web page specifies font-family
// that has Windows font name in the first.
nsCOMPtr<nsIPrefService> prefs = do_GetService(NS_PREFSERVICE_CONTRACTID);
if (!prefs)
return NS_ERROR_FAILURE;
nsCOMPtr<nsIPrefBranch> prefBranch;
prefs->GetBranch(0, getter_AddRefs(prefBranch));
if (!prefBranch)
return NS_ERROR_FAILURE;
nsXPIDLCString list;
prefBranch->GetCharPref("font.alias-list", getter_Copies(list));
NS_ENSURE_TRUE(Preferences::GetRootBranch(), NS_ERROR_FAILURE);
nsAdoptingCString list = Preferences::GetCString("font.alias-list");
if (!list.IsEmpty()) {
const char kComma = ',';

View File

@ -47,10 +47,11 @@
#include "nsTArray.h"
#include "gfxAtoms.h"
#include "nsIServiceManager.h"
#include "nsIPlatformCharset.h"
#include "nsIPrefBranch.h"
#include "nsIPrefService.h"
#include "mozilla/Preferences.h"
using namespace mozilla;
/**********************************************************************
* class gfxOS2Font
@ -68,18 +69,14 @@ gfxOS2Font::gfxOS2Font(gfxOS2FontEntry *aFontEntry, const gfxFontStyle *aFontSty
NS_LossyConvertUTF16toASCII(aFontEntry->Name()).get());
#endif
// try to get the preferences for hinting, antialias, and embolden options
nsCOMPtr<nsIPrefBranch> prefbranch = do_GetService(NS_PREFSERVICE_CONTRACTID);
if (prefbranch) {
int value;
nsresult rv = prefbranch->GetIntPref("gfx.os2.font.hinting", &value);
if (NS_SUCCEEDED(rv) && value >= FC_HINT_NONE && value <= FC_HINT_FULL)
mHinting = value;
PRBool enabled;
rv = prefbranch->GetBoolPref("gfx.os2.font.antialiasing", &enabled);
if (NS_SUCCEEDED(rv))
mAntialias = enabled;
PRInt32 value;
nsresult rv = Preferences::GetInt("gfx.os2.font.hinting", &value);
if (NS_SUCCEEDED(rv) && value >= FC_HINT_NONE && value <= FC_HINT_FULL) {
mHinting = value;
}
mAntialias = Preferences::GetBool("gfx.os2.font.antialiasing", mAntialias);
#ifdef DEBUG_thebes_2
printf(" font display options: hinting=%d, antialiasing=%s\n",
mHinting, mAntialias ? "on" : "off");

View File

@ -79,18 +79,17 @@
#include "qcms.h"
#include "plstr.h"
#include "nsIPrefService.h"
#include "nsIPrefBranch.h"
#include "nsIPrefBranch2.h"
#include "nsIPrefLocalizedString.h"
#include "nsCRT.h"
#include "GLContext.h"
#include "GLContextProvider.h"
#include "mozilla/FunctionTimer.h"
#include "mozilla/Preferences.h"
#include "nsIGfxInfo.h"
using namespace mozilla;
gfxPlatform *gPlatform = nsnull;
static bool gEverInitialized = false;
@ -154,6 +153,12 @@ SRGBOverrideObserver::Observe(nsISupports *aSubject,
#define GFX_PREF_HARFBUZZ_SCRIPTS "gfx.font_rendering.harfbuzz.scripts"
#define HARFBUZZ_SCRIPTS_DEFAULT gfxUnicodeProperties::SHAPING_DEFAULT
static const char* kObservedPrefs[] = {
"gfx.downloadable_fonts.",
"gfx.font_rendering.",
nsnull
};
class FontPrefsObserver : public nsIObserver
{
public:
@ -168,14 +173,12 @@ FontPrefsObserver::Observe(nsISupports *aSubject,
const char *aTopic,
const PRUnichar *someData)
{
nsCOMPtr<nsIPrefBranch> branch = do_QueryInterface(aSubject);
if (!branch || someData == nsnull) {
if (!someData) {
NS_ERROR("font pref observer code broken");
return NS_ERROR_UNEXPECTED;
}
gfxPlatform::GetPlatform()->FontsPrefsChanged(branch,
NS_ConvertUTF16toUTF8(someData).get());
NS_ASSERTION(gfxPlatform::GetPlatform(), "the singleton instance has gone");
gfxPlatform::GetPlatform()->FontsPrefsChanged(NS_ConvertUTF16toUTF8(someData).get());
return NS_OK;
}
@ -315,15 +318,11 @@ gfxPlatform::Init()
MigratePrefs();
/* Create and register our CMS Override observer. */
gPlatform->overrideObserver = new SRGBOverrideObserver();
FontPrefsObserver *fontPrefObserver = new FontPrefsObserver();
gPlatform->mSRGBOverrideObserver = new SRGBOverrideObserver();
Preferences::AddWeakObserver(gPlatform->mSRGBOverrideObserver, CMForceSRGBPrefName);
nsCOMPtr<nsIPrefBranch2> prefs = do_GetService(NS_PREFSERVICE_CONTRACTID);
if (prefs) {
prefs->AddObserver(CMForceSRGBPrefName, gPlatform->overrideObserver, PR_TRUE);
prefs->AddObserver("gfx.downloadable_fonts.", fontPrefObserver, PR_FALSE);
prefs->AddObserver("gfx.font_rendering.", fontPrefObserver, PR_FALSE);
}
gPlatform->mFontPrefsObserver = new FontPrefsObserver();
Preferences::AddStrongObservers(gPlatform->mFontPrefsObserver, kObservedPrefs);
// Force registration of the gfx component, thus arranging for
// ::Shutdown to be called.
@ -347,10 +346,18 @@ gfxPlatform::Shutdown()
// Free the various non-null transforms and loaded profiles
ShutdownCMS();
/* Unregister our CMS Override callback. */
nsCOMPtr<nsIPrefBranch2> prefs = do_GetService(NS_PREFSERVICE_CONTRACTID);
if (prefs)
prefs->RemoveObserver(CMForceSRGBPrefName, gPlatform->overrideObserver);
// In some cases, gPlatform may not be created but Shutdown() called,
// e.g., during xpcshell tests.
if (gPlatform) {
/* Unregister our CMS Override callback. */
NS_ASSERTION(gPlatform->mSRGBOverrideObserver, "mSRGBOverrideObserver has alreay gone");
Preferences::RemoveObserver(gPlatform->mSRGBOverrideObserver, CMForceSRGBPrefName);
gPlatform->mSRGBOverrideObserver = nsnull;
NS_ASSERTION(gPlatform->mFontPrefsObserver, "mFontPrefsObserver has alreay gone");
Preferences::RemoveObservers(gPlatform->mFontPrefsObserver, kObservedPrefs);
gPlatform->mFontPrefsObserver = nsnull;
}
mozilla::gl::GLContextProvider::Shutdown();
@ -419,26 +426,12 @@ gfxPlatform::UpdateFontList()
return NS_ERROR_NOT_IMPLEMENTED;
}
PRBool
gfxPlatform::GetBoolPref(const char *aPref, PRBool aDefault)
{
nsCOMPtr<nsIPrefBranch> prefs = do_GetService(NS_PREFSERVICE_CONTRACTID);
if (prefs) {
PRBool allow;
nsresult rv = prefs->GetBoolPref(aPref, &allow);
if (NS_SUCCEEDED(rv))
return allow;
}
return aDefault;
}
PRBool
gfxPlatform::DownloadableFontsEnabled()
{
if (mAllowDownloadableFonts == UNINITIALIZED_VALUE) {
mAllowDownloadableFonts =
GetBoolPref(GFX_DOWNLOADABLE_FONTS_ENABLED, PR_FALSE);
Preferences::GetBool(GFX_DOWNLOADABLE_FONTS_ENABLED, PR_FALSE);
}
return mAllowDownloadableFonts;
@ -449,7 +442,7 @@ gfxPlatform::SanitizeDownloadedFonts()
{
if (mDownloadableFontsSanitize == UNINITIALIZED_VALUE) {
mDownloadableFontsSanitize =
GetBoolPref(GFX_DOWNLOADABLE_FONTS_SANITIZE, PR_TRUE);
Preferences::GetBool(GFX_DOWNLOADABLE_FONTS_SANITIZE, PR_TRUE);
}
return mDownloadableFontsSanitize;
@ -459,15 +452,7 @@ PRBool
gfxPlatform::UseHarfBuzzForScript(PRInt32 aScriptCode)
{
if (mUseHarfBuzzScripts == UNINITIALIZED_VALUE) {
mUseHarfBuzzScripts = HARFBUZZ_SCRIPTS_DEFAULT;
nsCOMPtr<nsIPrefBranch2> prefs = do_GetService(NS_PREFSERVICE_CONTRACTID);
if (prefs) {
PRInt32 scripts;
nsresult rv = prefs->GetIntPref(GFX_PREF_HARFBUZZ_SCRIPTS, &scripts);
if (NS_SUCCEEDED(rv)) {
mUseHarfBuzzScripts = scripts;
}
}
mUseHarfBuzzScripts = Preferences::GetInt(GFX_PREF_HARFBUZZ_SCRIPTS, HARFBUZZ_SCRIPTS_DEFAULT);
}
PRInt32 shapingType = gfxUnicodeProperties::ScriptShapingType(aScriptCode);
@ -494,14 +479,9 @@ gfxPlatform::MakePlatformFont(const gfxProxyFontEntry *aProxyEntry,
static void
AppendGenericFontFromPref(nsString& aFonts, nsIAtom *aLangGroup, const char *aGenericName)
{
nsresult rv;
nsCOMPtr<nsIPrefBranch> prefs(do_GetService(NS_PREFSERVICE_CONTRACTID));
if (!prefs)
return;
NS_ENSURE_TRUE(Preferences::GetRootBranch(), );
nsCAutoString prefName, langGroupString;
nsXPIDLCString nameValue, nameListValue;
aLangGroup->ToUTF8String(langGroupString);
@ -511,7 +491,7 @@ AppendGenericFontFromPref(nsString& aFonts, nsIAtom *aLangGroup, const char *aGe
} else {
prefName.AssignLiteral("font.default.");
prefName.Append(langGroupString);
prefs->GetCharPref(prefName.get(), getter_Copies(genericDotLang));
genericDotLang = Preferences::GetCString(prefName.get());
}
genericDotLang.AppendLiteral(".");
@ -520,21 +500,21 @@ AppendGenericFontFromPref(nsString& aFonts, nsIAtom *aLangGroup, const char *aGe
// fetch font.name.xxx value
prefName.AssignLiteral("font.name.");
prefName.Append(genericDotLang);
rv = prefs->GetCharPref(prefName.get(), getter_Copies(nameValue));
if (NS_SUCCEEDED(rv)) {
nsAdoptingString nameValue = Preferences::GetString(prefName.get());
if (nameValue) {
if (!aFonts.IsEmpty())
aFonts.AppendLiteral(", ");
aFonts.Append(NS_ConvertUTF8toUTF16(nameValue));
aFonts += nameValue;
}
// fetch font.name-list.xxx value
prefName.AssignLiteral("font.name-list.");
prefName.Append(genericDotLang);
rv = prefs->GetCharPref(prefName.get(), getter_Copies(nameListValue));
if (NS_SUCCEEDED(rv) && !nameListValue.Equals(nameValue)) {
nsAdoptingString nameListValue = Preferences::GetString(prefName.get());
if (nameListValue && !nameListValue.Equals(nameValue)) {
if (!aFonts.IsEmpty())
aFonts.AppendLiteral(", ");
aFonts.Append(NS_ConvertUTF8toUTF16(nameListValue));
aFonts += nameListValue;
}
}
@ -551,25 +531,18 @@ gfxPlatform::GetPrefFonts(nsIAtom *aLanguage, nsString& aFonts, PRBool aAppendUn
PRBool gfxPlatform::ForEachPrefFont(eFontPrefLang aLangArray[], PRUint32 aLangArrayLen, PrefFontCallback aCallback,
void *aClosure)
{
nsresult rv;
nsCOMPtr<nsIPrefBranch> prefs(do_GetService(NS_PREFSERVICE_CONTRACTID));
if (!prefs)
return PR_FALSE;
NS_ENSURE_TRUE(Preferences::GetRootBranch(), PR_FALSE);
PRUint32 i;
for (i = 0; i < aLangArrayLen; i++) {
eFontPrefLang prefLang = aLangArray[i];
const char *langGroup = GetPrefLangName(prefLang);
nsCAutoString prefName;
nsXPIDLCString nameValue, nameListValue;
nsCAutoString genericDotLang;
prefName.AssignLiteral("font.default.");
prefName.Append(langGroup);
prefs->GetCharPref(prefName.get(), getter_Copies(genericDotLang));
nsAdoptingCString genericDotLang = Preferences::GetCString(prefName.get());
genericDotLang.AppendLiteral(".");
genericDotLang.Append(langGroup);
@ -577,8 +550,8 @@ PRBool gfxPlatform::ForEachPrefFont(eFontPrefLang aLangArray[], PRUint32 aLangAr
// fetch font.name.xxx value
prefName.AssignLiteral("font.name.");
prefName.Append(genericDotLang);
rv = prefs->GetCharPref(prefName.get(), getter_Copies(nameValue));
if (NS_SUCCEEDED(rv)) {
nsAdoptingCString nameValue = Preferences::GetCString(prefName.get());
if (nameValue) {
if (!aCallback(prefLang, NS_ConvertUTF8toUTF16(nameValue), aClosure))
return PR_FALSE;
}
@ -586,8 +559,8 @@ PRBool gfxPlatform::ForEachPrefFont(eFontPrefLang aLangArray[], PRUint32 aLangAr
// fetch font.name-list.xxx value
prefName.AssignLiteral("font.name-list.");
prefName.Append(genericDotLang);
rv = prefs->GetCharPref(prefName.get(), getter_Copies(nameListValue));
if (NS_SUCCEEDED(rv) && !nameListValue.Equals(nameValue)) {
nsAdoptingCString nameListValue = Preferences::GetCString(prefName.get());
if (nameListValue && !nameListValue.Equals(nameValue)) {
const char kComma = ',';
const char *p, *p_end;
nsCAutoString list(nameListValue);
@ -713,8 +686,6 @@ gfxPlatform::GetLangPrefs(eFontPrefLang aPrefLangs[], PRUint32 &aLen, eFontPrefL
void
gfxPlatform::AppendCJKPrefLangs(eFontPrefLang aPrefLangs[], PRUint32 &aLen, eFontPrefLang aCharLang, eFontPrefLang aPageLang)
{
nsCOMPtr<nsIPrefBranch> prefs(do_GetService(NS_PREFSERVICE_CONTRACTID));
// prefer the lang specified by the page *if* CJK
if (IsLangCJK(aPageLang)) {
AppendPrefLang(aPrefLangs, aLen, aPageLang);
@ -728,20 +699,7 @@ gfxPlatform::AppendCJKPrefLangs(eFontPrefLang aPrefLangs[], PRUint32 &aLen, eFon
PRUint32 tempLen = 0;
// Add the CJK pref fonts from accept languages, the order should be same order
nsCAutoString list;
if (prefs) {
nsCOMPtr<nsIPrefLocalizedString> prefString;
nsresult rv =
prefs->GetComplexValue("intl.accept_languages",
NS_GET_IID(nsIPrefLocalizedString),
getter_AddRefs(prefString));
if (NS_SUCCEEDED(rv) && prefString) {
nsAutoString temp;
prefString->ToString(getter_Copies(temp));
LossyCopyUTF16toASCII(temp, list);
}
}
nsAdoptingCString list = Preferences::GetLocalizedCString("intl.accept_languages");
if (!list.IsEmpty()) {
const char kComma = ',';
const char *p, *p_end;
@ -855,14 +813,10 @@ gfxPlatform::GetCMSMode()
{
if (gCMSInitialized == PR_FALSE) {
gCMSInitialized = PR_TRUE;
nsCOMPtr<nsIPrefBranch> prefs = do_GetService(NS_PREFSERVICE_CONTRACTID);
if (prefs) {
PRInt32 mode;
nsresult rv =
prefs->GetIntPref(CMPrefName, &mode);
if (NS_SUCCEEDED(rv) && (mode >= 0) && (mode < eCMSMode_AllCount)) {
gCMSMode = static_cast<eCMSMode>(mode);
}
PRInt32 mode;
nsresult rv = Preferences::GetInt(CMPrefName, &mode);
if (NS_SUCCEEDED(rv) && (mode >= 0) && (mode < eCMSMode_AllCount)) {
gCMSMode = static_cast<eCMSMode>(mode);
}
}
return gCMSMode;
@ -881,25 +835,21 @@ gfxPlatform::GetRenderingIntent()
if (gCMSIntent == -2) {
/* Try to query the pref system for a rendering intent. */
nsCOMPtr<nsIPrefBranch> prefs = do_GetService(NS_PREFSERVICE_CONTRACTID);
if (prefs) {
PRInt32 pIntent;
nsresult rv = prefs->GetIntPref(CMIntentPrefName, &pIntent);
if (NS_SUCCEEDED(rv)) {
/* If the pref is within range, use it as an override. */
if ((pIntent >= INTENT_MIN) && (pIntent <= INTENT_MAX))
gCMSIntent = pIntent;
/* If the pref is out of range, use embedded profile. */
else
gCMSIntent = -1;
PRInt32 pIntent;
if (NS_SUCCEEDED(Preferences::GetInt(CMIntentPrefName, &pIntent))) {
/* If the pref is within range, use it as an override. */
if ((pIntent >= INTENT_MIN) && (pIntent <= INTENT_MAX)) {
gCMSIntent = pIntent;
}
/* If the pref is out of range, use embedded profile. */
else {
gCMSIntent = -1;
}
}
/* If we didn't get a valid intent from prefs, use the default. */
if (gCMSIntent == -2)
else {
gCMSIntent = INTENT_DEFAULT;
}
}
return gCMSIntent;
}
@ -946,31 +896,21 @@ gfxPlatform::GetCMSOutputProfile()
if (!gCMSOutputProfile) {
NS_TIME_FUNCTION;
nsCOMPtr<nsIPrefBranch> prefs = do_GetService(NS_PREFSERVICE_CONTRACTID);
if (prefs) {
/* Determine if we're using the internal override to force sRGB as
an output profile for reftests. See Bug 452125.
nsresult rv;
Note that we don't normally (outside of tests) set a
default value of this preference, which means nsIPrefBranch::GetBoolPref
will typically throw (and leave its out-param untouched).
*/
if (Preferences::GetBool(CMForceSRGBPrefName, PR_FALSE)) {
gCMSOutputProfile = GetCMSsRGBProfile();
}
/* Determine if we're using the internal override to force sRGB as
an output profile for reftests. See Bug 452125.
Note that we don't normally (outside of tests) set a
default value of this preference, which means GetBoolPref
will typically throw (and leave its out-param untouched).
*/
PRBool doSRGBOverride;
rv = prefs->GetBoolPref(CMForceSRGBPrefName, &doSRGBOverride);
if (NS_SUCCEEDED(rv) && doSRGBOverride)
gCMSOutputProfile = GetCMSsRGBProfile();
if (!gCMSOutputProfile) {
nsXPIDLCString fname;
rv = prefs->GetCharPref(CMProfilePrefName,
getter_Copies(fname));
if (NS_SUCCEEDED(rv) && !fname.IsEmpty()) {
gCMSOutputProfile = qcms_profile_from_path(fname);
}
if (!gCMSOutputProfile) {
nsAdoptingCString fname = Preferences::GetCString(CMProfilePrefName);
if (!fname.IsEmpty()) {
gCMSOutputProfile = qcms_profile_from_path(fname);
}
}
@ -1104,26 +1044,14 @@ static void ShutdownCMS()
static void MigratePrefs()
{
/* Load the pref service. If we don't get it die quietly since this isn't
critical code. */
nsCOMPtr<nsIPrefBranch> prefs = do_GetService(NS_PREFSERVICE_CONTRACTID);
if (!prefs)
return;
/* Migrate from the boolean color_management.enabled pref - we now use
color_management.mode. */
PRBool hasOldCMPref;
nsresult rv =
prefs->PrefHasUserValue(CMPrefNameOld, &hasOldCMPref);
if (NS_SUCCEEDED(rv) && (hasOldCMPref == PR_TRUE)) {
PRBool CMWasEnabled;
rv = prefs->GetBoolPref(CMPrefNameOld, &CMWasEnabled);
if (NS_SUCCEEDED(rv) && (CMWasEnabled == PR_TRUE))
prefs->SetIntPref(CMPrefName, eCMSMode_All);
prefs->ClearUserPref(CMPrefNameOld);
if (Preferences::HasUserValue(CMPrefNameOld)) {
if (Preferences::GetBool(CMPrefNameOld, PR_FALSE)) {
Preferences::SetInt(CMPrefName, static_cast<PRInt32>(eCMSMode_All));
}
Preferences::ClearUser(CMPrefNameOld);
}
}
// default SetupClusterBoundaries, based on Unicode properties;
@ -1244,7 +1172,7 @@ gfxPlatform::SetupClusterBoundaries(gfxTextRun *aTextRun, const PRUnichar *aStri
}
void
gfxPlatform::FontsPrefsChanged(nsIPrefBranch *aPrefBranch, const char *aPref)
gfxPlatform::FontsPrefsChanged(const char *aPref)
{
NS_ASSERTION(aPref != nsnull, "null preference");
if (!strcmp(GFX_DOWNLOADABLE_FONTS_ENABLED, aPref)) {

View File

@ -65,7 +65,6 @@ class gfxPlatformFontList;
class gfxTextRun;
class nsIURI;
class nsIAtom;
class nsIPrefBranch;
// pref lang id's for font prefs
// !!! needs to match the list of pref font.default.xx entries listed in all.js !!!
@ -350,7 +349,7 @@ public:
*/
static qcms_transform* GetCMSRGBATransform();
virtual void FontsPrefsChanged(nsIPrefBranch *aPrefBranch, const char *aPref);
virtual void FontsPrefsChanged(const char *aPref);
/**
* Returns a 1x1 surface that can be used to create graphics contexts
@ -370,8 +369,6 @@ protected:
gfxPlatform();
virtual ~gfxPlatform();
static PRBool GetBoolPref(const char *aPref, PRBool aDefault);
void AppendCJKPrefLangs(eFontPrefLang aPrefLangs[], PRUint32 &aLen,
eFontPrefLang aCharLang, eFontPrefLang aPageLang);
@ -386,7 +383,8 @@ private:
nsRefPtr<gfxASurface> mScreenReferenceSurface;
nsTArray<PRUint32> mCJKPrefLangs;
nsCOMPtr<nsIObserver> overrideObserver;
nsCOMPtr<nsIObserver> mSRGBOverrideObserver;
nsCOMPtr<nsIObserver> mFontPrefsObserver;
};
#endif /* GFX_PLATFORM_H */

View File

@ -72,13 +72,14 @@
#include "gfxPlatformFontList.h"
#include "gfxTextRunWordCache.h"
#include "nsIPrefService.h"
#include "nsIPrefBranch2.h" // for pref changes callback notification
#include "nsServiceManagerUtils.h"
#include "nsUnicharUtils.h"
#include "nsUnicodeRange.h"
#include "gfxUnicodeProperties.h"
#include "mozilla/Preferences.h"
using namespace mozilla;
// font info loader constants
static const PRUint32 kDelayBeforeLoadingCmaps = 8 * 1000; // 8secs
static const PRUint32 kIntervalBetweenLoadingCmaps = 150; // 150ms
@ -97,12 +98,21 @@ static const PRUint32 kNumFontsPerSlice = 10; // read in info 10 fonts at a time
gfxPlatformFontList *gfxPlatformFontList::sPlatformFontList = nsnull;
static const char* kObservedPrefs[] = {
"font.",
"font.name-list.",
"intl.accept_languages", // hmmmm...
nsnull
};
class gfxFontListPrefObserver : public nsIObserver {
public:
NS_DECL_ISUPPORTS
NS_DECL_NSIOBSERVER
};
static gfxFontListPrefObserver* gFontListPrefObserver = nsnull;
NS_IMPL_ISUPPORTS1(gfxFontListPrefObserver, nsIObserver)
NS_IMETHODIMP
@ -139,17 +149,18 @@ gfxPlatformFontList::gfxPlatformFontList(PRBool aNeedFullnamePostscriptNames)
LoadBadUnderlineList();
// pref changes notification setup
gfxFontListPrefObserver *observer = new gfxFontListPrefObserver();
if (observer) {
nsCOMPtr<nsIPrefBranch2> pref = do_GetService(NS_PREFSERVICE_CONTRACTID);
if (pref) {
pref->AddObserver("font.", observer, PR_FALSE);
pref->AddObserver("font.name-list.", observer, PR_FALSE);
pref->AddObserver("intl.accept_languages", observer, PR_FALSE); // hmmmm...
} else {
delete observer;
}
}
NS_ASSERTION(!gFontListPrefObserver,
"There has been font list pref observer already");
gFontListPrefObserver = new gfxFontListPrefObserver();
NS_ADDREF(gFontListPrefObserver);
Preferences::AddStrongObservers(gFontListPrefObserver, kObservedPrefs);
}
gfxPlatformFontList::~gfxPlatformFontList()
{
NS_ASSERTION(gFontListPrefObserver, "There is no font list pref observer");
Preferences::RemoveObservers(gFontListPrefObserver, kObservedPrefs);
NS_RELEASE(gFontListPrefObserver);
}
nsresult

View File

@ -79,6 +79,8 @@ public:
sPlatformFontList = nsnull;
}
virtual ~gfxPlatformFontList();
// initialize font lists
virtual nsresult InitFontList();

View File

@ -47,18 +47,18 @@
#include "gfxCoreTextShaper.h"
#include "gfxUserFontSet.h"
#include "nsIPrefBranch.h"
#include "nsIPrefService.h"
#include "nsIPrefLocalizedString.h"
#include "nsServiceManagerUtils.h"
#include "nsCRT.h"
#include "nsTArray.h"
#include "nsUnicodeRange.h"
#include "mozilla/Preferences.h"
#include "qcms.h"
#include <dlfcn.h>
using namespace mozilla;
// cribbed from CTFontManager.h
enum {
kAutoActivationDisabled = 1
@ -270,17 +270,8 @@ gfxPlatformMac::ReadAntiAliasingThreshold()
PRUint32 threshold = 0; // default == no threshold
// first read prefs flag to determine whether to use the setting or not
PRBool useAntiAliasingThreshold = PR_FALSE;
nsCOMPtr<nsIPrefBranch> prefs = do_GetService(NS_PREFSERVICE_CONTRACTID);
if (prefs) {
PRBool enabled;
nsresult rv =
prefs->GetBoolPref("gfx.use_text_smoothing_setting", &enabled);
if (NS_SUCCEEDED(rv)) {
useAntiAliasingThreshold = enabled;
}
}
PRBool useAntiAliasingThreshold = Preferences::GetBool("gfx.use_text_smoothing_setting", PR_FALSE);
// if the pref setting is disabled, return 0 which effectively disables this feature
if (!useAntiAliasingThreshold)
return threshold;

View File

@ -76,8 +76,9 @@
#include FT_FREETYPE_H
#endif
#include "nsIPrefBranch.h"
#include "nsIPrefService.h"
#include "mozilla/Preferences.h"
using namespace mozilla;
#define DEFAULT_RENDER_MODE RENDER_DIRECT
@ -123,15 +124,9 @@ gfxQtPlatform::gfxQtPlatform()
#endif
nsresult rv;
PRInt32 ival;
// 0 - default gfxQPainterSurface
// 1 - gfxImageSurface
nsCOMPtr<nsIPrefBranch> prefs = do_GetService(NS_PREFSERVICE_CONTRACTID, &rv);
if (prefs) {
rv = prefs->GetIntPref("mozilla.widget-qt.render-mode", &ival);
if (NS_FAILED(rv))
ival = DEFAULT_RENDER_MODE;
}
PRInt32 ival = Preferences::GetInt("mozilla.widget-qt.render-mode", DEFAULT_RENDER_MODE);
const char *envTypeOverride = getenv("MOZ_QT_RENDER_TYPE");
if (envTypeOverride)

View File

@ -41,13 +41,10 @@
#include "nsWeakReference.h"
#include "nsCRT.h"
#include "nsServiceManagerUtils.h"
#include "nsIPrefBranch.h"
#include "nsIPrefBranch2.h"
#include "nsIPrefService.h"
#include "nsIObserver.h"
#include "nsBidiUtils.h"
#include "mozilla/Preferences.h"
#if defined(XP_UNIX)
#include <stdint.h>
@ -57,6 +54,8 @@
#include <stdio.h>
#endif
using namespace mozilla;
/**
* Cache individual "words" (strings delimited by white-space or white-space-like
* characters that don't involve kerning or ligatures) in textruns.
@ -221,8 +220,6 @@ protected:
nsTHashtable<CacheHashEntry> mCache;
PRInt32 mBidiNumeral;
nsCOMPtr<nsIPrefBranch2> mPrefBranch;
nsCOMPtr<nsIPrefBranch2> mFontPrefBranch;
#ifdef DEBUG
static PLDHashOperator CacheDumpEntry(CacheHashEntry* aEntry, void* userArg);
@ -235,6 +232,12 @@ static TextRunWordCache *gTextRunWordCache = nsnull;
static PRLogModuleInfo *gWordCacheLog = PR_NewLogModule("wordCache");
static const char* kObservedPrefs[] = {
"bidi.",
"font.",
nsnull
};
void
TextRunWordCache::Init()
{
@ -242,33 +245,14 @@ TextRunWordCache::Init()
mGeneration = 0;
#endif
nsCOMPtr<nsIPrefService> prefService = do_GetService(NS_PREFSERVICE_CONTRACTID);
if (!prefService)
return;
nsCOMPtr<nsIPrefBranch> branch;
prefService->GetBranch("bidi.", getter_AddRefs(branch));
mPrefBranch = do_QueryInterface(branch);
if (!mPrefBranch)
return;
mPrefBranch->AddObserver("", this, PR_TRUE);
mPrefBranch->GetIntPref("numeral", &mBidiNumeral);
nsCOMPtr<nsIPrefBranch> fontBranch;
prefService->GetBranch("font.", getter_AddRefs(fontBranch));
mFontPrefBranch = do_QueryInterface(fontBranch);
if (mFontPrefBranch)
mFontPrefBranch->AddObserver("", this, PR_TRUE);
Preferences::AddWeakObservers(this, kObservedPrefs);
mBidiNumeral = Preferences::GetInt("bidi.numeral", mBidiNumeral);
}
void
TextRunWordCache::Uninit()
{
if (mPrefBranch)
mPrefBranch->RemoveObserver("", this);
if (mFontPrefBranch)
mFontPrefBranch->RemoveObserver("", this);
Preferences::RemoveObservers(this, kObservedPrefs);
}
NS_IMETHODIMP
@ -277,8 +261,8 @@ TextRunWordCache::Observe(nsISupports *aSubject,
const PRUnichar *aData)
{
if (!nsCRT::strcmp(aTopic, NS_PREFBRANCH_PREFCHANGE_TOPIC_ID)) {
if (!nsCRT::strcmp(aData, NS_LITERAL_STRING("numeral").get())) {
mPrefBranch->GetIntPref("numeral", &mBidiNumeral);
if (!nsCRT::strcmp(aData, NS_LITERAL_STRING("bidi.numeral").get())) {
mBidiNumeral = Preferences::GetInt("bidi.numeral", mBidiNumeral);
}
mCache.Clear();
PR_LOG(gWordCacheLog, PR_LOG_DEBUG, ("flushing the textrun cache"));

View File

@ -46,8 +46,7 @@
#include "nsUnicharUtils.h"
#include "nsIPrefService.h"
#include "nsIPrefBranch2.h"
#include "mozilla/Preferences.h"
#include "nsServiceManagerUtils.h"
#include "nsTArray.h"
@ -86,6 +85,8 @@
#include "nsIMemoryReporter.h"
#include "nsMemory.h"
using namespace mozilla;
class D2DCacheReporter :
public nsIMemoryReporter
{
@ -283,18 +284,7 @@ gfxWindowsPlatform::UpdateRenderMode()
if (xr)
xr->GetInSafeMode(&safeMode);
nsCOMPtr<nsIPrefBranch2> pref = do_GetService(NS_PREFSERVICE_CONTRACTID);
nsresult rv;
PRBool preferDirectWrite = PR_FALSE;
rv = pref->GetBoolPref(
"gfx.font_rendering.directwrite.enabled", &preferDirectWrite);
if (NS_FAILED(rv)) {
preferDirectWrite = PR_FALSE;
}
mUseDirectWrite = preferDirectWrite;
mUseDirectWrite = Preferences::GetBool("gfx.font_rendering.directwrite.enabled", PR_FALSE);
#ifdef CAIRO_HAS_D2D_SURFACE
PRBool d2dDisabled = PR_FALSE;
@ -316,12 +306,8 @@ gfxWindowsPlatform::UpdateRenderMode()
}
}
rv = pref->GetBoolPref("gfx.direct2d.disabled", &d2dDisabled);
if (NS_FAILED(rv))
d2dDisabled = PR_FALSE;
rv = pref->GetBoolPref("gfx.direct2d.force-enabled", &d2dForceEnabled);
if (NS_FAILED(rv))
d2dForceEnabled = PR_FALSE;
d2dDisabled = Preferences::GetBool("gfx.direct2d.disabled", PR_FALSE);
d2dForceEnabled = Preferences::GetBool("gfx.direct2d.force-enabled", PR_FALSE);
bool tryD2D = !d2dBlocked || d2dForceEnabled;
@ -364,7 +350,7 @@ gfxWindowsPlatform::UpdateRenderMode()
mDWriteFactory = factory;
factory->Release();
SetupClearTypeParams(pref);
SetupClearTypeParams();
if (hr == S_OK)
reporter.SetSuccessful();
@ -713,7 +699,7 @@ PRBool
gfxWindowsPlatform::UseClearTypeForDownloadableFonts()
{
if (mUseClearTypeForDownloadableFonts == UNINITIALIZED_VALUE) {
mUseClearTypeForDownloadableFonts = GetBoolPref(GFX_DOWNLOADABLE_FONTS_USE_CLEARTYPE, PR_TRUE);
mUseClearTypeForDownloadableFonts = Preferences::GetBool(GFX_DOWNLOADABLE_FONTS_USE_CLEARTYPE, PR_TRUE);
}
return mUseClearTypeForDownloadableFonts;
@ -723,7 +709,7 @@ PRBool
gfxWindowsPlatform::UseClearTypeAlways()
{
if (mUseClearTypeAlways == UNINITIALIZED_VALUE) {
mUseClearTypeAlways = GetBoolPref(GFX_USE_CLEARTYPE_ALWAYS, PR_FALSE);
mUseClearTypeAlways = Preferences::GetBool(GFX_USE_CLEARTYPE_ALWAYS, PR_FALSE);
}
return mUseClearTypeAlways;
@ -891,11 +877,11 @@ gfxWindowsPlatform::GetCleartypeParams(nsTArray<ClearTypeParameterInfo>& aParams
}
void
gfxWindowsPlatform::FontsPrefsChanged(nsIPrefBranch *aPrefBranch, const char *aPref)
gfxWindowsPlatform::FontsPrefsChanged(const char *aPref)
{
PRBool clearTextFontCaches = PR_TRUE;
gfxPlatform::FontsPrefsChanged(aPrefBranch, aPref);
gfxPlatform::FontsPrefsChanged(aPref);
if (!aPref) {
mUseClearTypeForDownloadableFonts = UNINITIALIZED_VALUE;
@ -905,7 +891,7 @@ gfxWindowsPlatform::FontsPrefsChanged(nsIPrefBranch *aPrefBranch, const char *aP
} else if (!strcmp(GFX_USE_CLEARTYPE_ALWAYS, aPref)) {
mUseClearTypeAlways = UNINITIALIZED_VALUE;
} else if (!strncmp(GFX_CLEARTYPE_PARAMS, aPref, strlen(GFX_CLEARTYPE_PARAMS))) {
SetupClearTypeParams(aPrefBranch);
SetupClearTypeParams();
} else {
clearTextFontCaches = PR_FALSE;
}
@ -920,7 +906,7 @@ gfxWindowsPlatform::FontsPrefsChanged(nsIPrefBranch *aPrefBranch, const char *aP
}
void
gfxWindowsPlatform::SetupClearTypeParams(nsIPrefBranch *aPrefBranch)
gfxWindowsPlatform::SetupClearTypeParams()
{
#if CAIRO_HAS_DWRITE_FONT
if (GetDWriteFactory()) {
@ -932,36 +918,36 @@ gfxWindowsPlatform::SetupClearTypeParams(nsIPrefBranch *aPrefBranch)
int geometry = -1;
int mode = -1;
PRInt32 value;
if (NS_SUCCEEDED(aPrefBranch->GetIntPref(GFX_CLEARTYPE_PARAMS_GAMMA,
&value))) {
if (NS_SUCCEEDED(Preferences::GetInt(GFX_CLEARTYPE_PARAMS_GAMMA, &value))) {
if (value >= 1000 && value <= 2200) {
gamma = FLOAT(value / 1000.0);
}
}
if (NS_SUCCEEDED(aPrefBranch->GetIntPref(GFX_CLEARTYPE_PARAMS_CONTRAST,
&value))) {
if (NS_SUCCEEDED(Preferences::GetInt(GFX_CLEARTYPE_PARAMS_CONTRAST, &value))) {
if (value >= 0 && value <= 1000) {
contrast = FLOAT(value / 100.0);
}
}
if (NS_SUCCEEDED(aPrefBranch->GetIntPref(GFX_CLEARTYPE_PARAMS_LEVEL,
&value))) {
if (NS_SUCCEEDED(Preferences::GetInt(GFX_CLEARTYPE_PARAMS_LEVEL, &value))) {
if (value >= 0 && value <= 100) {
level = FLOAT(value / 100.0);
}
}
if (NS_SUCCEEDED(aPrefBranch->GetIntPref(GFX_CLEARTYPE_PARAMS_STRUCTURE,
&value))) {
if (NS_SUCCEEDED(Preferences::GetInt(GFX_CLEARTYPE_PARAMS_STRUCTURE, &value))) {
if (value >= 0 && value <= 2) {
geometry = value;
}
}
if (NS_SUCCEEDED(aPrefBranch->GetIntPref(GFX_CLEARTYPE_PARAMS_MODE,
&value))) {
if (NS_SUCCEEDED(Preferences::GetInt(GFX_CLEARTYPE_PARAMS_MODE, &value))) {
if (value >= 0 && value <= 5) {
mode = value;
}
}
cairo_dwrite_set_cleartype_params(gamma, contrast, level, geometry, mode);
switch (mode) {

View File

@ -243,9 +243,9 @@ public:
// returns ClearType tuning information for each display
static void GetCleartypeParams(nsTArray<ClearTypeParameterInfo>& aParams);
virtual void FontsPrefsChanged(nsIPrefBranch *aPrefBranch, const char *aPref);
virtual void FontsPrefsChanged(const char *aPref);
void SetupClearTypeParams(nsIPrefBranch *aPrefBranch);
void SetupClearTypeParams();
#ifdef CAIRO_HAS_DWRITE_FONT
IDWriteFactory *GetDWriteFactory() { return mDWriteFactory; }

View File

@ -45,10 +45,11 @@
#include "nsTArray.h"
#include "nsAlgorithm.h"
#include "nsServiceManagerUtils.h"
#include "nsIPrefService.h"
#include "mozilla/Preferences.h"
#include "cairo-xlib-xrender.h"
using namespace mozilla;
// Although the dimension parameters in the xCreatePixmapReq wire protocol are
// 16-bit unsigned integers, the server's CreatePixmap returns BadAlloc if
// either dimension cannot be represented by a 16-bit *signed* integer.
@ -169,14 +170,7 @@ gfxXlibSurface::Create(Screen *screen, XRenderPictFormat *format,
static PRBool GetForce24bppPref()
{
PRBool val = PR_FALSE; // default
nsCOMPtr<nsIPrefBranch> prefs = do_GetService(NS_PREFSERVICE_CONTRACTID);
if (!prefs)
return val;
prefs->GetBoolPref("mozilla.widget.force-24bpp", &val);
return val;
return Preferences::GetBool("mozilla.widget.force-24bpp", PR_FALSE);
}
already_AddRefed<gfxASurface>

View File

@ -333,6 +333,11 @@ members = [
'nsIDOMHTMLTextAreaElement.value',
'nsIDOMHTMLTextAreaElement.type',
'nsIDOMHTMLTextAreaElement.select',
'nsIDOMHTMLTextAreaElement.setSelectionRange',
'nsIDOMHTMLTextAreaElement.selectionStart',
'nsIDOMHTMLTextAreaElement.selectionEnd',
'nsIDOMHTMLTextAreaElement.textLength',
'nsIDOMHTMLTextAreaElement.wrap',
'nsIDOMHTMLTitleElement.text',
'nsIDOMHTMLCanvasElement.width',
'nsIDOMHTMLCanvasElement.height',
@ -350,11 +355,6 @@ members = [
'nsIDOMNSHTMLFrameElement.contentWindow',
'nsIDOMNSHTMLOptionCollection.selectedIndex',
'nsIDOMNSHTMLOptionCollection.add',
'nsIDOMNSHTMLTextAreaElement.setSelectionRange',
'nsIDOMNSHTMLTextAreaElement.selectionStart',
'nsIDOMNSHTMLTextAreaElement.selectionEnd',
'nsIDOMNSHTMLTextAreaElement.textLength',
'nsIDOMNSHTMLTextAreaElement.wrap',
# dom/interfaces/json - None.
# All 4 methods of nsIJSON call GetCurrentNativeCallContext.

View File

@ -113,7 +113,6 @@
#include "nsIParser.h"
#include "nsParserCIID.h"
#include "nsFrameSelection.h"
#include "nsIDOMNSHTMLTextAreaElement.h"
#include "nsViewsCID.h"
#include "nsPresArena.h"
#include "nsFrameManager.h"

View File

@ -563,7 +563,12 @@ nsFileControlFrame::BrowseMouseListener::HandleEvent(nsIDOMEvent* aEvent)
nsCOMPtr<nsIDOMFileList> fileList;
dataTransfer->GetFiles(getter_AddRefs(fileList));
PRBool oldState = mFrame->mTextFrame->GetFireChangeEventState();
mFrame->mTextFrame->SetFireChangeEventState(PR_TRUE);
inputElement->SetFiles(fileList, true);
mFrame->mTextFrame->SetFireChangeEventState(oldState);
mFrame->mTextFrame->CheckFireOnChange();
}
return NS_OK;

View File

@ -36,11 +36,9 @@
*
* ***** END LICENSE BLOCK ***** */
#include "nsCOMPtr.h"
#include "nsTextControlFrame.h"
#include "nsIDocument.h"
#include "nsIDOMNSHTMLTextAreaElement.h"
#include "nsIFormControl.h"
#include "nsIServiceManager.h"
#include "nsFrameSelection.h"

View File

@ -78,7 +78,7 @@
#endif
#include "nsBidiUtils.h"
#include "nsFrameManager.h"
#include "nsIPrefService.h"
#include "mozilla/Preferences.h"
#include "nsILookAndFeel.h"
#include "mozilla/dom/Element.h"
#include "FrameLayerBuilder.h"
@ -1409,15 +1409,7 @@ nsGfxScrollFrameInner::AsyncScroll::InitTimingFunction(nsSMILKeySpline& aTimingF
static PRBool
IsSmoothScrollingEnabled()
{
nsCOMPtr<nsIPrefBranch> prefs = do_GetService(NS_PREFSERVICE_CONTRACTID);
if (prefs) {
PRBool enabled;
nsresult rv = prefs->GetBoolPref(SMOOTH_SCROLL_PREF_NAME, &enabled);
if (NS_SUCCEEDED(rv)) {
return enabled;
}
}
return PR_FALSE;
return Preferences::GetBool(SMOOTH_SCROLL_PREF_NAME, PR_FALSE);
}
class ScrollFrameActivityTracker : public nsExpirationTracker<nsGfxScrollFrameInner,4> {

View File

@ -151,6 +151,7 @@ void Area::ParseCoords(const nsAString& aSpec)
mCoords = nsnull;
if (*cp == '\0')
{
nsMemory::Free(cp);
return;
}
@ -164,6 +165,7 @@ void Area::ParseCoords(const nsAString& aSpec)
}
if (*n_str == '\0')
{
nsMemory::Free(cp);
return;
}
@ -248,6 +250,7 @@ void Area::ParseCoords(const nsAString& aSpec)
value_list = new nscoord[cnt];
if (!value_list)
{
nsMemory::Free(cp);
return;
}
@ -290,7 +293,7 @@ void Area::ParseCoords(const nsAString& aSpec)
mNumCoords = cnt;
mCoords = value_list;
NS_Free(cp);
nsMemory::Free(cp);
}
}

View File

@ -199,8 +199,43 @@ static PRLogModuleInfo *nsObjectFrameLM = PR_NewLogModule("nsObjectFrame");
#endif /* PR_LOGGING */
#if defined(XP_MACOSX) && !defined(NP_NO_CARBON)
#define MAC_CARBON_PLUGINS
#endif
// The header files QuickdrawAPI.h and QDOffscreen.h are missing on OS X 10.7
// and up (though the QuickDraw APIs defined in them are still present) -- so
// we need to supply the relevant parts of their contents here. It's likely
// that Apple will eventually remove the APIs themselves (probably in OS X
// 10.8), so we need to make them weak imports, and test for their presence
// before using them.
extern "C" {
#if !defined(__QUICKDRAWAPI__)
extern void SetRect(
Rect * r,
short left,
short top,
short right,
short bottom)
__attribute__((weak_import));
#endif /* __QUICKDRAWAPI__ */
#if !defined(__QDOFFSCREEN__)
extern QDErr NewGWorldFromPtr(
GWorldPtr * offscreenGWorld,
UInt32 PixelFormat,
const Rect * boundsRect,
CTabHandle cTable, /* can be NULL */
GDHandle aGDevice, /* can be NULL */
GWorldFlags flags,
Ptr newBuffer,
SInt32 rowBytes)
__attribute__((weak_import));
extern void DisposeGWorld(GWorldPtr offscreenGWorld)
__attribute__((weak_import));
#endif /* __QDOFFSCREEN__ */
}
#endif /* #if defined(XP_MACOSX) && !defined(NP_NO_CARBON) */
using namespace mozilla;
using namespace mozilla::plugins;
@ -1272,6 +1307,13 @@ nsObjectFrame::PrintPlugin(nsRenderingContext& aRenderingContext,
// platform specific printing code
#ifdef MAC_CARBON_PLUGINS
// Don't use this code if any of the QuickDraw APIs it currently requires
// are missing (as they probably will be on OS X 10.8 and up).
if (!::SetRect || !::NewGWorldFromPtr || !::DisposeGWorld) {
NS_WARNING("Cannot print plugin -- required QuickDraw APIs are missing!");
return;
}
nsSize contentSize = GetContentRectRelativeToSelf().Size();
window.x = 0;
window.y = 0;

View File

@ -49,8 +49,7 @@
#include "nsRenderingContext.h"
#include "gfxPlatform.h"
#include "nsIPrefBranch.h"
#include "nsIPrefService.h"
#include "mozilla/Preferences.h"
#include "nsISupportsPrimitives.h"
#include "nsIComponentManager.h"
#include "nsIPersistentProperties2.h"
@ -68,6 +67,8 @@
#include "nsMathMLOperators.h"
#include "nsMathMLChar.h"
using namespace mozilla;
//#define SHOW_BORDERS 1
//#define NOISY_SEARCH 1
@ -595,23 +596,6 @@ nsGlyphTableList::GetGlyphTableFor(const nsAString& aFamily)
// -----------------------------------------------------------------------------------
// retrieve a pref value set by the user
static PRBool
GetPrefValue(nsIPrefBranch* aPrefBranch, const char* aPrefKey, nsString& aPrefValue)
{
aPrefValue.Truncate();
if (aPrefBranch) {
nsCOMPtr<nsISupportsString> prefString;
aPrefBranch->GetComplexValue(aPrefKey,
NS_GET_IID(nsISupportsString),
getter_AddRefs(prefString));
if (prefString) {
prefString->GetData(aPrefValue);
}
}
return !aPrefValue.IsEmpty();
}
// Lookup the preferences:
// "font.mathfont-family.\uNNNN.base" -- fonts for the base size
// "font.mathfont-family.\uNNNN.variants" -- fonts for larger glyphs
@ -619,7 +603,7 @@ GetPrefValue(nsIPrefBranch* aPrefBranch, const char* aPrefKey, nsString& aPrefVa
// Given the char code and mode of stretch, retrieve the preferred extension
// font families.
static PRBool
GetFontExtensionPref(nsIPrefBranch* aPrefBranch, PRUnichar aChar,
GetFontExtensionPref(PRUnichar aChar,
nsMathfontPrefExtension aExtension, nsString& aValue)
{
// initialize OUT param
@ -666,8 +650,11 @@ GetFontExtensionPref(nsIPrefBranch* aPrefBranch, PRUnichar aChar,
alternateKey.Append(tmp);
alternateKey.Append(extension);
return GetPrefValue(aPrefBranch, key.get(), aValue) ||
GetPrefValue(aPrefBranch, alternateKey.get(), aValue);
aValue = Preferences::GetString(key.get());
if (aValue.IsEmpty()) {
aValue = Preferences::GetString(alternateKey.get());
}
return !aValue.IsEmpty();
}
@ -705,7 +692,6 @@ InitGlobals(nsPresContext* aPresContext)
nsCAutoString key;
nsAutoString value;
nsCOMPtr<nsIPersistentProperties> mathfontProp;
nsCOMPtr<nsIPrefBranch> prefBranch(do_GetService(NS_PREFSERVICE_CONTRACTID));
// Add the math fonts in the gGlyphTableList in order of preference ...
// Note: we only load font-names at this stage. The actual glyph tables will
@ -1451,9 +1437,8 @@ nsMathMLChar::StretchInternal(nsPresContext* aPresContext,
nsFont font = mStyleContext->GetParent()->GetStyleFont()->mFont;
// Override with specific fonts if applicable for this character
nsCOMPtr<nsIPrefBranch> prefBranch = do_GetService(NS_PREFSERVICE_CONTRACTID);
nsAutoString families;
if (GetFontExtensionPref(prefBranch, mData[0], eExtension_base, families)) {
if (GetFontExtensionPref(mData[0], eExtension_base, families)) {
font.name = families;
}
@ -1568,8 +1553,7 @@ nsMathMLChar::StretchInternal(nsPresContext* aPresContext,
}
// See if there are preferred fonts for the variants of this char
if (!done && GetFontExtensionPref(prefBranch, mData[0], eExtension_variants,
families)) {
if (!done && GetFontExtensionPref(mData[0], eExtension_variants, families)) {
font.name = families;
StretchEnumContext enumData(this, aPresContext, aRenderingContext,
@ -1582,8 +1566,7 @@ nsMathMLChar::StretchInternal(nsPresContext* aPresContext,
// See if there are preferred fonts for the parts of this char
if (!done && !largeopOnly
&& GetFontExtensionPref(prefBranch, mData[0], eExtension_parts,
families)) {
&& GetFontExtensionPref(mData[0], eExtension_parts, families)) {
font.name = families;
StretchEnumContext enumData(this, aPresContext, aRenderingContext,
@ -1598,8 +1581,8 @@ nsMathMLChar::StretchInternal(nsPresContext* aPresContext,
// Use the css font-family but add preferred fallback fonts.
font.name = cssFamilies;
NS_NAMED_LITERAL_CSTRING(defaultKey, "font.mathfont-family");
nsAutoString fallbackFonts;
if (GetPrefValue(prefBranch, defaultKey.get(), fallbackFonts)) {
nsAdoptingString fallbackFonts = Preferences::GetString(defaultKey.get());
if (!fallbackFonts.IsEmpty()) {
AddFallbackFonts(font.name, fallbackFonts);
}

View File

@ -54,7 +54,7 @@
#include "nsIChannelEventSink.h"
#include "nsIInterfaceRequestor.h"
#include "nsContentUtils.h"
#include "nsIPrefService.h"
#include "mozilla/Preferences.h"
#include "nsPresContext.h"
#include "nsIPresShell.h"
@ -75,6 +75,8 @@
#include "nsStyleSet.h"
using namespace mozilla;
#ifdef PR_LOGGING
static PRLogModuleInfo *gFontDownloaderLog = PR_NewLogModule("fontdownloader");
#endif /* PR_LOGGING */
@ -104,11 +106,8 @@ nsFontFaceLoader::~nsFontFaceLoader()
void
nsFontFaceLoader::StartedLoading(nsIStreamLoader *aStreamLoader)
{
PRInt32 loadTimeout = 3000;
nsCOMPtr<nsIPrefBranch> prefs = do_GetService(NS_PREFSERVICE_CONTRACTID);
if (prefs) {
prefs->GetIntPref("gfx.downloadable_fonts.fallback_delay", &loadTimeout);
}
PRInt32 loadTimeout =
Preferences::GetInt("gfx.downloadable_fonts.fallback_delay", 3000);
if (loadTimeout > 0) {
mLoadTimer = do_CreateInstance("@mozilla.org/timer;1");
if (mLoadTimer) {

View File

@ -48,8 +48,6 @@
#include "nsIServiceManager.h"
#include "nsIAtom.h"
#include "nsQuickSort.h"
#include "nsIPrefBranch.h"
#include "nsIPrefService.h"
#include "nsIContent.h"
#include "nsIDocument.h"
@ -65,6 +63,7 @@ static NS_DEFINE_CID(kLayoutDebuggerCID, NS_LAYOUT_DEBUGGER_CID);
#include "nsISelectionController.h"
#include "mozilla/dom/Element.h"
#include "mozilla/Preferences.h"
using namespace mozilla;
@ -151,9 +150,9 @@ NS_IMPL_ISUPPORTS1(nsLayoutDebuggingTools, nsILayoutDebuggingTools)
NS_IMETHODIMP
nsLayoutDebuggingTools::Init(nsIDOMWindow *aWin)
{
mPrefs = do_GetService(NS_PREFSERVICE_CONTRACTID);
if (!mPrefs)
if (!Preferences::GetService()) {
return NS_ERROR_UNEXPECTED;
}
{
nsCOMPtr<nsPIDOMWindow> window = do_QueryInterface(aWin);
@ -163,13 +162,22 @@ nsLayoutDebuggingTools::Init(nsIDOMWindow *aWin)
}
NS_ENSURE_TRUE(mDocShell, NS_ERROR_UNEXPECTED);
GetBoolPref("nglayout.debug.paint_flashing", &mPaintFlashing);
GetBoolPref("nglayout.debug.paint_dumping", &mPaintDumping);
GetBoolPref("nglayout.debug.invalidate_dumping", &mInvalidateDumping);
GetBoolPref("nglayout.debug.event_dumping", &mEventDumping);
GetBoolPref("nglayout.debug.motion_event_dumping", &mMotionEventDumping);
GetBoolPref("nglayout.debug.crossing_event_dumping", &mCrossingEventDumping);
GetBoolPref("layout.reflow.showframecounts", &mReflowCounts);
mPaintFlashing =
Preferences::GetBool("nglayout.debug.paint_flashing", mPaintFlashing);
mPaintDumping =
Preferences::GetBool("nglayout.debug.paint_dumping", mPaintDumping);
mInvalidateDumping =
Preferences::GetBool("nglayout.debug.invalidate_dumping", mInvalidateDumping);
mEventDumping =
Preferences::GetBool("nglayout.debug.event_dumping", mEventDumping);
mMotionEventDumping =
Preferences::GetBool("nglayout.debug.motion_event_dumping",
mMotionEventDumping);
mCrossingEventDumping =
Preferences::GetBool("nglayout.debug.crossing_event_dumping",
mCrossingEventDumping);
mReflowCounts =
Preferences::GetBool("layout.reflow.showframecounts", mReflowCounts);
{
nsCOMPtr<nsILayoutDebugger> ld = do_GetService(kLayoutDebuggerCID);
@ -578,25 +586,14 @@ nsLayoutDebuggingTools::SetBoolPrefAndRefresh(const char * aPrefName,
PRBool aNewVal)
{
NS_ENSURE_TRUE(mDocShell, NS_ERROR_NOT_INITIALIZED);
NS_ENSURE_TRUE(mPrefs && aPrefName, NS_OK);
mPrefs->SetBoolPref(aPrefName, aNewVal);
nsCOMPtr<nsIPrefService> prefService = do_QueryInterface(mPrefs);
NS_ENSURE_STATE(prefService);
nsIPrefService* prefService = Preferences::GetService();
NS_ENSURE_TRUE(prefService && aPrefName, NS_OK);
Preferences::SetBool(aPrefName, aNewVal);
prefService->SavePrefFile(nsnull);
ForceRefresh();
return NS_OK;
}
nsresult
nsLayoutDebuggingTools::GetBoolPref(const char * aPrefName,
PRBool *aValue)
{
NS_ENSURE_TRUE(mPrefs && aPrefName, NS_OK);
mPrefs->GetBoolPref(aPrefName, aValue);
return NS_OK;
}

View File

@ -39,7 +39,6 @@
#include "nsILayoutDebuggingTools.h"
#include "nsIDocShell.h"
#include "nsCOMPtr.h"
#include "nsIPrefBranch.h"
class nsLayoutDebuggingTools : public nsILayoutDebuggingTools {
@ -57,7 +56,6 @@ protected:
nsresult SetBoolPrefAndRefresh(const char * aPrefName, PRBool aNewValue);
nsCOMPtr<nsIDocShell> mDocShell;
nsCOMPtr<nsIPrefBranch> mPrefs;
PRBool mEditorMode;
PRBool mVisualDebugging;

View File

@ -61,7 +61,6 @@
#include "nsLayoutCID.h"
#include "nsNetUtil.h"
#include "nsILocalFile.h"
#include "nsIPrefService.h"
#include "nsIViewManager.h"
#include "nsIView.h"

View File

@ -138,6 +138,10 @@
let event = document.createEvent("Events");
event.initEvent("AddonOptionsLoad", true, false);
this.dispatchEvent(event);
// Also send a notification to match the behavior of desktop Firefox
let id = this.id.substring(17); // length of |urn:mozilla:item:|
Services.obs.notifyObservers(document, "addon-options-displayed", id);
]]>
</body>
</method>

View File

@ -352,11 +352,6 @@ let Content = {
} else if (ot == errorDoc.getElementById("getMeOutOfHereButton")) {
sendAsyncMessage("Browser:CertException", { url: errorDoc.location.href, action: "leave" });
}
} else if (/^about:neterror\?e=netOffline/.test(errorDoc.documentURI)) {
if (ot == errorDoc.getElementById("errorTryAgain")) {
// Make sure we're online before attempting to load
Util.forceOnline();
}
} else if (/^about:blocked/.test(errorDoc.documentURI)) {
// The event came from a button on a malware/phishing block page
// First check whether it's malware or phishing, so that we can

View File

@ -56,16 +56,12 @@ _BROWSER_FILES = \
remote_vkb.js \
browser_addons.js \
browser_appmenu.js \
browser_autocomplete.html \
browser_autocomplete.js \
browser_autocompletesearch.js\
browser_awesomescreen.js \
browser_blank_01.html \
browser_blank_02.html \
browser_bookmarks.js \
browser_contacts.js \
browser_contentpopup.html \
browser_contentpopup.js \
browser_dragger.js \
browser_find.js \
browser_forms.html \
@ -100,10 +96,14 @@ _BROWSER_FILES = \
ifneq ($(OS_TARGET),Android)
_BROWSER_FILES += \
browser_autocomplete.html \
browser_autocomplete.js \
browser_bookmarks_star.js \
browser_bookmarks_tags.js \
browser_click_content.html \
browser_click_content.js \
browser_contentpopup.html \
browser_contentpopup.js \
browser_navigation.js \
$(NULL)
ifndef MOZ_PLATFORM_MAEMO

View File

@ -120,7 +120,11 @@ gTests.push({
// Create a listener for the opening bookmark
waitForPageShow(function() {
is(gCurrentTest._currentTab.browser.currentURI.spec, testURL_01, "Opened the right bookmark");
if (Services.appinfo.OS == "Android")
todo_is(gCurrentTest._currentTab.browser.currentURI.spec, testURL_01, "Opened the right bookmark");
else
is(gCurrentTest._currentTab.browser.currentURI.spec, testURL_01, "Opened the right bookmark");
Browser.closeTab(gCurrentTest._currentTab);
runNextTest();

View File

@ -53,7 +53,7 @@
<!ENTITY netInterrupt.longDesc "&sharedLongDesc;">
<!ENTITY netOffline.title "Offline mode">
<!ENTITY netOffline.overrideLongDesc "
<!ENTITY netOffline.longDesc2 "
<ul>
<li>Try again. &brandShortName; will attempt to open a connection and reload the page.</li>
</ul>

View File

@ -52,6 +52,10 @@
#include "nsIPrincipal.h"
#include "nsIFileURL.h"
#include "mozilla/Preferences.h"
using namespace mozilla;
static NS_DEFINE_CID(kZipReaderCID, NS_ZIPREADER_CID);
// the entry for a directory will either be empty (in the case of the
@ -839,18 +843,9 @@ nsJARChannel::OnDownloadComplete(nsIDownloader *downloader,
}
}
if (NS_SUCCEEDED(status) && mIsUnsafe) {
PRBool allowUnpack = PR_FALSE;
nsCOMPtr<nsIPrefBranch> prefs =
do_GetService(NS_PREFSERVICE_CONTRACTID);
if (prefs) {
prefs->GetBoolPref("network.jar.open-unsafe-types", &allowUnpack);
}
if (!allowUnpack) {
status = NS_ERROR_UNSAFE_CONTENT_TYPE;
}
if (NS_SUCCEEDED(status) && mIsUnsafe &&
!Preferences::GetBool("network.jar.open-unsafe-types", PR_FALSE)) {
status = NS_ERROR_UNSAFE_CONTENT_TYPE;
}
if (NS_SUCCEEDED(status)) {

View File

@ -35,14 +35,11 @@
*
* ***** END LICENSE BLOCK ***** */
#include "nsIServiceManager.h"
#include "nsIPrefService.h"
#include "nsIPrefBranch2.h"
#include "nsComponentManagerUtils.h"
#include "nsITimer.h"
#include "RasterImage.h"
#include "DiscardTracker.h"
#include "mozilla/Preferences.h"
namespace mozilla {
namespace imagelib {
@ -174,12 +171,7 @@ DiscardTracker::ReloadTimeout()
// read the timeout pref
PRInt32 discardTimeout;
nsCOMPtr<nsIPrefBranch2> branch = do_GetService(NS_PREFSERVICE_CONTRACTID);
if (!branch) {
NS_WARNING("nsIPrefBranch2 is not available!");
return;
}
rv = branch->GetIntPref(DISCARD_TIMEOUT_PREF, &discardTimeout);
rv = Preferences::GetInt(DISCARD_TIMEOUT_PREF, &discardTimeout);
// If we got something bogus, return
if (!NS_SUCCEEDED(rv) || discardTimeout <= 0)

View File

@ -276,10 +276,10 @@ public:
nsresult AddSourceData(const char *aBuffer, PRUint32 aCount);
/* Called after the all the source data has been added with addSourceData. */
virtual nsresult SourceDataComplete();
nsresult SourceDataComplete();
/* Called for multipart images when there's a new source image to add. */
virtual nsresult NewSourceData();
nsresult NewSourceData();
/**
* A hint of the number of bytes of source data that the image contains. If
@ -292,7 +292,7 @@ public:
* Thus, pre-allocation simplifies code and reduces the total number of
* allocations.
*/
virtual nsresult SetSourceSizeHint(PRUint32 sizeHint);
nsresult SetSourceSizeHint(PRUint32 sizeHint);
// "Blend" method indicates how the current image is combined with the
// previous image.

View File

@ -55,8 +55,6 @@
#include "nsIHttpChannel.h"
#include "nsICachingChannel.h"
#include "nsIInterfaceRequestor.h"
#include "nsIPrefBranch2.h"
#include "nsIPrefService.h"
#include "nsIProgressEventSink.h"
#include "nsIChannelEventSink.h"
#include "nsIAsyncVerifyRedirectCallback.h"
@ -90,7 +88,9 @@
#include "nsIChannelPolicy.h"
#include "mozilla/FunctionTimer.h"
#include "mozilla/Preferences.h"
using namespace mozilla;
using namespace mozilla::imagelib;
#if defined(DEBUG_pavlov) || defined(DEBUG_timeless)
@ -851,19 +851,15 @@ nsresult imgLoader::InitCache()
if (!sChromeCache.Init())
return NS_ERROR_OUT_OF_MEMORY;
nsCOMPtr<nsIPrefBranch> prefs = do_GetService(NS_PREFSERVICE_CONTRACTID, &rv);
if (NS_FAILED(rv))
return rv;
PRInt32 timeweight;
rv = prefs->GetIntPref("image.cache.timeweight", &timeweight);
rv = Preferences::GetInt("image.cache.timeweight", &timeweight);
if (NS_SUCCEEDED(rv))
sCacheTimeWeight = timeweight / 1000.0;
else
sCacheTimeWeight = 0.5;
PRInt32 cachesize;
rv = prefs->GetIntPref("image.cache.size", &cachesize);
rv = Preferences::GetInt("image.cache.size", &cachesize);
if (NS_SUCCEEDED(rv))
sCacheMaxSize = cachesize;
else
@ -884,13 +880,9 @@ nsresult imgLoader::InitCache()
nsresult imgLoader::Init()
{
nsresult rv;
nsCOMPtr<nsIPrefBranch2> prefs = do_GetService(NS_PREFSERVICE_CONTRACTID, &rv);
if (NS_FAILED(rv))
return rv;
ReadAcceptHeaderPref();
ReadAcceptHeaderPref(prefs);
prefs->AddObserver("image.http.accept", this, PR_TRUE);
Preferences::AddWeakObserver(this, "image.http.accept");
// Listen for when we leave private browsing mode
nsCOMPtr<nsIObserverService> obService = mozilla::services::GetObserverService();
@ -906,8 +898,7 @@ imgLoader::Observe(nsISupports* aSubject, const char* aTopic, const PRUnichar* a
// We listen for pref change notifications...
if (!strcmp(aTopic, NS_PREFBRANCH_PREFCHANGE_TOPIC_ID)) {
if (!strcmp(NS_ConvertUTF16toUTF8(aData).get(), "image.http.accept")) {
nsCOMPtr<nsIPrefBranch> prefs = do_QueryInterface(aSubject);
ReadAcceptHeaderPref(prefs);
ReadAcceptHeaderPref();
}
}
@ -925,13 +916,10 @@ imgLoader::Observe(nsISupports* aSubject, const char* aTopic, const PRUnichar* a
return NS_OK;
}
void imgLoader::ReadAcceptHeaderPref(nsIPrefBranch *aBranch)
void imgLoader::ReadAcceptHeaderPref()
{
NS_ASSERTION(aBranch, "Pref branch is null");
nsXPIDLCString accept;
nsresult rv = aBranch->GetCharPref("image.http.accept", getter_Copies(accept));
if (NS_SUCCEEDED(rv))
nsAdoptingCString accept = Preferences::GetCString("image.http.accept");
if (accept)
mAcceptHeader = accept;
else
mAcceptHeader = "image/png,image/*;q=0.8,*/*;q=0.5";

View File

@ -62,7 +62,6 @@ class imgRequestProxy;
class imgIRequest;
class imgIDecoderObserver;
class nsILoadGroup;
class nsIPrefBranch;
class imgCacheEntry
{
@ -323,7 +322,7 @@ private: // methods
nsLoadFlags aLoadFlags, imgIRequest *aRequestProxy,
imgIRequest **_retval);
void ReadAcceptHeaderPref(nsIPrefBranch *aBranch);
void ReadAcceptHeaderPref();
typedef nsRefPtrHashtable<nsCStringHashKey, imgCacheEntry> imgCacheTable;

View File

@ -80,8 +80,7 @@
#include "nsNetUtil.h"
#include "nsIProtocolHandler.h"
#include "nsIPrefService.h"
#include "nsIPrefBranch2.h"
#include "mozilla/Preferences.h"
#include "DiscardTracker.h"
#include "nsAsyncRedirectVerifyHelper.h"
@ -93,12 +92,20 @@
#define MAXBYTESFORSYNC_PREF "image.mem.max_bytes_for_sync_decode"
#define SVG_MIMETYPE "image/svg+xml"
using namespace mozilla;
using namespace mozilla::imagelib;
/* Kept up to date by a pref observer. */
static PRBool gDecodeOnDraw = PR_FALSE;
static PRBool gDiscardable = PR_FALSE;
static const char* kObservedPrefs[] = {
DISCARD_PREF,
DECODEONDRAW_PREF,
DISCARD_TIMEOUT_PREF,
nsnull
};
/*
* Pref observer goop. Yuck.
*/
@ -108,31 +115,28 @@ static PRBool gRegisteredPrefObserver = PR_FALSE;
// Reloader
static void
ReloadPrefs(nsIPrefBranch *aBranch)
ReloadPrefs()
{
// Discardable
PRBool discardable;
nsresult rv = aBranch->GetBoolPref(DISCARD_PREF, &discardable);
if (NS_SUCCEEDED(rv))
gDiscardable = discardable;
gDiscardable = Preferences::GetBool(DISCARD_PREF, gDiscardable);
// Decode-on-draw
PRBool decodeondraw;
rv = aBranch->GetBoolPref(DECODEONDRAW_PREF, &decodeondraw);
if (NS_SUCCEEDED(rv))
gDecodeOnDraw = decodeondraw;
gDecodeOnDraw = Preferences::GetBool(DECODEONDRAW_PREF, gDecodeOnDraw);
// Progressive decoding knobs
PRInt32 bytesAtATime, maxMS, maxBytesForSync;
rv = aBranch->GetIntPref(BYTESATATIME_PREF, &bytesAtATime);
if (NS_SUCCEEDED(rv))
if (NS_SUCCEEDED(Preferences::GetInt(BYTESATATIME_PREF, &bytesAtATime))) {
RasterImage::SetDecodeBytesAtATime(bytesAtATime);
rv = aBranch->GetIntPref(MAXMS_PREF, &maxMS);
if (NS_SUCCEEDED(rv))
}
if (NS_SUCCEEDED(Preferences::GetInt(MAXMS_PREF, &maxMS))) {
RasterImage::SetMaxMSBeforeYield(maxMS);
rv = aBranch->GetIntPref(MAXBYTESFORSYNC_PREF, &maxBytesForSync);
if (NS_SUCCEEDED(rv))
}
if (NS_SUCCEEDED(Preferences::GetInt(MAXBYTESFORSYNC_PREF,
&maxBytesForSync))) {
RasterImage::SetMaxBytesForSyncDecode(maxBytesForSync);
}
// Discard timeout
mozilla::imagelib::DiscardTracker::ReloadTimeout();
@ -161,15 +165,8 @@ imgRequestPrefObserver::Observe(nsISupports *aSubject,
strcmp(NS_LossyConvertUTF16toASCII(aData).get(), DISCARD_TIMEOUT_PREF))
return NS_OK;
// Get the pref branch
nsCOMPtr<nsIPrefBranch> branch = do_QueryInterface(aSubject);
if (!branch) {
NS_WARNING("Couldn't get pref branch within imgRequestPrefObserver::Observe!");
return NS_OK;
}
// Process the change
ReloadPrefs(branch);
ReloadPrefs();
return NS_OK;
}
@ -243,15 +240,10 @@ nsresult imgRequest::Init(nsIURI *aURI,
// Register our pref observer if it hasn't been done yet.
if (NS_UNLIKELY(!gRegisteredPrefObserver)) {
nsCOMPtr<nsIPrefBranch2> branch = do_GetService(NS_PREFSERVICE_CONTRACTID);
if (branch) {
nsCOMPtr<nsIObserver> observer(new imgRequestPrefObserver());
branch->AddObserver(DISCARD_PREF, observer, PR_FALSE);
branch->AddObserver(DECODEONDRAW_PREF, observer, PR_FALSE);
branch->AddObserver(DISCARD_TIMEOUT_PREF, observer, PR_FALSE);
ReloadPrefs(branch);
gRegisteredPrefObserver = PR_TRUE;
}
nsCOMPtr<nsIObserver> observer(new imgRequestPrefObserver());
Preferences::AddStrongObservers(observer, kObservedPrefs);
ReloadPrefs();
gRegisteredPrefObserver = PR_TRUE;
}
return NS_OK;

View File

@ -1,7 +1,3 @@
const Cc = Components.classes;
const Ci = Components.interfaces;
const Cu = Components.utils;
const RELATIVE_DIR = "modules/libpr0n/test/browser/";
const TESTROOT = "http://example.com/browser/" + RELATIVE_DIR;
const TESTROOT2 = "http://example.org/browser/" + RELATIVE_DIR;
@ -9,8 +5,6 @@ const TESTROOT2 = "http://example.org/browser/" + RELATIVE_DIR;
var chrome_root = getRootDirectory(gTestPath);
const CHROMEROOT = chrome_root;
Cu.import("resource://gre/modules/XPCOMUtils.jsm");
function getImageLoading(doc, id) {
var htmlImg = doc.getElementById(id);
return htmlImg.QueryInterface(Ci.nsIImageLoadingContent);

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