зеркало из https://github.com/mozilla/gecko-dev.git
Merge m-c into tm again.
This commit is contained in:
Коммит
1ea26cada3
|
@ -232,7 +232,6 @@ _TEST_FILES = test_bug5141.html \
|
|||
file_bug445225_multipart.txt^headers^ \
|
||||
test_title.html \
|
||||
test_bug453521.html \
|
||||
test_bug391728.html \
|
||||
file_bug391728.html \
|
||||
test_bug454325.html \
|
||||
file_bug391728_2.html \
|
||||
|
@ -276,5 +275,9 @@ _TEST_FILES = test_bug5141.html \
|
|||
# test_bug444546.html \
|
||||
# bug444546.sjs \
|
||||
|
||||
# Disabled because of a leak that occurs when the test plugin can actually load
|
||||
# instances.
|
||||
# test_bug391728.html \
|
||||
|
||||
libs:: $(_TEST_FILES)
|
||||
$(INSTALL) $(foreach f,$^,"$f") $(DEPTH)/_tests/testing/mochitest/tests/$(relativesrcdir)
|
||||
|
|
|
@ -93,7 +93,7 @@ let gFunctions = [
|
|||
// 11: Irish Gaeilge
|
||||
[5, function(n) n==1?0:n==2?1:n>=3&&n<=6?2:n>=7&&n<=10?3:4],
|
||||
// 12: Arabic
|
||||
[4, function(n) n==1?0:n==2?1:n<=10?2:3],
|
||||
[6, function(n) n==0?5:n==1?0:n==2?1:n%100>=3&&n%100<=10?2:n%100>=11&&n%100<=99?3:4],
|
||||
// 13: Maltese
|
||||
[4, function(n) n==1?0:n==0||n%100>0&&n%100<=10?1:n%100>10&&n%100<20?2:3],
|
||||
// 14: Macedonian
|
||||
|
|
|
@ -0,0 +1,579 @@
|
|||
/* ***** 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 Plural Form l10n Test Code.
|
||||
*
|
||||
* The Initial Developer of the Original Code is
|
||||
* Edward Lee <edward.lee@engineering.uiuc.edu>.
|
||||
* Portions created by the Initial Developer are Copyright (C) 2008
|
||||
* the Initial Developer. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the terms of
|
||||
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
* in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
* of those above. If you wish to allow use of your version of this file only
|
||||
* under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
* use your version of this file under the terms of the MPL, indicate your
|
||||
* decision by deleting the provisions above and replace them with the notice
|
||||
* and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
* the provisions above, a recipient may use your version of this file under
|
||||
* the terms of any one of the MPL, the GPL or the LGPL.
|
||||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
/**
|
||||
* Make sure each of the plural forms have the correct number of forms and
|
||||
* match up in functionality.
|
||||
*/
|
||||
|
||||
Components.utils.import("resource://gre/modules/PluralForm.jsm");
|
||||
|
||||
function run_test()
|
||||
{
|
||||
let allExpect = [[
|
||||
// 0: Chinese 0-9, 10-19, ..., 90-99
|
||||
1,1,1,1,1,1,1,1,1,1,
|
||||
1,1,1,1,1,1,1,1,1,1,
|
||||
1,1,1,1,1,1,1,1,1,1,
|
||||
1,1,1,1,1,1,1,1,1,1,
|
||||
1,1,1,1,1,1,1,1,1,1,
|
||||
1,1,1,1,1,1,1,1,1,1,
|
||||
1,1,1,1,1,1,1,1,1,1,
|
||||
1,1,1,1,1,1,1,1,1,1,
|
||||
1,1,1,1,1,1,1,1,1,1,
|
||||
1,1,1,1,1,1,1,1,1,1,
|
||||
// 100-109, 110-119, ..., 190-199
|
||||
1,1,1,1,1,1,1,1,1,1,
|
||||
1,1,1,1,1,1,1,1,1,1,
|
||||
1,1,1,1,1,1,1,1,1,1,
|
||||
1,1,1,1,1,1,1,1,1,1,
|
||||
1,1,1,1,1,1,1,1,1,1,
|
||||
1,1,1,1,1,1,1,1,1,1,
|
||||
1,1,1,1,1,1,1,1,1,1,
|
||||
1,1,1,1,1,1,1,1,1,1,
|
||||
1,1,1,1,1,1,1,1,1,1,
|
||||
1,1,1,1,1,1,1,1,1,1,
|
||||
// 200-209, 210-219, ..., 290-299
|
||||
1,1,1,1,1,1,1,1,1,1,
|
||||
1,1,1,1,1,1,1,1,1,1,
|
||||
1,1,1,1,1,1,1,1,1,1,
|
||||
1,1,1,1,1,1,1,1,1,1,
|
||||
1,1,1,1,1,1,1,1,1,1,
|
||||
1,1,1,1,1,1,1,1,1,1,
|
||||
1,1,1,1,1,1,1,1,1,1,
|
||||
1,1,1,1,1,1,1,1,1,1,
|
||||
1,1,1,1,1,1,1,1,1,1,
|
||||
1,1,1,1,1,1,1,1,1,1,
|
||||
], [
|
||||
// 1: English 0-9, 10-19, ..., 90-99
|
||||
2,1,2,2,2,2,2,2,2,2,
|
||||
2,2,2,2,2,2,2,2,2,2,
|
||||
2,2,2,2,2,2,2,2,2,2,
|
||||
2,2,2,2,2,2,2,2,2,2,
|
||||
2,2,2,2,2,2,2,2,2,2,
|
||||
2,2,2,2,2,2,2,2,2,2,
|
||||
2,2,2,2,2,2,2,2,2,2,
|
||||
2,2,2,2,2,2,2,2,2,2,
|
||||
2,2,2,2,2,2,2,2,2,2,
|
||||
2,2,2,2,2,2,2,2,2,2,
|
||||
// 100-109, 110-119, ..., 190-199
|
||||
2,2,2,2,2,2,2,2,2,2,
|
||||
2,2,2,2,2,2,2,2,2,2,
|
||||
2,2,2,2,2,2,2,2,2,2,
|
||||
2,2,2,2,2,2,2,2,2,2,
|
||||
2,2,2,2,2,2,2,2,2,2,
|
||||
2,2,2,2,2,2,2,2,2,2,
|
||||
2,2,2,2,2,2,2,2,2,2,
|
||||
2,2,2,2,2,2,2,2,2,2,
|
||||
2,2,2,2,2,2,2,2,2,2,
|
||||
2,2,2,2,2,2,2,2,2,2,
|
||||
// 200-209, 210-219, ..., 290-299
|
||||
2,2,2,2,2,2,2,2,2,2,
|
||||
2,2,2,2,2,2,2,2,2,2,
|
||||
2,2,2,2,2,2,2,2,2,2,
|
||||
2,2,2,2,2,2,2,2,2,2,
|
||||
2,2,2,2,2,2,2,2,2,2,
|
||||
2,2,2,2,2,2,2,2,2,2,
|
||||
2,2,2,2,2,2,2,2,2,2,
|
||||
2,2,2,2,2,2,2,2,2,2,
|
||||
2,2,2,2,2,2,2,2,2,2,
|
||||
2,2,2,2,2,2,2,2,2,2,
|
||||
], [
|
||||
// 2: French 0-9, 10-19, ..., 90-99
|
||||
1,1,2,2,2,2,2,2,2,2,
|
||||
2,2,2,2,2,2,2,2,2,2,
|
||||
2,2,2,2,2,2,2,2,2,2,
|
||||
2,2,2,2,2,2,2,2,2,2,
|
||||
2,2,2,2,2,2,2,2,2,2,
|
||||
2,2,2,2,2,2,2,2,2,2,
|
||||
2,2,2,2,2,2,2,2,2,2,
|
||||
2,2,2,2,2,2,2,2,2,2,
|
||||
2,2,2,2,2,2,2,2,2,2,
|
||||
2,2,2,2,2,2,2,2,2,2,
|
||||
// 100-109, 110-119, ..., 190-199
|
||||
2,2,2,2,2,2,2,2,2,2,
|
||||
2,2,2,2,2,2,2,2,2,2,
|
||||
2,2,2,2,2,2,2,2,2,2,
|
||||
2,2,2,2,2,2,2,2,2,2,
|
||||
2,2,2,2,2,2,2,2,2,2,
|
||||
2,2,2,2,2,2,2,2,2,2,
|
||||
2,2,2,2,2,2,2,2,2,2,
|
||||
2,2,2,2,2,2,2,2,2,2,
|
||||
2,2,2,2,2,2,2,2,2,2,
|
||||
2,2,2,2,2,2,2,2,2,2,
|
||||
// 200-209, 210-219, ..., 290-299
|
||||
2,2,2,2,2,2,2,2,2,2,
|
||||
2,2,2,2,2,2,2,2,2,2,
|
||||
2,2,2,2,2,2,2,2,2,2,
|
||||
2,2,2,2,2,2,2,2,2,2,
|
||||
2,2,2,2,2,2,2,2,2,2,
|
||||
2,2,2,2,2,2,2,2,2,2,
|
||||
2,2,2,2,2,2,2,2,2,2,
|
||||
2,2,2,2,2,2,2,2,2,2,
|
||||
2,2,2,2,2,2,2,2,2,2,
|
||||
2,2,2,2,2,2,2,2,2,2,
|
||||
], [
|
||||
// 3: Latvian 0-9, 10-19, ..., 90-99
|
||||
1,2,3,3,3,3,3,3,3,3,
|
||||
3,3,3,3,3,3,3,3,3,3,
|
||||
3,2,3,3,3,3,3,3,3,3,
|
||||
3,2,3,3,3,3,3,3,3,3,
|
||||
3,2,3,3,3,3,3,3,3,3,
|
||||
3,2,3,3,3,3,3,3,3,3,
|
||||
3,2,3,3,3,3,3,3,3,3,
|
||||
3,2,3,3,3,3,3,3,3,3,
|
||||
3,2,3,3,3,3,3,3,3,3,
|
||||
3,2,3,3,3,3,3,3,3,3,
|
||||
// 100-109, 110-119, ..., 190-199
|
||||
3,2,3,3,3,3,3,3,3,3,
|
||||
3,3,3,3,3,3,3,3,3,3,
|
||||
3,2,3,3,3,3,3,3,3,3,
|
||||
3,2,3,3,3,3,3,3,3,3,
|
||||
3,2,3,3,3,3,3,3,3,3,
|
||||
3,2,3,3,3,3,3,3,3,3,
|
||||
3,2,3,3,3,3,3,3,3,3,
|
||||
3,2,3,3,3,3,3,3,3,3,
|
||||
3,2,3,3,3,3,3,3,3,3,
|
||||
3,2,3,3,3,3,3,3,3,3,
|
||||
// 200-209, 210-219, ..., 290-299
|
||||
3,2,3,3,3,3,3,3,3,3,
|
||||
3,3,3,3,3,3,3,3,3,3,
|
||||
3,2,3,3,3,3,3,3,3,3,
|
||||
3,2,3,3,3,3,3,3,3,3,
|
||||
3,2,3,3,3,3,3,3,3,3,
|
||||
3,2,3,3,3,3,3,3,3,3,
|
||||
3,2,3,3,3,3,3,3,3,3,
|
||||
3,2,3,3,3,3,3,3,3,3,
|
||||
3,2,3,3,3,3,3,3,3,3,
|
||||
3,2,3,3,3,3,3,3,3,3,
|
||||
], [
|
||||
// 4: Scottish Gaelic 0-9, 10-19, ..., 90-99
|
||||
3,1,2,3,3,3,3,3,3,3,
|
||||
3,3,3,3,3,3,3,3,3,3,
|
||||
3,3,3,3,3,3,3,3,3,3,
|
||||
3,3,3,3,3,3,3,3,3,3,
|
||||
3,3,3,3,3,3,3,3,3,3,
|
||||
3,3,3,3,3,3,3,3,3,3,
|
||||
3,3,3,3,3,3,3,3,3,3,
|
||||
3,3,3,3,3,3,3,3,3,3,
|
||||
3,3,3,3,3,3,3,3,3,3,
|
||||
3,3,3,3,3,3,3,3,3,3,
|
||||
// 100-109, 110-119, ..., 190-199
|
||||
3,3,3,3,3,3,3,3,3,3,
|
||||
3,3,3,3,3,3,3,3,3,3,
|
||||
3,3,3,3,3,3,3,3,3,3,
|
||||
3,3,3,3,3,3,3,3,3,3,
|
||||
3,3,3,3,3,3,3,3,3,3,
|
||||
3,3,3,3,3,3,3,3,3,3,
|
||||
3,3,3,3,3,3,3,3,3,3,
|
||||
3,3,3,3,3,3,3,3,3,3,
|
||||
3,3,3,3,3,3,3,3,3,3,
|
||||
3,3,3,3,3,3,3,3,3,3,
|
||||
// 200-209, 210-219, ..., 290-299
|
||||
3,3,3,3,3,3,3,3,3,3,
|
||||
3,3,3,3,3,3,3,3,3,3,
|
||||
3,3,3,3,3,3,3,3,3,3,
|
||||
3,3,3,3,3,3,3,3,3,3,
|
||||
3,3,3,3,3,3,3,3,3,3,
|
||||
3,3,3,3,3,3,3,3,3,3,
|
||||
3,3,3,3,3,3,3,3,3,3,
|
||||
3,3,3,3,3,3,3,3,3,3,
|
||||
3,3,3,3,3,3,3,3,3,3,
|
||||
3,3,3,3,3,3,3,3,3,3,
|
||||
], [
|
||||
// 5: Romanian 0-9, 10-19, ..., 90-99
|
||||
2,1,2,2,2,2,2,2,2,2,
|
||||
2,2,2,2,2,2,2,2,2,2,
|
||||
3,3,3,3,3,3,3,3,3,3,
|
||||
3,3,3,3,3,3,3,3,3,3,
|
||||
3,3,3,3,3,3,3,3,3,3,
|
||||
3,3,3,3,3,3,3,3,3,3,
|
||||
3,3,3,3,3,3,3,3,3,3,
|
||||
3,3,3,3,3,3,3,3,3,3,
|
||||
3,3,3,3,3,3,3,3,3,3,
|
||||
3,3,3,3,3,3,3,3,3,3,
|
||||
// 100-109, 110-119, ..., 190-199
|
||||
3,2,2,2,2,2,2,2,2,2,
|
||||
2,2,2,2,2,2,2,2,2,2,
|
||||
3,3,3,3,3,3,3,3,3,3,
|
||||
3,3,3,3,3,3,3,3,3,3,
|
||||
3,3,3,3,3,3,3,3,3,3,
|
||||
3,3,3,3,3,3,3,3,3,3,
|
||||
3,3,3,3,3,3,3,3,3,3,
|
||||
3,3,3,3,3,3,3,3,3,3,
|
||||
3,3,3,3,3,3,3,3,3,3,
|
||||
3,3,3,3,3,3,3,3,3,3,
|
||||
// 200-209, 210-219, ..., 290-299
|
||||
3,2,2,2,2,2,2,2,2,2,
|
||||
2,2,2,2,2,2,2,2,2,2,
|
||||
3,3,3,3,3,3,3,3,3,3,
|
||||
3,3,3,3,3,3,3,3,3,3,
|
||||
3,3,3,3,3,3,3,3,3,3,
|
||||
3,3,3,3,3,3,3,3,3,3,
|
||||
3,3,3,3,3,3,3,3,3,3,
|
||||
3,3,3,3,3,3,3,3,3,3,
|
||||
3,3,3,3,3,3,3,3,3,3,
|
||||
3,3,3,3,3,3,3,3,3,3,
|
||||
], [
|
||||
// 6: Lithuanian 0-9, 10-19, ..., 90-99
|
||||
2,1,3,3,3,3,3,3,3,3,
|
||||
2,2,2,2,2,2,2,2,2,2,
|
||||
2,1,3,3,3,3,3,3,3,3,
|
||||
2,1,3,3,3,3,3,3,3,3,
|
||||
2,1,3,3,3,3,3,3,3,3,
|
||||
2,1,3,3,3,3,3,3,3,3,
|
||||
2,1,3,3,3,3,3,3,3,3,
|
||||
2,1,3,3,3,3,3,3,3,3,
|
||||
2,1,3,3,3,3,3,3,3,3,
|
||||
2,1,3,3,3,3,3,3,3,3,
|
||||
// 100-109, 110-119, ..., 190-199
|
||||
2,1,3,3,3,3,3,3,3,3,
|
||||
2,2,2,2,2,2,2,2,2,2,
|
||||
2,1,3,3,3,3,3,3,3,3,
|
||||
2,1,3,3,3,3,3,3,3,3,
|
||||
2,1,3,3,3,3,3,3,3,3,
|
||||
2,1,3,3,3,3,3,3,3,3,
|
||||
2,1,3,3,3,3,3,3,3,3,
|
||||
2,1,3,3,3,3,3,3,3,3,
|
||||
2,1,3,3,3,3,3,3,3,3,
|
||||
2,1,3,3,3,3,3,3,3,3,
|
||||
// 200-209, 210-219, ..., 290-299
|
||||
2,1,3,3,3,3,3,3,3,3,
|
||||
2,2,2,2,2,2,2,2,2,2,
|
||||
2,1,3,3,3,3,3,3,3,3,
|
||||
2,1,3,3,3,3,3,3,3,3,
|
||||
2,1,3,3,3,3,3,3,3,3,
|
||||
2,1,3,3,3,3,3,3,3,3,
|
||||
2,1,3,3,3,3,3,3,3,3,
|
||||
2,1,3,3,3,3,3,3,3,3,
|
||||
2,1,3,3,3,3,3,3,3,3,
|
||||
2,1,3,3,3,3,3,3,3,3,
|
||||
], [
|
||||
// 7: Russian 0-9, 10-19, ..., 90-99
|
||||
3,1,2,2,2,3,3,3,3,3,
|
||||
3,3,3,3,3,3,3,3,3,3,
|
||||
3,1,2,2,2,3,3,3,3,3,
|
||||
3,1,2,2,2,3,3,3,3,3,
|
||||
3,1,2,2,2,3,3,3,3,3,
|
||||
3,1,2,2,2,3,3,3,3,3,
|
||||
3,1,2,2,2,3,3,3,3,3,
|
||||
3,1,2,2,2,3,3,3,3,3,
|
||||
3,1,2,2,2,3,3,3,3,3,
|
||||
3,1,2,2,2,3,3,3,3,3,
|
||||
// 100-109, 110-119, ..., 190-199
|
||||
3,1,2,2,2,3,3,3,3,3,
|
||||
3,3,3,3,3,3,3,3,3,3,
|
||||
3,1,2,2,2,3,3,3,3,3,
|
||||
3,1,2,2,2,3,3,3,3,3,
|
||||
3,1,2,2,2,3,3,3,3,3,
|
||||
3,1,2,2,2,3,3,3,3,3,
|
||||
3,1,2,2,2,3,3,3,3,3,
|
||||
3,1,2,2,2,3,3,3,3,3,
|
||||
3,1,2,2,2,3,3,3,3,3,
|
||||
3,1,2,2,2,3,3,3,3,3,
|
||||
// 200-209, 210-219, ..., 290-299
|
||||
3,1,2,2,2,3,3,3,3,3,
|
||||
3,3,3,3,3,3,3,3,3,3,
|
||||
3,1,2,2,2,3,3,3,3,3,
|
||||
3,1,2,2,2,3,3,3,3,3,
|
||||
3,1,2,2,2,3,3,3,3,3,
|
||||
3,1,2,2,2,3,3,3,3,3,
|
||||
3,1,2,2,2,3,3,3,3,3,
|
||||
3,1,2,2,2,3,3,3,3,3,
|
||||
3,1,2,2,2,3,3,3,3,3,
|
||||
3,1,2,2,2,3,3,3,3,3,
|
||||
], [
|
||||
// 8: Slovak 0-9, 10-19, ..., 90-99
|
||||
3,1,2,2,2,3,3,3,3,3,
|
||||
3,3,3,3,3,3,3,3,3,3,
|
||||
3,3,3,3,3,3,3,3,3,3,
|
||||
3,3,3,3,3,3,3,3,3,3,
|
||||
3,3,3,3,3,3,3,3,3,3,
|
||||
3,3,3,3,3,3,3,3,3,3,
|
||||
3,3,3,3,3,3,3,3,3,3,
|
||||
3,3,3,3,3,3,3,3,3,3,
|
||||
3,3,3,3,3,3,3,3,3,3,
|
||||
3,3,3,3,3,3,3,3,3,3,
|
||||
// 100-109, 110-119, ..., 190-199
|
||||
3,3,3,3,3,3,3,3,3,3,
|
||||
3,3,3,3,3,3,3,3,3,3,
|
||||
3,3,3,3,3,3,3,3,3,3,
|
||||
3,3,3,3,3,3,3,3,3,3,
|
||||
3,3,3,3,3,3,3,3,3,3,
|
||||
3,3,3,3,3,3,3,3,3,3,
|
||||
3,3,3,3,3,3,3,3,3,3,
|
||||
3,3,3,3,3,3,3,3,3,3,
|
||||
3,3,3,3,3,3,3,3,3,3,
|
||||
3,3,3,3,3,3,3,3,3,3,
|
||||
// 200-209, 210-219, ..., 290-299
|
||||
3,3,3,3,3,3,3,3,3,3,
|
||||
3,3,3,3,3,3,3,3,3,3,
|
||||
3,3,3,3,3,3,3,3,3,3,
|
||||
3,3,3,3,3,3,3,3,3,3,
|
||||
3,3,3,3,3,3,3,3,3,3,
|
||||
3,3,3,3,3,3,3,3,3,3,
|
||||
3,3,3,3,3,3,3,3,3,3,
|
||||
3,3,3,3,3,3,3,3,3,3,
|
||||
3,3,3,3,3,3,3,3,3,3,
|
||||
3,3,3,3,3,3,3,3,3,3,
|
||||
], [
|
||||
// 9: Polish 0-9, 10-19, ..., 90-99
|
||||
3,1,2,2,2,3,3,3,3,3,
|
||||
3,3,3,3,3,3,3,3,3,3,
|
||||
3,3,2,2,2,3,3,3,3,3,
|
||||
3,3,2,2,2,3,3,3,3,3,
|
||||
3,3,2,2,2,3,3,3,3,3,
|
||||
3,3,2,2,2,3,3,3,3,3,
|
||||
3,3,2,2,2,3,3,3,3,3,
|
||||
3,3,2,2,2,3,3,3,3,3,
|
||||
3,3,2,2,2,3,3,3,3,3,
|
||||
3,3,2,2,2,3,3,3,3,3,
|
||||
// 100-109, 110-119, ..., 190-199
|
||||
3,3,2,2,2,3,3,3,3,3,
|
||||
3,3,3,3,3,3,3,3,3,3,
|
||||
3,3,2,2,2,3,3,3,3,3,
|
||||
3,3,2,2,2,3,3,3,3,3,
|
||||
3,3,2,2,2,3,3,3,3,3,
|
||||
3,3,2,2,2,3,3,3,3,3,
|
||||
3,3,2,2,2,3,3,3,3,3,
|
||||
3,3,2,2,2,3,3,3,3,3,
|
||||
3,3,2,2,2,3,3,3,3,3,
|
||||
3,3,2,2,2,3,3,3,3,3,
|
||||
// 200-209, 210-219, ..., 290-299
|
||||
3,3,2,2,2,3,3,3,3,3,
|
||||
3,3,3,3,3,3,3,3,3,3,
|
||||
3,3,2,2,2,3,3,3,3,3,
|
||||
3,3,2,2,2,3,3,3,3,3,
|
||||
3,3,2,2,2,3,3,3,3,3,
|
||||
3,3,2,2,2,3,3,3,3,3,
|
||||
3,3,2,2,2,3,3,3,3,3,
|
||||
3,3,2,2,2,3,3,3,3,3,
|
||||
3,3,2,2,2,3,3,3,3,3,
|
||||
3,3,2,2,2,3,3,3,3,3,
|
||||
], [
|
||||
// 10: Slovenian 0-9, 10-19, ..., 90-99
|
||||
4,1,2,3,3,4,4,4,4,4,
|
||||
4,4,4,4,4,4,4,4,4,4,
|
||||
4,4,4,4,4,4,4,4,4,4,
|
||||
4,4,4,4,4,4,4,4,4,4,
|
||||
4,4,4,4,4,4,4,4,4,4,
|
||||
4,4,4,4,4,4,4,4,4,4,
|
||||
4,4,4,4,4,4,4,4,4,4,
|
||||
4,4,4,4,4,4,4,4,4,4,
|
||||
4,4,4,4,4,4,4,4,4,4,
|
||||
4,4,4,4,4,4,4,4,4,4,
|
||||
// 100-109, 110-119, ..., 190-199
|
||||
4,1,2,3,3,4,4,4,4,4,
|
||||
4,4,4,4,4,4,4,4,4,4,
|
||||
4,4,4,4,4,4,4,4,4,4,
|
||||
4,4,4,4,4,4,4,4,4,4,
|
||||
4,4,4,4,4,4,4,4,4,4,
|
||||
4,4,4,4,4,4,4,4,4,4,
|
||||
4,4,4,4,4,4,4,4,4,4,
|
||||
4,4,4,4,4,4,4,4,4,4,
|
||||
4,4,4,4,4,4,4,4,4,4,
|
||||
4,4,4,4,4,4,4,4,4,4,
|
||||
// 200-209, 210-219, ..., 290-299
|
||||
4,1,2,3,3,4,4,4,4,4,
|
||||
4,4,4,4,4,4,4,4,4,4,
|
||||
4,4,4,4,4,4,4,4,4,4,
|
||||
4,4,4,4,4,4,4,4,4,4,
|
||||
4,4,4,4,4,4,4,4,4,4,
|
||||
4,4,4,4,4,4,4,4,4,4,
|
||||
4,4,4,4,4,4,4,4,4,4,
|
||||
4,4,4,4,4,4,4,4,4,4,
|
||||
4,4,4,4,4,4,4,4,4,4,
|
||||
4,4,4,4,4,4,4,4,4,4,
|
||||
], [
|
||||
// 11: Irish Gaeilge 0-9, 10-19, ..., 90-99
|
||||
5,1,2,3,3,3,3,4,4,4,
|
||||
4,5,5,5,5,5,5,5,5,5,
|
||||
5,5,5,5,5,5,5,5,5,5,
|
||||
5,5,5,5,5,5,5,5,5,5,
|
||||
5,5,5,5,5,5,5,5,5,5,
|
||||
5,5,5,5,5,5,5,5,5,5,
|
||||
5,5,5,5,5,5,5,5,5,5,
|
||||
5,5,5,5,5,5,5,5,5,5,
|
||||
5,5,5,5,5,5,5,5,5,5,
|
||||
5,5,5,5,5,5,5,5,5,5,
|
||||
// 100-109, 110-119, ..., 190-199
|
||||
5,5,5,5,5,5,5,5,5,5,
|
||||
5,5,5,5,5,5,5,5,5,5,
|
||||
5,5,5,5,5,5,5,5,5,5,
|
||||
5,5,5,5,5,5,5,5,5,5,
|
||||
5,5,5,5,5,5,5,5,5,5,
|
||||
5,5,5,5,5,5,5,5,5,5,
|
||||
5,5,5,5,5,5,5,5,5,5,
|
||||
5,5,5,5,5,5,5,5,5,5,
|
||||
5,5,5,5,5,5,5,5,5,5,
|
||||
5,5,5,5,5,5,5,5,5,5,
|
||||
// 200-209, 210-219, ..., 290-299
|
||||
5,5,5,5,5,5,5,5,5,5,
|
||||
5,5,5,5,5,5,5,5,5,5,
|
||||
5,5,5,5,5,5,5,5,5,5,
|
||||
5,5,5,5,5,5,5,5,5,5,
|
||||
5,5,5,5,5,5,5,5,5,5,
|
||||
5,5,5,5,5,5,5,5,5,5,
|
||||
5,5,5,5,5,5,5,5,5,5,
|
||||
5,5,5,5,5,5,5,5,5,5,
|
||||
5,5,5,5,5,5,5,5,5,5,
|
||||
5,5,5,5,5,5,5,5,5,5,
|
||||
], [
|
||||
// 12: Arabic 0-9, 10-19, ..., 90-99
|
||||
6,1,2,3,3,3,3,3,3,3,
|
||||
3,4,4,4,4,4,4,4,4,4,
|
||||
4,4,4,4,4,4,4,4,4,4,
|
||||
4,4,4,4,4,4,4,4,4,4,
|
||||
4,4,4,4,4,4,4,4,4,4,
|
||||
4,4,4,4,4,4,4,4,4,4,
|
||||
4,4,4,4,4,4,4,4,4,4,
|
||||
4,4,4,4,4,4,4,4,4,4,
|
||||
4,4,4,4,4,4,4,4,4,4,
|
||||
4,4,4,4,4,4,4,4,4,4,
|
||||
// 100-109, 110-119, ..., 190-199
|
||||
5,5,5,3,3,3,3,3,3,3,
|
||||
3,4,4,4,4,4,4,4,4,4,
|
||||
4,4,4,4,4,4,4,4,4,4,
|
||||
4,4,4,4,4,4,4,4,4,4,
|
||||
4,4,4,4,4,4,4,4,4,4,
|
||||
4,4,4,4,4,4,4,4,4,4,
|
||||
4,4,4,4,4,4,4,4,4,4,
|
||||
4,4,4,4,4,4,4,4,4,4,
|
||||
4,4,4,4,4,4,4,4,4,4,
|
||||
4,4,4,4,4,4,4,4,4,4,
|
||||
// 200-209, 210-219, ..., 290-299
|
||||
5,5,5,3,3,3,3,3,3,3,
|
||||
3,4,4,4,4,4,4,4,4,4,
|
||||
4,4,4,4,4,4,4,4,4,4,
|
||||
4,4,4,4,4,4,4,4,4,4,
|
||||
4,4,4,4,4,4,4,4,4,4,
|
||||
4,4,4,4,4,4,4,4,4,4,
|
||||
4,4,4,4,4,4,4,4,4,4,
|
||||
4,4,4,4,4,4,4,4,4,4,
|
||||
4,4,4,4,4,4,4,4,4,4,
|
||||
4,4,4,4,4,4,4,4,4,4,
|
||||
], [
|
||||
// 13: Maltese 0-9, 10-19, ..., 90-99
|
||||
2,1,2,2,2,2,2,2,2,2,
|
||||
2,3,3,3,3,3,3,3,3,3,
|
||||
4,4,4,4,4,4,4,4,4,4,
|
||||
4,4,4,4,4,4,4,4,4,4,
|
||||
4,4,4,4,4,4,4,4,4,4,
|
||||
4,4,4,4,4,4,4,4,4,4,
|
||||
4,4,4,4,4,4,4,4,4,4,
|
||||
4,4,4,4,4,4,4,4,4,4,
|
||||
4,4,4,4,4,4,4,4,4,4,
|
||||
4,4,4,4,4,4,4,4,4,4,
|
||||
// 100-109, 110-119, ..., 190-199
|
||||
4,2,2,2,2,2,2,2,2,2,
|
||||
2,3,3,3,3,3,3,3,3,3,
|
||||
4,4,4,4,4,4,4,4,4,4,
|
||||
4,4,4,4,4,4,4,4,4,4,
|
||||
4,4,4,4,4,4,4,4,4,4,
|
||||
4,4,4,4,4,4,4,4,4,4,
|
||||
4,4,4,4,4,4,4,4,4,4,
|
||||
4,4,4,4,4,4,4,4,4,4,
|
||||
4,4,4,4,4,4,4,4,4,4,
|
||||
4,4,4,4,4,4,4,4,4,4,
|
||||
// 200-209, 210-219, ..., 290-299
|
||||
4,2,2,2,2,2,2,2,2,2,
|
||||
2,3,3,3,3,3,3,3,3,3,
|
||||
4,4,4,4,4,4,4,4,4,4,
|
||||
4,4,4,4,4,4,4,4,4,4,
|
||||
4,4,4,4,4,4,4,4,4,4,
|
||||
4,4,4,4,4,4,4,4,4,4,
|
||||
4,4,4,4,4,4,4,4,4,4,
|
||||
4,4,4,4,4,4,4,4,4,4,
|
||||
4,4,4,4,4,4,4,4,4,4,
|
||||
4,4,4,4,4,4,4,4,4,4,
|
||||
], [
|
||||
// 14: Macedonian 0-9, 10-19, ..., 90-99
|
||||
3,1,2,3,3,3,3,3,3,3,
|
||||
3,1,2,3,3,3,3,3,3,3,
|
||||
3,1,2,3,3,3,3,3,3,3,
|
||||
3,1,2,3,3,3,3,3,3,3,
|
||||
3,1,2,3,3,3,3,3,3,3,
|
||||
3,1,2,3,3,3,3,3,3,3,
|
||||
3,1,2,3,3,3,3,3,3,3,
|
||||
3,1,2,3,3,3,3,3,3,3,
|
||||
3,1,2,3,3,3,3,3,3,3,
|
||||
3,1,2,3,3,3,3,3,3,3,
|
||||
// 100-109, 110-119, ..., 190-199
|
||||
3,1,2,3,3,3,3,3,3,3,
|
||||
3,1,2,3,3,3,3,3,3,3,
|
||||
3,1,2,3,3,3,3,3,3,3,
|
||||
3,1,2,3,3,3,3,3,3,3,
|
||||
3,1,2,3,3,3,3,3,3,3,
|
||||
3,1,2,3,3,3,3,3,3,3,
|
||||
3,1,2,3,3,3,3,3,3,3,
|
||||
3,1,2,3,3,3,3,3,3,3,
|
||||
3,1,2,3,3,3,3,3,3,3,
|
||||
3,1,2,3,3,3,3,3,3,3,
|
||||
// 200-209, 210-219, ..., 290-299
|
||||
3,1,2,3,3,3,3,3,3,3,
|
||||
3,1,2,3,3,3,3,3,3,3,
|
||||
3,1,2,3,3,3,3,3,3,3,
|
||||
3,1,2,3,3,3,3,3,3,3,
|
||||
3,1,2,3,3,3,3,3,3,3,
|
||||
3,1,2,3,3,3,3,3,3,3,
|
||||
3,1,2,3,3,3,3,3,3,3,
|
||||
3,1,2,3,3,3,3,3,3,3,
|
||||
3,1,2,3,3,3,3,3,3,3,
|
||||
3,1,2,3,3,3,3,3,3,3,
|
||||
]];
|
||||
|
||||
for (let [rule, expect] in Iterator(allExpect)) {
|
||||
print("\nTesting rule #" + rule);
|
||||
|
||||
let [get, numForms] = PluralForm.makeGetter(rule);
|
||||
|
||||
// Make sure the largest value expected matches the number of plural forms
|
||||
let maxExpect = Math.max.apply(this, expect);
|
||||
do_check_eq(maxExpect, numForms());
|
||||
|
||||
// Make a string of numbers, e.g., 1;2;3;4;5
|
||||
let words = [];
|
||||
for (let i = 1; i <= maxExpect; i++)
|
||||
words.push(i);
|
||||
words = words.join(";");
|
||||
|
||||
// Make sure we get the expected number
|
||||
for (let [index, number] in Iterator(expect)) {
|
||||
print(["Plural form of ", index, " should be ", number, " (", words, ")"].join(""));
|
||||
do_check_eq(get(index, words), number);
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1981,6 +1981,7 @@ TraceRecorder::snapshot(ExitType exitType)
|
|||
: 0;
|
||||
exit->exitType = exitType;
|
||||
exit->addGuard(rec);
|
||||
exit->block = fp->blockChain;
|
||||
exit->ip_adj = ip_adj;
|
||||
exit->sp_adj = (stackSlots * sizeof(double)) - treeInfo->nativeStackBase;
|
||||
exit->rp_adj = exit->calldepth * sizeof(FrameInfo);
|
||||
|
@ -2792,9 +2793,10 @@ js_SynthesizeFrame(JSContext* cx, const FrameInfo& fi)
|
|||
JS_ASSERT(FUN_INTERPRETED(fun));
|
||||
|
||||
/* Assert that we have a correct sp distance from cx->fp->slots in fi. */
|
||||
JS_ASSERT_IF(!FI_IMACRO_PC(fi, cx->fp),
|
||||
js_ReconstructStackDepth(cx, cx->fp->script, FI_SCRIPT_PC(fi, cx->fp))
|
||||
== uintN(fi.s.spdist - cx->fp->script->nfixed));
|
||||
JSStackFrame* fp = cx->fp;
|
||||
JS_ASSERT_IF(!FI_IMACRO_PC(fi, fp),
|
||||
js_ReconstructStackDepth(cx, fp->script, FI_SCRIPT_PC(fi, fp))
|
||||
== uintN(fi.s.spdist - fp->script->nfixed));
|
||||
|
||||
uintN nframeslots = JS_HOWMANY(sizeof(JSInlineFrame), sizeof(jsval));
|
||||
JSScript* script = fun->u.i.script;
|
||||
|
@ -2804,12 +2806,12 @@ js_SynthesizeFrame(JSContext* cx, const FrameInfo& fi)
|
|||
JSArena* a = cx->stackPool.current;
|
||||
void* newmark = (void*) a->avail;
|
||||
uintN argc = fi.s.argc & 0x7fff;
|
||||
jsval* vp = cx->fp->slots + fi.s.spdist - (2 + argc);
|
||||
jsval* vp = fp->slots + fi.s.spdist - (2 + argc);
|
||||
uintN missing = 0;
|
||||
jsval* newsp;
|
||||
|
||||
if (fun->nargs > argc) {
|
||||
const JSFrameRegs& regs = *cx->fp->regs;
|
||||
const JSFrameRegs& regs = *fp->regs;
|
||||
|
||||
newsp = vp + 2 + fun->nargs;
|
||||
JS_ASSERT(newsp > regs.sp);
|
||||
|
@ -2867,11 +2869,20 @@ js_SynthesizeFrame(JSContext* cx, const FrameInfo& fi)
|
|||
bool constructing = fi.s.argc & 0x8000;
|
||||
newifp->frame.argc = argc;
|
||||
|
||||
jsbytecode* imacro_pc = FI_IMACRO_PC(fi, cx->fp);
|
||||
jsbytecode* script_pc = FI_SCRIPT_PC(fi, cx->fp);
|
||||
jsbytecode* imacro_pc = FI_IMACRO_PC(fi, fp);
|
||||
jsbytecode* script_pc = FI_SCRIPT_PC(fi, fp);
|
||||
newifp->callerRegs.pc = imacro_pc ? imacro_pc : script_pc;
|
||||
newifp->callerRegs.sp = cx->fp->slots + fi.s.spdist;
|
||||
cx->fp->imacpc = imacro_pc ? script_pc : NULL;
|
||||
newifp->callerRegs.sp = fp->slots + fi.s.spdist;
|
||||
fp->imacpc = imacro_pc ? script_pc : NULL;
|
||||
|
||||
JS_ASSERT(!(fp->flags & JSFRAME_POP_BLOCKS));
|
||||
#ifdef DEBUG
|
||||
if (fi.block != fp->blockChain) {
|
||||
for (JSObject* obj = fi.block; obj != fp->blockChain; obj = STOBJ_GET_PARENT(obj))
|
||||
JS_ASSERT(obj);
|
||||
}
|
||||
#endif
|
||||
fp->blockChain = fi.block;
|
||||
|
||||
newifp->frame.argv = newifp->callerRegs.sp - argc;
|
||||
JS_ASSERT(newifp->frame.argv);
|
||||
|
@ -2880,10 +2891,10 @@ js_SynthesizeFrame(JSContext* cx, const FrameInfo& fi)
|
|||
// someone forgets to initialize it later.
|
||||
newifp->frame.argv[-1] = JSVAL_HOLE;
|
||||
#endif
|
||||
JS_ASSERT(newifp->frame.argv >= StackBase(cx->fp) + 2);
|
||||
JS_ASSERT(newifp->frame.argv >= StackBase(fp) + 2);
|
||||
|
||||
newifp->frame.rval = JSVAL_VOID;
|
||||
newifp->frame.down = cx->fp;
|
||||
newifp->frame.down = fp;
|
||||
newifp->frame.annotation = NULL;
|
||||
newifp->frame.scopeChain = OBJ_GET_PARENT(cx, fi.callee);
|
||||
newifp->frame.sharpDepth = 0;
|
||||
|
@ -2895,7 +2906,7 @@ js_SynthesizeFrame(JSContext* cx, const FrameInfo& fi)
|
|||
newifp->mark = newmark;
|
||||
newifp->frame.thisp = NULL; // will be set by js_ExecuteTree -> FlushNativeStackFrame
|
||||
|
||||
newifp->frame.regs = cx->fp->regs;
|
||||
newifp->frame.regs = fp->regs;
|
||||
newifp->frame.regs->pc = script->code;
|
||||
newifp->frame.regs->sp = newsp + script->nfixed;
|
||||
newifp->frame.imacpc = NULL;
|
||||
|
@ -2910,13 +2921,14 @@ js_SynthesizeFrame(JSContext* cx, const FrameInfo& fi)
|
|||
#endif
|
||||
|
||||
/*
|
||||
* Note that cx->fp->script is still the caller's script; set the callee
|
||||
* Note that fp->script is still the caller's script; set the callee
|
||||
* inline frame's idea of caller version from its version.
|
||||
*/
|
||||
newifp->callerVersion = (JSVersion) cx->fp->script->version;
|
||||
newifp->callerVersion = (JSVersion) fp->script->version;
|
||||
|
||||
cx->fp->regs = &newifp->callerRegs;
|
||||
cx->fp = &newifp->frame;
|
||||
// After this paragraph, fp and cx->fp point to the newly synthesized frame.
|
||||
fp->regs = &newifp->callerRegs;
|
||||
fp = cx->fp = &newifp->frame;
|
||||
|
||||
if (fun->flags & JSFUN_HEAVYWEIGHT) {
|
||||
/*
|
||||
|
@ -2943,8 +2955,8 @@ js_SynthesizeFrame(JSContext* cx, const FrameInfo& fi)
|
|||
// FIXME? we must count stack slots from caller's operand stack up to (but not including)
|
||||
// callee's, including missing arguments. Could we shift everything down to the caller's
|
||||
// fp->slots (where vars start) and avoid some of the complexity?
|
||||
return (fi.s.spdist - cx->fp->down->script->nfixed) +
|
||||
((fun->nargs > cx->fp->argc) ? fun->nargs - cx->fp->argc : 0) +
|
||||
return (fi.s.spdist - fp->down->script->nfixed) +
|
||||
((fun->nargs > fp->argc) ? fun->nargs - fp->argc : 0) +
|
||||
script->nfixed;
|
||||
}
|
||||
|
||||
|
@ -3669,9 +3681,13 @@ js_ExecuteTree(JSContext* cx, Fragment* f, uintN& inlineCallCount,
|
|||
|
||||
/* Adjust sp and pc relative to the tree we exited from (not the tree we entered into).
|
||||
These are our final values for sp and pc since js_SynthesizeFrame has already taken
|
||||
care of all frames in between. */
|
||||
care of all frames in between. But first we recover fp->blockChain, which comes from
|
||||
the side exit struct. */
|
||||
JSStackFrame* fp = cx->fp;
|
||||
|
||||
JS_ASSERT(!(fp->flags & JSFRAME_POP_BLOCKS));
|
||||
fp->blockChain = innermost->block;
|
||||
|
||||
/* If we are not exiting from an inlined frame the state->sp is spbase, otherwise spbase
|
||||
is whatever slots frames around us consume. */
|
||||
DECODE_IP_ADJ(innermost->ip_adj, fp);
|
||||
|
@ -3679,7 +3695,6 @@ js_ExecuteTree(JSContext* cx, Fragment* f, uintN& inlineCallCount,
|
|||
JS_ASSERT_IF(!fp->imacpc,
|
||||
fp->slots + fp->script->nfixed +
|
||||
js_ReconstructStackDepth(cx, fp->script, fp->regs->pc) == fp->regs->sp);
|
||||
|
||||
|
||||
#if defined(JS_JIT_SPEW) && (defined(NANOJIT_IA32) || (defined(NANOJIT_AMD64) && defined(__GNUC__)))
|
||||
uint64 cycles = rdtsc() - start;
|
||||
|
@ -6591,6 +6606,7 @@ TraceRecorder::interpretedFunctionCall(jsval& fval, JSFunction* fun, uintN argc,
|
|||
|
||||
FrameInfo fi = {
|
||||
JSVAL_TO_OBJECT(fval),
|
||||
fp->blockChain,
|
||||
ENCODE_IP_ADJ(fp, fp->regs->pc),
|
||||
typemap,
|
||||
{ { fp->regs->sp - fp->slots, argc | (constructing ? 0x8000 : 0) } }
|
||||
|
@ -6600,14 +6616,17 @@ TraceRecorder::interpretedFunctionCall(jsval& fval, JSFunction* fun, uintN argc,
|
|||
if (callDepth >= treeInfo->maxCallDepth)
|
||||
treeInfo->maxCallDepth = callDepth + 1;
|
||||
|
||||
lir->insStorei(INS_CONSTPTR(fi.callee), lirbuf->rp,
|
||||
callDepth * sizeof(FrameInfo) + offsetof(FrameInfo, callee));
|
||||
lir->insStorei(INS_CONSTPTR(fi.ip_adj), lirbuf->rp,
|
||||
callDepth * sizeof(FrameInfo) + offsetof(FrameInfo, ip_adj));
|
||||
lir->insStorei(INS_CONSTPTR(fi.typemap), lirbuf->rp,
|
||||
callDepth * sizeof(FrameInfo) + offsetof(FrameInfo, typemap));
|
||||
lir->insStorei(INS_CONST(fi.word), lirbuf->rp,
|
||||
callDepth * sizeof(FrameInfo) + offsetof(FrameInfo, word));
|
||||
#define STORE_AT_RP(name) \
|
||||
lir->insStorei(INS_CONSTPTR(fi.name), lirbuf->rp, \
|
||||
callDepth * sizeof(FrameInfo) + offsetof(FrameInfo, name))
|
||||
|
||||
STORE_AT_RP(callee);
|
||||
STORE_AT_RP(block);
|
||||
STORE_AT_RP(ip_adj);
|
||||
STORE_AT_RP(typemap);
|
||||
STORE_AT_RP(word);
|
||||
|
||||
#undef STORE_AT_RP
|
||||
|
||||
atoms = fun->u.i.script->atomMap.vector;
|
||||
return true;
|
||||
|
|
|
@ -191,6 +191,7 @@ enum ExitType {
|
|||
|
||||
struct VMSideExit : public nanojit::SideExit
|
||||
{
|
||||
JSObject* block;
|
||||
intptr_t ip_adj;
|
||||
intptr_t sp_adj;
|
||||
intptr_t rp_adj;
|
||||
|
@ -248,7 +249,8 @@ public:
|
|||
|
||||
struct FrameInfo {
|
||||
JSObject* callee; // callee function object
|
||||
intptr_t ip_adj; // callee script-based pc index and imacro pc
|
||||
JSObject* block; // caller block chain head
|
||||
intptr_t ip_adj; // caller script-based pc index and imacro pc
|
||||
uint8* typemap; // typemap for the stack frame
|
||||
union {
|
||||
struct {
|
||||
|
|
|
@ -20,6 +20,7 @@
|
|||
#
|
||||
# Contributor(s):
|
||||
# Dave Townsend <dtownsend@oxymoronical.com>
|
||||
# Josh Aas <josh@mozilla.com>
|
||||
#
|
||||
# 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
|
||||
|
@ -50,4 +51,11 @@ XPCSHELL_TESTS = \
|
|||
unit \
|
||||
$(NULL)
|
||||
|
||||
# plugin mochitests only work on UNIX variants, including Mac OS X, at this time
|
||||
ifneq (,$(filter gtk2 cocoa windows,$(MOZ_WIDGET_TOOLKIT)))
|
||||
ifdef ENABLE_TESTS
|
||||
DIRS += mochitest
|
||||
endif
|
||||
endif
|
||||
|
||||
include $(topsrcdir)/config/rules.mk
|
||||
|
|
|
@ -0,0 +1,50 @@
|
|||
#
|
||||
# ***** 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
|
||||
# Mozilla Foundation.
|
||||
# Portions created by the Initial Developer are Copyright (C) 2007
|
||||
# the Initial Developer. All Rights Reserved.
|
||||
#
|
||||
# Contributor(s):
|
||||
#
|
||||
# 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 *****
|
||||
|
||||
DEPTH = ../../../..
|
||||
topsrcdir = @top_srcdir@
|
||||
srcdir = @srcdir@
|
||||
VPATH = @srcdir@
|
||||
relativesrcdir = modules/plugin/test
|
||||
|
||||
include $(DEPTH)/config/autoconf.mk
|
||||
include $(topsrcdir)/config/rules.mk
|
||||
|
||||
_TEST_FILES = test_npruntime.xul
|
||||
|
||||
libs:: $(_TEST_FILES)
|
||||
$(INSTALL) $^ $(DEPTH)/_tests/testing/mochitest/chrome/$(relativesrcdir)
|
|
@ -0,0 +1,29 @@
|
|||
<?xml version="1.0"?>
|
||||
<?xml-stylesheet href="chrome://global/skin" type="text/css"?>
|
||||
<?xml-stylesheet href="chrome://mochikit/content/tests/SimpleTest/test.css"
|
||||
type="text/css"?>
|
||||
<window title="Basic Plugin Tests"
|
||||
xmlns:html="http://www.w3.org/1999/xhtml"
|
||||
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
|
||||
<title>Basic Plugin Tests</title>
|
||||
<script type="application/javascript"
|
||||
src="chrome://mochikit/content/MochiKit/packed.js"></script>
|
||||
<script type="application/javascript"
|
||||
src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js" />
|
||||
<body xmlns="http://www.w3.org/1999/xhtml" onload="runTests()">
|
||||
<embed id="plugin1" type="application/x-test" width="400" height="400"></embed>
|
||||
</body>
|
||||
<script class="testbody" type="application/javascript">
|
||||
<![CDATA[
|
||||
SimpleTest.waitForExplicitFinish();
|
||||
|
||||
function runTests() {
|
||||
var pluginElement = document.getElementById("plugin1");
|
||||
|
||||
ok(pluginElement.identifierToStringTest('foo') == "foo", "identifierToStringTest failed");
|
||||
|
||||
SimpleTest.finish();
|
||||
}
|
||||
]]>
|
||||
</script>
|
||||
</window>
|
|
@ -54,12 +54,25 @@ REQUIRES = \
|
|||
NO_DIST_INSTALL = 1
|
||||
NO_INSTALL = 1
|
||||
|
||||
ifeq ($(OS_ARCH),WINNT)
|
||||
RCFILE = nptest.rc
|
||||
RESFILE = nptest.res
|
||||
CPPSRCS = \
|
||||
nptest.cpp \
|
||||
nptest_utils.cpp \
|
||||
$(NULL)
|
||||
|
||||
ifeq ($(MOZ_WIDGET_TOOLKIT),cocoa)
|
||||
CMMSRCS = nptest_macosx.mm
|
||||
endif
|
||||
|
||||
CPPSRCS = nptest.cpp
|
||||
ifeq ($(MOZ_WIDGET_TOOLKIT),gtk2)
|
||||
CPPSRCS += nptest_gtk2.cpp
|
||||
endif
|
||||
|
||||
ifeq ($(MOZ_WIDGET_TOOLKIT),windows)
|
||||
CPPSRCS += nptest_windows.cpp
|
||||
RCFILE = nptest.rc
|
||||
RESFILE = nptest.res
|
||||
DEFFILE = $(win_srcdir)/nptest.def
|
||||
endif
|
||||
|
||||
include $(topsrcdir)/config/rules.mk
|
||||
|
||||
|
|
|
@ -1,83 +1,524 @@
|
|||
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
|
||||
/* ***** 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 mozilla.org
|
||||
* Portions created by the Initial Developer are Copyright (C) 2008
|
||||
* the Initial Developer. All Rights Reserved.
|
||||
*
|
||||
*
|
||||
* Copyright (c) 2008, Mozilla Corporation
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are met:
|
||||
*
|
||||
* * Redistributions of source code must retain the above copyright notice, this
|
||||
* list of conditions and the following disclaimer.
|
||||
* * Redistributions in binary form must reproduce the above copyright notice,
|
||||
* this list of conditions and the following disclaimer in the documentation
|
||||
* and/or other materials provided with the distribution.
|
||||
* * Neither the name of the Mozilla Corporation nor the names of its
|
||||
* contributors may be used to endorse or promote products derived from this
|
||||
* software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
|
||||
* ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
|
||||
* ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
* Contributor(s):
|
||||
* Dave Townsend <dtownsend@oxymoronical.com>
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the terms of
|
||||
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
* in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
* of those above. If you wish to allow use of your version of this file only
|
||||
* under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
* use your version of this file under the terms of the MPL, indicate your
|
||||
* decision by deleting the provisions above and replace them with the notice
|
||||
* and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
* the provisions above, a recipient may use your version of this file under
|
||||
* the terms of any one of the MPL, the GPL or the LGPL.
|
||||
*
|
||||
* Josh Aas <josh@mozilla.com>
|
||||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
#include "npapi.h"
|
||||
#include "npfunctions.h"
|
||||
#include "nptest.h"
|
||||
#include "nptest_utils.h"
|
||||
#include "nptest_platform.h"
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
#define PLUGIN_NAME "Test Plug-in"
|
||||
#define PLUGIN_DESCRIPTION "Plug-in for testing purposes."
|
||||
#define PLUGIN_VERSION "1.0.0.0"
|
||||
|
||||
//
|
||||
// static data
|
||||
//
|
||||
|
||||
static NPNetscapeFuncs* sBrowserFuncs = NULL;
|
||||
static NPClass sNPClass;
|
||||
|
||||
//
|
||||
// identifiers
|
||||
//
|
||||
|
||||
#define IDENTIFIER_TO_STRING_TEST_METHOD 0
|
||||
#define NUM_METHOD_IDENTIFIERS 1
|
||||
|
||||
static NPIdentifier sPluginMethodIdentifiers[NUM_METHOD_IDENTIFIERS];
|
||||
static const NPUTF8 *sPluginMethodIdentifierNames[NUM_METHOD_IDENTIFIERS] = {
|
||||
"identifierToStringTest",
|
||||
};
|
||||
|
||||
static bool sIdentifiersInitialized = false;
|
||||
|
||||
static void initializeIdentifiers()
|
||||
{
|
||||
if (!sIdentifiersInitialized) {
|
||||
NPN_GetStringIdentifiers(sPluginMethodIdentifierNames, NUM_METHOD_IDENTIFIERS, sPluginMethodIdentifiers);
|
||||
sIdentifiersInitialized = true;
|
||||
}
|
||||
}
|
||||
|
||||
static void clearIdentifiers()
|
||||
{
|
||||
memset(sPluginMethodIdentifierNames, 0, NUM_METHOD_IDENTIFIERS * sizeof(NPIdentifier));
|
||||
sIdentifiersInitialized = false;
|
||||
}
|
||||
|
||||
//
|
||||
// function signatures
|
||||
//
|
||||
|
||||
bool identifierToStringTest(const NPVariant* args, uint32_t argCount, NPVariant* result);
|
||||
|
||||
NPObject* scriptableAllocate(NPP npp, NPClass* aClass);
|
||||
void scriptableDeallocate(NPObject* npobj);
|
||||
void scriptableInvalidate(NPObject* npobj);
|
||||
bool scriptableHasMethod(NPObject* npobj, NPIdentifier name);
|
||||
bool scriptableInvoke(NPObject* npobj, NPIdentifier name, const NPVariant* args, uint32_t argCount, NPVariant* result);
|
||||
bool scriptableInvokeDefault(NPObject* npobj, const NPVariant* args, uint32_t argCount, NPVariant* result);
|
||||
bool scriptableHasProperty(NPObject* npobj, NPIdentifier name);
|
||||
bool scriptableGetProperty(NPObject* npobj, NPIdentifier name, NPVariant* result);
|
||||
bool scriptableSetProperty(NPObject* npobj, NPIdentifier name, const NPVariant* value);
|
||||
bool scriptableRemoveProperty(NPObject* npobj, NPIdentifier name);
|
||||
bool scriptableEnumerate(NPObject* npobj, NPIdentifier** identifier, uint32_t* count);
|
||||
bool scriptableConstruct(NPObject* npobj, const NPVariant* args, uint32_t argCount, NPVariant* result);
|
||||
|
||||
//
|
||||
// npapi plugin functions
|
||||
//
|
||||
|
||||
#ifdef XP_UNIX
|
||||
NP_EXPORT(char*)
|
||||
NP_GetPluginVersion()
|
||||
{
|
||||
return PLUGIN_VERSION;
|
||||
}
|
||||
#endif
|
||||
|
||||
#if defined(XP_UNIX)
|
||||
|
||||
#define PLUGIN_NAME "Test Plug-in"
|
||||
#define PLUGIN_DESCRIPTION "Plug-in for testing purposes."
|
||||
#define PLUGIN_VERSION "1.0.0.0"
|
||||
|
||||
NP_EXPORT(char*)
|
||||
NP_GetPluginVersion(void) {
|
||||
return PLUGIN_VERSION;
|
||||
}
|
||||
|
||||
NP_EXPORT(char*)
|
||||
NP_GetMIMEDescription(void) {
|
||||
return "application/x-test:tst:Test mimetype";
|
||||
}
|
||||
|
||||
NP_EXPORT(NPError)
|
||||
NP_Initialize(NPNetscapeFuncs*, NPPluginFuncs*) {
|
||||
return NPERR_NO_ERROR;
|
||||
}
|
||||
|
||||
NP_EXPORT(NPError)
|
||||
NP_Shutdown(void) {
|
||||
return NPERR_NO_ERROR;
|
||||
}
|
||||
|
||||
NP_EXPORT(NPError)
|
||||
NP_GetValue(void *future, NPPVariable aVariable, void *aValue) {
|
||||
switch (aVariable) {
|
||||
case NPPVpluginNameString:
|
||||
*((char **)aValue) = PLUGIN_NAME;
|
||||
break;
|
||||
case NPPVpluginDescriptionString:
|
||||
*((char **)aValue) = PLUGIN_DESCRIPTION;
|
||||
break;
|
||||
default:
|
||||
return NPERR_INVALID_PARAM;
|
||||
break;
|
||||
}
|
||||
return NPERR_NO_ERROR;
|
||||
}
|
||||
|
||||
NP_EXPORT(char*) NP_GetMIMEDescription()
|
||||
#elif defined(XP_WIN)
|
||||
char* NP_GetMIMEDescription()
|
||||
#endif
|
||||
{
|
||||
return "application/x-test:tst:Test mimetype";
|
||||
}
|
||||
|
||||
#ifdef XP_UNIX
|
||||
NP_EXPORT(NPError)
|
||||
NP_GetValue(void* future, NPPVariable aVariable, void* aValue) {
|
||||
switch (aVariable) {
|
||||
case NPPVpluginNameString:
|
||||
*((char**)aValue) = PLUGIN_NAME;
|
||||
break;
|
||||
case NPPVpluginDescriptionString:
|
||||
*((char**)aValue) = PLUGIN_DESCRIPTION;
|
||||
break;
|
||||
default:
|
||||
return NPERR_INVALID_PARAM;
|
||||
break;
|
||||
}
|
||||
return NPERR_NO_ERROR;
|
||||
}
|
||||
#endif
|
||||
|
||||
static void fillPluginFunctionTable(NPPluginFuncs* pFuncs)
|
||||
{
|
||||
pFuncs->version = 11;
|
||||
pFuncs->size = sizeof(*pFuncs);
|
||||
pFuncs->newp = NPP_New;
|
||||
pFuncs->destroy = NPP_Destroy;
|
||||
pFuncs->setwindow = NPP_SetWindow;
|
||||
pFuncs->newstream = NPP_NewStream;
|
||||
pFuncs->destroystream = NPP_DestroyStream;
|
||||
pFuncs->asfile = NPP_StreamAsFile;
|
||||
pFuncs->writeready = NPP_WriteReady;
|
||||
pFuncs->write = NPP_Write;
|
||||
pFuncs->print = NPP_Print;
|
||||
pFuncs->event = NPP_HandleEvent;
|
||||
pFuncs->urlnotify = NPP_URLNotify;
|
||||
pFuncs->getvalue = NPP_GetValue;
|
||||
pFuncs->setvalue = NPP_SetValue;
|
||||
}
|
||||
|
||||
#if defined(XP_MACOSX)
|
||||
NP_EXPORT(NPError) NP_Initialize(NPNetscapeFuncs* bFuncs)
|
||||
#elif defined(XP_WIN)
|
||||
NPError OSCALL NP_Initialize(NPNetscapeFuncs* bFuncs)
|
||||
#elif defined(XP_UNIX)
|
||||
NP_EXPORT(NPError) NP_Initialize(NPNetscapeFuncs* bFuncs, NPPluginFuncs* pFuncs)
|
||||
#endif
|
||||
{
|
||||
sBrowserFuncs = bFuncs;
|
||||
|
||||
initializeIdentifiers();
|
||||
|
||||
memset(&sNPClass, 0, sizeof(NPClass));
|
||||
sNPClass.structVersion = NP_CLASS_STRUCT_VERSION;
|
||||
sNPClass.allocate = (NPAllocateFunctionPtr)scriptableAllocate;
|
||||
sNPClass.deallocate = (NPDeallocateFunctionPtr)scriptableDeallocate;
|
||||
sNPClass.invalidate = (NPInvalidateFunctionPtr)scriptableInvalidate;
|
||||
sNPClass.hasMethod = (NPHasMethodFunctionPtr)scriptableHasMethod;
|
||||
sNPClass.invoke = (NPInvokeFunctionPtr)scriptableInvoke;
|
||||
sNPClass.invokeDefault = (NPInvokeDefaultFunctionPtr)scriptableInvokeDefault;
|
||||
sNPClass.hasProperty = (NPHasPropertyFunctionPtr)scriptableHasProperty;
|
||||
sNPClass.getProperty = (NPGetPropertyFunctionPtr)scriptableGetProperty;
|
||||
sNPClass.setProperty = (NPSetPropertyFunctionPtr)scriptableSetProperty;
|
||||
sNPClass.removeProperty = (NPRemovePropertyFunctionPtr)scriptableRemoveProperty;
|
||||
sNPClass.enumerate = (NPEnumerationFunctionPtr)scriptableEnumerate;
|
||||
sNPClass.construct = (NPConstructFunctionPtr)scriptableConstruct;
|
||||
|
||||
#if defined(XP_UNIX) && !defined(XP_MACOSX)
|
||||
fillPluginFunctionTable(pFuncs);
|
||||
#endif
|
||||
|
||||
return NPERR_NO_ERROR;
|
||||
}
|
||||
|
||||
#if defined(XP_MACOSX)
|
||||
NP_EXPORT(NPError) NP_GetEntryPoints(NPPluginFuncs* pFuncs)
|
||||
#elif defined(XP_WIN)
|
||||
NPError OSCALL NP_GetEntryPoints(NPPluginFuncs* pFuncs)
|
||||
#endif
|
||||
#if defined(XP_MACOSX) || defined(XP_WIN)
|
||||
{
|
||||
fillPluginFunctionTable(pFuncs);
|
||||
return NPERR_NO_ERROR;
|
||||
}
|
||||
#endif
|
||||
|
||||
#if defined(XP_UNIX)
|
||||
NP_EXPORT(NPError) NP_Shutdown()
|
||||
#elif defined(XP_WIN)
|
||||
NPError OSCALL NP_Shutdown()
|
||||
#endif
|
||||
{
|
||||
clearIdentifiers();
|
||||
|
||||
return NPERR_NO_ERROR;
|
||||
}
|
||||
|
||||
NPError
|
||||
NPP_New(NPMIMEType pluginType, NPP instance, uint16_t mode, int16_t argc, char* argn[], char* argv[], NPSavedData* saved)
|
||||
{
|
||||
NPN_SetValue(instance, NPPVpluginWindowBool, NULL);
|
||||
|
||||
// set up our our instance data
|
||||
InstanceData* instanceData = (InstanceData*)malloc(sizeof(InstanceData));
|
||||
if (!instanceData)
|
||||
return NPERR_OUT_OF_MEMORY_ERROR;
|
||||
memset(instanceData, 0, sizeof(InstanceData));
|
||||
instanceData->npp = instance;
|
||||
instance->pdata = instanceData;
|
||||
|
||||
TestNPObject* scriptableObject = (TestNPObject*)NPN_CreateObject(instance, &sNPClass);
|
||||
if (!scriptableObject) {
|
||||
printf("NPN_CreateObject failed to create an object, can't create a plugin instance\n");
|
||||
return NPERR_GENERIC_ERROR;
|
||||
}
|
||||
NPN_RetainObject(scriptableObject);
|
||||
scriptableObject->npp = instance;
|
||||
instanceData->scriptableObject = scriptableObject;
|
||||
|
||||
// do platform-specific initialization
|
||||
NPError err = pluginInstanceInit(instanceData);
|
||||
if (err != NPERR_NO_ERROR)
|
||||
return err;
|
||||
|
||||
return NPERR_NO_ERROR;
|
||||
}
|
||||
|
||||
NPError
|
||||
NPP_Destroy(NPP instance, NPSavedData** save)
|
||||
{
|
||||
InstanceData* instanceData = (InstanceData*)(instance->pdata);
|
||||
NPN_ReleaseObject(instanceData->scriptableObject);
|
||||
free(instanceData);
|
||||
return NPERR_NO_ERROR;
|
||||
}
|
||||
|
||||
NPError
|
||||
NPP_SetWindow(NPP instance, NPWindow* window)
|
||||
{
|
||||
InstanceData* instanceData = (InstanceData*)(instance->pdata);
|
||||
instanceData->window = *window;
|
||||
return NPERR_NO_ERROR;
|
||||
}
|
||||
|
||||
NPError
|
||||
NPP_NewStream(NPP instance, NPMIMEType type, NPStream* stream, NPBool seekable, uint16_t* stype)
|
||||
{
|
||||
*stype = NP_ASFILEONLY;
|
||||
return NPERR_NO_ERROR;
|
||||
}
|
||||
|
||||
NPError
|
||||
NPP_DestroyStream(NPP instance, NPStream* stream, NPReason reason)
|
||||
{
|
||||
return NPERR_NO_ERROR;
|
||||
}
|
||||
|
||||
int32_t
|
||||
NPP_WriteReady(NPP instance, NPStream* stream)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
int32_t
|
||||
NPP_Write(NPP instance, NPStream* stream, int32_t offset, int32_t len, void* buffer)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
void
|
||||
NPP_StreamAsFile(NPP instance, NPStream* stream, const char* fname)
|
||||
{
|
||||
}
|
||||
|
||||
void
|
||||
NPP_Print(NPP instance, NPPrint* platformPrint)
|
||||
{
|
||||
}
|
||||
|
||||
int16_t
|
||||
NPP_HandleEvent(NPP instance, void* event)
|
||||
{
|
||||
InstanceData* instanceData = (InstanceData*)(instance->pdata);
|
||||
return pluginHandleEvent(instanceData, event);
|
||||
}
|
||||
|
||||
void
|
||||
NPP_URLNotify(NPP instance, const char* url, NPReason reason, void* notifyData)
|
||||
{
|
||||
}
|
||||
|
||||
NPError
|
||||
NPP_GetValue(NPP instance, NPPVariable variable, void* value)
|
||||
{
|
||||
if (variable == NPPVpluginScriptableNPObject) {
|
||||
NPObject* object = ((InstanceData*)instance->pdata)->scriptableObject;
|
||||
NPN_RetainObject(object);
|
||||
*((NPObject**)value) = object;
|
||||
return NPERR_NO_ERROR;
|
||||
}
|
||||
|
||||
return NPERR_GENERIC_ERROR;
|
||||
}
|
||||
|
||||
NPError
|
||||
NPP_SetValue(NPP instance, NPNVariable variable, void* value)
|
||||
{
|
||||
return NPERR_GENERIC_ERROR;
|
||||
}
|
||||
|
||||
//
|
||||
// npapi browser functions
|
||||
//
|
||||
|
||||
bool
|
||||
NPN_SetProperty(NPP instance, NPObject* obj, NPIdentifier propertyName, const NPVariant* value)
|
||||
{
|
||||
return sBrowserFuncs->setproperty(instance, obj, propertyName, value);
|
||||
}
|
||||
|
||||
NPIdentifier
|
||||
NPN_GetIntIdentifier(int32_t intid)
|
||||
{
|
||||
return sBrowserFuncs->getintidentifier(intid);
|
||||
}
|
||||
|
||||
NPIdentifier
|
||||
NPN_GetStringIdentifier(const NPUTF8* name)
|
||||
{
|
||||
return sBrowserFuncs->getstringidentifier(name);
|
||||
}
|
||||
|
||||
void
|
||||
NPN_GetStringIdentifiers(const NPUTF8 **names, int32_t nameCount, NPIdentifier *identifiers)
|
||||
{
|
||||
return sBrowserFuncs->getstringidentifiers(names, nameCount, identifiers);
|
||||
}
|
||||
|
||||
NPUTF8*
|
||||
NPN_UTF8FromIdentifier(NPIdentifier identifier)
|
||||
{
|
||||
return sBrowserFuncs->utf8fromidentifier(identifier);
|
||||
}
|
||||
|
||||
int32_t
|
||||
NPN_IntFromIdentifier(NPIdentifier identifier)
|
||||
{
|
||||
return sBrowserFuncs->intfromidentifier(identifier);
|
||||
}
|
||||
|
||||
NPError
|
||||
NPN_GetValue(NPP instance, NPNVariable variable, void* value)
|
||||
{
|
||||
return sBrowserFuncs->getvalue(instance, variable, value);
|
||||
}
|
||||
|
||||
NPError
|
||||
NPN_SetValue(NPP instance, NPPVariable variable, void* value)
|
||||
{
|
||||
return sBrowserFuncs->setvalue(instance, variable, value);
|
||||
}
|
||||
|
||||
bool
|
||||
NPN_HasProperty(NPP instance, NPObject* obj, NPIdentifier propertyName)
|
||||
{
|
||||
return sBrowserFuncs->hasproperty(instance, obj, propertyName);
|
||||
}
|
||||
|
||||
NPObject*
|
||||
NPN_CreateObject(NPP instance, NPClass* aClass)
|
||||
{
|
||||
return sBrowserFuncs->createobject(instance, aClass);
|
||||
}
|
||||
|
||||
const char*
|
||||
NPN_UserAgent(NPP instance)
|
||||
{
|
||||
return sBrowserFuncs->uagent(instance);
|
||||
}
|
||||
|
||||
NPObject*
|
||||
NPN_RetainObject(NPObject* obj)
|
||||
{
|
||||
return sBrowserFuncs->retainobject(obj);
|
||||
}
|
||||
|
||||
void
|
||||
NPN_ReleaseObject(NPObject* obj)
|
||||
{
|
||||
return sBrowserFuncs->releaseobject(obj);
|
||||
}
|
||||
|
||||
void*
|
||||
NPN_MemAlloc(uint32_t size)
|
||||
{
|
||||
return sBrowserFuncs->memalloc(size);
|
||||
}
|
||||
|
||||
void
|
||||
NPN_MemFree(void* ptr)
|
||||
{
|
||||
return sBrowserFuncs->memfree(ptr);
|
||||
}
|
||||
|
||||
//
|
||||
// npruntime object functions
|
||||
//
|
||||
|
||||
NPObject*
|
||||
scriptableAllocate(NPP npp, NPClass* aClass)
|
||||
{
|
||||
TestNPObject* object = (TestNPObject*)NPN_MemAlloc(sizeof(TestNPObject));
|
||||
if (!object)
|
||||
return NULL;
|
||||
memset(object, 0, sizeof(TestNPObject));
|
||||
return object;
|
||||
}
|
||||
|
||||
void
|
||||
scriptableDeallocate(NPObject* npobj)
|
||||
{
|
||||
NPN_MemFree(npobj);
|
||||
}
|
||||
|
||||
void
|
||||
scriptableInvalidate(NPObject* npobj)
|
||||
{
|
||||
}
|
||||
|
||||
bool
|
||||
scriptableHasMethod(NPObject* npobj, NPIdentifier name)
|
||||
{
|
||||
for (int i = 0; i < NUM_METHOD_IDENTIFIERS; i++) {
|
||||
if (name == sPluginMethodIdentifiers[i])
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
bool
|
||||
scriptableInvoke(NPObject* npobj, NPIdentifier name, const NPVariant* args, uint32_t argCount, NPVariant* result)
|
||||
{
|
||||
if (name == sPluginMethodIdentifiers[IDENTIFIER_TO_STRING_TEST_METHOD])
|
||||
return identifierToStringTest(args, argCount, result);
|
||||
return false;
|
||||
}
|
||||
|
||||
bool
|
||||
scriptableInvokeDefault(NPObject* npobj, const NPVariant* args, uint32_t argCount, NPVariant* result)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
bool
|
||||
scriptableHasProperty(NPObject* npobj, NPIdentifier name)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
bool
|
||||
scriptableGetProperty(NPObject* npobj, NPIdentifier name, NPVariant* result)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
bool
|
||||
scriptableSetProperty(NPObject* npobj, NPIdentifier name, const NPVariant* value)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
bool
|
||||
scriptableRemoveProperty(NPObject* npobj, NPIdentifier name)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
bool
|
||||
scriptableEnumerate(NPObject* npobj, NPIdentifier** identifier, uint32_t* count)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
bool
|
||||
scriptableConstruct(NPObject* npobj, const NPVariant* args, uint32_t argCount, NPVariant* result)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
//
|
||||
// test functions
|
||||
//
|
||||
|
||||
bool
|
||||
identifierToStringTest(const NPVariant* args, uint32_t argCount, NPVariant* result)
|
||||
{
|
||||
if (argCount != 1)
|
||||
return false;
|
||||
NPIdentifier identifier = variantToIdentifier(args[0]);
|
||||
if (!identifier)
|
||||
return false;
|
||||
NPUTF8* utf8String = NPN_UTF8FromIdentifier(identifier);
|
||||
if (!utf8String)
|
||||
return false;
|
||||
STRINGZ_TO_NPVARIANT(utf8String, *result);
|
||||
return true;
|
||||
}
|
||||
|
|
|
@ -0,0 +1,7 @@
|
|||
LIBRARY NPTEST
|
||||
|
||||
EXPORTS
|
||||
NP_GetEntryPoints @1
|
||||
NP_Initialize @2
|
||||
NP_Shutdown @3
|
||||
NP_GetMIMEDescription @4
|
|
@ -0,0 +1,53 @@
|
|||
/* ***** BEGIN LICENSE BLOCK *****
|
||||
*
|
||||
* Copyright (c) 2008, Mozilla Corporation
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are met:
|
||||
*
|
||||
* * Redistributions of source code must retain the above copyright notice, this
|
||||
* list of conditions and the following disclaimer.
|
||||
* * Redistributions in binary form must reproduce the above copyright notice,
|
||||
* this list of conditions and the following disclaimer in the documentation
|
||||
* and/or other materials provided with the distribution.
|
||||
* * Neither the name of the Mozilla Corporation nor the names of its
|
||||
* contributors may be used to endorse or promote products derived from this
|
||||
* software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
|
||||
* ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
|
||||
* ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
* Contributor(s):
|
||||
* Josh Aas <josh@mozilla.com>
|
||||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
#ifndef nptest_h_
|
||||
#define nptest_h_
|
||||
|
||||
#include "mozilla-config.h"
|
||||
|
||||
#include "npapi.h"
|
||||
#include "npfunctions.h"
|
||||
#include "npruntime.h"
|
||||
|
||||
typedef struct TestNPObject : NPObject {
|
||||
NPP npp;
|
||||
} TestNPObject;
|
||||
|
||||
typedef struct InstanceData {
|
||||
NPP npp;
|
||||
NPWindow window;
|
||||
TestNPObject* scriptableObject;
|
||||
} InstanceData;
|
||||
|
||||
#endif // nptest_h_
|
|
@ -0,0 +1,51 @@
|
|||
/* ***** BEGIN LICENSE BLOCK *****
|
||||
*
|
||||
* Copyright (c) 2008, Mozilla Corporation
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are met:
|
||||
*
|
||||
* * Redistributions of source code must retain the above copyright notice, this
|
||||
* list of conditions and the following disclaimer.
|
||||
* * Redistributions in binary form must reproduce the above copyright notice,
|
||||
* this list of conditions and the following disclaimer in the documentation
|
||||
* and/or other materials provided with the distribution.
|
||||
* * Neither the name of the Mozilla Corporation nor the names of its
|
||||
* contributors may be used to endorse or promote products derived from this
|
||||
* software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
|
||||
* ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
|
||||
* ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
* Contributor(s):
|
||||
* Josh Aas <josh@mozilla.com>
|
||||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
#include "nptest_platform.h"
|
||||
|
||||
NPError
|
||||
pluginInstanceInit(InstanceData* instanceData)
|
||||
{
|
||||
return NPERR_NO_ERROR;
|
||||
}
|
||||
|
||||
int16_t
|
||||
pluginHandleEvent(InstanceData* instanceData, void* event)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
void
|
||||
pluginDraw(InstanceData* instanceData)
|
||||
{
|
||||
}
|
|
@ -0,0 +1,167 @@
|
|||
/* ***** BEGIN LICENSE BLOCK *****
|
||||
*
|
||||
* Copyright (c) 2008, Mozilla Corporation
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are met:
|
||||
*
|
||||
* * Redistributions of source code must retain the above copyright notice, this
|
||||
* list of conditions and the following disclaimer.
|
||||
* * Redistributions in binary form must reproduce the above copyright notice,
|
||||
* this list of conditions and the following disclaimer in the documentation
|
||||
* and/or other materials provided with the distribution.
|
||||
* * Neither the name of the Mozilla Corporation nor the names of its
|
||||
* contributors may be used to endorse or promote products derived from this
|
||||
* software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
|
||||
* ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
|
||||
* ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
* Contributor(s):
|
||||
* Josh Aas <josh@mozilla.com>
|
||||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
#include "nptest_platform.h"
|
||||
#include <CoreServices/CoreServices.h>
|
||||
|
||||
NPError
|
||||
pluginInstanceInit(InstanceData* instanceData)
|
||||
{
|
||||
NPP npp = instanceData->npp;
|
||||
// select the right drawing model if necessary
|
||||
NPBool supportsCoreGraphics = false;
|
||||
if (NPN_GetValue(npp, NPNVsupportsCoreGraphicsBool, &supportsCoreGraphics) == NPERR_NO_ERROR && supportsCoreGraphics) {
|
||||
NPN_SetValue(npp, NPPVpluginDrawingModel, (void*)NPDrawingModelCoreGraphics);
|
||||
} else {
|
||||
printf("CoreGraphics drawing model not supported, can't create a plugin instance.\n");
|
||||
return NPERR_INCOMPATIBLE_VERSION_ERROR;
|
||||
}
|
||||
return NPERR_NO_ERROR;
|
||||
}
|
||||
|
||||
int16_t
|
||||
pluginHandleEvent(InstanceData* instanceData, void* event)
|
||||
{
|
||||
EventRecord* carbonEvent = (EventRecord*)event;
|
||||
if (carbonEvent && (carbonEvent->what == updateEvt)) {
|
||||
pluginDraw(instanceData);
|
||||
return 1;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
void
|
||||
pluginDraw(InstanceData* instanceData)
|
||||
{
|
||||
if (!instanceData)
|
||||
return;
|
||||
|
||||
NPP npp = instanceData->npp;
|
||||
if (!npp)
|
||||
return;
|
||||
|
||||
const char* uaString = NPN_UserAgent(npp);
|
||||
if (!uaString)
|
||||
return;
|
||||
|
||||
NPWindow window = instanceData->window;
|
||||
|
||||
CGContextRef cgContext = ((NP_CGContext*)(window.window))->context;
|
||||
|
||||
CFStringRef uaCFString = CFStringCreateWithCString(kCFAllocatorDefault, uaString, kCFStringEncodingASCII);
|
||||
|
||||
float windowWidth = window.width;
|
||||
float windowHeight = window.height;
|
||||
|
||||
// save the cgcontext gstate
|
||||
CGContextSaveGState(cgContext);
|
||||
|
||||
// we get a flipped context
|
||||
CGContextTranslateCTM(cgContext, 0.0, windowHeight);
|
||||
CGContextScaleCTM(cgContext, 1.0, -1.0);
|
||||
|
||||
// draw a gray background for the plugin
|
||||
CGContextAddRect(cgContext, CGRectMake(0, 0, windowWidth, windowHeight));
|
||||
CGContextSetGrayFillColor(cgContext, 0.5, 1.0);
|
||||
CGContextDrawPath(cgContext, kCGPathFill);
|
||||
|
||||
// draw a black frame around the plugin
|
||||
CGContextAddRect(cgContext, CGRectMake(0, 0, windowWidth, windowHeight));
|
||||
CGContextSetGrayStrokeColor(cgContext, 0.0, 1.0);
|
||||
CGContextSetLineWidth(cgContext, 6.0);
|
||||
CGContextStrokePath(cgContext);
|
||||
|
||||
// draw the UA string using ATSUI
|
||||
CGContextSetGrayFillColor(cgContext, 0.0, 1.0);
|
||||
ATSUStyle atsuStyle;
|
||||
ATSUCreateStyle(&atsuStyle);
|
||||
CFIndex stringLength = CFStringGetLength(uaCFString);
|
||||
UniChar* unicharBuffer = (UniChar*)malloc((stringLength + 1) * sizeof(UniChar));
|
||||
CFStringGetCharacters(uaCFString, CFRangeMake(0, stringLength), unicharBuffer);
|
||||
UniCharCount runLengths = kATSUToTextEnd;
|
||||
ATSUTextLayout atsuLayout;
|
||||
ATSUCreateTextLayoutWithTextPtr(unicharBuffer,
|
||||
kATSUFromTextBeginning,
|
||||
kATSUToTextEnd,
|
||||
stringLength,
|
||||
1,
|
||||
&runLengths,
|
||||
&atsuStyle,
|
||||
&atsuLayout);
|
||||
ATSUAttributeTag contextTag = kATSUCGContextTag;
|
||||
ByteCount byteSize = sizeof(CGContextRef);
|
||||
ATSUAttributeValuePtr contextATSUPtr = &cgContext;
|
||||
ATSUSetLayoutControls(atsuLayout, 1, &contextTag, &byteSize, &contextATSUPtr);
|
||||
ATSUTextMeasurement lineAscent, lineDescent;
|
||||
ATSUGetLineControl(atsuLayout,
|
||||
kATSUFromTextBeginning,
|
||||
kATSULineAscentTag,
|
||||
sizeof(ATSUTextMeasurement),
|
||||
&lineAscent,
|
||||
&byteSize);
|
||||
ATSUGetLineControl(atsuLayout,
|
||||
kATSUFromTextBeginning,
|
||||
kATSULineDescentTag,
|
||||
sizeof(ATSUTextMeasurement),
|
||||
&lineDescent,
|
||||
&byteSize);
|
||||
float lineHeight = FixedToFloat(lineAscent) + FixedToFloat(lineDescent);
|
||||
ItemCount softBreakCount;
|
||||
ATSUBatchBreakLines(atsuLayout,
|
||||
kATSUFromTextBeginning,
|
||||
stringLength,
|
||||
FloatToFixed(windowWidth - 10.0),
|
||||
&softBreakCount);
|
||||
ATSUGetSoftLineBreaks(atsuLayout,
|
||||
kATSUFromTextBeginning,
|
||||
kATSUToTextEnd,
|
||||
0, NULL, &softBreakCount);
|
||||
UniCharArrayOffset* softBreaks = (UniCharArrayOffset*)malloc(softBreakCount * sizeof(UniCharArrayOffset));
|
||||
ATSUGetSoftLineBreaks(atsuLayout,
|
||||
kATSUFromTextBeginning,
|
||||
kATSUToTextEnd,
|
||||
softBreakCount, softBreaks, &softBreakCount);
|
||||
UniCharArrayOffset currentDrawOffset = kATSUFromTextBeginning;
|
||||
unsigned int i = 0;
|
||||
while (i < softBreakCount) {
|
||||
ATSUDrawText(atsuLayout, currentDrawOffset, softBreaks[i], FloatToFixed(5.0), FloatToFixed(windowHeight - 5.0 - (lineHeight * (i + 1.0))));
|
||||
currentDrawOffset = softBreaks[i];
|
||||
i++;
|
||||
}
|
||||
ATSUDrawText(atsuLayout, currentDrawOffset, kATSUToTextEnd, FloatToFixed(5.0), FloatToFixed(windowHeight - 5.0 - (lineHeight * (i + 1.0))));
|
||||
free(unicharBuffer);
|
||||
free(softBreaks);
|
||||
|
||||
// restore the cgcontext gstate
|
||||
CGContextRestoreGState(cgContext);
|
||||
}
|
|
@ -0,0 +1,44 @@
|
|||
/* ***** BEGIN LICENSE BLOCK *****
|
||||
*
|
||||
* Copyright (c) 2008, Mozilla Corporation
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are met:
|
||||
*
|
||||
* * Redistributions of source code must retain the above copyright notice, this
|
||||
* list of conditions and the following disclaimer.
|
||||
* * Redistributions in binary form must reproduce the above copyright notice,
|
||||
* this list of conditions and the following disclaimer in the documentation
|
||||
* and/or other materials provided with the distribution.
|
||||
* * Neither the name of the Mozilla Corporation nor the names of its
|
||||
* contributors may be used to endorse or promote products derived from this
|
||||
* software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
|
||||
* ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
|
||||
* ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
* Contributor(s):
|
||||
* Josh Aas <josh@mozilla.com>
|
||||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
#ifndef nptest_platform_h_
|
||||
#define nptest_platform_h_
|
||||
|
||||
#include "nptest.h"
|
||||
|
||||
NPError pluginInstanceInit(InstanceData* instanceData);
|
||||
int16_t pluginHandleEvent(InstanceData* instanceData, void* event);
|
||||
// draws a gray box with a black border containing the browser UA string
|
||||
void pluginDraw(InstanceData* instanceData);
|
||||
|
||||
#endif // nptest_platform_h_
|
|
@ -0,0 +1,83 @@
|
|||
/* ***** BEGIN LICENSE BLOCK *****
|
||||
*
|
||||
* Copyright (C) 2006, 2007, 2008 Apple Inc. All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
|
||||
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR
|
||||
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
||||
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
||||
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
|
||||
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
|
||||
* OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
* Contributor(s):
|
||||
* Josh Aas <josh@mozilla.com>
|
||||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
#include "nptest_utils.h"
|
||||
|
||||
#include <string.h>
|
||||
|
||||
NPUTF8*
|
||||
createCStringFromNPVariant(const NPVariant* variant)
|
||||
{
|
||||
size_t length = NPVARIANT_TO_STRING(*variant).UTF8Length;
|
||||
NPUTF8* result = (NPUTF8*)malloc(length + 1);
|
||||
memcpy(result, NPVARIANT_TO_STRING(*variant).UTF8Characters, length);
|
||||
result[length] = '\0';
|
||||
return result;
|
||||
}
|
||||
|
||||
NPIdentifier
|
||||
variantToIdentifier(NPVariant variant)
|
||||
{
|
||||
if (NPVARIANT_IS_STRING(variant))
|
||||
return stringVariantToIdentifier(variant);
|
||||
else if (NPVARIANT_IS_INT32(variant))
|
||||
return int32VariantToIdentifier(variant);
|
||||
else if (NPVARIANT_IS_DOUBLE(variant))
|
||||
return doubleVariantToIdentifier(variant);
|
||||
return 0;
|
||||
}
|
||||
|
||||
NPIdentifier
|
||||
stringVariantToIdentifier(NPVariant variant)
|
||||
{
|
||||
assert(NPVARIANT_IS_STRING(variant));
|
||||
NPUTF8* utf8String = createCStringFromNPVariant(&variant);
|
||||
NPIdentifier identifier = NPN_GetStringIdentifier(utf8String);
|
||||
free(utf8String);
|
||||
return identifier;
|
||||
}
|
||||
|
||||
NPIdentifier
|
||||
int32VariantToIdentifier(NPVariant variant)
|
||||
{
|
||||
assert(NPVARIANT_IS_INT32(variant));
|
||||
int32 integer = NPVARIANT_TO_INT32(variant);
|
||||
return NPN_GetIntIdentifier(integer);
|
||||
}
|
||||
|
||||
NPIdentifier
|
||||
doubleVariantToIdentifier(NPVariant variant)
|
||||
{
|
||||
assert(NPVARIANT_IS_DOUBLE(variant));
|
||||
double value = NPVARIANT_TO_DOUBLE(variant);
|
||||
// sadly there is no "getdoubleidentifier"
|
||||
int32 integer = static_cast<int32>(value);
|
||||
return NPN_GetIntIdentifier(integer);
|
||||
}
|
|
@ -0,0 +1,43 @@
|
|||
/* ***** BEGIN LICENSE BLOCK *****
|
||||
*
|
||||
* Copyright (C) 2006, 2007, 2008 Apple Inc. All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
|
||||
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR
|
||||
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
||||
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
||||
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
|
||||
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
|
||||
* OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
* Contributor(s):
|
||||
* Josh Aas <josh@mozilla.com>
|
||||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
#ifndef nptest_utils_h_
|
||||
#define nptest_utils_h_
|
||||
|
||||
#include "nptest.h"
|
||||
|
||||
NPUTF8* createCStringFromNPVariant(const NPVariant* variant);
|
||||
|
||||
NPIdentifier variantToIdentifier(NPVariant variant);
|
||||
NPIdentifier stringVariantToIdentifier(NPVariant variant);
|
||||
NPIdentifier int32VariantToIdentifier(NPVariant variant);
|
||||
NPIdentifier doubleVariantToIdentifier(NPVariant variant);
|
||||
|
||||
#endif // nptest_utils_h_
|
|
@ -0,0 +1,51 @@
|
|||
/* ***** BEGIN LICENSE BLOCK *****
|
||||
*
|
||||
* Copyright (c) 2008, Mozilla Corporation
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are met:
|
||||
*
|
||||
* * Redistributions of source code must retain the above copyright notice, this
|
||||
* list of conditions and the following disclaimer.
|
||||
* * Redistributions in binary form must reproduce the above copyright notice,
|
||||
* this list of conditions and the following disclaimer in the documentation
|
||||
* and/or other materials provided with the distribution.
|
||||
* * Neither the name of the Mozilla Corporation nor the names of its
|
||||
* contributors may be used to endorse or promote products derived from this
|
||||
* software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
|
||||
* ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
|
||||
* ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
* Contributor(s):
|
||||
* Josh Aas <josh@mozilla.com>
|
||||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
#include "nptest_platform.h"
|
||||
|
||||
NPError
|
||||
pluginInstanceInit(InstanceData* instanceData)
|
||||
{
|
||||
return NPERR_NO_ERROR;
|
||||
}
|
||||
|
||||
int16_t
|
||||
pluginHandleEvent(InstanceData* instanceData, void* event)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
void
|
||||
pluginDraw(InstanceData* instanceData)
|
||||
{
|
||||
}
|
|
@ -40,13 +40,74 @@
|
|||
// escaping checks -- highly dependent on the default index handler output
|
||||
// format
|
||||
|
||||
var paths =
|
||||
[
|
||||
"http://localhost:4444/", // check top-level directory listing
|
||||
"http://localhost:4444/foo/", // check non-top-level, too
|
||||
"http://localhost:4444/bar/folder^/" // trailing-caret leaf with hidden files
|
||||
];
|
||||
var currPathIndex = 0;
|
||||
var srv, dir, dirEntries;
|
||||
|
||||
function run_test()
|
||||
{
|
||||
createTestDirectory();
|
||||
|
||||
srv = createServer();
|
||||
srv.registerDirectory("/", dir);
|
||||
|
||||
var nameDir = do_get_file("netwerk/test/httpserver/test/data/name-scheme/");
|
||||
srv.registerDirectory("/bar/", nameDir);
|
||||
|
||||
srv.start(4444);
|
||||
|
||||
runHttpTests(tests, function() { srv.stop(); destroyTestDirectory(); });
|
||||
}
|
||||
|
||||
function createTestDirectory()
|
||||
{
|
||||
dir = Cc["@mozilla.org/file/directory_service;1"]
|
||||
.getService(Ci.nsIProperties)
|
||||
.get("TmpD", Ci.nsIFile);
|
||||
dir.append("index_handler_test_" + Math.random());
|
||||
dir.createUnique(Ci.nsIFile.DIRECTORY_TYPE, 0744);
|
||||
|
||||
// populate with test directories, files, etc.
|
||||
// Files must be in expected order of display on the index page!
|
||||
|
||||
files = [];
|
||||
|
||||
makeFile("aa_directory", true, dir, files);
|
||||
makeFile("Ba_directory", true, dir, files);
|
||||
makeFile("bb_directory", true, dir, files);
|
||||
makeFile("foo", true, dir, files);
|
||||
makeFile("a_file", false, dir, files);
|
||||
makeFile("B_file", false, dir, files);
|
||||
makeFile("za'z", false, dir, files);
|
||||
makeFile("zb&z", false, dir, files);
|
||||
makeFile("zc<q", false, dir, files);
|
||||
makeFile('zd"q', false, dir, files);
|
||||
makeFile("ze%g", false, dir, files);
|
||||
makeFile("zf%200h", false, dir, files);
|
||||
makeFile("zg>m", false, dir, files);
|
||||
|
||||
dirEntries = [files];
|
||||
|
||||
var subdir = dir.clone();
|
||||
subdir.append("foo");
|
||||
|
||||
files = [];
|
||||
|
||||
makeFile("aa_dir", true, subdir, files);
|
||||
makeFile("b_dir", true, subdir, files);
|
||||
makeFile("AA_file.txt", false, subdir, files);
|
||||
makeFile("test.txt", false, subdir, files);
|
||||
|
||||
dirEntries.push(files);
|
||||
}
|
||||
|
||||
function destroyTestDirectory()
|
||||
{
|
||||
dir.remove(true);
|
||||
}
|
||||
|
||||
|
||||
/*************
|
||||
* UTILITIES *
|
||||
*************/
|
||||
|
||||
/** Verifies data in bytes for the trailing-caret path above. */
|
||||
function hiddenDataCheck(bytes, uri, path)
|
||||
|
@ -116,7 +177,6 @@ function hiddenDataCheck(bytes, uri, path)
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Verifies data in bytes (an array of bytes) represents an index page for the
|
||||
* given URI and path, which should be a page listing the given directory
|
||||
|
@ -177,7 +237,7 @@ function dataCheck(bytes, uri, path, dirEntries)
|
|||
var ios = Cc["@mozilla.org/network/io-service;1"]
|
||||
.getService(Ci.nsIIOService);
|
||||
|
||||
var top = ios.newURI(uri, null, null);
|
||||
var dirURI = ios.newURI(uri, null, null);
|
||||
|
||||
for (var i = 0; i < items.length; i++)
|
||||
{
|
||||
|
@ -197,130 +257,6 @@ function dataCheck(bytes, uri, path, dirEntries)
|
|||
}
|
||||
}
|
||||
|
||||
var listener =
|
||||
{
|
||||
// data from request
|
||||
_data: [],
|
||||
|
||||
onStartRequest: function(request, cx)
|
||||
{
|
||||
var ch = request.QueryInterface(Ci.nsIHttpChannel);
|
||||
do_check_eq(ch.getResponseHeader("Content-Type"), "text/html");
|
||||
|
||||
this._data.length = 0;
|
||||
this._uri = paths[currPathIndex];
|
||||
this._path = this._uri.substring(paths[0].length - 1);
|
||||
this._dirEntries = dirEntries[currPathIndex];
|
||||
},
|
||||
onDataAvailable: function(request, cx, inputStream, offset, count)
|
||||
{
|
||||
var bytes = makeBIS(inputStream).readByteArray(count);
|
||||
Array.prototype.push.apply(this._data, bytes);
|
||||
},
|
||||
onStopRequest: function(request, cx, status)
|
||||
{
|
||||
if (currPathIndex == 2)
|
||||
hiddenDataCheck(this._data, this._uri, this._path);
|
||||
else
|
||||
dataCheck(this._data, this._uri, this._path, this._dirEntries);
|
||||
|
||||
if (++currPathIndex == paths.length)
|
||||
{
|
||||
srv.stop();
|
||||
destroyTestDirectory();
|
||||
}
|
||||
else
|
||||
{
|
||||
performNextTest();
|
||||
}
|
||||
do_test_finished();
|
||||
},
|
||||
QueryInterface: function(aIID)
|
||||
{
|
||||
if (aIID.equals(Ci.nsIStreamListener) ||
|
||||
aIID.equals(Ci.nsIRequestObserver) ||
|
||||
aIID.equals(Ci.nsISupports))
|
||||
return this;
|
||||
throw Cr.NS_ERROR_NO_INTERFACE;
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
var srv, dir, dirEntries;
|
||||
|
||||
function run_test()
|
||||
{
|
||||
createTestDirectory();
|
||||
|
||||
srv = createServer();
|
||||
srv.registerDirectory("/", dir);
|
||||
|
||||
var nameDir = do_get_file("netwerk/test/httpserver/test/data/name-scheme/");
|
||||
srv.registerDirectory("/bar/", nameDir);
|
||||
|
||||
srv.start(4444);
|
||||
|
||||
performNextTest();
|
||||
}
|
||||
|
||||
function performNextTest()
|
||||
{
|
||||
do_test_pending();
|
||||
|
||||
var ch = makeChannel(paths[currPathIndex]);
|
||||
ch.asyncOpen(listener, null);
|
||||
}
|
||||
|
||||
function createTestDirectory()
|
||||
{
|
||||
dir = Cc["@mozilla.org/file/directory_service;1"]
|
||||
.getService(Ci.nsIProperties)
|
||||
.get("TmpD", Ci.nsIFile);
|
||||
dir.append("index_handler_test_" + Math.random());
|
||||
dir.createUnique(Ci.nsIFile.DIRECTORY_TYPE, 0744);
|
||||
|
||||
// populate with test directories, files, etc.
|
||||
// Files must be in expected order of display on the index page!
|
||||
|
||||
files = [];
|
||||
|
||||
makeFile("aa_directory", true, dir, files);
|
||||
makeFile("Ba_directory", true, dir, files);
|
||||
makeFile("bb_directory", true, dir, files);
|
||||
makeFile("foo", true, dir, files);
|
||||
makeFile("a_file", false, dir, files);
|
||||
makeFile("B_file", false, dir, files);
|
||||
makeFile("za'z", false, dir, files);
|
||||
makeFile("zb&z", false, dir, files);
|
||||
makeFile("zc<q", false, dir, files);
|
||||
makeFile('zd"q', false, dir, files);
|
||||
makeFile("ze%g", false, dir, files);
|
||||
makeFile("zf%200h", false, dir, files);
|
||||
makeFile("zg>m", false, dir, files);
|
||||
|
||||
dirEntries = [files];
|
||||
|
||||
var subdir = dir.clone();
|
||||
subdir.append("foo");
|
||||
|
||||
files = [];
|
||||
|
||||
makeFile("aa_dir", true, subdir, files);
|
||||
makeFile("b_dir", true, subdir, files);
|
||||
makeFile("AA_file.txt", false, subdir, files);
|
||||
makeFile("test.txt", false, subdir, files);
|
||||
|
||||
dirEntries.push(files);
|
||||
}
|
||||
|
||||
function destroyTestDirectory()
|
||||
{
|
||||
dir.remove(true);
|
||||
}
|
||||
|
||||
|
||||
// utilities
|
||||
|
||||
/**
|
||||
* Create a file/directory with the given name underneath parentDir, and
|
||||
* append an object with name/isDirectory properties to lst corresponding
|
||||
|
@ -328,10 +264,7 @@ function destroyTestDirectory()
|
|||
*/
|
||||
function makeFile(name, isDirectory, parentDir, lst)
|
||||
{
|
||||
var type = isDirectory
|
||||
? Ci.nsIFile.DIRECTORY_TYPE
|
||||
: Ci.nsIFile.NORMAL_FILE_TYPE;
|
||||
|
||||
var type = Ci.nsIFile[isDirectory ? "DIRECTORY_TYPE" : "NORMAL_FILE_TYPE"];
|
||||
var file = parentDir.clone();
|
||||
|
||||
try
|
||||
|
@ -342,3 +275,43 @@ function makeFile(name, isDirectory, parentDir, lst)
|
|||
}
|
||||
catch (e) { /* OS probably doesn't like file name, skip */ }
|
||||
}
|
||||
|
||||
/*********
|
||||
* TESTS *
|
||||
*********/
|
||||
|
||||
var tests = [];
|
||||
var test;
|
||||
|
||||
// check top-level directory listing
|
||||
test = new Test("http://localhost:4444/",
|
||||
null, start, stopRootDirectory),
|
||||
tests.push(test);
|
||||
function start(ch)
|
||||
{
|
||||
do_check_eq(ch.getResponseHeader("Content-Type"), "text/html");
|
||||
}
|
||||
function stopRootDirectory(ch, cx, status, data)
|
||||
{
|
||||
dataCheck(data, "http://localhost:4444/", "/", dirEntries[0]);
|
||||
}
|
||||
|
||||
|
||||
// check non-top-level, too
|
||||
test = new Test("http://localhost:4444/foo/",
|
||||
null, start, stopFooDirectory),
|
||||
tests.push(test);
|
||||
function stopFooDirectory(ch, cx, status, data)
|
||||
{
|
||||
dataCheck(data, "http://localhost:4444/foo/", "/foo/", dirEntries[1]);
|
||||
}
|
||||
|
||||
|
||||
// trailing-caret leaf with hidden files
|
||||
test = new Test("http://localhost:4444/bar/folder^/",
|
||||
null, start, stopTrailingCaretDirectory),
|
||||
tests.push(test);
|
||||
function stopTrailingCaretDirectory(ch, cx, status, data)
|
||||
{
|
||||
hiddenDataCheck(data, "http://localhost:4444/bar/folder^/", "/bar/folder^/");
|
||||
}
|
||||
|
|
|
@ -38,67 +38,6 @@
|
|||
|
||||
// Make sure setIndexHandler works as expected
|
||||
|
||||
var paths =
|
||||
[
|
||||
"http://localhost:4444/",
|
||||
"http://localhost:4444/"
|
||||
];
|
||||
var currPathIndex = 0;
|
||||
|
||||
var listener =
|
||||
{
|
||||
// NSISTREAMLISTENER
|
||||
onDataAvailable: function(request, cx, inputStream, offset, count)
|
||||
{
|
||||
makeBIS(inputStream).readByteArray(count); // required by API
|
||||
},
|
||||
// NSIREQUESTOBSERVER
|
||||
onStartRequest: function(request, cx)
|
||||
{
|
||||
var ch = request.QueryInterface(Ci.nsIHttpChannel)
|
||||
.QueryInterface(Ci.nsIHttpChannelInternal);
|
||||
|
||||
switch (currPathIndex)
|
||||
{
|
||||
case 0:
|
||||
do_check_eq(ch.getResponseHeader("Content-Length"), "10");
|
||||
srv.setIndexHandler(null);
|
||||
break;
|
||||
|
||||
case 1:
|
||||
do_check_eq(ch.responseStatus, 200); // default index handler
|
||||
break;
|
||||
}
|
||||
},
|
||||
onStopRequest: function(request, cx, status)
|
||||
{
|
||||
do_check_true(Components.isSuccessCode(status));
|
||||
if (++currPathIndex == paths.length)
|
||||
srv.stop();
|
||||
else
|
||||
performNextTest();
|
||||
do_test_finished();
|
||||
},
|
||||
// NSISUPPORTS
|
||||
QueryInterface: function(aIID)
|
||||
{
|
||||
if (aIID.equals(Ci.nsIStreamListener) ||
|
||||
aIID.equals(Ci.nsIRequestObserver) ||
|
||||
aIID.equals(Ci.nsISupports))
|
||||
return this;
|
||||
throw Cr.NS_ERROR_NO_INTERFACE;
|
||||
}
|
||||
};
|
||||
|
||||
function performNextTest()
|
||||
{
|
||||
do_test_pending();
|
||||
|
||||
var ch = makeChannel(paths[currPathIndex]);
|
||||
ch.loadFlags |= Ci.nsIRequest.LOAD_BYPASS_CACHE; // important!
|
||||
ch.asyncOpen(listener, null);
|
||||
}
|
||||
|
||||
var srv, serverBasePath;
|
||||
|
||||
function run_test()
|
||||
|
@ -109,7 +48,41 @@ function run_test()
|
|||
srv.setIndexHandler(myIndexHandler);
|
||||
srv.start(4444);
|
||||
|
||||
performNextTest();
|
||||
runHttpTests(tests, function() { srv.stop(); });
|
||||
}
|
||||
|
||||
|
||||
var tests = [];
|
||||
var test;
|
||||
|
||||
test = new Test("http://localhost:4444/",
|
||||
init, startCustomIndexHandler, stopCustomIndexHandler);
|
||||
tests.push(test);
|
||||
function init(ch)
|
||||
{
|
||||
ch.loadFlags |= Ci.nsIRequest.LOAD_BYPASS_CACHE; // important!
|
||||
}
|
||||
function startCustomIndexHandler(ch, cx)
|
||||
{
|
||||
do_check_eq(ch.getResponseHeader("Content-Length"), "10");
|
||||
srv.setIndexHandler(null);
|
||||
}
|
||||
function stopCustomIndexHandler(ch, cx, status, data)
|
||||
{
|
||||
do_check_true(Components.isSuccessCode(status));
|
||||
do_check_eq(String.fromCharCode.apply(null, data), "directory!");
|
||||
}
|
||||
|
||||
test = new Test("http://localhost:4444/",
|
||||
init, startDefaultIndexHandler, stopDefaultIndexHandler);
|
||||
tests.push(test);
|
||||
function startDefaultIndexHandler(ch, cx)
|
||||
{
|
||||
do_check_eq(ch.responseStatus, 200);
|
||||
}
|
||||
function stopDefaultIndexHandler(ch, cx, status, data)
|
||||
{
|
||||
do_check_true(Components.isSuccessCode(status));
|
||||
}
|
||||
|
||||
// PATH HANDLERS
|
||||
|
|
|
@ -39,102 +39,6 @@
|
|||
// exercise nsIHttpResponse.setStatusLine, ensure its atomicity, and ensure the
|
||||
// specified behavior occurs if it's not called
|
||||
|
||||
var paths =
|
||||
[
|
||||
"http://localhost:4444/no/setstatusline",
|
||||
"http://localhost:4444/http1_0",
|
||||
"http://localhost:4444/http1_1",
|
||||
"http://localhost:4444/invalidVersion",
|
||||
"http://localhost:4444/invalidStatus",
|
||||
"http://localhost:4444/invalidDescription",
|
||||
"http://localhost:4444/crazyCode",
|
||||
"http://localhost:4444/nullVersion"
|
||||
];
|
||||
var currPathIndex = 0;
|
||||
|
||||
var listener =
|
||||
{
|
||||
// NSISTREAMLISTENER
|
||||
onDataAvailable: function(request, cx, inputStream, offset, count)
|
||||
{
|
||||
makeBIS(inputStream).readByteArray(count); // required by API
|
||||
},
|
||||
// NSIREQUESTOBSERVER
|
||||
onStartRequest: function(request, cx)
|
||||
{
|
||||
var ch = request.QueryInterface(Ci.nsIHttpChannel)
|
||||
.QueryInterface(Ci.nsIHttpChannelInternal);
|
||||
|
||||
switch (currPathIndex)
|
||||
{
|
||||
case 0:
|
||||
checkStatusLine(ch, 1, 1, 200, "OK");
|
||||
break;
|
||||
|
||||
case 1:
|
||||
checkStatusLine(ch, 1, 0, 200, "OK");
|
||||
break;
|
||||
|
||||
case 2:
|
||||
checkStatusLine(ch, 1, 1, 200, "OK");
|
||||
break;
|
||||
|
||||
case 3:
|
||||
case 4:
|
||||
case 5:
|
||||
checkStatusLine(ch, 1, 1, 200, "OK");
|
||||
do_check_eq(ch.getResponseHeader("Passed"), "true");
|
||||
break;
|
||||
|
||||
case 6:
|
||||
checkStatusLine(ch, 1, 1, 617, "Crazy");
|
||||
break;
|
||||
|
||||
case 7:
|
||||
// currently, this server implementation defaults to 1.1
|
||||
checkStatusLine(ch, 1, 1, 255, "NULL");
|
||||
break;
|
||||
}
|
||||
},
|
||||
onStopRequest: function(request, cx, status)
|
||||
{
|
||||
do_check_true(Components.isSuccessCode(status));
|
||||
if (++currPathIndex == paths.length)
|
||||
srv.stop();
|
||||
else
|
||||
performNextTest();
|
||||
do_test_finished();
|
||||
},
|
||||
// NSISUPPORTS
|
||||
QueryInterface: function(aIID)
|
||||
{
|
||||
if (aIID.equals(Ci.nsIStreamListener) ||
|
||||
aIID.equals(Ci.nsIRequestObserver) ||
|
||||
aIID.equals(Ci.nsISupports))
|
||||
return this;
|
||||
throw Cr.NS_ERROR_NO_INTERFACE;
|
||||
}
|
||||
};
|
||||
|
||||
function checkStatusLine(channel, httpMaxVer, httpMinVer, httpCode, statusText)
|
||||
{
|
||||
do_check_eq(channel.responseStatus, httpCode);
|
||||
do_check_eq(channel.responseStatusText, statusText);
|
||||
|
||||
var respMaj = {}, respMin = {};
|
||||
channel.getResponseVersion(respMaj, respMin);
|
||||
do_check_eq(respMaj.value, httpMaxVer);
|
||||
do_check_eq(respMin.value, httpMinVer);
|
||||
}
|
||||
|
||||
function performNextTest()
|
||||
{
|
||||
do_test_pending();
|
||||
|
||||
var ch = makeChannel(paths[currPathIndex]);
|
||||
ch.asyncOpen(listener, null);
|
||||
}
|
||||
|
||||
var srv;
|
||||
|
||||
function run_test()
|
||||
|
@ -152,27 +56,77 @@ function run_test()
|
|||
|
||||
srv.start(4444);
|
||||
|
||||
performNextTest();
|
||||
runHttpTests(tests, function() { srv.stop() });
|
||||
}
|
||||
|
||||
// PATH HANDLERS
|
||||
|
||||
/*************
|
||||
* UTILITIES *
|
||||
*************/
|
||||
|
||||
function checkStatusLine(channel, httpMaxVer, httpMinVer, httpCode, statusText)
|
||||
{
|
||||
do_check_eq(channel.responseStatus, httpCode);
|
||||
do_check_eq(channel.responseStatusText, statusText);
|
||||
|
||||
var respMaj = {}, respMin = {};
|
||||
channel.getResponseVersion(respMaj, respMin);
|
||||
do_check_eq(respMaj.value, httpMaxVer);
|
||||
do_check_eq(respMin.value, httpMinVer);
|
||||
}
|
||||
|
||||
|
||||
/*********
|
||||
* TESTS *
|
||||
*********/
|
||||
|
||||
var tests = [];
|
||||
var test;
|
||||
|
||||
// /no/setstatusline
|
||||
function noSetstatusline(metadata, response)
|
||||
{
|
||||
}
|
||||
test = new Test("http://localhost:4444/no/setstatusline",
|
||||
null, startNoSetStatusLine, stop);
|
||||
tests.push(test);
|
||||
function startNoSetStatusLine(ch, cx)
|
||||
{
|
||||
checkStatusLine(ch, 1, 1, 200, "OK");
|
||||
}
|
||||
function stop(ch, cx, status, data)
|
||||
{
|
||||
do_check_true(Components.isSuccessCode(status));
|
||||
}
|
||||
|
||||
|
||||
// /http1_0
|
||||
function http1_0(metadata, response)
|
||||
{
|
||||
response.setStatusLine("1.0", 200, "OK");
|
||||
}
|
||||
test = new Test("http://localhost:4444/http1_0",
|
||||
null, startHttp1_0, stop);
|
||||
tests.push(test);
|
||||
function startHttp1_0(ch, cx)
|
||||
{
|
||||
checkStatusLine(ch, 1, 0, 200, "OK");
|
||||
}
|
||||
|
||||
|
||||
// /http1_1
|
||||
function http1_1(metadata, response)
|
||||
{
|
||||
response.setStatusLine("1.1", 200, "OK");
|
||||
}
|
||||
test = new Test("http://localhost:4444/http1_1",
|
||||
null, startHttp1_1, stop);
|
||||
tests.push(test);
|
||||
function startHttp1_1(ch, cx)
|
||||
{
|
||||
checkStatusLine(ch, 1, 1, 200, "OK");
|
||||
}
|
||||
|
||||
|
||||
// /invalidVersion
|
||||
function invalidVersion(metadata, response)
|
||||
|
@ -186,6 +140,15 @@ function invalidVersion(metadata, response)
|
|||
response.setHeader("Passed", "true", false);
|
||||
}
|
||||
}
|
||||
test = new Test("http://localhost:4444/invalidVersion",
|
||||
null, startPassedTrue, stop);
|
||||
tests.push(test);
|
||||
function startPassedTrue(ch, cx)
|
||||
{
|
||||
checkStatusLine(ch, 1, 1, 200, "OK");
|
||||
do_check_eq(ch.getResponseHeader("Passed"), "true");
|
||||
}
|
||||
|
||||
|
||||
// /invalidStatus
|
||||
function invalidStatus(metadata, response)
|
||||
|
@ -199,6 +162,11 @@ function invalidStatus(metadata, response)
|
|||
response.setHeader("Passed", "true", false);
|
||||
}
|
||||
}
|
||||
test = new Test("http://localhost:4444/invalidStatus",
|
||||
null, startPassedTrue, stop);
|
||||
tests.push(test);
|
||||
|
||||
|
||||
// /invalidDescription
|
||||
function invalidDescription(metadata, response)
|
||||
{
|
||||
|
@ -211,15 +179,35 @@ function invalidDescription(metadata, response)
|
|||
response.setHeader("Passed", "true", false);
|
||||
}
|
||||
}
|
||||
test = new Test("http://localhost:4444/invalidDescription",
|
||||
null, startPassedTrue, stop);
|
||||
tests.push(test);
|
||||
|
||||
|
||||
// /crazyCode
|
||||
function crazyCode(metadata, response)
|
||||
{
|
||||
response.setStatusLine("1.1", 617, "Crazy");
|
||||
}
|
||||
test = new Test("http://localhost:4444/crazyCode",
|
||||
null, startCrazy, stop);
|
||||
tests.push(test);
|
||||
function startCrazy(ch, cx)
|
||||
{
|
||||
checkStatusLine(ch, 1, 1, 617, "Crazy");
|
||||
}
|
||||
|
||||
|
||||
// /nullVersion
|
||||
function nullVersion(metadata, response)
|
||||
{
|
||||
response.setStatusLine(null, 255, "NULL");
|
||||
}
|
||||
test = new Test("http://localhost:4444/nullVersion",
|
||||
null, startNullVersion, stop);
|
||||
tests.push(test);
|
||||
function startNullVersion(ch, cx)
|
||||
{
|
||||
// currently, this server implementation defaults to 1.1
|
||||
checkStatusLine(ch, 1, 1, 255, "NULL");
|
||||
}
|
||||
|
|
|
@ -64,10 +64,10 @@
|
|||
#
|
||||
# ------------------------------------------------------------------
|
||||
|
||||
FROMTOP=/share/builds/components/nspr20/v4.7.2
|
||||
TOTOP=./v4.7.2
|
||||
NSPRDIR=nspr-4.7.2
|
||||
SOURCETAG=NSPR_4_7_2_RTM
|
||||
FROMTOP=/share/builds/components/nspr20/v4.7.4
|
||||
TOTOP=./v4.7.4
|
||||
NSPRDIR=nspr-4.7.4
|
||||
SOURCETAG=NSPR_4_7_4_RTM
|
||||
|
||||
#
|
||||
# enumerate Unix object directories on /s/b/c
|
||||
|
|
|
@ -113,12 +113,16 @@ PROGS = $(OBJDIR)/now$(PROG_SUFFIX)
|
|||
ifeq (,$(CROSS_COMPILE)$(filter-out OS2 WINNT,$(OS_ARCH)))
|
||||
TARGETS = $(PROGS)
|
||||
else
|
||||
ifeq ($(OS_ARCH),WINCE)
|
||||
TARGETS = $(PROGS)
|
||||
else
|
||||
PROGS += $(OBJDIR)/nsinstall$(PROG_SUFFIX)
|
||||
TARGETS = $(PROGS) $(PLSRCS:.pl=)
|
||||
endif
|
||||
endif
|
||||
|
||||
OUTOPTION = -o # end of the line
|
||||
ifeq (,$(filter-out WINNT WIN95,$(OS_TARGET)))
|
||||
ifeq (,$(filter-out WINNT WIN95 WINCE,$(OS_TARGET)))
|
||||
ifndef NS_USE_GCC
|
||||
OUTOPTION = -Fe
|
||||
endif
|
||||
|
|
|
@ -42,7 +42,7 @@
|
|||
#include <sys/timeb.h>
|
||||
#elif defined(XP_UNIX) || defined(XP_OS2) || defined(XP_BEOS)
|
||||
#include <sys/time.h>
|
||||
#elif defined(WIN32)
|
||||
#elif defined(_WIN32)
|
||||
#include <windows.h>
|
||||
#else
|
||||
#error "Architecture not supported"
|
||||
|
@ -87,7 +87,7 @@ int main(int argc, char **argv)
|
|||
fprintf(stdout, "%lld", now);
|
||||
#endif
|
||||
|
||||
#elif defined(WIN32)
|
||||
#elif defined(_WIN32)
|
||||
__int64 now;
|
||||
FILETIME ft;
|
||||
GetSystemTimeAsFileTime(&ft);
|
||||
|
|
|
@ -42,3 +42,4 @@
|
|||
*/
|
||||
|
||||
#error "Do not include this header file."
|
||||
|
||||
|
|
|
@ -106,13 +106,13 @@ endif
|
|||
#
|
||||
|
||||
ifdef LIBRARY_NAME
|
||||
ifeq (,$(filter-out WINNT OS2,$(OS_ARCH)))
|
||||
ifeq (,$(filter-out WINNT WINCE OS2,$(OS_ARCH)))
|
||||
|
||||
#
|
||||
# Win95, Win16, and OS/2 require library names conforming to the 8.3 rule.
|
||||
# other platforms do not.
|
||||
#
|
||||
ifeq (,$(filter-out WIN95 OS2,$(OS_TARGET)))
|
||||
ifeq (,$(filter-out WIN95 WINCE OS2,$(OS_TARGET)))
|
||||
LIBRARY = $(OBJDIR)/$(LIBRARY_NAME)$(LIBRARY_VERSION)_s.$(LIB_SUFFIX)
|
||||
SHARED_LIBRARY = $(OBJDIR)/$(LIBRARY_NAME)$(LIBRARY_VERSION).$(DLL_SUFFIX)
|
||||
IMPORT_LIBRARY = $(OBJDIR)/$(LIBRARY_NAME)$(LIBRARY_VERSION).$(LIB_SUFFIX)
|
||||
|
@ -139,7 +139,7 @@ endif
|
|||
endif
|
||||
|
||||
ifndef TARGETS
|
||||
ifeq (,$(filter-out WINNT OS2,$(OS_ARCH)))
|
||||
ifeq (,$(filter-out WINNT WINCE OS2,$(OS_ARCH)))
|
||||
TARGETS = $(LIBRARY) $(SHARED_LIBRARY) $(IMPORT_LIBRARY)
|
||||
ifndef BUILD_OPT
|
||||
ifdef MSC_VER
|
||||
|
@ -409,12 +409,16 @@ $(OBJDIR)/%.$(OBJ_SUFFIX): %.cpp
|
|||
ifeq ($(NS_USE_GCC)_$(OS_ARCH),_WINNT)
|
||||
$(CCC) -Fo$@ -c $(CCCFLAGS) $(call abspath,$<)
|
||||
else
|
||||
ifeq ($(NS_USE_GCC)_$(OS_ARCH),_WINCE)
|
||||
$(CCC) -Fo$@ -c $(CCCFLAGS) $<
|
||||
else
|
||||
ifdef NEED_ABSOLUTE_PATH
|
||||
$(CCC) -o $@ -c $(CCCFLAGS) $(call abspath,$<)
|
||||
else
|
||||
$(CCC) -o $@ -c $(CCCFLAGS) $<
|
||||
endif
|
||||
endif
|
||||
endif
|
||||
|
||||
WCCFLAGS1 = $(subst /,\\,$(CFLAGS))
|
||||
WCCFLAGS2 = $(subst -I,-i=,$(WCCFLAGS1))
|
||||
|
@ -424,12 +428,16 @@ $(OBJDIR)/%.$(OBJ_SUFFIX): %.c
|
|||
ifeq ($(NS_USE_GCC)_$(OS_ARCH),_WINNT)
|
||||
$(CC) -Fo$@ -c $(CFLAGS) $(call abspath,$<)
|
||||
else
|
||||
ifeq ($(NS_USE_GCC)_$(OS_ARCH),_WINCE)
|
||||
$(CC) -Fo$@ -c $(CFLAGS) $<
|
||||
else
|
||||
ifdef NEED_ABSOLUTE_PATH
|
||||
$(CC) -o $@ -c $(CFLAGS) $(call abspath,$<)
|
||||
else
|
||||
$(CC) -o $@ -c $(CFLAGS) $<
|
||||
endif
|
||||
endif
|
||||
endif
|
||||
|
||||
|
||||
$(OBJDIR)/%.$(OBJ_SUFFIX): %.s
|
||||
|
|
|
@ -689,7 +689,7 @@ test "$host_alias" != "$target_alias" &&
|
|||
|
||||
MOD_MAJOR_VERSION=4
|
||||
MOD_MINOR_VERSION=7
|
||||
MOD_PATCH_VERSION=2
|
||||
MOD_PATCH_VERSION=4
|
||||
NSPR_MODNAME=nspr20
|
||||
_HAVE_PTHREADS=
|
||||
USE_PTHREADS=
|
||||
|
@ -1110,7 +1110,7 @@ EOF
|
|||
beos*)
|
||||
DEFINES="$DEFINES -DDEBUG_${USER}"
|
||||
;;
|
||||
msvc*|mks*|cygwin*|mingw*|os2*)
|
||||
msvc*|mks*|cygwin*|mingw*|wince*|os2*)
|
||||
DEFINES="$DEFINES -DDEBUG_`echo ${USERNAME} | sed -e 's| |_|g'`"
|
||||
;;
|
||||
*)
|
||||
|
@ -2783,6 +2783,7 @@ if test -n "$CROSS_COMPILE"; then
|
|||
linux*) OS_ARCH=Linux ;;
|
||||
solaris*) OS_ARCH=SunOS OS_RELEASE=5 ;;
|
||||
mingw*) OS_ARCH=WINNT ;;
|
||||
wince*) OS_ARCH=WINCE ;;
|
||||
darwin*) OS_ARCH=Darwin ;;
|
||||
esac
|
||||
else
|
||||
|
@ -2946,7 +2947,7 @@ case "$host" in
|
|||
*-mingw*)
|
||||
NSINSTALL=nsinstall
|
||||
;;
|
||||
*-cygwin*|*-msvc*|*-mks*)
|
||||
*-cygwin*|*-msvc*|*-mks*|*-wince*)
|
||||
NSINSTALL='$(CYGWIN_WRAPPER) nsinstall'
|
||||
if test `echo "${PATH}" | grep -c \;` = 0; then
|
||||
CYGWIN_WRAPPER='sh $(topsrcdir)/build/cygwin-wrapper'
|
||||
|
@ -2980,17 +2981,17 @@ EOF
|
|||
DSO_LDOPTS='-brtl -bnortllib -bM:SRE -bnoentry -bexpall -blibpath:/usr/lib:/lib'
|
||||
ac_safe=`echo "sys/atomic_op.h" | sed 'y%./+-%__p_%'`
|
||||
echo $ac_n "checking for sys/atomic_op.h""... $ac_c" 1>&6
|
||||
echo "configure:2984: checking for sys/atomic_op.h" >&5
|
||||
echo "configure:2985: checking for sys/atomic_op.h" >&5
|
||||
if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then
|
||||
echo $ac_n "(cached) $ac_c" 1>&6
|
||||
else
|
||||
cat > conftest.$ac_ext <<EOF
|
||||
#line 2989 "configure"
|
||||
#line 2990 "configure"
|
||||
#include "confdefs.h"
|
||||
#include <sys/atomic_op.h>
|
||||
EOF
|
||||
ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
|
||||
{ (eval echo configure:2994: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
|
||||
{ (eval echo configure:2995: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
|
||||
ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
|
||||
if test -z "$ac_err"; then
|
||||
rm -rf conftest*
|
||||
|
@ -3147,7 +3148,7 @@ EOF
|
|||
_DEBUG_FLAGS='-gdwarf-2 -O0'
|
||||
MKSHLIB='$(CCC) $(DSO_LDOPTS) -o $@'
|
||||
echo $ac_n "checking for gethostbyaddr in -lbind""... $ac_c" 1>&6
|
||||
echo "configure:3151: checking for gethostbyaddr in -lbind" >&5
|
||||
echo "configure:3152: checking for gethostbyaddr in -lbind" >&5
|
||||
ac_lib_var=`echo bind'_'gethostbyaddr | sed 'y%./+-%__p_%'`
|
||||
if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
|
||||
echo $ac_n "(cached) $ac_c" 1>&6
|
||||
|
@ -3155,7 +3156,7 @@ else
|
|||
ac_save_LIBS="$LIBS"
|
||||
LIBS="-lbind $LIBS"
|
||||
cat > conftest.$ac_ext <<EOF
|
||||
#line 3159 "configure"
|
||||
#line 3160 "configure"
|
||||
#include "confdefs.h"
|
||||
/* Override any gcc2 internal prototype to avoid an error. */
|
||||
/* We use char because int might match the return type of a gcc2
|
||||
|
@ -3166,7 +3167,7 @@ int main() {
|
|||
gethostbyaddr()
|
||||
; return 0; }
|
||||
EOF
|
||||
if { (eval echo configure:3170: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
|
||||
if { (eval echo configure:3171: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
|
||||
rm -rf conftest*
|
||||
eval "ac_cv_lib_$ac_lib_var=yes"
|
||||
else
|
||||
|
@ -4207,6 +4208,43 @@ EOF
|
|||
|
||||
;;
|
||||
|
||||
*-wince*)
|
||||
cat >> confdefs.h <<\EOF
|
||||
#define XP_PC 1
|
||||
EOF
|
||||
|
||||
cat >> confdefs.h <<\EOF
|
||||
#define WIN32 1
|
||||
EOF
|
||||
|
||||
cat >> confdefs.h <<\EOF
|
||||
#define WINCE 1
|
||||
EOF
|
||||
|
||||
cat >> confdefs.h <<\EOF
|
||||
#define _PR_GLOBAL_THREADS_ONLY 1
|
||||
EOF
|
||||
|
||||
|
||||
AR='lib -NOLOGO -OUT:"$@"'
|
||||
AR_FLAGS=
|
||||
|
||||
OBJ_SUFFIX=obj
|
||||
LIB_SUFFIX=lib
|
||||
DLL_SUFFIX=dll
|
||||
MKSHLIB='$(LD) -DLL $(DSO_LDOPTS) -OUT:$@'
|
||||
|
||||
PR_MD_ARCH_DIR=windows
|
||||
RESOLVE_LINK_SYMBOLS=1
|
||||
|
||||
MDCPUCFG_H=_win95.cfg
|
||||
LIBNSPR='$(dist_libdir)/nspr$(MOD_MAJOR_VERSION).$(LIB_SUFFIX)'
|
||||
LIBPLC='$(dist_libdir)/plc$(MOD_MAJOR_VERSION).$(LIB_SUFFIX)'
|
||||
|
||||
DLLFLAGS='-OUT:"$@"'
|
||||
_DEBUG_FLAGS=-Zi
|
||||
;;
|
||||
|
||||
*-ncr-sysv*)
|
||||
cat >> confdefs.h <<\EOF
|
||||
#define XP_UNIX 1
|
||||
|
@ -4294,7 +4332,9 @@ EOF
|
|||
#define HAVE_BSD_FLOCK 1
|
||||
EOF
|
||||
|
||||
USE_NSPR_THREADS=1
|
||||
if test -z "$USE_NSPR_THREADS"; then
|
||||
USE_PTHREADS=1
|
||||
fi
|
||||
MDCPUCFG_H=_netbsd.cfg
|
||||
PR_MD_CSRCS=netbsd.c
|
||||
|
||||
|
@ -4501,17 +4541,17 @@ EOF
|
|||
_OPTIMIZE_FLAGS="$_OPTIMIZE_FLAGS -Olimit 4000"
|
||||
ac_safe=`echo "machine/builtins.h" | sed 'y%./+-%__p_%'`
|
||||
echo $ac_n "checking for machine/builtins.h""... $ac_c" 1>&6
|
||||
echo "configure:4505: checking for machine/builtins.h" >&5
|
||||
echo "configure:4545: checking for machine/builtins.h" >&5
|
||||
if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then
|
||||
echo $ac_n "(cached) $ac_c" 1>&6
|
||||
else
|
||||
cat > conftest.$ac_ext <<EOF
|
||||
#line 4510 "configure"
|
||||
#line 4550 "configure"
|
||||
#include "confdefs.h"
|
||||
#include <machine/builtins.h>
|
||||
EOF
|
||||
ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
|
||||
{ (eval echo configure:4515: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
|
||||
{ (eval echo configure:4555: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
|
||||
ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
|
||||
if test -z "$ac_err"; then
|
||||
rm -rf conftest*
|
||||
|
@ -4766,15 +4806,29 @@ EOF
|
|||
LD=/usr/ccs/bin/ld
|
||||
MKSHLIB='$(CC) $(DSO_LDOPTS) -o $@'
|
||||
RESOLVE_LINK_SYMBOLS=1
|
||||
case "${OS_RELEASE}" in
|
||||
5.8|5.9)
|
||||
;;
|
||||
*)
|
||||
# It is safe to use the -Bdirect linker flag on Solaris 10 or later.
|
||||
USE_B_DIRECT=1
|
||||
;;
|
||||
esac
|
||||
if test -n "$GNU_CC"; then
|
||||
DSO_CFLAGS=-fPIC
|
||||
if `$CC -print-prog-name=ld` -v 2>&1 | grep -c GNU >/dev/null; then
|
||||
GCC_USE_GNU_LD=1
|
||||
fi
|
||||
DSO_LDOPTS='-shared -Wl,-h,$(notdir $@),-z,combreloc,-z,defs,-z,ignore,-Bdirect'
|
||||
DSO_LDOPTS='-shared -Wl,-h,$(notdir $@),-z,combreloc,-z,defs,-z,ignore'
|
||||
if test -n "$USE_B_DIRECT"; then
|
||||
DSO_LDOPTS="$DSO_LDOPTS,-Bdirect"
|
||||
fi
|
||||
else
|
||||
DSO_CFLAGS=-KPIC
|
||||
DSO_LDOPTS='-G -h $(notdir $@) -z combreloc -z defs -z ignore -Bdirect'
|
||||
DSO_LDOPTS='-G -h $(notdir $@) -z combreloc -z defs -z ignore'
|
||||
if test -n "$USE_B_DIRECT"; then
|
||||
DSO_LDOPTS="$DSO_LDOPTS -Bdirect"
|
||||
fi
|
||||
fi
|
||||
if test -n "$GNU_CC"; then
|
||||
CFLAGS="$CFLAGS -Wall"
|
||||
|
@ -5027,7 +5081,7 @@ case $target in
|
|||
;;
|
||||
*)
|
||||
echo $ac_n "checking for dlopen in -ldl""... $ac_c" 1>&6
|
||||
echo "configure:5031: checking for dlopen in -ldl" >&5
|
||||
echo "configure:5085: checking for dlopen in -ldl" >&5
|
||||
ac_lib_var=`echo dl'_'dlopen | sed 'y%./+-%__p_%'`
|
||||
if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
|
||||
echo $ac_n "(cached) $ac_c" 1>&6
|
||||
|
@ -5035,7 +5089,7 @@ else
|
|||
ac_save_LIBS="$LIBS"
|
||||
LIBS="-ldl $LIBS"
|
||||
cat > conftest.$ac_ext <<EOF
|
||||
#line 5039 "configure"
|
||||
#line 5093 "configure"
|
||||
#include "confdefs.h"
|
||||
/* Override any gcc2 internal prototype to avoid an error. */
|
||||
/* We use char because int might match the return type of a gcc2
|
||||
|
@ -5046,7 +5100,7 @@ int main() {
|
|||
dlopen()
|
||||
; return 0; }
|
||||
EOF
|
||||
if { (eval echo configure:5050: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
|
||||
if { (eval echo configure:5104: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
|
||||
rm -rf conftest*
|
||||
eval "ac_cv_lib_$ac_lib_var=yes"
|
||||
else
|
||||
|
@ -5063,17 +5117,17 @@ if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then
|
|||
echo "$ac_t""yes" 1>&6
|
||||
ac_safe=`echo "dlfcn.h" | sed 'y%./+-%__p_%'`
|
||||
echo $ac_n "checking for dlfcn.h""... $ac_c" 1>&6
|
||||
echo "configure:5067: checking for dlfcn.h" >&5
|
||||
echo "configure:5121: checking for dlfcn.h" >&5
|
||||
if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then
|
||||
echo $ac_n "(cached) $ac_c" 1>&6
|
||||
else
|
||||
cat > conftest.$ac_ext <<EOF
|
||||
#line 5072 "configure"
|
||||
#line 5126 "configure"
|
||||
#include "confdefs.h"
|
||||
#include <dlfcn.h>
|
||||
EOF
|
||||
ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
|
||||
{ (eval echo configure:5077: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
|
||||
{ (eval echo configure:5131: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
|
||||
ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
|
||||
if test -z "$ac_err"; then
|
||||
rm -rf conftest*
|
||||
|
@ -5106,13 +5160,13 @@ esac
|
|||
|
||||
if test $ac_cv_prog_gcc = yes; then
|
||||
echo $ac_n "checking whether ${CC-cc} needs -traditional""... $ac_c" 1>&6
|
||||
echo "configure:5110: checking whether ${CC-cc} needs -traditional" >&5
|
||||
echo "configure:5164: checking whether ${CC-cc} needs -traditional" >&5
|
||||
if eval "test \"`echo '$''{'ac_cv_prog_gcc_traditional'+set}'`\" = set"; then
|
||||
echo $ac_n "(cached) $ac_c" 1>&6
|
||||
else
|
||||
ac_pattern="Autoconf.*'x'"
|
||||
cat > conftest.$ac_ext <<EOF
|
||||
#line 5116 "configure"
|
||||
#line 5170 "configure"
|
||||
#include "confdefs.h"
|
||||
#include <sgtty.h>
|
||||
Autoconf TIOCGETP
|
||||
|
@ -5130,7 +5184,7 @@ rm -f conftest*
|
|||
|
||||
if test $ac_cv_prog_gcc_traditional = no; then
|
||||
cat > conftest.$ac_ext <<EOF
|
||||
#line 5134 "configure"
|
||||
#line 5188 "configure"
|
||||
#include "confdefs.h"
|
||||
#include <termio.h>
|
||||
Autoconf TCGETA
|
||||
|
@ -5154,12 +5208,12 @@ fi
|
|||
for ac_func in lchown strerror
|
||||
do
|
||||
echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
|
||||
echo "configure:5158: checking for $ac_func" >&5
|
||||
echo "configure:5212: checking for $ac_func" >&5
|
||||
if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then
|
||||
echo $ac_n "(cached) $ac_c" 1>&6
|
||||
else
|
||||
cat > conftest.$ac_ext <<EOF
|
||||
#line 5163 "configure"
|
||||
#line 5217 "configure"
|
||||
#include "confdefs.h"
|
||||
/* System header to define __stub macros and hopefully few prototypes,
|
||||
which can conflict with char $ac_func(); below. */
|
||||
|
@ -5182,7 +5236,7 @@ $ac_func();
|
|||
|
||||
; return 0; }
|
||||
EOF
|
||||
if { (eval echo configure:5186: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
|
||||
if { (eval echo configure:5240: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
|
||||
rm -rf conftest*
|
||||
eval "ac_cv_func_$ac_func=yes"
|
||||
else
|
||||
|
@ -5223,7 +5277,7 @@ hpux*)
|
|||
if test -z "$GNU_CC"; then
|
||||
|
||||
echo $ac_n "checking for +Olit support""... $ac_c" 1>&6
|
||||
echo "configure:5227: checking for +Olit support" >&5
|
||||
echo "configure:5281: checking for +Olit support" >&5
|
||||
if eval "test \"`echo '$''{'ac_cv_hpux_usable_olit_option'+set}'`\" = set"; then
|
||||
echo $ac_n "(cached) $ac_c" 1>&6
|
||||
else
|
||||
|
@ -5262,7 +5316,7 @@ darwin*)
|
|||
*)
|
||||
|
||||
echo $ac_n "checking for pthread_create in -lpthreads""... $ac_c" 1>&6
|
||||
echo "configure:5266: checking for pthread_create in -lpthreads" >&5
|
||||
echo "configure:5320: checking for pthread_create in -lpthreads" >&5
|
||||
echo "
|
||||
#include <pthread.h>
|
||||
void *foo(void *v) { return v; }
|
||||
|
@ -5284,7 +5338,7 @@ echo "
|
|||
echo "$ac_t""no" 1>&6
|
||||
|
||||
echo $ac_n "checking for pthread_create in -lpthread""... $ac_c" 1>&6
|
||||
echo "configure:5288: checking for pthread_create in -lpthread" >&5
|
||||
echo "configure:5342: checking for pthread_create in -lpthread" >&5
|
||||
echo "
|
||||
#include <pthread.h>
|
||||
void *foo(void *v) { return v; }
|
||||
|
@ -5306,7 +5360,7 @@ echo "
|
|||
echo "$ac_t""no" 1>&6
|
||||
|
||||
echo $ac_n "checking for pthread_create in -lc_r""... $ac_c" 1>&6
|
||||
echo "configure:5310: checking for pthread_create in -lc_r" >&5
|
||||
echo "configure:5364: checking for pthread_create in -lc_r" >&5
|
||||
echo "
|
||||
#include <pthread.h>
|
||||
void *foo(void *v) { return v; }
|
||||
|
@ -5328,7 +5382,7 @@ echo "
|
|||
echo "$ac_t""no" 1>&6
|
||||
|
||||
echo $ac_n "checking for pthread_create in -lc""... $ac_c" 1>&6
|
||||
echo "configure:5332: checking for pthread_create in -lc" >&5
|
||||
echo "configure:5386: checking for pthread_create in -lc" >&5
|
||||
echo "
|
||||
#include <pthread.h>
|
||||
void *foo(void *v) { return v; }
|
||||
|
@ -5460,7 +5514,7 @@ if test -n "$USE_PTHREADS"; then
|
|||
rm -f conftest*
|
||||
ac_cv_have_dash_pthread=no
|
||||
echo $ac_n "checking whether ${CC-cc} accepts -pthread""... $ac_c" 1>&6
|
||||
echo "configure:5464: checking whether ${CC-cc} accepts -pthread" >&5
|
||||
echo "configure:5518: checking whether ${CC-cc} accepts -pthread" >&5
|
||||
echo 'int main() { return 0; }' | cat > conftest.c
|
||||
${CC-cc} -pthread -o conftest conftest.c > conftest.out 2>&1
|
||||
if test $? -eq 0; then
|
||||
|
@ -5483,7 +5537,7 @@ echo "configure:5464: checking whether ${CC-cc} accepts -pthread" >&5
|
|||
ac_cv_have_dash_pthreads=no
|
||||
if test "$ac_cv_have_dash_pthread" = "no"; then
|
||||
echo $ac_n "checking whether ${CC-cc} accepts -pthreads""... $ac_c" 1>&6
|
||||
echo "configure:5487: checking whether ${CC-cc} accepts -pthreads" >&5
|
||||
echo "configure:5541: checking whether ${CC-cc} accepts -pthreads" >&5
|
||||
echo 'int main() { return 0; }' | cat > conftest.c
|
||||
${CC-cc} -pthreads -o conftest conftest.c > conftest.out 2>&1
|
||||
if test $? -eq 0; then
|
||||
|
@ -5682,7 +5736,7 @@ EOF
|
|||
|
||||
fi
|
||||
;;
|
||||
*-mingw*|*-cygwin*|*-msvc*|*-mks*|*-os2*|*-beos*)
|
||||
*-mingw*|*-cygwin*|*-msvc*|*-mks*|*-wince*|*-os2*|*-beos*)
|
||||
USE_PTHREADS=
|
||||
_PTHREAD_LDFLAGS=
|
||||
USE_USER_PTHREADS=
|
||||
|
@ -6016,7 +6070,7 @@ s%\[%\\&%g
|
|||
s%\]%\\&%g
|
||||
s%\$%$$%g
|
||||
EOF
|
||||
DEFS=`sed -f conftest.defs confdefs.h | tr '\012' ' '`
|
||||
DEFS=`sed -f conftest.defs confdefs.h | tr '\012' ' ' | tr '\015' ' '`
|
||||
rm -f conftest.defs
|
||||
|
||||
|
||||
|
|
|
@ -50,7 +50,7 @@ dnl = Defaults
|
|||
dnl ========================================================
|
||||
MOD_MAJOR_VERSION=4
|
||||
MOD_MINOR_VERSION=7
|
||||
MOD_PATCH_VERSION=2
|
||||
MOD_PATCH_VERSION=4
|
||||
NSPR_MODNAME=nspr20
|
||||
_HAVE_PTHREADS=
|
||||
USE_PTHREADS=
|
||||
|
@ -384,7 +384,7 @@ if test -n "$MOZ_DEBUG"; then
|
|||
beos*)
|
||||
DEFINES="$DEFINES -DDEBUG_${USER}"
|
||||
;;
|
||||
msvc*|mks*|cygwin*|mingw*|os2*)
|
||||
msvc*|mks*|cygwin*|mingw*|wince*|os2*)
|
||||
DEFINES="$DEFINES -DDEBUG_`echo ${USERNAME} | sed -e 's| |_|g'`"
|
||||
;;
|
||||
*)
|
||||
|
@ -651,6 +651,7 @@ if test -n "$CROSS_COMPILE"; then
|
|||
linux*) OS_ARCH=Linux ;;
|
||||
solaris*) OS_ARCH=SunOS OS_RELEASE=5 ;;
|
||||
mingw*) OS_ARCH=WINNT ;;
|
||||
wince*) OS_ARCH=WINCE ;;
|
||||
darwin*) OS_ARCH=Darwin ;;
|
||||
esac
|
||||
else
|
||||
|
@ -817,7 +818,7 @@ case "$host" in
|
|||
*-mingw*)
|
||||
NSINSTALL=nsinstall
|
||||
;;
|
||||
*-cygwin*|*-msvc*|*-mks*)
|
||||
*-cygwin*|*-msvc*|*-mks*|*-wince*)
|
||||
NSINSTALL='$(CYGWIN_WRAPPER) nsinstall'
|
||||
if test `echo "${PATH}" | grep -c \;` = 0; then
|
||||
CYGWIN_WRAPPER='sh $(topsrcdir)/build/cygwin-wrapper'
|
||||
|
@ -1684,6 +1685,31 @@ tools are selected during the Xcode/Developer Tools installation.])
|
|||
|
||||
;;
|
||||
|
||||
*-wince*)
|
||||
AC_DEFINE(XP_PC)
|
||||
AC_DEFINE(WIN32)
|
||||
AC_DEFINE(WINCE)
|
||||
AC_DEFINE(_PR_GLOBAL_THREADS_ONLY)
|
||||
|
||||
AR='lib -NOLOGO -OUT:"$@"'
|
||||
AR_FLAGS=
|
||||
|
||||
OBJ_SUFFIX=obj
|
||||
LIB_SUFFIX=lib
|
||||
DLL_SUFFIX=dll
|
||||
MKSHLIB='$(LD) -DLL $(DSO_LDOPTS) -OUT:$@'
|
||||
|
||||
PR_MD_ARCH_DIR=windows
|
||||
RESOLVE_LINK_SYMBOLS=1
|
||||
|
||||
MDCPUCFG_H=_win95.cfg
|
||||
LIBNSPR='$(dist_libdir)/nspr$(MOD_MAJOR_VERSION).$(LIB_SUFFIX)'
|
||||
LIBPLC='$(dist_libdir)/plc$(MOD_MAJOR_VERSION).$(LIB_SUFFIX)'
|
||||
|
||||
DLLFLAGS='-OUT:"$@"'
|
||||
_DEBUG_FLAGS=-Zi
|
||||
;;
|
||||
|
||||
*-ncr-sysv*)
|
||||
AC_DEFINE(XP_UNIX)
|
||||
AC_DEFINE(SVR4)
|
||||
|
@ -1729,7 +1755,9 @@ mips-nec-sysv*)
|
|||
AC_DEFINE(XP_UNIX)
|
||||
AC_DEFINE(NETBSD)
|
||||
AC_DEFINE(HAVE_BSD_FLOCK)
|
||||
USE_NSPR_THREADS=1
|
||||
if test -z "$USE_NSPR_THREADS"; then
|
||||
USE_PTHREADS=1
|
||||
fi
|
||||
MDCPUCFG_H=_netbsd.cfg
|
||||
PR_MD_CSRCS=netbsd.c
|
||||
|
||||
|
@ -1989,15 +2017,29 @@ mips-sony-newsos*)
|
|||
LD=/usr/ccs/bin/ld
|
||||
MKSHLIB='$(CC) $(DSO_LDOPTS) -o $@'
|
||||
RESOLVE_LINK_SYMBOLS=1
|
||||
case "${OS_RELEASE}" in
|
||||
5.8|5.9)
|
||||
;;
|
||||
*)
|
||||
# It is safe to use the -Bdirect linker flag on Solaris 10 or later.
|
||||
USE_B_DIRECT=1
|
||||
;;
|
||||
esac
|
||||
if test -n "$GNU_CC"; then
|
||||
DSO_CFLAGS=-fPIC
|
||||
if `$CC -print-prog-name=ld` -v 2>&1 | grep -c GNU >/dev/null; then
|
||||
GCC_USE_GNU_LD=1
|
||||
fi
|
||||
DSO_LDOPTS='-shared -Wl,-h,$(notdir $@),-z,combreloc,-z,defs,-z,ignore,-Bdirect'
|
||||
DSO_LDOPTS='-shared -Wl,-h,$(notdir $@),-z,combreloc,-z,defs,-z,ignore'
|
||||
if test -n "$USE_B_DIRECT"; then
|
||||
DSO_LDOPTS="$DSO_LDOPTS,-Bdirect"
|
||||
fi
|
||||
else
|
||||
DSO_CFLAGS=-KPIC
|
||||
DSO_LDOPTS='-G -h $(notdir $@) -z combreloc -z defs -z ignore -Bdirect'
|
||||
DSO_LDOPTS='-G -h $(notdir $@) -z combreloc -z defs -z ignore'
|
||||
if test -n "$USE_B_DIRECT"; then
|
||||
DSO_LDOPTS="$DSO_LDOPTS -Bdirect"
|
||||
fi
|
||||
fi
|
||||
if test -n "$GNU_CC"; then
|
||||
CFLAGS="$CFLAGS -Wall"
|
||||
|
@ -2594,8 +2636,8 @@ case "$target" in
|
|||
AC_DEFINE(_PR_LOCAL_THREADS_ONLY)
|
||||
fi
|
||||
;;
|
||||
*-mingw*|*-cygwin*|*-msvc*|*-mks*|*-os2*|*-beos*)
|
||||
dnl win32, os2 & beos cannot use pthreads
|
||||
*-mingw*|*-cygwin*|*-msvc*|*-mks*|*-wince*|*-os2*|*-beos*)
|
||||
dnl win32, wince, os2 & beos cannot use pthreads
|
||||
USE_PTHREADS=
|
||||
_PTHREAD_LDFLAGS=
|
||||
USE_USER_PTHREADS=
|
||||
|
|
|
@ -44,7 +44,7 @@
|
|||
|
||||
#define PR_AF_INET6 30 /* same as AF_INET6 */
|
||||
|
||||
#if defined(__i386__) || defined(__x86_64__)
|
||||
#ifdef __LITTLE_ENDIAN__
|
||||
#undef IS_BIG_ENDIAN
|
||||
#define IS_LITTLE_ENDIAN 1
|
||||
#else
|
||||
|
|
|
@ -72,6 +72,7 @@
|
|||
#define _PR_HAVE_SOCKADDR_LEN
|
||||
#define _PR_STAT_HAS_ST_ATIMESPEC
|
||||
#define _PR_HAVE_LARGE_OFF_T
|
||||
#define _PR_HAVE_SYSV_SEMAPHORES
|
||||
#define PR_HAVE_SYSV_NAMED_SHARED_MEMORY
|
||||
|
||||
#define _PR_INET6
|
||||
|
|
|
@ -417,11 +417,21 @@ extern void _MD_CleanupBeforeExit(void);
|
|||
#elif defined(__arm__)
|
||||
/* ARM/Linux */
|
||||
#if defined(__GLIBC__) && __GLIBC__ >= 2
|
||||
#ifdef __ARM_EABI__
|
||||
/* EABI */
|
||||
#define _MD_GET_SP(_t) (_t)->md.context[0].__jmpbuf[8]
|
||||
#define _MD_SET_FP(_t, val) ((_t)->md.context[0].__jmpbuf[7] = (val))
|
||||
#define _MD_GET_SP_PTR(_t) &(_MD_GET_SP(_t))
|
||||
#define _MD_GET_FP_PTR(_t) (&(_t)->md.context[0].__jmpbuf[7])
|
||||
#define _MD_SP_TYPE __ptr_t
|
||||
#else /* __ARM_EABI__ */
|
||||
/* old ABI */
|
||||
#define _MD_GET_SP(_t) (_t)->md.context[0].__jmpbuf[20]
|
||||
#define _MD_SET_FP(_t, val) ((_t)->md.context[0].__jmpbuf[19] = (val))
|
||||
#define _MD_GET_SP_PTR(_t) &(_MD_GET_SP(_t))
|
||||
#define _MD_GET_FP_PTR(_t) (&(_t)->md.context[0].__jmpbuf[19])
|
||||
#define _MD_SP_TYPE __ptr_t
|
||||
#endif /* __ARM_EABI__ */
|
||||
#else
|
||||
#error "ARM/Linux pre-glibc2 not supported yet"
|
||||
#endif /* defined(__GLIBC__) && __GLIBC__ >= 2 */
|
||||
|
|
|
@ -46,9 +46,15 @@
|
|||
#define WIN32
|
||||
#endif
|
||||
|
||||
#ifdef _WIN32_WCE
|
||||
#ifndef WINCE
|
||||
#define WINCE
|
||||
#endif
|
||||
#else
|
||||
#ifndef WIN95
|
||||
#define WIN95
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#define PR_AF_INET6 23 /* same as AF_INET6 */
|
||||
|
||||
|
@ -98,7 +104,7 @@
|
|||
#define PR_ALIGN_OF_POINTER 4
|
||||
|
||||
#define PR_BYTES_PER_WORD_LOG2 2
|
||||
#define PR_BYTES_PER_DWORD_LOG2 2
|
||||
#define PR_BYTES_PER_DWORD_LOG2 3
|
||||
|
||||
#elif defined(_ALPHA_)
|
||||
|
||||
|
@ -242,6 +248,54 @@
|
|||
#define PR_BYTES_PER_WORD_LOG2 3
|
||||
#define PR_BYTES_PER_DWORD_LOG2 3
|
||||
|
||||
#elif defined(_ARM_)
|
||||
|
||||
#define IS_LITTLE_ENDIAN 1
|
||||
#undef IS_BIG_ENDIAN
|
||||
|
||||
#define PR_BYTES_PER_BYTE 1
|
||||
#define PR_BYTES_PER_SHORT 2
|
||||
#define PR_BYTES_PER_INT 4
|
||||
#define PR_BYTES_PER_INT64 8
|
||||
#define PR_BYTES_PER_LONG 4
|
||||
#define PR_BYTES_PER_FLOAT 4
|
||||
#define PR_BYTES_PER_WORD 4
|
||||
#define PR_BYTES_PER_DWORD 8
|
||||
#define PR_BYTES_PER_DOUBLE 8
|
||||
|
||||
#define PR_BITS_PER_BYTE 8
|
||||
#define PR_BITS_PER_SHORT 16
|
||||
#define PR_BITS_PER_INT 32
|
||||
#define PR_BITS_PER_INT64 64
|
||||
#define PR_BITS_PER_LONG 32
|
||||
#define PR_BITS_PER_FLOAT 32
|
||||
#define PR_BITS_PER_WORD 32
|
||||
#define PR_BITS_PER_DWORD 64
|
||||
#define PR_BITS_PER_DOUBLE 64
|
||||
|
||||
#define PR_BITS_PER_BYTE_LOG2 3
|
||||
#define PR_BITS_PER_SHORT_LOG2 4
|
||||
#define PR_BITS_PER_INT_LOG2 5
|
||||
#define PR_BITS_PER_INT64_LOG2 6
|
||||
#define PR_BITS_PER_LONG_LOG2 5
|
||||
#define PR_BITS_PER_FLOAT_LOG2 5
|
||||
#define PR_BITS_PER_WORD_LOG2 5
|
||||
#define PR_BITS_PER_DWORD_LOG2 6
|
||||
#define PR_BITS_PER_DOUBLE_LOG2 6
|
||||
|
||||
#define PR_ALIGN_OF_SHORT 2
|
||||
#define PR_ALIGN_OF_INT 4
|
||||
#define PR_ALIGN_OF_LONG 4
|
||||
#define PR_ALIGN_OF_INT64 8
|
||||
#define PR_ALIGN_OF_FLOAT 4
|
||||
#define PR_ALIGN_OF_WORD 4
|
||||
#define PR_ALIGN_OF_DWORD 8
|
||||
#define PR_ALIGN_OF_DOUBLE 4
|
||||
#define PR_ALIGN_OF_POINTER 4
|
||||
|
||||
#define PR_BYTES_PER_WORD_LOG2 2
|
||||
#define PR_BYTES_PER_DWORD_LOG2 3
|
||||
|
||||
#else /* defined(_M_IX86) || defined(_X86_) */
|
||||
|
||||
#error unknown processor architecture
|
||||
|
|
|
@ -56,6 +56,8 @@
|
|||
#define _PR_SI_ARCHITECTURE "x86-64"
|
||||
#elif defined(_IA64_)
|
||||
#define _PR_SI_ARCHITECTURE "ia64"
|
||||
#elif defined(_ARM_)
|
||||
#define _PR_SI_ARCHITECTURE "arm"
|
||||
#else
|
||||
#error unknown processor architecture
|
||||
#endif
|
||||
|
|
|
@ -51,7 +51,7 @@ PR_BEGIN_EXTERN_C
|
|||
#ifdef WINNT
|
||||
#include "md/_winnt.h"
|
||||
#include "md/_win32_errors.h"
|
||||
#elif defined(WIN95)
|
||||
#elif defined(WIN95) || defined(WINCE)
|
||||
#include "md/_win95.h"
|
||||
#include "md/_win32_errors.h"
|
||||
#elif defined(WIN16)
|
||||
|
|
|
@ -110,7 +110,7 @@ NSPR_API(PRInt32) PR_AtomicAdd(PRInt32 *ptr, PRInt32 val);
|
|||
** the macros and functions won't be compatible and can't be used
|
||||
** interchangeably.
|
||||
*/
|
||||
#if defined(_WIN32) && (_MSC_VER >= 1310)
|
||||
#if defined(_WIN32) && !defined(_WIN32_WCE) && (_MSC_VER >= 1310)
|
||||
|
||||
long __cdecl _InterlockedIncrement(long volatile *Addend);
|
||||
#pragma intrinsic(_InterlockedIncrement)
|
||||
|
|
|
@ -63,11 +63,11 @@ PR_BEGIN_EXTERN_C
|
|||
** The format of the version string is
|
||||
** "<major version>.<minor version>[.<patch level>] [<Beta>]"
|
||||
*/
|
||||
#define PR_VERSION "4.7.2"
|
||||
#define PR_VERSION "4.7.4 Beta"
|
||||
#define PR_VMAJOR 4
|
||||
#define PR_VMINOR 7
|
||||
#define PR_VPATCH 2
|
||||
#define PR_BETA PR_FALSE
|
||||
#define PR_VPATCH 4
|
||||
#define PR_BETA PR_TRUE
|
||||
|
||||
/*
|
||||
** PRVersionCheck
|
||||
|
|
|
@ -392,7 +392,7 @@ NSPR_API(PRStatus) PR_GetProtoByNumber(
|
|||
/***********************************************************************
|
||||
** FUNCTION:
|
||||
** DESCRIPTION: PR_GetAddrInfoByName()
|
||||
** Lookup a host by name. Equivalent to getaddrinfo(host, NULL, ...) of
|
||||
** Look up a host by name. Equivalent to getaddrinfo(host, NULL, ...) of
|
||||
** RFC 3493.
|
||||
**
|
||||
** INPUTS:
|
||||
|
@ -438,7 +438,7 @@ NSPR_API(void) PR_FreeAddrInfo(PRAddrInfo *addrInfo);
|
|||
** INPUTS:
|
||||
** void *enumPtr Index pointer of the enumeration. The enumeration
|
||||
** starts and ends with a value of NULL.
|
||||
** PRAddrInfo *addrInfo
|
||||
** const PRAddrInfo *addrInfo
|
||||
** The PRAddrInfo handle returned by a successful
|
||||
** call to PR_GetAddrInfoByName().
|
||||
** PRUint16 port The port number to be assigned as part of the
|
||||
|
@ -446,11 +446,11 @@ NSPR_API(void) PR_FreeAddrInfo(PRAddrInfo *addrInfo);
|
|||
** OUTPUTS:
|
||||
** PRNetAddr *result A pointer to an address structure that will be
|
||||
** filled in by the call to the enumeration if the
|
||||
** result of the call is greater than zero.
|
||||
** result of the call is not NULL.
|
||||
** RETURN:
|
||||
** void* The value that should be used for the next call
|
||||
** of the enumerator ('enumPtr'). The enumeration
|
||||
** is ended if this value is returned NULL.
|
||||
** is ended if this value is NULL.
|
||||
***********************************************************************/
|
||||
NSPR_API(void *) PR_EnumerateAddrInfo(
|
||||
void *enumPtr, const PRAddrInfo *addrInfo, PRUint16 port, PRNetAddr *result);
|
||||
|
@ -462,7 +462,7 @@ NSPR_API(void *) PR_EnumerateAddrInfo(
|
|||
** PR_GetAddrInfoByName().
|
||||
**
|
||||
** INPUTS:
|
||||
** PRAddrInfo *addrInfo
|
||||
** const PRAddrInfo *addrInfo
|
||||
** The PRAddrInfo handle returned by a successful
|
||||
** call to PR_GetAddrInfoByName().
|
||||
** RETURN:
|
||||
|
|
|
@ -44,7 +44,7 @@
|
|||
#include <image.h>
|
||||
#endif
|
||||
|
||||
#ifdef XP_MACOSX
|
||||
#if defined(XP_MACOSX) && defined(USE_MACH_DYLD)
|
||||
#include <CodeFragments.h>
|
||||
#include <TextUtils.h>
|
||||
#include <Types.h>
|
||||
|
@ -155,8 +155,8 @@ struct _imcb *IAC$GL_IMAGE_LIST = NULL;
|
|||
/*
|
||||
* On these platforms, symbols have a leading '_'.
|
||||
*/
|
||||
#if defined(SUNOS4) || defined(DARWIN) || defined(NEXTSTEP) \
|
||||
|| defined(WIN16) || defined(XP_OS2) \
|
||||
#if defined(SUNOS4) || (defined(DARWIN) && defined(USE_MACH_DYLD)) \
|
||||
|| defined(NEXTSTEP) || defined(WIN16) || defined(XP_OS2) \
|
||||
|| ((defined(OPENBSD) || defined(NETBSD)) && !defined(__ELF__))
|
||||
#define NEED_LEADING_UNDERSCORE
|
||||
#endif
|
||||
|
@ -179,7 +179,7 @@ struct PRLibrary {
|
|||
#endif
|
||||
#endif
|
||||
|
||||
#ifdef XP_MACOSX
|
||||
#if defined(XP_MACOSX) && defined(USE_MACH_DYLD)
|
||||
CFragConnectionID connection;
|
||||
CFBundleRef bundle;
|
||||
Ptr main;
|
||||
|
@ -223,15 +223,7 @@ static int pr_ConvertUTF16toUTF8(LPCWSTR wname, LPSTR name, int len);
|
|||
/************************************************************************/
|
||||
|
||||
#if !defined(USE_DLFCN) && !defined(HAVE_STRERROR)
|
||||
static char* errStrBuf = NULL;
|
||||
#define ERR_STR_BUF_LENGTH 20
|
||||
static char* errno_string(PRIntn oserr)
|
||||
{
|
||||
if (errStrBuf == NULL)
|
||||
errStrBuf = PR_MALLOC(ERR_STR_BUF_LENGTH);
|
||||
PR_snprintf(errStrBuf, ERR_STR_BUF_LENGTH, "error %d", oserr);
|
||||
return errStrBuf;
|
||||
}
|
||||
#endif
|
||||
|
||||
static void DLLErrorInternal(PRIntn oserr)
|
||||
|
@ -247,7 +239,9 @@ static void DLLErrorInternal(PRIntn oserr)
|
|||
#elif defined(HAVE_STRERROR)
|
||||
error = strerror(oserr); /* this should be okay */
|
||||
#else
|
||||
error = errno_string(oserr);
|
||||
char errStrBuf[ERR_STR_BUF_LENGTH];
|
||||
PR_snprintf(errStrBuf, sizeof(errStrBuf), "error %d", oserr);
|
||||
error = errStrBuf;
|
||||
#endif
|
||||
if (NULL != error)
|
||||
PR_SetErrorText(strlen(error), error);
|
||||
|
@ -382,10 +376,6 @@ void _PR_ShutdownLinker(void)
|
|||
free(_pr_currentLibPath);
|
||||
_pr_currentLibPath = NULL;
|
||||
}
|
||||
|
||||
#if !defined(USE_DLFCN) && !defined(HAVE_STRERROR)
|
||||
PR_DELETE(errStrBuf);
|
||||
#endif
|
||||
}
|
||||
#endif
|
||||
|
||||
|
@ -629,7 +619,7 @@ pr_LoadMachDyldModule(const char *name)
|
|||
}
|
||||
#endif
|
||||
|
||||
#ifdef XP_MACOSX
|
||||
#if defined(XP_MACOSX) && defined(USE_MACH_DYLD)
|
||||
|
||||
/*
|
||||
** macLibraryLoadProc is a function definition for a Mac shared library
|
||||
|
@ -788,7 +778,7 @@ pr_LoadViaDyld(const char *name, PRLibrary *lm)
|
|||
return (lm->dlh != NULL || lm->image != NULL) ? PR_SUCCESS : PR_FAILURE;
|
||||
}
|
||||
|
||||
#endif /* XP_MACOSX */
|
||||
#endif /* XP_MACOSX && USE_MACH_DYLD */
|
||||
|
||||
#ifdef WIN95
|
||||
static HMODULE WINAPI
|
||||
|
@ -926,7 +916,7 @@ pr_LoadLibraryByPathname(const char *name, PRIntn flags)
|
|||
}
|
||||
#endif /* WIN32 || WIN16 */
|
||||
|
||||
#ifdef XP_MACOSX
|
||||
#if defined(XP_MACOSX) && defined(USE_MACH_DYLD)
|
||||
{
|
||||
int i;
|
||||
PRStatus status;
|
||||
|
@ -954,7 +944,7 @@ pr_LoadLibraryByPathname(const char *name, PRIntn flags)
|
|||
}
|
||||
#endif
|
||||
|
||||
#if defined(XP_UNIX) && !defined(XP_MACOSX)
|
||||
#if defined(XP_UNIX) && !(defined(XP_MACOSX) && defined(USE_MACH_DYLD))
|
||||
#ifdef HAVE_DLL
|
||||
{
|
||||
#if defined(USE_DLFCN)
|
||||
|
@ -1018,7 +1008,7 @@ pr_LoadLibraryByPathname(const char *name, PRIntn flags)
|
|||
pr_loadmap = lm;
|
||||
}
|
||||
#endif /* HAVE_DLL */
|
||||
#endif /* XP_UNIX */
|
||||
#endif /* XP_UNIX && !(XP_MACOSX && USE_MACH_DYLD) */
|
||||
|
||||
lm->refCount = 1;
|
||||
|
||||
|
@ -1299,7 +1289,7 @@ PR_UnloadLibrary(PRLibrary *lib)
|
|||
}
|
||||
#endif /* XP_PC */
|
||||
|
||||
#ifdef XP_MACOSX
|
||||
#if defined(XP_MACOSX) && defined(USE_MACH_DYLD)
|
||||
/* Close the connection */
|
||||
if (lib->connection)
|
||||
CloseConnection(&(lib->connection));
|
||||
|
@ -1398,7 +1388,7 @@ pr_FindSymbolInLib(PRLibrary *lm, const char *name)
|
|||
f = GetProcAddress(lm->dlh, name);
|
||||
#endif /* WIN32 || WIN16 */
|
||||
|
||||
#ifdef XP_MACOSX
|
||||
#if defined(XP_MACOSX) && defined(USE_MACH_DYLD)
|
||||
/* add this offset to skip the leading underscore in name */
|
||||
#define SYM_OFFSET 1
|
||||
if (lm->bundle) {
|
||||
|
@ -1439,7 +1429,7 @@ pr_FindSymbolInLib(PRLibrary *lm, const char *name)
|
|||
f = NULL;
|
||||
}
|
||||
#undef SYM_OFFSET
|
||||
#endif /* XP_MACOSX */
|
||||
#endif /* XP_MACOSX && USE_MACH_DYLD */
|
||||
|
||||
#ifdef XP_BEOS
|
||||
if( B_NO_ERROR != get_image_symbol( (image_id)lm->dlh, name, B_SYMBOL_TYPE_TEXT, &f ) ) {
|
||||
|
@ -1627,7 +1617,8 @@ PR_IMPLEMENT(char *)
|
|||
PR_GetLibraryFilePathname(const char *name, PRFuncPtr addr)
|
||||
{
|
||||
#if defined(USE_DLFCN) && (defined(SOLARIS) || defined(FREEBSD) \
|
||||
|| defined(LINUX) || defined(__GNU__) || defined(__GLIBC__))
|
||||
|| defined(LINUX) || defined(__GNU__) || defined(__GLIBC__) \
|
||||
|| defined(DARWIN))
|
||||
Dl_info dli;
|
||||
char *result;
|
||||
|
||||
|
|
|
@ -42,15 +42,34 @@
|
|||
|
||||
#include "primpl.h"
|
||||
|
||||
#ifdef WINCE
|
||||
typedef DWORD (*IntervalFuncType)(void);
|
||||
static IntervalFuncType intervalFunc;
|
||||
#endif
|
||||
|
||||
void
|
||||
_PR_MD_INTERVAL_INIT()
|
||||
{
|
||||
#ifdef WINCE
|
||||
HMODULE mmtimerlib = LoadLibraryW(L"mmtimer.dll"); /* XXX leaked! */
|
||||
if (mmtimerlib) {
|
||||
intervalFunc = (IntervalFuncType)GetProcAddress(mmtimerlib,
|
||||
"timeGetTime");
|
||||
} else {
|
||||
intervalFunc = &GetTickCount;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
PRIntervalTime
|
||||
_PR_MD_GET_INTERVAL()
|
||||
{
|
||||
return timeGetTime(); /* milliseconds since system start */
|
||||
/* milliseconds since system start */
|
||||
#ifdef WINCE
|
||||
return (*intervalFunc)();
|
||||
#else
|
||||
return timeGetTime();
|
||||
#endif
|
||||
}
|
||||
|
||||
PRIntervalTime
|
||||
|
|
|
@ -247,6 +247,12 @@ PRInt32 _PR_MD_PR_POLL(PRPollDesc *pds, PRIntn npds, PRIntervalTime timeout)
|
|||
|
||||
if (0 != ready) return ready; /* no need to block */
|
||||
|
||||
/*
|
||||
* FD_SET does nothing if the fd_set's internal fd_array is full. If
|
||||
* nrd, nwt, or nex is greater than FD_SETSIZE, we know FD_SET must
|
||||
* have failed to insert an osfd into the corresponding fd_set, and
|
||||
* therefore we should fail.
|
||||
*/
|
||||
if ((nrd > FD_SETSIZE) || (nwt > FD_SETSIZE) || (nex > FD_SETSIZE)) {
|
||||
PR_SetError(PR_INVALID_ARGUMENT_ERROR, 0);
|
||||
return -1;
|
||||
|
|
|
@ -812,7 +812,7 @@ PR_IMPLEMENT(PRStatus) PR_DeleteSemaphore(const char *name)
|
|||
*/
|
||||
#if (defined(__GNU_LIBRARY__) && !defined(_SEM_SEMUN_UNDEFINED)) \
|
||||
|| defined(FREEBSD) || defined(OPENBSD) || defined(BSDI) \
|
||||
|| defined(SYMBIAN)
|
||||
|| defined(DARWIN) || defined(SYMBIAN)
|
||||
/* union semun is defined by including <sys/sem.h> */
|
||||
#else
|
||||
/* according to X/OPEN we have to define it ourselves */
|
||||
|
|
|
@ -121,18 +121,27 @@ $lprog = shift;
|
|||
}
|
||||
|
||||
sub print_end {
|
||||
$lprog = shift;
|
||||
$lstatus = shift;
|
||||
($lprog, $exit_status, $exit_signal, $exit_core) = @_;
|
||||
|
||||
if ($lstatus == 0) {
|
||||
if (($exit_status == 0) && ($exit_signal == 0) && ($exit_core == 0)) {
|
||||
$str_status = "Passed";
|
||||
} else {
|
||||
$str_status = "FAILED";
|
||||
}
|
||||
if ($exit_signal != 0) {
|
||||
$str_signal = " - signal $exit_signal";
|
||||
} else {
|
||||
$str_signal = "";
|
||||
}
|
||||
if ($exit_core != 0) {
|
||||
$str_core = " - core dumped";
|
||||
} else {
|
||||
$str_core = "";
|
||||
}
|
||||
$now = getTime;
|
||||
# Full output
|
||||
print "\nEND TEST: $lprog ($now)\n";
|
||||
print "TEST STATUS: $lprog = $str_status (errno $lstatus)\n";
|
||||
print "TEST STATUS: $lprog = $str_status (exit status " . $exit_status . $str_signal . $str_core . ")\n";
|
||||
print "--------------------------------------------------\n\n";
|
||||
# Summary output
|
||||
print OF "\t\t\t$str_status\n";
|
||||
|
@ -147,6 +156,9 @@ $lprog = shift; # command to run
|
|||
setsid or die "setsid failed: $!";
|
||||
# Start test program
|
||||
exec("./$lprog");
|
||||
# We should not be here unless exec failed.
|
||||
print "Faild to exec $lprog";
|
||||
exit 1 << 8;
|
||||
}
|
||||
|
||||
sub ux_wait_timeout {
|
||||
|
@ -171,7 +183,7 @@ $ltimeout = shift; # timeout
|
|||
$ltimeout--;
|
||||
} else {
|
||||
# Child has ended
|
||||
$lstatus = $? % 256;
|
||||
$lstatus = $?;
|
||||
# Exit the wait loop and don't kill
|
||||
$ltimeout = -1;
|
||||
}
|
||||
|
@ -183,7 +195,7 @@ $ltimeout = shift; # timeout
|
|||
print "Timeout ! Kill child process $lpid\n";
|
||||
# Kill the child process and group
|
||||
kill(-9,$lpid);
|
||||
$lstatus = 1;
|
||||
$lstatus = 9;
|
||||
}
|
||||
|
||||
return $lstatus;
|
||||
|
@ -201,7 +213,11 @@ $prog = shift; # Program to test
|
|||
} else {
|
||||
# we are in the parent process
|
||||
$status = ux_wait_timeout($child_pid,$timeout);
|
||||
print_end($prog, $status);
|
||||
# See Perlvar for documentation of $?
|
||||
# exit status = $status >> 8
|
||||
# exit signal = $status & 127 (no signal = 0)
|
||||
# core dump = $status & 128 (no core = 0)
|
||||
print_end($prog, $status >> 8, $status & 127, $status & 128);
|
||||
}
|
||||
|
||||
return $status;
|
||||
|
@ -246,12 +262,13 @@ $prog = shift; # Program to test
|
|||
if ( $retwait == 0) {
|
||||
# the prog didn't finish after the timeout: kill
|
||||
$ProcessObj->Kill($status);
|
||||
print "Timeout ! Process killed with error code $status\n";
|
||||
print "Timeout ! Process killed with exit status $status\n";
|
||||
} else {
|
||||
# the prog finished before the timeout: get exit code
|
||||
# the prog finished before the timeout: get exit status
|
||||
$ProcessObj->GetExitCode($status);
|
||||
}
|
||||
print_end($prog,$status);
|
||||
# There is no signal, no core on Windows
|
||||
print_end($prog, $status, 0, 0);
|
||||
|
||||
return $status
|
||||
}
|
||||
|
@ -373,7 +390,6 @@ $prog = shift; # Program to test
|
|||
open_log;
|
||||
|
||||
foreach $current_prog (@progs) {
|
||||
# print "Current_prog=$current_prog\n";
|
||||
if ($osname =~ $WINOS) {
|
||||
win_test_prog($current_prog);
|
||||
} else {
|
||||
|
|
|
@ -52,9 +52,10 @@
|
|||
#include <stdlib.h>
|
||||
|
||||
/*
|
||||
* This release (4.7.2) is backward compatible with the
|
||||
* 4.0.x, 4.1.x, 4.2.x, 4.3.x, 4.4.x, 4.5.x, 4.6.x, 4.7, and
|
||||
* 4.7.1 releases. It, of course, is compatible with itself.
|
||||
* This release (4.7.4) is backward compatible with the
|
||||
* 4.0.x, 4.1.x, 4.2.x, 4.3.x, 4.4.x, 4.5.x, 4.6.x, 4.7,
|
||||
* 4.7.1, 4.7.2, and 4.7.3 releases. It, of course, is
|
||||
* compatible with itself.
|
||||
*/
|
||||
static char *compatible_version[] = {
|
||||
"4.0", "4.0.1", "4.1", "4.1.1", "4.1.2", "4.1.3",
|
||||
|
@ -62,7 +63,7 @@ static char *compatible_version[] = {
|
|||
"4.5", "4.5.1",
|
||||
"4.6", "4.6.1", "4.6.2", "4.6.3", "4.6.4", "4.6.5",
|
||||
"4.6.6", "4.6.7", "4.6.8",
|
||||
"4.7", "4.7.1", PR_VERSION
|
||||
"4.7", "4.7.1", "4.7.2", "4.7.3", PR_VERSION
|
||||
};
|
||||
|
||||
/*
|
||||
|
|
|
@ -538,9 +538,8 @@ TagAutoCompleteSearch.prototype = {
|
|||
if (self._stopped)
|
||||
yield false;
|
||||
// for each match, prepend what the user has typed so far
|
||||
var pattern = new RegExp("(^" + searchResults[i] + "$|" + searchResults[i] + "(,|;))");
|
||||
if (searchResults[i].indexOf(searchString) == 0 &&
|
||||
!pattern.test(before)) {
|
||||
comments.indexOf(searchResults[i]) == -1) {
|
||||
results.push(before + searchResults[i]);
|
||||
comments.push(searchResults[i]);
|
||||
}
|
||||
|
@ -577,12 +576,15 @@ TagAutoCompleteSearch.prototype = {
|
|||
driveGenerator();
|
||||
},
|
||||
|
||||
/**
|
||||
* nsITimer callback
|
||||
*/
|
||||
notify: function PTACS_notify(timer) {
|
||||
if (this._callback)
|
||||
this._callback();
|
||||
},
|
||||
|
||||
/*
|
||||
/**
|
||||
* Stop an asynchronous search that is in progress
|
||||
*/
|
||||
stopSearch: function PTACS_stopSearch() {
|
||||
|
|
|
@ -161,7 +161,7 @@ var tests = [
|
|||
* Test tag autocomplete
|
||||
*/
|
||||
function run_test() {
|
||||
tagssvc.tagURI(uri1, ["bar", "baz", "boo"]);
|
||||
tagssvc.tagURI(uri1, ["bar", "baz", "boo", "*nix"]);
|
||||
|
||||
tests[0]();
|
||||
}
|
||||
|
|
|
@ -1797,17 +1797,13 @@ nsChildView::OnPaint(nsPaintEvent &event)
|
|||
}
|
||||
|
||||
|
||||
// this is handled for us by UpdateWidget
|
||||
// The OS manages repaints well enough on its own, so we don't have to
|
||||
// flush them out here. In other words, the OS will automatically call
|
||||
// displayIfNeeded at the appropriate times, so we don't need to do it
|
||||
// ourselves. See bmo bug 459319.
|
||||
NS_IMETHODIMP nsChildView::Update()
|
||||
{
|
||||
NS_OBJC_BEGIN_TRY_ABORT_BLOCK_NSRESULT;
|
||||
|
||||
// Update means "Flush any pending changes right now." It does *not* mean
|
||||
// repaint the world. :) -- dwh
|
||||
[mView displayIfNeeded];
|
||||
return NS_OK;
|
||||
|
||||
NS_OBJC_END_TRY_ABORT_BLOCK_NSRESULT;
|
||||
}
|
||||
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче