Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Webkit Sources Released for BlackBerry - Bundle 278

  • Loading branch information...
commit f6253c09e1121c04aadb86b613bcf54c26db1787 0 parents
@sdevitt sdevitt authored
Showing with 37,376 additions and 0 deletions.
  1. +291 −0 olympia/.gitattributes
  2. +35 −0 olympia/.gitignore
  3. +320 −0 olympia/Android.mk
  4. +6 −0 olympia/BugsSite/.cvsignore
  5. +7 −0 olympia/BugsSite/.htaccess
  6. +697 −0 olympia/BugsSite/Bugzilla.pm
  7. +1 −0  olympia/BugsSite/Bugzilla/.cvsignore
  8. +3 −0  olympia/BugsSite/Bugzilla/.htaccess
  9. +959 −0 olympia/BugsSite/Bugzilla/Attachment.pm
  10. +295 −0 olympia/BugsSite/Bugzilla/Attachment/PatchReader.pm
  11. +460 −0 olympia/BugsSite/Bugzilla/Auth.pm
  12. +125 −0 olympia/BugsSite/Bugzilla/Auth/Login.pm
  13. +86 −0 olympia/BugsSite/Bugzilla/Auth/Login/CGI.pm
  14. +96 −0 olympia/BugsSite/Bugzilla/Auth/Login/Cookie.pm
  15. +52 −0 olympia/BugsSite/Bugzilla/Auth/Login/Env.pm
  16. +87 −0 olympia/BugsSite/Bugzilla/Auth/Login/Stack.pm
  17. +166 −0 olympia/BugsSite/Bugzilla/Auth/Persist/Cookie.pm
  18. +235 −0 olympia/BugsSite/Bugzilla/Auth/Verify.pm
  19. +83 −0 olympia/BugsSite/Bugzilla/Auth/Verify/DB.pm
  20. +176 −0 olympia/BugsSite/Bugzilla/Auth/Verify/LDAP.pm
  21. +64 −0 olympia/BugsSite/Bugzilla/Auth/Verify/RADIUS.pm
  22. +81 −0 olympia/BugsSite/Bugzilla/Auth/Verify/Stack.pm
  23. +3,517 −0 olympia/BugsSite/Bugzilla/Bug.pm
  24. +737 −0 olympia/BugsSite/Bugzilla/BugMail.pm
  25. +409 −0 olympia/BugsSite/Bugzilla/CGI.pm
  26. +446 −0 olympia/BugsSite/Bugzilla/Chart.pm
  27. +252 −0 olympia/BugsSite/Bugzilla/Classification.pm
  28. +647 −0 olympia/BugsSite/Bugzilla/Component.pm
  29. +404 −0 olympia/BugsSite/Bugzilla/Config.pm
  30. +69 −0 olympia/BugsSite/Bugzilla/Config/Admin.pm
  31. +104 −0 olympia/BugsSite/Bugzilla/Config/Attachment.pm
  32. +135 −0 olympia/BugsSite/Bugzilla/Config/Auth.pm
  33. +115 −0 olympia/BugsSite/Bugzilla/Config/BugChange.pm
  34. +126 −0 olympia/BugsSite/Bugzilla/Config/BugFields.pm
  35. +93 −0 olympia/BugsSite/Bugzilla/Config/BugMove.pm
  36. +468 −0 olympia/BugsSite/Bugzilla/Config/Common.pm
  37. +133 −0 olympia/BugsSite/Bugzilla/Config/Core.pm
  38. +52 −0 olympia/BugsSite/Bugzilla/Config/DependencyGraph.pm
  39. +108 −0 olympia/BugsSite/Bugzilla/Config/GroupSecurity.pm
  40. +87 −0 olympia/BugsSite/Bugzilla/Config/LDAP.pm
  41. +102 −0 olympia/BugsSite/Bugzilla/Config/MTA.pm
  42. +75 −0 olympia/BugsSite/Bugzilla/Config/PatchViewer.pm
  43. +87 −0 olympia/BugsSite/Bugzilla/Config/Query.pm
  44. +60 −0 olympia/BugsSite/Bugzilla/Config/RADIUS.pm
  45. +73 −0 olympia/BugsSite/Bugzilla/Config/ShadowDB.pm
  46. +71 −0 olympia/BugsSite/Bugzilla/Config/UserMatch.pm
  47. +494 −0 olympia/BugsSite/Bugzilla/Constants.pm
  48. +2,375 −0 olympia/BugsSite/Bugzilla/DB.pm
  49. +967 −0 olympia/BugsSite/Bugzilla/DB/Mysql.pm
  50. +608 −0 olympia/BugsSite/Bugzilla/DB/Oracle.pm
  51. +261 −0 olympia/BugsSite/Bugzilla/DB/Pg.pm
  52. +2,564 −0 olympia/BugsSite/Bugzilla/DB/Schema.pm
  53. +369 −0 olympia/BugsSite/Bugzilla/DB/Schema/Mysql.pm
  54. +403 −0 olympia/BugsSite/Bugzilla/DB/Schema/Oracle.pm
  55. +166 −0 olympia/BugsSite/Bugzilla/DB/Schema/Pg.pm
  56. +234 −0 olympia/BugsSite/Bugzilla/Error.pm
  57. +803 −0 olympia/BugsSite/Bugzilla/Field.pm
  58. +1,187 −0 olympia/BugsSite/Bugzilla/Flag.pm
  59. +482 −0 olympia/BugsSite/Bugzilla/FlagType.pm
  60. +403 −0 olympia/BugsSite/Bugzilla/Group.pm
  61. +401 −0 olympia/BugsSite/Bugzilla/Hook.pm
  62. +452 −0 olympia/BugsSite/Bugzilla/Install.pm
  63. +251 −0 olympia/BugsSite/Bugzilla/Install/CPAN.pm
  64. +3,101 −0 olympia/BugsSite/Bugzilla/Install/DB.pm
  65. +689 −0 olympia/BugsSite/Bugzilla/Install/Filesystem.pm
  66. +452 −0 olympia/BugsSite/Bugzilla/Install/Localconfig.pm
  67. +684 −0 olympia/BugsSite/Bugzilla/Install/Requirements.pm
  68. +553 −0 olympia/BugsSite/Bugzilla/Install/Util.pm
  69. +189 −0 olympia/BugsSite/Bugzilla/Keyword.pm
  70. +205 −0 olympia/BugsSite/Bugzilla/Mailer.pm
  71. +375 −0 olympia/BugsSite/Bugzilla/Milestone.pm
  72. +802 −0 olympia/BugsSite/Bugzilla/Object.pm
  73. +469 −0 olympia/BugsSite/Bugzilla/Product.pm
  74. +2,068 −0 olympia/BugsSite/Bugzilla/Search.pm
  75. +530 −0 olympia/BugsSite/Bugzilla/Search/Quicksearch.pm
  76. +314 −0 olympia/BugsSite/Bugzilla/Search/Saved.pm
  77. +261 −0 olympia/BugsSite/Bugzilla/Series.pm
  78. +278 −0 olympia/BugsSite/Bugzilla/Status.pm
  79. +924 −0 olympia/BugsSite/Bugzilla/Template.pm
  80. +66 −0 olympia/BugsSite/Bugzilla/Template/Parser.pm
  81. +64 −0 olympia/BugsSite/Bugzilla/Template/Plugin/Bugzilla.pm
  82. +172 −0 olympia/BugsSite/Bugzilla/Template/Plugin/Hook.pm
  83. +65 −0 olympia/BugsSite/Bugzilla/Template/Plugin/User.pm
Sorry, we could not display the entire diff because too many files (105,383) changed.
291 olympia/.gitattributes
@@ -0,0 +1,291 @@
+# To enable automatic merging of ChangeLog files, use the following command:
+# git config merge.changelog.driver "resolve-ChangeLogs --merge-driver %O %A %B"
+ChangeLog* merge=changelog
+
+# To enable smart diffing of ObjC[++] files, run the following commands:
+# git config diff.objcpp.xfuncname "^[-+@a-zA-Z_].*$"
+# git config diff.objcppheader.xfuncname "^[@a-zA-Z_].*$"
+*.m diff=objc
+*.mm diff=objcpp
+mac/*.h diff=objcppheader
+*/mac/*.h diff=objcppheader
+*/*/mac/*.h diff=objcppheader
+objc/*.h diff=objcppheader
+*/objc/*.h diff=objcppheader
+*/*/objc/*.h diff=objcppheader
+WebKitTools/WebKitLauncher/*.h diff=objcppheader
+
+JavaScriptCore/JavaScriptCore.vcproj/JavaScriptCore.sln -crlf
+JavaScriptCore/JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj -crlf
+JavaScriptCore/JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCoreCF.vsprops -crlf
+JavaScriptCore/JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCoreCFLite.vsprops -crlf
+JavaScriptCore/JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCoreCommon.vsprops -crlf
+JavaScriptCore/JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCoreGenerated.vcproj -crlf
+JavaScriptCore/JavaScriptCore.vcproj/JavaScriptCoreSubmit.sln -crlf
+JavaScriptCore/JavaScriptCore.vcproj/WTF/WTF.vcproj -crlf
+JavaScriptCore/JavaScriptCore.vcproj/WTF/WTFCommon.vsprops -crlf
+JavaScriptCore/JavaScriptCore.vcproj/jsc/jsc.vcproj -crlf
+JavaScriptCore/JavaScriptCore.vcproj/jsc/jscCommon.vsprops -crlf
+JavaScriptCore/JavaScriptCore.vcproj/testapi/testapi.vcproj -crlf
+LayoutTests/dom/svg/level3/xpath/Attribute_Nodes.svg -crlf
+LayoutTests/dom/svg/level3/xpath/Attribute_Nodes_xmlns.svg -crlf
+LayoutTests/dom/svg/level3/xpath/Comment_Nodes.svg -crlf
+LayoutTests/dom/svg/level3/xpath/Conformance_Expressions.svg -crlf
+LayoutTests/dom/svg/level3/xpath/Conformance_ID.svg -crlf
+LayoutTests/dom/svg/level3/xpath/Conformance_hasFeature_3.svg -crlf
+LayoutTests/dom/svg/level3/xpath/Conformance_hasFeature_empty.svg -crlf
+LayoutTests/dom/svg/level3/xpath/Conformance_hasFeature_null.svg -crlf
+LayoutTests/dom/svg/level3/xpath/Conformance_isSupported_3.svg -crlf
+LayoutTests/dom/svg/level3/xpath/Conformance_isSupported_empty.svg -crlf
+LayoutTests/dom/svg/level3/xpath/Conformance_isSupported_null.svg -crlf
+LayoutTests/dom/svg/level3/xpath/Element_Nodes.svg -crlf
+LayoutTests/dom/svg/level3/xpath/Processing_Instruction_Nodes.svg -crlf
+LayoutTests/dom/svg/level3/xpath/Text_Nodes.svg -crlf
+LayoutTests/dom/svg/level3/xpath/XPathEvaluatorCast01.svg -crlf
+LayoutTests/dom/svg/level3/xpath/XPathEvaluator_createExpression_INVALID_EXPRESSION_ERR.svg -crlf
+LayoutTests/dom/svg/level3/xpath/XPathEvaluator_createExpression_NAMESPACE_ERR_01.svg -crlf
+LayoutTests/dom/svg/level3/xpath/XPathEvaluator_createExpression_NAMESPACE_ERR_02.svg -crlf
+LayoutTests/dom/svg/level3/xpath/XPathEvaluator_createExpression_NS.svg -crlf
+LayoutTests/dom/svg/level3/xpath/XPathEvaluator_createExpression_no_NS.svg -crlf
+LayoutTests/dom/svg/level3/xpath/XPathEvaluator_createNSResolver_all.svg -crlf
+LayoutTests/dom/svg/level3/xpath/XPathEvaluator_createNSResolver_document.svg -crlf
+LayoutTests/dom/svg/level3/xpath/XPathEvaluator_createNSResolver_documentElement.svg -crlf
+LayoutTests/dom/svg/level3/xpath/XPathEvaluator_evaluate_INVALID_EXPRESSION_ERR.svg -crlf
+LayoutTests/dom/svg/level3/xpath/XPathEvaluator_evaluate_NAMESPACE_ERR.svg -crlf
+LayoutTests/dom/svg/level3/xpath/XPathEvaluator_evaluate_NOT_SUPPORTED_ERR.svg -crlf
+LayoutTests/dom/svg/level3/xpath/XPathEvaluator_evaluate_TYPE_ERR.svg -crlf
+LayoutTests/dom/svg/level3/xpath/XPathEvaluator_evaluate_WRONG_DOCUMENT_ERR.svg -crlf
+LayoutTests/dom/svg/level3/xpath/XPathEvaluator_evaluate_document.svg -crlf
+LayoutTests/dom/svg/level3/xpath/XPathEvaluator_evaluate_documentElement.svg -crlf
+LayoutTests/dom/svg/level3/xpath/XPathExpression_evaluate_NOT_SUPPORTED_ERR.svg -crlf
+LayoutTests/dom/svg/level3/xpath/XPathExpression_evaluate_WRONG_DOCUMENT_ERR.svg -crlf
+LayoutTests/dom/svg/level3/xpath/XPathExpression_evaluate_document.svg -crlf
+LayoutTests/dom/svg/level3/xpath/XPathExpression_evaluate_documentElement.svg -crlf
+LayoutTests/dom/svg/level3/xpath/XPathNSResolver_lookupNamespaceURI_nist_dmstc.svg -crlf
+LayoutTests/dom/svg/level3/xpath/XPathNSResolver_lookupNamespaceURI_null.svg -crlf
+LayoutTests/dom/svg/level3/xpath/XPathNSResolver_lookupNamespaceURI_prefix.svg -crlf
+LayoutTests/dom/svg/level3/xpath/XPathNSResolver_lookupNamespaceURI_xml.svg -crlf
+LayoutTests/dom/svg/level3/xpath/XPathResult_TYPE_ERR.svg -crlf
+LayoutTests/dom/svg/level3/xpath/XPathResult_booleanValue_false.svg -crlf
+LayoutTests/dom/svg/level3/xpath/XPathResult_booleanValue_true.svg -crlf
+LayoutTests/dom/svg/level3/xpath/XPathResult_invalidIteratorState_ANY_TYPE.svg -crlf
+LayoutTests/dom/svg/level3/xpath/XPathResult_invalidIteratorState_ANY_UNORDERED_NODE_TYPE.svg -crlf
+LayoutTests/dom/svg/level3/xpath/XPathResult_invalidIteratorState_BOOLEAN_TYPE.svg -crlf
+LayoutTests/dom/svg/level3/xpath/XPathResult_invalidIteratorState_FIRST_ORDERED_NODE_TYPE.svg -crlf
+LayoutTests/dom/svg/level3/xpath/XPathResult_invalidIteratorState_NUMBER_TYPE.svg -crlf
+LayoutTests/dom/svg/level3/xpath/XPathResult_invalidIteratorState_ORDERED_NODE_ITERATOR_TYPE.svg -crlf
+LayoutTests/dom/svg/level3/xpath/XPathResult_invalidIteratorState_ORDERED_NODE_SNAPSHOT_TYPE.svg -crlf
+LayoutTests/dom/svg/level3/xpath/XPathResult_invalidIteratorState_STRING_TYPE.svg -crlf
+LayoutTests/dom/svg/level3/xpath/XPathResult_invalidIteratorState_UNORDERED_NODE_ITERATOR_TYPE.svg -crlf
+LayoutTests/dom/svg/level3/xpath/XPathResult_invalidIteratorState_UNORDERED_NODE_SNAPSHOT_TYPE.svg -crlf
+LayoutTests/dom/svg/level3/xpath/XPathResult_iterateNext_INVALID_STATE_ERR.svg -crlf
+LayoutTests/dom/svg/level3/xpath/XPathResult_iteratorNext_ORDERED_NODE_ITERATOR_TYPE.svg -crlf
+LayoutTests/dom/svg/level3/xpath/XPathResult_numberValue.svg -crlf
+LayoutTests/dom/svg/level3/xpath/XPathResult_resultType.svg -crlf
+LayoutTests/dom/svg/level3/xpath/XPathResult_singleNodeValue_ANY_UNORDERED_NODE_TYPE.svg -crlf
+LayoutTests/dom/svg/level3/xpath/XPathResult_singleNodeValue_FIRST_ORDERED_NODE_TYPE.svg -crlf
+LayoutTests/dom/svg/level3/xpath/XPathResult_snapshotItem_ORDERED_NODE_SNAPSHOT_TYPE_null.svg -crlf
+LayoutTests/dom/svg/level3/xpath/XPathResult_snapshotItem_ORDERED_NODE_SNAPSHOT_TYPE_order.svg -crlf
+LayoutTests/dom/svg/level3/xpath/XPathResult_snapshotItem_UNORDERED_NODE_SNAPSHOT_TYPE_count.svg -crlf
+LayoutTests/dom/svg/level3/xpath/XPathResult_snapshotItem_UNORDERED_NODE_SNAPSHOT_TYPE_null.svg -crlf
+LayoutTests/dom/svg/level3/xpath/XPathResult_snapshotLength_ORDERED_NODE_SNAPSHOT_TYPE.svg -crlf
+LayoutTests/dom/svg/level3/xpath/XPathResult_snapshotLength_UNORDERED_NODE_SNAPSHOT_TYPE.svg -crlf
+LayoutTests/dom/svg/level3/xpath/XPathResult_stringValue.svg -crlf
+LayoutTests/editing/execCommand/align-in-span.html -crlf
+LayoutTests/editing/selection/drag-start-event-client-x-y.html -crlf
+LayoutTests/fast/backgrounds/background-position-rounding.html -crlf
+LayoutTests/fast/backgrounds/repeat/resources/background-repeat-shorthand.js -crlf
+LayoutTests/fast/backgrounds/repeat/resources/margin-shorthand.js -crlf
+LayoutTests/fast/block/float/clamped-right-float.html -crlf
+LayoutTests/fast/block/positioning/absolute-with-html-border-quirks.html -crlf
+LayoutTests/fast/block/positioning/absolute-with-html-border-strict.html -crlf
+LayoutTests/fast/canvas/script-tests/canvas-gradient-without-path.js -crlf
+LayoutTests/fast/css/color-quirk.html -crlf
+LayoutTests/fast/css/color-strict.html -crlf
+LayoutTests/fast/css/css1_forward_compatible_parsing.html -crlf
+LayoutTests/fast/css/empty-pseudo-class.html -crlf
+LayoutTests/fast/css/first-child-pseudo-class.html -crlf
+LayoutTests/fast/css/first-of-type-pseudo-class.html -crlf
+LayoutTests/fast/css/last-child-pseudo-class.html -crlf
+LayoutTests/fast/css/last-of-type-pseudo-class.html -crlf
+LayoutTests/fast/css/only-child-pseudo-class.html -crlf
+LayoutTests/fast/css/only-of-type-pseudo-class.html -crlf
+LayoutTests/fast/css/text-input-with-webkit-border-radius.html -crlf
+LayoutTests/fast/dom/Document/open-with-pending-load.html -crlf
+LayoutTests/fast/dom/Element/hostname-host.html -crlf
+LayoutTests/fast/dom/StyleSheet/ownerNode-lifetime-2.html -crlf
+LayoutTests/fast/dom/Window/window-property-clearing-expected.txt -crlf
+LayoutTests/fast/dom/everything-to-string.html -crlf
+LayoutTests/fast/dom/insert-span-into-long-text-bug-28245.html -crlf
+LayoutTests/fast/dom/resources/TestApplet.java -crlf
+LayoutTests/fast/dom/simultaneouslyRegsiteredTimerFireOrder-expected.txt -crlf
+LayoutTests/fast/dom/timer-clear-interval-in-handler-and-generate-error.html -crlf
+LayoutTests/fast/events/keydown-keypress-focus-change.html -crlf
+LayoutTests/fast/events/node-event-anchor-lock.html -crlf
+LayoutTests/fast/events/onload-fires-twice.html -crlf
+LayoutTests/fast/events/set-event-in-another-frame.html -crlf
+LayoutTests/fast/events/set-event-to-null.html -crlf
+LayoutTests/fast/forms/resources/form-and-frame-interaction-retains-values-main.html -crlf
+LayoutTests/fast/forms/resources/form-and-frame-interaction-retains-values-submit.html -crlf
+LayoutTests/fast/forms/select-remove-option.html -crlf
+LayoutTests/fast/forms/select-reset-multiple-selections-4-single-selection.html -crlf
+LayoutTests/fast/forms/textfield-onchange-deletion.html -crlf
+LayoutTests/fast/frames/frame-src-attribute.html -crlf
+LayoutTests/fast/frames/iframe-scroll-page-up-down.html-disabled -crlf
+LayoutTests/fast/frames/javascript-url-as-framesrc-crash.html -crlf
+LayoutTests/fast/frames/resources/iframe-scroll-page-up-down-1.html -crlf
+LayoutTests/fast/frames/resources/iframe-scroll-page-up-down-2.html -crlf
+LayoutTests/fast/frames/viewsource-attribute.html -crlf
+LayoutTests/fast/inline/inline-padding-disables-text-quirk.html -crlf
+LayoutTests/fast/loader/submit-form-while-parsing-1.xhtml -crlf
+LayoutTests/fast/overflow/dynamic-hidden.html -crlf
+LayoutTests/fast/parser/external-entities-in-xslt.xml -crlf
+LayoutTests/fast/parser/external-entities.xml -crlf
+LayoutTests/fast/parser/resources/external-entities.xsl -crlf
+LayoutTests/fast/replaced/replaced-breaking.html -crlf
+LayoutTests/fast/table/dynamic-cellpadding.html -crlf
+LayoutTests/fast/table/fixed-table-with-percent-inside-percent-table.html -crlf
+LayoutTests/fast/table/fixed-table-with-percent-width-inside-auto-table.html -crlf
+LayoutTests/fast/table/fixed-table-with-percent-width-inside-extra-large-div.html -crlf
+LayoutTests/fast/table/fixed-table-with-small-percent-width.html -crlf
+LayoutTests/fast/table/rules-attr-dynchange1.html -crlf
+LayoutTests/fast/table/rules-attr-dynchange2.html -crlf
+LayoutTests/fast/text/international/thai-baht-space.html -crlf
+LayoutTests/fast/text/resources/line-breaks-crlf.txt -crlf
+LayoutTests/fast/text/text-large-negative-letter-spacing-with-opacity.html -crlf
+LayoutTests/fast/text/text-letter-spacing.html -crlf
+LayoutTests/http/tests/appcache/max-size.html -crlf
+LayoutTests/http/tests/misc/location-test-xsl-style-sheet.xml -crlf
+LayoutTests/http/tests/misc/resources/location-test-xsl-style-sheet.xsl -crlf
+LayoutTests/http/tests/misc/single-character-pi-stylesheet.xhtml -crlf
+LayoutTests/http/tests/misc/will-send-request-returns-null-on-redirect.html -crlf
+LayoutTests/http/tests/navigation/no-referrer-reset.html -crlf
+LayoutTests/http/tests/navigation/no-referrer-same-window.html -crlf
+LayoutTests/http/tests/navigation/no-referrer-subframe.html -crlf
+LayoutTests/http/tests/navigation/no-referrer-target-blank.html -crlf
+LayoutTests/http/tests/navigation/resources/no-referrer-same-window-helper.php -crlf
+LayoutTests/http/tests/security/isolatedWorld/events.html -crlf
+LayoutTests/http/tests/security/isolatedWorld/resources/iframe.html -crlf
+LayoutTests/http/tests/security/isolatedWorld/resources/userGestureEvents-second-window.html -crlf
+LayoutTests/http/tests/security/isolatedWorld/userGestureEvents.html -crlf
+LayoutTests/http/tests/security/resources/empty-svg.php -crlf
+LayoutTests/platform/win/fast/events/panScroll-event-fired.html -crlf
+LayoutTests/platform/win/fast/events/panScroll-image-no-scroll.html -crlf
+LayoutTests/platform/win/fast/events/panScroll-imageMap-href-no-scroll.html -crlf
+LayoutTests/platform/win/fast/events/panScroll-imageMap-noHref-scroll.html -crlf
+LayoutTests/platform/win/fast/events/panScroll-nested-divs.html -crlf
+LayoutTests/platform/win/fast/events/panScroll-no-iframe-jump.html -crlf
+LayoutTests/platform/win/fast/events/panScroll-preventDefault.html -crlf
+LayoutTests/svg/custom/marker-opacity.svg -crlf
+LayoutTests/svg/custom/resources/graffiti.svg -crlf
+LayoutTests/svg/custom/struct-use-09-b.svg -crlf
+LayoutTests/svg/custom/svg-fonts-in-html.html -crlf
+LayoutTests/svg/custom/use-events-crash.svg -crlf
+LayoutTests/svg/custom/use-on-symbol-inside-pattern.svg -crlf
+LayoutTests/svg/custom/use-setAttribute-crash.svg -crlf
+LayoutTests/svg/custom/xml-stylesheet.svg -crlf
+LayoutTests/tables/mozilla/bugs/bug119786.html -crlf
+LayoutTests/tables/mozilla/bugs/bug222846.html -crlf
+LayoutTests/tables/mozilla/bugs/bug275625.html -crlf
+LayoutTests/tables/mozilla/images/aboutHeader.gif -crlf
+LayoutTests/tables/mozilla/images/main-horizontal-scroll.gif -crlf
+LayoutTests/tables/mozilla_expected_failures/bugs/bug101759.html -crlf
+LayoutTests/tables/mozilla_expected_failures/bugs/bug14489.html -crlf
+LayoutTests/tables/mozilla_expected_failures/images/aboutHeader.gif -crlf
+LayoutTests/tables/mozilla_expected_failures/images/main-horizontal-scroll.gif -crlf
+LayoutTests/wml/resources/enter-card-with-events.wml -crlf
+LayoutTests/wml/resources/enter-first-card-with-events.wml -crlf
+PageLoadTests/svg/files/Harvey_Rayner.svg -crlf
+PageLoadTests/svg/files/cacuts_01.svg -crlf
+PageLoadTests/svg/files/crawfish2_ganson.svg -crlf
+PageLoadTests/svg/files/france.svg -crlf
+PageLoadTests/svg/files/mtsthelens.svg -crlf
+PageLoadTests/svg/files/worldcup.svg -crlf
+PlanetWebKit/planet/LICENCE -crlf
+SunSpider/tests/parse-only/jquery-1.3.2.js -crlf
+WebCore/WebCore.vcproj/QTMovieWin.vcproj -crlf
+WebCore/WebCore.vcproj/WebCore.sln -crlf
+WebCore/WebCore.vcproj/WebCore.submit.sln -crlf
+WebCore/WebCore.vcproj/WebCore.vcproj -crlf
+WebCore/WebCore.vcproj/WebCoreCFNetwork.vsprops -crlf
+WebCore/WebCore.vcproj/WebCoreCG.vsprops -crlf
+WebCore/WebCore.vcproj/WebCoreCURL.vsprops -crlf
+WebCore/WebCore.vcproj/WebCoreCairo.vsprops -crlf
+WebCore/WebCore.vcproj/WebCoreGenerated.vcproj -crlf
+WebCore/WebCore.vcproj/WebCoreMediaQT.vsprops -crlf
+WebCore/WebCore.vcproj/WebCorePthreads.vsprops -crlf
+WebCore/WebCore.vcproj/WebCoreQuartzCore.vsprops -crlf
+WebCore/accessibility/AccessibilityAllInOne.cpp -crlf
+WebCore/bindings/js/JSExceptionBase.cpp -crlf
+WebCore/bindings/js/JSExceptionBase.h -crlf
+WebCore/manual-tests/DOMContextMenuEvent.html -crlf
+WebCore/manual-tests/cursor-max-size.html -crlf
+WebCore/manual-tests/drag-with-div-or-image-as-data-image.html -crlf
+WebCore/manual-tests/empty-script-crash.html -crlf
+WebCore/manual-tests/remove-form-node-with-radio-buttons-crash.html -crlf
+WebCore/manual-tests/select-delete-item.html -crlf
+WebCore/manual-tests/textarea-caret-position-after-auto-spell-correct.html -crlf
+WebCore/platform/chromium/SuddenTerminationChromium.cpp -crlf
+WebCore/platform/network/win/NetworkStateNotifierWin.cpp -crlf
+WebCore/platform/wx/wxcode/non-kerned-drawing.h -crlf
+WebCore/rendering/RenderThemeChromiumWin.h -crlf
+WebKit/chromium/src/EventListenerWrapper.cpp -crlf
+WebKit/chromium/src/EventListenerWrapper.h -crlf
+WebKit/chromium/src/WebEventListener.cpp -crlf
+WebKit/chromium/src/WebEventListenerPrivate.cpp -crlf
+WebKit/chromium/src/WebEventListenerPrivate.h -crlf
+WebKit/gtk/po/sr.po -crlf
+WebKit/gtk/po/sr@latin.po -crlf
+WebKit/qt/tests/qwebframe/resources/testiframe.html -crlf
+WebKit/qt/tests/qwebframe/resources/testiframe2.html -crlf
+WebKit/win/COMPropertyBag.h -crlf
+WebKit/win/COMVariantSetter.h -crlf
+WebKit/win/Interfaces/IWebEmbeddedView.idl -crlf
+WebKit/win/Interfaces/JavaScriptCoreAPITypes.idl -crlf
+WebKit/win/WebCoreSupport/EmbeddedWidget.cpp -crlf
+WebKit/win/WebCoreSupport/EmbeddedWidget.h -crlf
+WebKit/win/WebCoreSupport/WebInspectorDelegate.h -crlf
+WebKit/win/WebIconFetcher.cpp -crlf
+WebKit/win/WebIconFetcher.h -crlf
+WebKit/win/WebKit.vcproj/Interfaces.vcproj -crlf
+WebKit/win/WebKit.vcproj/WebKit.sln -crlf
+WebKit/win/WebKit.vcproj/WebKit.submit.sln -crlf
+WebKit/win/WebKit.vcproj/WebKit.vcproj -crlf
+WebKit/win/WebKit.vcproj/WebKitGUID.vcproj -crlf
+WebKitLibraries/win/tools/vsprops/WinCairo.vsprops -crlf
+WebKitLibraries/win/tools/vsprops/cURL.vsprops -crlf
+WebKitLibraries/win/tools/vsprops/debug_wincairo.vsprops -crlf
+WebKitSite/blog/license.txt -crlf
+WebKitSite/blog/wp-config-sample.php -crlf
+WebKitSite/blog/wp-config.php -crlf
+WebKitSite/blog/wp-includes/images/crystal/license.txt -crlf
+WebKitSite/blog/wp-includes/js/scriptaculous/MIT-LICENSE -crlf
+WebKitSite/blog/wp-includes/js/swfupload/plugins/swfupload.speed.js -crlf
+WebKitSite/blog/wp-includes/js/tinymce/license.txt -crlf
+WebKitSite/perf/slickspeed/frameworks/DomQuery.js -crlf
+WebKitTools/CLWrapper/CLWrapper.sln -crlf
+WebKitTools/CLWrapper/CLWrapper.vcproj -crlf
+WebKitTools/DumpRenderTree/DumpRenderTree.sln -crlf
+WebKitTools/DumpRenderTree/cairo/PixelDumpSupportCairo.cpp -crlf
+WebKitTools/DumpRenderTree/win/DumpRenderTree.vcproj -crlf
+WebKitTools/DumpRenderTree/win/ImageDiff.vcproj -crlf
+WebKitTools/DumpRenderTree/win/TestNetscapePlugin/TestNetscapePlugin.def -crlf
+WebKitTools/DumpRenderTree/win/TestNetscapePlugin/TestNetscapePlugin.rc -crlf
+WebKitTools/DumpRenderTree/win/TestNetscapePlugin/TestNetscapePlugin.vcproj -crlf
+WebKitTools/FindSafari/FindSafari.vcproj -crlf
+WebKitTools/FindSafari/Safari.exe.manifest -crlf
+WebKitTools/MIDLWrapper/MIDLWrapper.sln -crlf
+WebKitTools/MIDLWrapper/MIDLWrapper.vcproj -crlf
+WebKitTools/Scripts/webkitpy/mock.py -crlf
+WebKitTools/WebKitAPITest/WebKitAPITest.vcproj -crlf
+WebKitTools/WebKitAPITest/WebKitAPITestCommon.vsprops -crlf
+WebKitTools/WebKitLauncherWin/WebKitLauncherWin.vcproj -crlf
+WebKitTools/WinLauncher/WinLauncher.h -crlf
+WebKitTools/WinLauncher/WinLauncher.vcproj -crlf
+WebKitTools/record-memory-win/main.cpp -crlf
+WebKitTools/record-memory-win/record-memory-win.vcproj -crlf
+WebKitTools/TestResultServer/index.yaml -crlf
+WebKitTools/BuildSlaveSupport/win/kill-old-processes -crlf
+WebKitTools/MiniBrowser/MiniBrowser.vcproj -crlf
+WebKitTools/MiniBrowser/win/MiniBrowser.rc -crlf
+
35 olympia/.gitignore
@@ -0,0 +1,35 @@
+*.mode*
+*.pbxuser
+*.perspective*
+*.pyc
+build/
+/WebKitBuild/
+autoinstall.cache.d
+WebKitTools/Scripts/webkitpy/thirdparty/autoinstalled
+
+# Ignore Chromium projects auto-generated from .gyp files:
+JavaScriptCore/JavaScriptCore.gyp/JavaScriptCore.xcodeproj
+WebCore/WebCore.gyp/WebCore.xcodeproj
+WebKit/chromium/WebKit.xcodeproj
+WebKitTools/DumpRenderTree/DumpRenderTree.gyp/DumpRenderTree.xcodeproj
+
+# Ignore status files that manage Chromium dependencies.
+WebKit/chromium/.gclient
+WebKit/chromium/.gclient_entries
+
+# Ignore compiled java tests:
+LayoutTests/java/*.class
+
+# Though the GTK build builds in a subdirectory, autogen.sh still deposits
+# a few files into the source tree.
+/aclocal.m4
+/autom4te.cache
+/autotools
+/autotoolsconfig.h.in
+/configure
+/GNUmakefile.in
+/WebKit/gtk/docs/GNUmakefile.in
+/gtk-doc.make
+/INSTALL
+/README
+*~
320 olympia/Android.mk
@@ -0,0 +1,320 @@
+##
+## Copyright 2009, The Android Open Source Project
+##
+## 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.
+##
+## THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ``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.
+##
+
+LOCAL_PATH := $(call my-dir)
+
+# Two ways to control which JS engine is used:
+# 1. use JS_ENGINE environment variable, value can be either 'jsc' or 'v8'
+# This is the preferred way.
+# 2. if JS_ENGINE is not set, or is not 'jsc' or 'v8', this makefile picks
+# up a default engine to build.
+# To help setup buildbot, a new environment variable, USE_ALT_JS_ENGINE,
+# can be set to true, so that two builds can be different but without
+# specifying which JS engine to use.
+# To enable JIT in Android's JSC, please set ENABLE_JSC_JIT environment
+# variable to true.
+
+# Read JS_ENGINE environment variable
+JAVASCRIPT_ENGINE = $(JS_ENGINE)
+
+ifneq ($(JAVASCRIPT_ENGINE),jsc)
+ ifneq ($(JAVASCRIPT_ENGINE),v8)
+ # No JS engine is specified, pickup the one we want as default.
+ ifeq ($(USE_ALT_JS_ENGINE),true)
+ JAVASCRIPT_ENGINE = v8
+ else
+ JAVASCRIPT_ENGINE = jsc
+ endif
+ endif
+endif
+
+BASE_PATH := $(call my-dir)
+include $(CLEAR_VARS)
+
+# Define our module and find the intermediates directory
+LOCAL_MODULE := libwebcore
+LOCAL_MODULE_CLASS := STATIC_LIBRARIES
+base_intermediates := $(call local-intermediates-dir)
+
+# Using := here prevents recursive expansion
+WEBKIT_SRC_FILES :=
+
+# We have to use bison 2.3
+include $(BASE_PATH)/bison_check.mk
+
+# Build our list of include paths. We include WebKit/android/icu first so that
+# any files that include <unicode/ucnv.h> will include our ucnv.h first. We
+# also add external/ as an include directory so that we can specify the real
+# icu header directory as a more exact reference to avoid including our ucnv.h.
+#
+# Note that JavasCriptCore/ must be included after WebCore/, so that we pick up
+# the right config.h.
+LOCAL_C_INCLUDES := \
+ $(JNI_H_INCLUDE) \
+ $(LOCAL_PATH)/WebKit/android/icu \
+ external/ \
+ external/icu4c/common \
+ external/icu4c/i18n \
+ external/libxml2/include \
+ external/skia/emoji \
+ external/skia/include/core \
+ external/skia/include/effects \
+ external/skia/include/images \
+ external/skia/include/ports \
+ external/skia/include/utils \
+ external/skia/src/ports \
+ external/sqlite/dist \
+ frameworks/base/core/jni/android/graphics
+
+LOCAL_C_INCLUDES := $(LOCAL_C_INCLUDES) \
+ $(LOCAL_PATH)/WebCore \
+ $(LOCAL_PATH)/WebCore/accessibility \
+ $(LOCAL_PATH)/WebCore/css \
+ $(LOCAL_PATH)/WebCore/dom \
+ $(LOCAL_PATH)/WebCore/editing \
+ $(LOCAL_PATH)/WebCore/history \
+ $(LOCAL_PATH)/WebCore/history/android \
+ $(LOCAL_PATH)/WebCore/html \
+ $(LOCAL_PATH)/WebCore/html/canvas \
+ $(LOCAL_PATH)/WebCore/inspector \
+ $(LOCAL_PATH)/WebCore/loader \
+ $(LOCAL_PATH)/WebCore/loader/appcache \
+ $(LOCAL_PATH)/WebCore/loader/icon \
+ $(LOCAL_PATH)/WebCore/notifications \
+ $(LOCAL_PATH)/WebCore/page \
+ $(LOCAL_PATH)/WebCore/page/android \
+ $(LOCAL_PATH)/WebCore/page/animation \
+ $(LOCAL_PATH)/WebCore/platform \
+ $(LOCAL_PATH)/WebCore/platform/android \
+ $(LOCAL_PATH)/WebCore/platform/animation \
+ $(LOCAL_PATH)/WebCore/platform/graphics \
+ $(LOCAL_PATH)/WebCore/platform/graphics/android \
+ $(LOCAL_PATH)/WebCore/platform/graphics/network \
+ $(LOCAL_PATH)/WebCore/platform/graphics/skia \
+ $(LOCAL_PATH)/WebCore/platform/graphics/transforms \
+ $(LOCAL_PATH)/WebCore/platform/image-decoders \
+ $(LOCAL_PATH)/WebCore/platform/mock \
+ $(LOCAL_PATH)/WebCore/platform/network \
+ $(LOCAL_PATH)/WebCore/platform/network/android \
+ $(LOCAL_PATH)/WebCore/platform/sql \
+ $(LOCAL_PATH)/WebCore/platform/text \
+ $(LOCAL_PATH)/WebCore/plugins \
+ $(LOCAL_PATH)/WebCore/plugins/android \
+ $(LOCAL_PATH)/WebCore/rendering \
+ $(LOCAL_PATH)/WebCore/rendering/style \
+ $(LOCAL_PATH)/WebCore/storage \
+ $(LOCAL_PATH)/WebCore/workers \
+ $(LOCAL_PATH)/WebCore/xml
+
+LOCAL_C_INCLUDES := $(LOCAL_C_INCLUDES) \
+ $(LOCAL_PATH)/WebKit/android \
+ $(LOCAL_PATH)/WebKit/android/WebCoreSupport \
+ $(LOCAL_PATH)/WebKit/android/jni \
+ $(LOCAL_PATH)/WebKit/android/nav \
+ $(LOCAL_PATH)/WebKit/android/plugins \
+ $(LOCAL_PATH)/WebKit/android/stl
+
+LOCAL_C_INCLUDES := $(LOCAL_C_INCLUDES) \
+ $(LOCAL_PATH)/JavaScriptCore \
+ $(LOCAL_PATH)/JavaScriptCore/wtf \
+ $(LOCAL_PATH)/JavaScriptCore/wtf/unicode \
+ $(LOCAL_PATH)/JavaScriptCore/wtf/unicode/icu
+
+LOCAL_C_INCLUDES := $(LOCAL_C_INCLUDES) \
+ $(base_intermediates)/WebCore/ \
+ $(base_intermediates)/WebCore/css \
+ $(base_intermediates)/WebCore/html \
+ $(base_intermediates)/WebCore/platform
+
+ifeq ($(ENABLE_SVG), true)
+LOCAL_C_INCLUDES := $(LOCAL_C_INCLUDES) \
+ $(LOCAL_PATH)/WebCore/platform/graphics/filters \
+ $(LOCAL_PATH)/WebCore/svg \
+ $(LOCAL_PATH)/WebCore/svg/animation \
+ $(LOCAL_PATH)/WebCore/svg/graphics \
+ $(LOCAL_PATH)/WebCore/svg/graphics/filters \
+ $(base_intermediates)/WebCore/svg
+endif
+
+ifeq ($(JAVASCRIPT_ENGINE),v8)
+# Include WTF source file.
+d := JavaScriptCore
+LOCAL_PATH := $(BASE_PATH)/$d
+intermediates := $(base_intermediates)/$d
+include $(LOCAL_PATH)/Android.v8.wtf.mk
+WEBKIT_SRC_FILES += $(addprefix $d/,$(LOCAL_SRC_FILES))
+endif # JAVASCRIPT_ENGINE == v8
+
+# Include source files for WebCore
+d := WebCore
+LOCAL_PATH := $(BASE_PATH)/$d
+JAVASCRIPTCORE_PATH := $(BASE_PATH)/JavaScriptCore
+intermediates := $(base_intermediates)/$d
+include $(LOCAL_PATH)/Android.mk
+ifeq ($(JAVASCRIPT_ENGINE),jsc)
+include $(LOCAL_PATH)/Android.jscbindings.mk
+endif
+ifeq ($(JAVASCRIPT_ENGINE),v8)
+include $(LOCAL_PATH)/Android.v8bindings.mk
+endif
+WEBKIT_SRC_FILES += $(addprefix $d/,$(LOCAL_SRC_FILES))
+LOCAL_C_INCLUDES += $(BINDING_C_INCLUDES)
+
+# Include the derived source files for WebCore. Uses the same path as
+# WebCore
+include $(LOCAL_PATH)/Android.derived.mk
+ifeq ($(JAVASCRIPT_ENGINE),jsc)
+include $(LOCAL_PATH)/Android.derived.jscbindings.mk
+endif
+ifeq ($(JAVASCRIPT_ENGINE),v8)
+include $(LOCAL_PATH)/Android.derived.v8bindings.mk
+endif
+
+# Redefine LOCAL_PATH here so the build system is not confused
+LOCAL_PATH := $(BASE_PATH)
+
+# Define our compiler flags
+LOCAL_CFLAGS += -Wno-endif-labels -Wno-import -Wno-format
+LOCAL_CFLAGS += -fno-strict-aliasing
+LOCAL_CFLAGS += -include "WebCorePrefix.h"
+LOCAL_CFLAGS += -fvisibility=hidden
+
+# Enable JSC JIT if JSC is used and ENABLE_JSC_JIT environment
+# variable is set to true
+ifeq ($(JAVASCRIPT_ENGINE),jsc)
+ifeq ($(ENABLE_JSC_JIT),true)
+LOCAL_CFLAGS += -DENABLE_ANDROID_JSC_JIT=1
+endif
+endif
+
+ifeq ($(TARGET_ARCH),arm)
+LOCAL_CFLAGS += -Darm
+endif
+
+ifeq ($(ENABLE_SVG),true)
+LOCAL_CFLAGS += -DENABLE_SVG=1
+endif
+
+# Temporary disable SVG_ANIMATION.
+ifeq ($(ENABLE_SVG_ANIMATION),true)
+LOCAL_CFLAGS += -DENABLE_SVG_ANIMATION=1
+endif
+
+ifeq ($(WEBCORE_INSTRUMENTATION),true)
+LOCAL_CFLAGS += -DANDROID_INSTRUMENT
+endif
+
+# LOCAL_LDLIBS is used in simulator builds only and simulator builds are only
+# valid on Linux
+LOCAL_LDLIBS += -lpthread -ldl
+
+# Build the list of shared libraries
+LOCAL_SHARED_LIBRARIES := \
+ libandroid_runtime \
+ libnativehelper \
+ libsqlite \
+ libskia \
+ libutils \
+ libui \
+ libcutils \
+ libicuuc \
+ libicudata \
+ libicui18n \
+ libmedia
+
+ifeq ($(WEBCORE_INSTRUMENTATION),true)
+LOCAL_SHARED_LIBRARIES += libhardware_legacy
+endif
+
+# We have to use the android version of libdl when we are not on the simulator
+ifneq ($(TARGET_SIMULATOR),true)
+LOCAL_SHARED_LIBRARIES += libdl
+endif
+
+# Build the list of static libraries
+LOCAL_STATIC_LIBRARIES := libxml2
+ifeq ($(JAVASCRIPT_ENGINE),v8)
+LOCAL_STATIC_LIBRARIES += libv8
+endif
+
+# Redefine LOCAL_SRC_FILES to be all the WebKit source files
+LOCAL_SRC_FILES := $(WEBKIT_SRC_FILES)
+
+# Define this for use in other makefiles.
+WEBKIT_C_INCLUDES := $(LOCAL_C_INCLUDES)
+WEBKIT_CFLAGS := $(LOCAL_CFLAGS)
+WEBKIT_GENERATED_SOURCES := $(LOCAL_GENERATED_SOURCES)
+WEBKIT_LDLIBS := $(LOCAL_LDLIBS)
+WEBKIT_SHARED_LIBRARIES := $(LOCAL_SHARED_LIBRARIES)
+WEBKIT_STATIC_LIBRARIES := $(LOCAL_STATIC_LIBRARIES)
+
+# Build the library all at once
+include $(BUILD_STATIC_LIBRARY)
+
+ifeq ($(JAVASCRIPT_ENGINE),jsc)
+# Now build libjs as a static library.
+include $(CLEAR_VARS)
+LOCAL_MODULE := libjs
+LOCAL_LDLIBS := $(WEBKIT_LDLIBS)
+LOCAL_SHARED_LIBRARIES := $(WEBKIT_SHARED_LIBRARIES)
+LOCAL_STATIC_LIBRARIES := $(WEBKIT_STATIC_LIBRARIES)
+LOCAL_CFLAGS := $(WEBKIT_CFLAGS)
+# Include source files for JavaScriptCore
+d := JavaScriptCore
+LOCAL_PATH := $(BASE_PATH)/$d
+LOCAL_MODULE_CLASS := STATIC_LIBRARIES
+# Cannot use base_intermediates as this is a new module
+intermediates := $(call local-intermediates-dir)
+include $(LOCAL_PATH)/Android.mk
+# Redefine LOCAL_SRC_FILES with the correct prefix
+LOCAL_SRC_FILES := $(addprefix $d/,$(LOCAL_SRC_FILES))
+# Use the base path to resolve file names
+LOCAL_PATH := $(BASE_PATH)
+# Append jsc intermediate include paths to the WebKit include list.
+LOCAL_C_INCLUDES := $(WEBKIT_C_INCLUDES) \
+ $(intermediates) \
+ $(intermediates)/parser \
+ $(intermediates)/runtime \
+# Build libjs
+include $(BUILD_STATIC_LIBRARY)
+endif # JAVASCRIPT_ENGINE == jsc
+
+# Now build the shared library using only the exported jni entry point. This
+# will strip out any unused code from the entry point.
+include $(CLEAR_VARS)
+# if you need to make webcore huge (for debugging), enable this line
+#LOCAL_PRELINK_MODULE := false
+LOCAL_MODULE := libwebcore
+LOCAL_LDLIBS := $(WEBKIT_LDLIBS)
+LOCAL_SHARED_LIBRARIES := $(WEBKIT_SHARED_LIBRARIES)
+LOCAL_STATIC_LIBRARIES := libwebcore $(WEBKIT_STATIC_LIBRARIES)
+ifeq ($(JAVASCRIPT_ENGINE),jsc)
+LOCAL_STATIC_LIBRARIES += libjs
+endif
+LOCAL_LDFLAGS := -fvisibility=hidden
+LOCAL_CFLAGS := $(WEBKIT_CFLAGS)
+LOCAL_C_INCLUDES := $(WEBKIT_C_INCLUDES)
+LOCAL_PATH := $(BASE_PATH)
+include $(BUILD_SHARED_LIBRARY)
6 olympia/BugsSite/.cvsignore
@@ -0,0 +1,6 @@
+.htaccess
+graphs
+data
+localconfig
+index.html
+old-params.txt
7 olympia/BugsSite/.htaccess
@@ -0,0 +1,7 @@
+# don't allow people to retrieve non-cgi executable files or our private data
+<FilesMatch ^(.*\.pm|.*\.pl|.*localconfig.*)$>
+ deny from all
+</FilesMatch>
+<FilesMatch ^(localconfig.js|localconfig.rdf)$>
+ allow from all
+</FilesMatch>
697 olympia/BugsSite/Bugzilla.pm
@@ -0,0 +1,697 @@
+# -*- Mode: perl; indent-tabs-mode: nil -*-
+#
+# 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 the Bugzilla Bug Tracking System.
+#
+# The Initial Developer of the Original Code is Netscape Communications
+# Corporation. Portions created by Netscape are
+# Copyright (C) 1998 Netscape Communications Corporation. All
+# Rights Reserved.
+#
+# Contributor(s): Bradley Baetz <bbaetz@student.usyd.edu.au>
+# Erik Stambaugh <erik@dasbistro.com>
+# A. Karl Kornel <karl@kornel.name>
+# Marc Schumann <wurblzap@gmail.com>
+
+package Bugzilla;
+
+use strict;
+
+# We want any compile errors to get to the browser, if possible.
+BEGIN {
+ # This makes sure we're in a CGI.
+ if ($ENV{SERVER_SOFTWARE} && !$ENV{MOD_PERL}) {
+ require CGI::Carp;
+ CGI::Carp->import('fatalsToBrowser');
+ }
+}
+
+use Bugzilla::Config;
+use Bugzilla::Constants;
+use Bugzilla::Auth;
+use Bugzilla::Auth::Persist::Cookie;
+use Bugzilla::CGI;
+use Bugzilla::DB;
+use Bugzilla::Install::Localconfig qw(read_localconfig);
+use Bugzilla::Template;
+use Bugzilla::User;
+use Bugzilla::Error;
+use Bugzilla::Util;
+use Bugzilla::Field;
+use Bugzilla::Flag;
+
+use File::Basename;
+use File::Spec::Functions;
+use Safe;
+
+# This creates the request cache for non-mod_perl installations.
+our $_request_cache = {};
+
+#####################################################################
+# Constants
+#####################################################################
+
+# Scripts that are not stopped by shutdownhtml being in effect.
+use constant SHUTDOWNHTML_EXEMPT => [
+ 'editparams.cgi',
+ 'checksetup.pl',
+ 'recode.pl',
+];
+
+# Non-cgi scripts that should silently exit.
+use constant SHUTDOWNHTML_EXIT_SILENTLY => [
+ 'whine.pl'
+];
+
+#####################################################################
+# Global Code
+#####################################################################
+
+# $::SIG{__DIE__} = i_am_cgi() ? \&CGI::Carp::confess : \&Carp::confess;
+
+# Note that this is a raw subroutine, not a method, so $class isn't available.
+sub init_page {
+ (binmode STDOUT, ':utf8') if Bugzilla->params->{'utf8'};
+
+ # Some environment variables are not taint safe
+ delete @::ENV{'PATH', 'IFS', 'CDPATH', 'ENV', 'BASH_ENV'};
+ # Some modules throw undefined errors (notably File::Spec::Win32) if
+ # PATH is undefined.
+ $ENV{'PATH'} = '';
+
+ # IIS prints out warnings to the webpage, so ignore them, or log them
+ # to a file if the file exists.
+ if ($ENV{SERVER_SOFTWARE} && $ENV{SERVER_SOFTWARE} =~ /microsoft-iis/i) {
+ $SIG{__WARN__} = sub {
+ my ($msg) = @_;
+ my $datadir = bz_locations()->{'datadir'};
+ if (-w "$datadir/errorlog") {
+ my $warning_log = new IO::File(">>$datadir/errorlog");
+ print $warning_log $msg;
+ $warning_log->close();
+ }
+ };
+ }
+
+ # If Bugzilla is shut down, do not allow anything to run, just display a
+ # message to the user about the downtime and log out. Scripts listed in
+ # SHUTDOWNHTML_EXEMPT are exempt from this message.
+ #
+ # Because this is code which is run live from perl "use" commands of other
+ # scripts, we're skipping this part if we get here during a perl syntax
+ # check -- runtests.pl compiles scripts without running them, so we
+ # need to make sure that this check doesn't apply to 'perl -c' calls.
+ #
+ # This code must go here. It cannot go anywhere in Bugzilla::CGI, because
+ # it uses Template, and that causes various dependency loops.
+ if (!$^C && Bugzilla->params->{"shutdownhtml"}
+ && lsearch(SHUTDOWNHTML_EXEMPT, basename($0)) == -1)
+ {
+ # Allow non-cgi scripts to exit silently (without displaying any
+ # message), if desired. At this point, no DBI call has been made
+ # yet, and no error will be returned if the DB is inaccessible.
+ if (lsearch(SHUTDOWNHTML_EXIT_SILENTLY, basename($0)) > -1
+ && !i_am_cgi())
+ {
+ exit;
+ }
+
+ # For security reasons, log out users when Bugzilla is down.
+ # Bugzilla->login() is required to catch the logincookie, if any.
+ my $user;
+ eval { $user = Bugzilla->login(LOGIN_OPTIONAL); };
+ if ($@) {
+ # The DB is not accessible. Use the default user object.
+ $user = Bugzilla->user;
+ $user->{settings} = {};
+ }
+ my $userid = $user->id;
+ Bugzilla->logout();
+
+ my $template = Bugzilla->template;
+ my $vars = {};
+ $vars->{'message'} = 'shutdown';
+ $vars->{'userid'} = $userid;
+ # Generate and return a message about the downtime, appropriately
+ # for if we're a command-line script or a CGI script.
+ my $extension;
+ if (i_am_cgi() && (!Bugzilla->cgi->param('ctype')
+ || Bugzilla->cgi->param('ctype') eq 'html')) {
+ $extension = 'html';
+ }
+ else {
+ $extension = 'txt';
+ }
+ print Bugzilla->cgi->header() if i_am_cgi();
+ my $t_output;
+ $template->process("global/message.$extension.tmpl", $vars, \$t_output)
+ || ThrowTemplateError($template->error);
+ print $t_output . "\n";
+ exit;
+ }
+}
+
+init_page() if !$ENV{MOD_PERL};
+
+#####################################################################
+# Subroutines and Methods
+#####################################################################
+
+sub template {
+ my $class = shift;
+ $class->request_cache->{language} = "";
+ $class->request_cache->{template} ||= Bugzilla::Template->create();
+ return $class->request_cache->{template};
+}
+
+sub template_inner {
+ my ($class, $lang) = @_;
+ $lang = defined($lang) ? $lang : ($class->request_cache->{language} || "");
+ $class->request_cache->{language} = $lang;
+ $class->request_cache->{"template_inner_$lang"}
+ ||= Bugzilla::Template->create();
+ return $class->request_cache->{"template_inner_$lang"};
+}
+
+sub cgi {
+ my $class = shift;
+ $class->request_cache->{cgi} ||= new Bugzilla::CGI();
+ return $class->request_cache->{cgi};
+}
+
+sub localconfig {
+ my $class = shift;
+ $class->request_cache->{localconfig} ||= read_localconfig();
+ return $class->request_cache->{localconfig};
+}
+
+sub params {
+ my $class = shift;
+ $class->request_cache->{params} ||= Bugzilla::Config::read_param_file();
+ return $class->request_cache->{params};
+}
+
+sub user {
+ my $class = shift;
+ $class->request_cache->{user} ||= new Bugzilla::User;
+ return $class->request_cache->{user};
+}
+
+sub set_user {
+ my ($class, $user) = @_;
+ $class->request_cache->{user} = $user;
+}
+
+sub sudoer {
+ my $class = shift;
+ return $class->request_cache->{sudoer};
+}
+
+sub sudo_request {
+ my ($class, $new_user, $new_sudoer) = @_;
+ $class->request_cache->{user} = $new_user;
+ $class->request_cache->{sudoer} = $new_sudoer;
+ # NOTE: If you want to log the start of an sudo session, do it here.
+}
+
+sub login {
+ my ($class, $type) = @_;
+
+ return $class->user if $class->user->id;
+
+ my $authorizer = new Bugzilla::Auth();
+ $type = LOGIN_REQUIRED if $class->cgi->param('GoAheadAndLogIn');
+ if (!defined $type || $type == LOGIN_NORMAL) {
+ $type = $class->params->{'requirelogin'} ? LOGIN_REQUIRED : LOGIN_NORMAL;
+ }
+ my $authenticated_user = $authorizer->login($type);
+
+ # At this point, we now know if a real person is logged in.
+ # We must now check to see if an sudo session is in progress.
+ # For a session to be in progress, the following must be true:
+ # 1: There must be a logged in user
+ # 2: That user must be in the 'bz_sudoer' group
+ # 3: There must be a valid value in the 'sudo' cookie
+ # 4: A Bugzilla::User object must exist for the given cookie value
+ # 5: That user must NOT be in the 'bz_sudo_protect' group
+ my $sudo_cookie = $class->cgi->cookie('sudo');
+ detaint_natural($sudo_cookie) if defined($sudo_cookie);
+ my $sudo_target;
+ $sudo_target = new Bugzilla::User($sudo_cookie) if defined($sudo_cookie);
+ if (defined($authenticated_user) &&
+ $authenticated_user->in_group('bz_sudoers') &&
+ defined($sudo_cookie) &&
+ defined($sudo_target) &&
+ !($sudo_target->in_group('bz_sudo_protect'))
+ )
+ {
+ $class->set_user($sudo_target);
+ $class->request_cache->{sudoer} = $authenticated_user;
+ # And make sure that both users have the same Auth object,
+ # since we never call Auth::login for the sudo target.
+ $sudo_target->set_authorizer($authenticated_user->authorizer);
+
+ # NOTE: If you want to do any special logging, do it here.
+ }
+ else {
+ $class->set_user($authenticated_user);
+ }
+
+ # We run after the login has completed since
+ # some of the checks in ssl_require_redirect
+ # look for Bugzilla->user->id to determine
+ # if redirection is required.
+ if (i_am_cgi() && ssl_require_redirect()) {
+ $class->cgi->require_https($class->params->{'sslbase'});
+ }
+
+ return $class->user;
+}
+
+sub logout {
+ my ($class, $option) = @_;
+
+ # If we're not logged in, go away
+ return unless $class->user->id;
+
+ $option = LOGOUT_CURRENT unless defined $option;
+ Bugzilla::Auth::Persist::Cookie->logout({type => $option});
+ $class->logout_request() unless $option eq LOGOUT_KEEP_CURRENT;
+}
+
+sub logout_user {
+ my ($class, $user) = @_;
+ # When we're logging out another user we leave cookies alone, and
+ # therefore avoid calling Bugzilla->logout() directly.
+ Bugzilla::Auth::Persist::Cookie->logout({user => $user});
+}
+
+# just a compatibility front-end to logout_user that gets a user by id
+sub logout_user_by_id {
+ my ($class, $id) = @_;
+ my $user = new Bugzilla::User($id);
+ $class->logout_user($user);
+}
+
+# hack that invalidates credentials for a single request
+sub logout_request {
+ my $class = shift;
+ delete $class->request_cache->{user};
+ delete $class->request_cache->{sudoer};
+ # We can't delete from $cgi->cookie, so logincookie data will remain
+ # there. Don't rely on it: use Bugzilla->user->login instead!
+}
+
+sub dbh {
+ my $class = shift;
+ # If we're not connected, then we must want the main db
+ $class->request_cache->{dbh} ||= $class->request_cache->{dbh_main}
+ = Bugzilla::DB::connect_main();
+
+ return $class->request_cache->{dbh};
+}
+
+sub languages {
+ my $class = shift;
+ return $class->request_cache->{languages}
+ if $class->request_cache->{languages};
+
+ my @files = glob(catdir(bz_locations->{'templatedir'}, '*'));
+ my @languages;
+ foreach my $dir_entry (@files) {
+ # It's a language directory only if it contains "default" or
+ # "custom". This auto-excludes CVS directories as well.
+ next unless (-d catdir($dir_entry, 'default')
+ || -d catdir($dir_entry, 'custom'));
+ $dir_entry = basename($dir_entry);
+ # Check for language tag format conforming to RFC 1766.
+ next unless $dir_entry =~ /^[a-zA-Z]{1,8}(-[a-zA-Z]{1,8})?$/;
+ push(@languages, $dir_entry);
+ }
+ return $class->request_cache->{languages} = \@languages;
+}
+
+sub error_mode {
+ my ($class, $newval) = @_;
+ if (defined $newval) {
+ $class->request_cache->{error_mode} = $newval;
+ }
+ return $class->request_cache->{error_mode}
+ || Bugzilla::Constants::ERROR_MODE_WEBPAGE;
+}
+
+sub usage_mode {
+ my ($class, $newval) = @_;
+ if (defined $newval) {
+ if ($newval == USAGE_MODE_BROWSER) {
+ $class->error_mode(ERROR_MODE_WEBPAGE);
+ }
+ elsif ($newval == USAGE_MODE_CMDLINE) {
+ $class->error_mode(ERROR_MODE_DIE);
+ }
+ elsif ($newval == USAGE_MODE_WEBSERVICE) {
+ $class->error_mode(ERROR_MODE_DIE_SOAP_FAULT);
+ }
+ elsif ($newval == USAGE_MODE_EMAIL) {
+ $class->error_mode(ERROR_MODE_DIE);
+ }
+ else {
+ ThrowCodeError('usage_mode_invalid',
+ {'invalid_usage_mode', $newval});
+ }
+ $class->request_cache->{usage_mode} = $newval;
+ }
+ return $class->request_cache->{usage_mode}
+ || Bugzilla::Constants::USAGE_MODE_BROWSER;
+}
+
+sub installation_mode {
+ my ($class, $newval) = @_;
+ ($class->request_cache->{installation_mode} = $newval) if defined $newval;
+ return $class->request_cache->{installation_mode}
+ || INSTALLATION_MODE_INTERACTIVE;
+}
+
+sub installation_answers {
+ my ($class, $filename) = @_;
+ if ($filename) {
+ my $s = new Safe;
+ $s->rdo($filename);
+
+ die "Error reading $filename: $!" if $!;
+ die "Error evaluating $filename: $@" if $@;
+
+ # Now read the param back out from the sandbox
+ $class->request_cache->{installation_answers} = $s->varglob('answer');
+ }
+ return $class->request_cache->{installation_answers} || {};
+}
+
+sub switch_to_shadow_db {
+ my $class = shift;
+
+ if (!$class->request_cache->{dbh_shadow}) {
+ if ($class->params->{'shadowdb'}) {
+ $class->request_cache->{dbh_shadow} = Bugzilla::DB::connect_shadow();
+ } else {
+ $class->request_cache->{dbh_shadow} = request_cache()->{dbh_main};
+ }
+ }
+
+ $class->request_cache->{dbh} = $class->request_cache->{dbh_shadow};
+ # we have to return $class->dbh instead of {dbh} as
+ # {dbh_shadow} may be undefined if no shadow DB is used
+ # and no connection to the main DB has been established yet.
+ return $class->dbh;
+}
+
+sub switch_to_main_db {
+ my $class = shift;
+
+ $class->request_cache->{dbh} = $class->request_cache->{dbh_main};
+ # We have to return $class->dbh instead of {dbh} as
+ # {dbh_main} may be undefined if no connection to the main DB
+ # has been established yet.
+ return $class->dbh;
+}
+
+sub get_fields {
+ my $class = shift;
+ my $criteria = shift;
+ # This function may be called during installation, and Field::match
+ # may fail at that time. so we want to return an empty list in that
+ # case.
+ my $fields = eval { Bugzilla::Field->match($criteria) } || [];
+ return @$fields;
+}
+
+sub active_custom_fields {
+ my $class = shift;
+ if (!exists $class->request_cache->{active_custom_fields}) {
+ $class->request_cache->{active_custom_fields} =
+ Bugzilla::Field->match({ custom => 1, obsolete => 0 });
+ }
+ return @{$class->request_cache->{active_custom_fields}};
+}
+
+sub has_flags {
+ my $class = shift;
+
+ if (!defined $class->request_cache->{has_flags}) {
+ $class->request_cache->{has_flags} = Bugzilla::Flag::has_flags();
+ }
+ return $class->request_cache->{has_flags};
+}
+
+sub hook_args {
+ my ($class, $args) = @_;
+ $class->request_cache->{hook_args} = $args if $args;
+ return $class->request_cache->{hook_args};
+}
+
+sub request_cache {
+ if ($ENV{MOD_PERL}) {
+ require Apache2::RequestUtil;
+ return Apache2::RequestUtil->request->pnotes();
+ }
+ return $_request_cache;
+}
+
+# Private methods
+
+# Per-process cleanup. Note that this is a plain subroutine, not a method,
+# so we don't have $class available.
+sub _cleanup {
+ my $main = Bugzilla->request_cache->{dbh_main};
+ my $shadow = Bugzilla->request_cache->{dbh_shadow};
+ foreach my $dbh ($main, $shadow) {
+ next if !$dbh;
+ $dbh->bz_rollback_transaction() if $dbh->bz_in_transaction;
+ $dbh->disconnect;
+ }
+ undef $_request_cache;
+}
+
+sub END {
+ # Bugzilla.pm cannot compile in mod_perl.pl if this runs.
+ _cleanup() unless $ENV{MOD_PERL};
+}
+
+1;
+
+__END__
+
+=head1 NAME
+
+Bugzilla - Semi-persistent collection of various objects used by scripts
+and modules
+
+=head1 SYNOPSIS
+
+ use Bugzilla;
+
+ sub someModulesSub {
+ Bugzilla->dbh->prepare(...);
+ Bugzilla->template->process(...);
+ }
+
+=head1 DESCRIPTION
+
+Several Bugzilla 'things' are used by a variety of modules and scripts. This
+includes database handles, template objects, and so on.
+
+This module is a singleton intended as a central place to store these objects.
+This approach has several advantages:
+
+=over 4
+
+=item *
+
+They're not global variables, so we don't have issues with them staying around
+with mod_perl
+
+=item *
+
+Everything is in one central place, so it's easy to access, modify, and maintain
+
+=item *
+
+Code in modules can get access to these objects without having to have them
+all passed from the caller, and the caller's caller, and....
+
+=item *
+
+We can reuse objects across requests using mod_perl where appropriate (eg
+templates), whilst destroying those which are only valid for a single request
+(such as the current user)
+
+=back
+
+Note that items accessible via this object are demand-loaded when requested.
+
+For something to be added to this object, it should either be able to benefit
+from persistence when run under mod_perl (such as the a C<template> object),
+or should be something which is globally required by a large ammount of code
+(such as the current C<user> object).
+
+=head1 METHODS
+
+Note that all C<Bugzilla> functionality is method based; use C<Bugzilla-E<gt>dbh>
+rather than C<Bugzilla::dbh>. Nothing cares about this now, but don't rely on
+that.
+
+=over 4
+
+=item C<template>
+
+The current C<Template> object, to be used for output
+
+=item C<template_inner>
+
+If you ever need a L<Bugzilla::Template> object while you're already
+processing a template, use this. Also use it if you want to specify
+the language to use. If no argument is passed, it uses the last
+language set. If the argument is "" (empty string), the language is
+reset to the current one (the one used by Bugzilla->template).
+
+=item C<cgi>
+
+The current C<cgi> object. Note that modules should B<not> be using this in
+general. Not all Bugzilla actions are cgi requests. Its useful as a convenience
+method for those scripts/templates which are only use via CGI, though.
+
+=item C<user>
+
+C<undef> if there is no currently logged in user or if the login code has not
+yet been run. If an sudo session is in progress, the C<Bugzilla::User>
+corresponding to the person who is being impersonated. If no session is in
+progress, the current C<Bugzilla::User>.
+
+=item C<set_user>
+
+Allows you to directly set what L</user> will return. You can use this
+if you want to bypass L</login> for some reason and directly "log in"
+a specific L<Bugzilla::User>. Be careful with it, though!
+
+=item C<sudoer>
+
+C<undef> if there is no currently logged in user, the currently logged in user
+is not in the I<sudoer> group, or there is no session in progress. If an sudo
+session is in progress, returns the C<Bugzilla::User> object corresponding to
+the person who logged in and initiated the session. If no session is in
+progress, returns the C<Bugzilla::User> object corresponding to the currently
+logged in user.
+
+=item C<sudo_request>
+This begins an sudo session for the current request. It is meant to be
+used when a session has just started. For normal use, sudo access should
+normally be set at login time.
+
+=item C<login>
+
+Logs in a user, returning a C<Bugzilla::User> object, or C<undef> if there is
+no logged in user. See L<Bugzilla::Auth|Bugzilla::Auth>, and
+L<Bugzilla::User|Bugzilla::User>.
+
+=item C<logout($option)>
+
+Logs out the current user, which involves invalidating user sessions and
+cookies. Three options are available from
+L<Bugzilla::Constants|Bugzilla::Constants>: LOGOUT_CURRENT (the
+default), LOGOUT_ALL or LOGOUT_KEEP_CURRENT.
+
+=item C<logout_user($user)>
+
+Logs out the specified user (invalidating all his sessions), taking a
+Bugzilla::User instance.
+
+=item C<logout_by_id($id)>
+
+Logs out the user with the id specified. This is a compatibility
+function to be used in callsites where there is only a userid and no
+Bugzilla::User instance.
+
+=item C<logout_request>
+
+Essentially, causes calls to C<Bugzilla-E<gt>user> to return C<undef>. This has the
+effect of logging out a user for the current request only; cookies and
+database sessions are left intact.
+
+=item C<error_mode>
+
+Call either C<Bugzilla->error_mode(Bugzilla::Constants::ERROR_MODE_DIE)>
+or C<Bugzilla->error_mode(Bugzilla::Constants::ERROR_MODE_DIE_SOAP_FAULT)> to
+change this flag's default of C<Bugzilla::Constants::ERROR_MODE_WEBPAGE> and to
+indicate that errors should be passed to error mode specific error handlers
+rather than being sent to a browser and finished with an exit().
+
+This is useful, for example, to keep C<eval> blocks from producing wild HTML
+on errors, making it easier for you to catch them.
+(Remember to reset the error mode to its previous value afterwards, though.)
+
+C<Bugzilla->error_mode> will return the current state of this flag.
+
+Note that C<Bugzilla->error_mode> is being called by C<Bugzilla->usage_mode> on
+usage mode changes.
+
+=item C<usage_mode>
+
+Call either C<Bugzilla->usage_mode(Bugzilla::Constants::USAGE_MODE_CMDLINE)>
+or C<Bugzilla->usage_mode(Bugzilla::Constants::USAGE_MODE_WEBSERVICE)> near the
+beginning of your script to change this flag's default of
+C<Bugzilla::Constants::USAGE_MODE_BROWSER> and to indicate that Bugzilla is
+being called in a non-interactive manner.
+This influences error handling because on usage mode changes, C<usage_mode>
+calls C<Bugzilla->error_mode> to set an error mode which makes sense for the
+usage mode.
+
+C<Bugzilla->usage_mode> will return the current state of this flag.
+
+=item C<installation_mode>
+
+Determines whether or not installation should be silent. See
+L<Bugzilla::Constants> for the C<INSTALLATION_MODE> constants.
+
+=item C<installation_answers>
+
+Returns a hashref representing any "answers" file passed to F<checksetup.pl>,
+used to automatically answer or skip prompts.
+
+=item C<dbh>
+
+The current database handle. See L<DBI>.
+
+=item C<languages>
+
+Currently installed languages.
+Returns a reference to a list of RFC 1766 language tags of installed languages.
+
+=item C<switch_to_shadow_db>
+
+Switch from using the main database to using the shadow database.
+
+=item C<switch_to_main_db>
+
+Change the database object to refer to the main database.
+
+=item C<params>
+
+The current Parameters of Bugzilla, as a hashref. If C<data/params>
+does not exist, then we return an empty hashref. If C<data/params>
+is unreadable or is not valid perl, we C<die>.
+
+=item C<hook_args>
+
+If you are running inside a code hook (see L<Bugzilla::Hook>) this
+is how you get the arguments passed to the hook.
+
+=back
1  olympia/BugsSite/Bugzilla/.cvsignore
@@ -0,0 +1 @@
+.htaccess
3  olympia/BugsSite/Bugzilla/.htaccess
@@ -0,0 +1,3 @@
+# nothing in this directory is retrievable unless overridden by an .htaccess
+# in a subdirectory
+deny from all
959 olympia/BugsSite/Bugzilla/Attachment.pm
@@ -0,0 +1,959 @@
+# -*- Mode: perl; indent-tabs-mode: nil -*-
+#
+# 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 the Bugzilla Bug Tracking System.
+#
+# The Initial Developer of the Original Code is Netscape Communications
+# Corporation. Portions created by Netscape are
+# Copyright (C) 1998 Netscape Communications Corporation. All
+# Rights Reserved.
+#
+# Contributor(s): Terry Weissman <terry@mozilla.org>
+# Myk Melez <myk@mozilla.org>
+# Marc Schumann <wurblzap@gmail.com>
+# Frédéric Buclin <LpSolit@gmail.com>
+
+use strict;
+
+package Bugzilla::Attachment;
+
+=head1 NAME
+
+Bugzilla::Attachment - a file related to a bug that a user has uploaded
+ to the Bugzilla server
+
+=head1 SYNOPSIS
+
+ use Bugzilla::Attachment;
+
+ # Get the attachment with the given ID.
+ my $attachment = Bugzilla::Attachment->get($attach_id);
+
+ # Get the attachments with the given IDs.
+ my $attachments = Bugzilla::Attachment->get_list($attach_ids);
+
+=head1 DESCRIPTION
+
+This module defines attachment objects, which represent files related to bugs
+that users upload to the Bugzilla server.
+
+=cut
+
+use Bugzilla::Constants;
+use Bugzilla::Error;
+use Bugzilla::Flag;
+use Bugzilla::User;
+use Bugzilla::Util;
+use Bugzilla::Field;
+
+sub get {
+ my $invocant = shift;
+ my $id = shift;
+
+ my $attachments = _retrieve([$id]);
+ my $self = $attachments->[0];
+ bless($self, ref($invocant) || $invocant) if $self;
+
+ return $self;
+}
+
+sub get_list {
+ my $invocant = shift;
+ my $ids = shift;
+
+ my $attachments = _retrieve($ids);
+ foreach my $attachment (@$attachments) {
+ bless($attachment, ref($invocant) || $invocant);
+ }
+
+ return $attachments;
+}
+
+sub _retrieve {
+ my ($ids) = @_;
+
+ return [] if scalar(@$ids) == 0;
+
+ my @columns = (
+ 'attachments.attach_id AS id',
+ 'attachments.bug_id AS bug_id',
+ 'attachments.description AS description',
+ 'attachments.mimetype AS contenttype',
+ 'attachments.submitter_id AS attacher_id',
+ Bugzilla->dbh->sql_date_format('attachments.creation_ts',
+ '%Y.%m.%d %H:%i') . " AS attached",
+ 'attachments.modification_time',
+ 'attachments.filename AS filename',
+ 'attachments.ispatch AS ispatch',
+ 'attachments.isurl AS isurl',
+ 'attachments.isobsolete AS isobsolete',
+ 'attachments.isprivate AS isprivate'
+ );
+ my $columns = join(", ", @columns);
+ my $dbh = Bugzilla->dbh;
+ my $records = $dbh->selectall_arrayref(
+ "SELECT $columns
+ FROM attachments
+ WHERE "
+ . Bugzilla->dbh->sql_in('attach_id', $ids)
+ . " ORDER BY attach_id",
+ { Slice => {} });
+ return $records;
+}
+
+=pod
+
+=head2 Instance Properties
+
+=over
+
+=item C<id>
+
+the unique identifier for the attachment
+
+=back
+
+=cut
+
+sub id {
+ my $self = shift;
+ return $self->{id};
+}
+
+=over
+
+=item C<bug_id>
+
+the ID of the bug to which the attachment is attached
+
+=back
+
+=cut
+
+# XXX Once Bug.pm slims down sufficiently this should become a reference
+# to a bug object.
+sub bug_id {
+ my $self = shift;
+ return $self->{bug_id};
+}
+
+=over
+
+=item C<description>
+
+user-provided text describing the attachment
+
+=back
+
+=cut
+
+sub description {
+ my $self = shift;
+ return $self->{description};
+}
+
+=over
+
+=item C<contenttype>
+
+the attachment's MIME media type
+
+=back
+
+=cut
+
+sub contenttype {
+ my $self = shift;
+ return $self->{contenttype};
+}
+
+=over
+
+=item C<attacher>
+
+the user who attached the attachment
+
+=back
+
+=cut
+
+sub attacher {
+ my $self = shift;
+ return $self->{attacher} if exists $self->{attacher};
+ $self->{attacher} = new Bugzilla::User($self->{attacher_id});
+ return $self->{attacher};
+}
+
+=over
+
+=item C<attached>
+
+the date and time on which the attacher attached the attachment
+
+=back
+
+=cut
+
+sub attached {
+ my $self = shift;
+ return $self->{attached};
+}
+
+=over
+
+=item C<modification_time>
+
+the date and time on which the attachment was last modified.
+
+=back
+
+=cut
+
+sub modification_time {
+ my $self = shift;
+ return $self->{modification_time};
+}
+
+=over
+
+=item C<filename>
+
+the name of the file the attacher attached
+
+=back
+
+=cut
+
+sub filename {
+ my $self = shift;
+ return $self->{filename};
+}
+
+=over
+
+=item C<ispatch>
+
+whether or not the attachment is a patch
+
+=back
+
+=cut
+
+sub ispatch {
+ my $self = shift;
+ return $self->{ispatch};
+}
+
+=over
+
+=item C<isurl>
+
+whether or not the attachment is a URL
+
+=back
+
+=cut
+
+sub isurl {
+ my $self = shift;
+ return $self->{isurl};
+}
+
+=over
+
+=item C<isobsolete>
+
+whether or not the attachment is obsolete
+
+=back
+
+=cut
+
+sub isobsolete {
+ my $self = shift;
+ return $self->{isobsolete};
+}
+
+=over
+
+=item C<isprivate>
+
+whether or not the attachment is private
+
+=back
+
+=cut
+
+sub isprivate {
+ my $self = shift;
+ return $self->{isprivate};
+}
+
+=over
+
+=item C<is_viewable>
+
+Returns 1 if the attachment has a content-type viewable in this browser.
+Note that we don't use $cgi->Accept()'s ability to check if a content-type
+matches, because this will return a value even if it's matched by the generic
+*/* which most browsers add to the end of their Accept: headers.
+
+=back
+
+=cut
+
+sub is_viewable {
+ my $self = shift;
+ my $contenttype = $self->contenttype;
+ my $cgi = Bugzilla->cgi;
+
+ # We assume we can view all text and image types.
+ return 1 if ($contenttype =~ /^(text|image)\//);
+
+ # Mozilla can view XUL. Note the trailing slash on the Gecko detection to
+ # avoid sending XUL to Safari.
+ return 1 if (($contenttype =~ /^application\/vnd\.mozilla\./)
+ && ($cgi->user_agent() =~ /Gecko\//));
+
+ # If it's not one of the above types, we check the Accept: header for any
+ # types mentioned explicitly.
+ my $accept = join(",", $cgi->Accept());
+ return 1 if ($accept =~ /^(.*,)?\Q$contenttype\E(,.*)?$/);
+
+ return 0;
+}
+
+=over
+
+=item C<data>
+
+the content of the attachment
+
+=back
+
+=cut
+
+sub data {
+ my $self = shift;
+ return $self->{data} if exists $self->{data};
+
+ # First try to get the attachment data from the database.
+ ($self->{data}) = Bugzilla->dbh->selectrow_array("SELECT thedata
+ FROM attach_data
+ WHERE id = ?",
+ undef,
+ $self->{id});
+
+ # If there's no attachment data in the database, the attachment is stored
+ # in a local file, so retrieve it from there.
+ if (length($self->{data}) == 0) {
+ if (open(AH, $self->_get_local_filename())) {
+ local $/;
+ binmode AH;
+ $self->{data} = <AH>;
+ close(AH);
+ }
+ }
+
+ return $self->{data};
+}
+
+=over
+
+=item C<datasize>
+
+the length (in characters) of the attachment content
+
+=back
+
+=cut
+
+# datasize is a property of the data itself, and it's unclear whether we should
+# expose it at all, since you can easily derive it from the data itself: in TT,
+# attachment.data.size; in Perl, length($attachment->{data}). But perhaps
+# it makes sense for performance reasons, since accessing the data forces it
+# to get retrieved from the database/filesystem and loaded into memory,
+# while datasize avoids loading the attachment into memory, calling SQL's
+# LENGTH() function or stat()ing the file instead. I've left it in for now.
+
+sub datasize {
+ my $self = shift;
+ return $self->{datasize} if exists $self->{datasize};
+
+ # If we have already retrieved the data, return its size.
+ return length($self->{data}) if exists $self->{data};
+
+ $self->{datasize} =
+ Bugzilla->dbh->selectrow_array("SELECT LENGTH(thedata)
+ FROM attach_data
+ WHERE id = ?",
+ undef, $self->{id}) || 0;
+
+ # If there's no attachment data in the database, either the attachment
+ # is stored in a local file, and so retrieve its size from the file,
+ # or the attachment has been deleted.
+ unless ($self->{datasize}) {
+ if (open(AH, $self->_get_local_filename())) {
+ binmode AH;
+ $self->{datasize} = (stat(AH))[7];
+ close(AH);
+ }
+ }
+
+ return $self->{datasize};
+}
+
+=over
+
+=item C<flags>
+
+flags that have been set on the attachment
+
+=back
+
+=cut
+
+sub flags {
+ my $self = shift;
+ return $self->{flags} if exists $self->{flags};
+
+ $self->{flags} = Bugzilla::Flag->match({ 'attach_id' => $self->id });
+ return $self->{flags};
+}
+
+# Instance methods; no POD documentation here yet because the only ones so far
+# are private.
+
+sub _get_local_filename {
+ my $self = shift;
+ my $hash = ($self->id % 100) + 100;
+ $hash =~ s/.*(\d\d)$/group.$1/;
+ return bz_locations()->{'attachdir'} . "/$hash/attachment." . $self->id;
+}
+
+sub _validate_filename {
+ my ($throw_error) = @_;
+ my $cgi = Bugzilla->cgi;
+ defined $cgi->upload('data')
+ || ($throw_error ? ThrowUserError("file_not_specified") : return 0);
+
+ my $filename = $cgi->upload('data');
+
+ # Remove path info (if any) from the file name. The browser should do this
+ # for us, but some are buggy. This may not work on Mac file names and could
+ # mess up file names with slashes in them, but them's the breaks. We only
+ # use this as a hint to users downloading attachments anyway, so it's not
+ # a big deal if it munges incorrectly occasionally.
+ $filename =~ s/^.*[\/\\]//;
+
+ # Truncate the filename to 100 characters, counting from the end of the
+ # string to make sure we keep the filename extension.
+ $filename = substr($filename, -100, 100);
+
+ return $filename;
+}
+
+sub _validate_data {
+ my ($throw_error, $hr_vars) = @_;
+ my $cgi = Bugzilla->cgi;
+ my $maxsize = $cgi->param('ispatch') ? Bugzilla->params->{'maxpatchsize'}
+ : Bugzilla->params->{'maxattachmentsize'};
+ $maxsize *= 1024; # Convert from K
+ my $fh;
+ # Skip uploading into a local variable if the user wants to upload huge
+ # attachments into local files.
+ if (!$cgi->param('bigfile')) {
+ $fh = $cgi->upload('data');
+ }
+ my $data;
+
+ # We could get away with reading only as much as required, except that then
+ # we wouldn't have a size to print to the error handler below.
+ if (!$cgi->param('bigfile')) {
+ # enable 'slurp' mode
+ local $/;
+ $data = <$fh>;
+ }
+
+ $data
+ || ($cgi->param('bigfile'))
+ || ($throw_error ? ThrowUserError("zero_length_file") : return 0);
+
+ # Windows screenshots are usually uncompressed BMP files which
+ # makes for a quick way to eat up disk space. Let's compress them.
+ # We do this before we check the size since the uncompressed version
+ # could easily be greater than maxattachmentsize.
+ if (Bugzilla->params->{'convert_uncompressed_images'}
+ && $cgi->param('contenttype') eq 'image/bmp') {
+ require Image::Magick;
+ my $img = Image::Magick->new(magick=>'bmp');
+ $img->BlobToImage($data);
+ $img->set(magick=>'png');
+ my $imgdata = $img->ImageToBlob();
+ $data = $imgdata;
+ $cgi->param('contenttype', 'image/png');
+ $hr_vars->{'convertedbmp'} = 1;
+ }
+
+ # Make sure the attachment does not exceed the maximum permitted size
+ my $len = $data ? length($data) : 0;
+ if ($maxsize && $len > $maxsize) {
+ my $vars = { filesize => sprintf("%.0f", $len/1024) };
+ if ($cgi->param('ispatch')) {
+ $throw_error ? ThrowUserError("patch_too_large", $vars) : return 0;
+ }
+ else {
+ $throw_error ? ThrowUserError("file_too_large", $vars) : return 0;
+ }
+ }
+
+ return $data || '';
+}
+
+=pod
+
+=head2 Class Methods
+
+=over
+
+=item C<get_attachments_by_bug($bug_id)>
+
+Description: retrieves and returns the attachments the currently logged in
+ user can view for the given bug.
+
+Params: C<$bug_id> - integer - the ID of the bug for which
+ to retrieve and return attachments.
+
+Returns: a reference to an array of attachment objects.
+
+=cut
+
+sub get_attachments_by_bug {
+ my ($class, $bug_id) = @_;
+ my $user = Bugzilla->user;
+ my $dbh = Bugzilla->dbh;
+
+ # By default, private attachments are not accessible, unless the user
+ # is in the insider group or submitted the attachment.
+ my $and_restriction = '';
+ my @values = ($bug_id);
+
+ unless ($user->is_insider) {
+ $and_restriction = 'AND (isprivate = 0 OR submitter_id = ?)';
+ push(@values, $user->id);
+ }
+
+ my $attach_ids = $dbh->selectcol_arrayref("SELECT attach_id FROM attachments
+ WHERE bug_id = ? $and_restriction",
+ undef, @values);
+ my $attachments = Bugzilla::Attachment->get_list($attach_ids);
+ return $attachments;
+}
+
+=pod
+
+=item C<validate_is_patch()>
+
+Description: validates the "patch" flag passed in by CGI.
+
+Returns: 1 on success.
+
+=cut
+
+sub validate_is_patch {
+ my ($class, $throw_error) = @_;
+ my $cgi = Bugzilla->cgi;
+
+ # Set the ispatch flag to zero if it is undefined, since the UI uses
+ # an HTML checkbox to represent this flag, and unchecked HTML checkboxes
+ # do not get sent in HTML requests.
+ $cgi->param('ispatch', $cgi->param('ispatch') ? 1 : 0);
+
+ # Set the content type to text/plain if the attachment is a patch.
+ $cgi->param('contenttype', 'text/plain') if $cgi->param('ispatch');
+
+ return 1;
+}
+
+=pod
+
+=item C<validate_description()>
+
+Description: validates the description passed in by CGI.
+
+Returns: 1 on success.
+
+=cut
+
+sub validate_description {
+ my ($class, $throw_error) = @_;
+ my $cgi = Bugzilla->cgi;
+
+ $cgi->param('description')
+ || ($throw_error ? ThrowUserError("missing_attachment_description") : return 0);
+
+ return 1;
+}
+
+=pod
+
+=item C<validate_content_type()>
+
+Description: validates the content type passed in by CGI.
+
+Returns: 1 on success.
+
+=cut
+
+sub validate_content_type {
+ my ($class, $throw_error) = @_;
+ my $cgi = Bugzilla->cgi;
+
+ if (!defined $cgi->param('contenttypemethod')) {
+ $throw_error ? ThrowUserError("missing_content_type_method") : return 0;
+ }
+ elsif ($cgi->param('contenttypemethod') eq 'autodetect') {
+ my $contenttype =
+ $cgi->uploadInfo($cgi->param('data'))->{'Content-Type'};
+ # The user asked us to auto-detect the content type, so use the type
+ # specified in the HTTP request headers.
+ if ( !$contenttype ) {
+ $throw_error ? ThrowUserError("missing_content_type") : return 0;
+ }
+ $cgi->param('contenttype', $contenttype);
+ }
+ elsif ($cgi->param('contenttypemethod') eq 'list') {
+ # The user selected a content type from the list, so use their
+ # selection.
+ $cgi->param('contenttype', $cgi->param('contenttypeselection'));
+ }
+ elsif ($cgi->param('contenttypemethod') eq 'manual') {
+ # The user entered a content type manually, so use their entry.
+ $cgi->param('contenttype', $cgi->param('contenttypeentry'));
+ }
+ else {
+ $throw_error ?
+ ThrowCodeError("illegal_content_type_method",
+ { contenttypemethod => $cgi->param('contenttypemethod') }) :
+ return 0;
+ }
+
+ if ( $cgi->param('contenttype') !~
+ /^(application|audio|image|message|model|multipart|text|video)\/.+$/ ) {
+ $throw_error ?
+ ThrowUserError("invalid_content_type",
+ { contenttype => $cgi->param('contenttype') }) :
+ return 0;
+ }
+
+ return 1;
+}
+
+=pod
+
+=item C<validate_can_edit($attachment, $product_id)>
+
+Description: validates if the user is allowed to view and edit the attachment.
+ Only the submitter or someone with editbugs privs can edit it.
+ Only the submitter and users in the insider group can view
+ private attachments.
+
+Params: $attachment - the attachment object being edited.
+ $product_id - the product ID the attachment belongs to.
+
+Returns: 1 on success. Else an error is thrown.
+
+=cut
+
+sub validate_can_edit {
+ my ($attachment, $product_id) = @_;
+ my $user = Bugzilla->user;
+
+ # The submitter can edit their attachments.
+ return 1 if ($attachment->attacher->id == $user->id
+ || ((!$attachment->isprivate || $user->is_insider)
+ && $user->in_group('editbugs', $product_id)));
+
+ # If we come here, then this attachment cannot be seen by the user.
+ ThrowUserError('illegal_attachment_edit', { attach_id => $attachment->id });
+}
+
+=item C<validate_obsolete($bug)>
+
+Description: validates if attachments the user wants to mark as obsolete
+ really belong to the given bug and are not already obsolete.
+ Moreover, a user cannot mark an attachment as obsolete if
+ he cannot view it (due to restrictions on it).
+
+Params: $bug - The bug object obsolete attachments should belong to.
+
+Returns: 1 on success. Else an error is thrown.
+
+=cut
+
+sub validate_obsolete {
+ my ($class, $bug) = @_;
+ my $cgi = Bugzilla->cgi;
+
+ # Make sure the attachment id is valid and the user has permissions to view
+ # the bug to which it is attached. Make sure also that the user can view
+ # the attachment itself.
+ my @obsolete_attachments;
+ foreach my $attachid ($cgi->param('obsolete')) {
+ my $vars = {};
+ $vars->{'attach_id'} = $attachid;
+
+ detaint_natural($attachid)
+ || ThrowCodeError('invalid_attach_id_to_obsolete', $vars);
+
+ my $attachment = Bugzilla::Attachment->get($attachid);
+
+ # Make sure the attachment exists in the database.
+ ThrowUserError('invalid_attach_id', $vars) unless $attachment;
+
+ # Check that the user can view and edit this attachment.
+ $attachment->validate_can_edit($bug->product_id);
+
+ $vars->{'description'} = $attachment->description;
+
+ if ($attachment->bug_id != $bug->bug_id) {
+ $vars->{'my_bug_id'} = $bug->bug_id;
+ $vars->{'attach_bug_id'} = $attachment->bug_id;
+ ThrowCodeError('mismatched_bug_ids_on_obsolete', $vars);
+ }
+
+ if ($attachment->isobsolete) {
+ ThrowCodeError('attachment_already_obsolete', $vars);
+ }
+
+ push(@obsolete_attachments, $attachment);
+ }
+ return @obsolete_attachments;
+}
+
+
+=pod
+
+=item C<insert_attachment_for_bug($throw_error, $bug, $user, $timestamp, $hr_vars)>
+
+Description: inserts an attachment from CGI input for the given bug.
+
+Params: C<$bug> - Bugzilla::Bug object - the bug for which to insert
+ the attachment.
+ C<$user> - Bugzilla::User object - the user we're inserting an
+ attachment for.
+ C<$timestamp> - scalar - timestamp of the insert as returned
+ by SELECT NOW().
+ C<$hr_vars> - hash reference - reference to a hash of template
+ variables.
+
+Returns: the ID of the new attachment.
+
+=cut
+
+sub insert_attachment_for_bug {
+ my ($class, $throw_error, $bug, $user, $timestamp, $hr_vars) = @_;
+
+ my $cgi = Bugzilla->cgi;
+ my $dbh = Bugzilla->dbh;
+ my $attachurl = $cgi->param('attachurl') || '';
+ my $data;
+ my $filename;
+ my $contenttype;
+ my $isurl;
+ $class->validate_is_patch($throw_error) || return;
+ $class->validate_description($throw_error) || return;
+
+ if (Bugzilla->params->{'allow_attach_url'}
+ && ($attachurl =~ /^(http|https|ftp):\/\/\S+/)
+ && !defined $cgi->upload('data'))
+ {
+ $filename = '';
+ $data = $attachurl;
+ $isurl = 1;
+ $contenttype = 'text/plain';
+ $cgi->param('ispatch', 0);
+ $cgi->delete('bigfile');
+ }
+ else {
+ $filename = _validate_filename($throw_error) || return;
+ # need to validate content type before data as
+ # we now check the content type for image/bmp in _validate_data()
+ unless ($cgi->param('ispatch')) {
+ $class->validate_content_type($throw_error) || return;
+
+ # Set the ispatch flag to 1 if we're set to autodetect
+ # and the content type is text/x-diff or text/x-patch
+ if ($cgi->param('contenttypemethod') eq 'autodetect'
+ && $cgi->param('contenttype') =~ m{text/x-(?:diff|patch)})
+ {
+ $cgi->param('ispatch', 1);
+ $cgi->param('contenttype', 'text/plain');
+ }
+ }
+ $data = _validate_data($throw_error, $hr_vars);
+ # If the attachment is stored locally, $data eq ''.
+ # If an error is thrown, $data eq '0'.
+ ($data ne '0') || return;
+ $contenttype = $cgi->param('contenttype');
+
+ # These are inserted using placeholders so no need to panic
+ trick_taint($filename);
+ trick_taint($contenttype);
+ $isurl = 0;
+ }
+
+ # Check attachments the user tries to mark as obsolete.
+ my @obsolete_attachments;
+ if ($cgi->param('obsolete')) {
+ @obsolete_attachments = $class->validate_obsolete($bug);
+ }
+
+ # The order of these function calls is important, as Flag::validate
+ # assumes User::match_field has ensured that the
+ # values in the requestee fields are legitimate user email addresses.
+ my $match_status = Bugzilla::User::match_field($cgi, {
+ '^requestee(_type)?-(\d+)$' => { 'type' => 'multi' },
+ }, MATCH_SKIP_CONFIRM);
+
+ $hr_vars->{'match_field'} = 'requestee';
+ if ($match_status == USER_MATCH_FAILED) {
+ $hr_vars->{'message'} = 'user_match_failed';
+ }
+ elsif ($match_status == USER_MATCH_MULTIPLE) {
+ $hr_vars->{'message'} = 'user_match_multiple';
+ }
+
+ # Escape characters in strings that will be used in SQL statements.
+ my $description = $cgi->param('description');
+ trick_taint($description);
+ my $isprivate = $cgi->param('isprivate') ? 1 : 0;
+
+ # Insert the attachment into the database.
+ my $sth = $dbh->do(
+ "INSERT INTO attachments
+ (bug_id, creation_ts, modification_time, filename, description,
+ mimetype, ispatch, isurl, isprivate, submitter_id)
+ VALUES (?,?,?,?,?,?,?,?,?,?)", undef, ($bug->bug_id, $timestamp, $timestamp,
+ $filename, $description, $contenttype, $cgi->param('ispatch'),
+ $isurl, $isprivate, $user->id));
+ # Retrieve the ID of the newly created attachment record.
+ my $attachid = $dbh->bz_last_key('attachments', 'attach_id');
+
+ # We only use $data here in this INSERT with a placeholder,
+ # so it's safe.
+ $sth = $dbh->prepare("INSERT INTO attach_data
+ (id, thedata) VALUES ($attachid, ?)");
+ trick_taint($data);
+ $sth->bind_param(1, $data, $dbh->BLOB_TYPE);
+ $sth->execute();
+
+ # If the file is to be stored locally, stream the file from the web server
+ # to the local file without reading it into a local variable.
+ if ($cgi->param('bigfile')) {
+ my $attachdir = bz_locations()->{'attachdir'};
+ my $fh = $cgi->upload('data');
+ my $hash = ($attachid % 100) + 100;
+ $hash =~ s/.*(\d\d)$/group.$1/;
+ mkdir "$attachdir/$hash", 0770;
+ chmod 0770, "$attachdir/$hash";
+ open(AH, ">$attachdir/$hash/attachment.$attachid");
+ binmode AH;
+ my $sizecount = 0;
+ my $limit = (Bugzilla->params->{"maxlocalattachment"} * 1048576);
+ while (<$fh>) {
+ print AH $_;
+ $sizecount += length($_);
+ if ($sizecount > $limit) {
+ close AH;
+ close $fh;
+ unlink "$attachdir/$hash/attachment.$attachid";
+ $throw_error ? ThrowUserError("local_file_too_large") : return;
+ }
+ }
+ close AH;
+ close $fh;
+ }
+
+ # Make existing attachments obsolete.
+ my $fieldid = get_field_id('attachments.isobsolete');
+
+ foreach my $obsolete_attachment (@obsolete_attachments) {
+ # If the obsolete attachment has request flags, cancel them.
+ # This call must be done before updating the 'attachments' table.
+ Bugzilla::Flag->CancelRequests($bug, $obsolete_attachment, $timestamp);
+
+ $dbh->do('UPDATE attachments SET isobsolete = 1, modification_time = ?
+ WHERE attach_id = ?',
+ undef, ($timestamp, $obsolete_attachment->id));
+
+ $dbh->do('INSERT INTO bugs_activity (bug_id, attach_id, who, bug_when,
+ fieldid, removed, added)
+ VALUES (?,?,?,?,?,?,?)',
+ undef, ($bug->bug_id, $obsolete_attachment->id, $user->id,
+ $timestamp, $fieldid, 0, 1));
+ }
+
+ my $attachment = Bugzilla::Attachment->get($attachid);
+
+ # 1. Add flags, if any. To avoid dying if something goes wrong
+ # while processing flags, we will eval() flag validation.
+ # This requires errors to die().
+ # XXX: this can go away as soon as flag validation is able to
+ # fail without dying.
+ #
+ # 2. Flag::validate() should not detect any reference to existing flags
+ # when creating a new attachment. Setting the third param to -1 will
+ # force this function to check this point.
+ my $error_mode_cache = Bugzilla->error_mode;
+ Bugzilla->error_mode(ERROR_MODE_DIE);
+ eval {
+ Bugzilla::Flag::validate($bug->bug_id, -1, SKIP_REQUESTEE_ON_ERROR);
+ Bugzilla::Flag->process($bug, $attachment, $timestamp, $hr_vars);
+ };
+ Bugzilla->error_mode($error_mode_cache);
+ if ($@) {
+ $hr_vars->{'message'} = 'flag_creation_failed';
+ $hr_vars->{'flag_creation_error'} = $@;
+ }
+
+ # Return the new attachment object.
+ return $attachment;
+}
+
+=pod
+
+=item C<remove_from_db()>
+
+Description: removes an attachment from the DB.
+
+Params: none
+
+Returns: nothing
+
+=back
+
+=cut
+
+sub remove_from_db {
+ my $self = shift;
+ my $dbh = Bugzilla->dbh;
+
+ $dbh->bz_start_transaction();
+ $dbh->do('DELETE FROM flags WHERE attach_id = ?', undef, $self->id);
+ $dbh->do('DELETE FROM attach_data WHERE id = ?', undef, $self->id);
+ $dbh->do('UPDATE attachments SET mimetype = ?, ispatch = ?, isurl = ?, isobsolete = ?
+ WHERE attach_id = ?', undef, ('text/plain', 0, 0, 1, $self->id));
+ $dbh->bz_commit_transaction();
+}
+
+1;
295