ScriptLoader.h 2.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768
  1. /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
  2. /* This Source Code Form is subject to the terms of the Mozilla Public
  3. * License, v. 2.0. If a copy of the MPL was not distributed with this
  4. * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
  5. #ifndef mozilla_dom_workers_scriptloader_h__
  6. #define mozilla_dom_workers_scriptloader_h__
  7. #include "Workers.h"
  8. #include "nsIContentPolicyBase.h"
  9. class nsIPrincipal;
  10. class nsIURI;
  11. class nsIDocument;
  12. class nsILoadGroup;
  13. class nsString;
  14. class nsIChannel;
  15. namespace mozilla {
  16. class ErrorResult;
  17. } // namespace mozilla
  18. BEGIN_WORKERS_NAMESPACE
  19. enum WorkerScriptType {
  20. WorkerScript,
  21. DebuggerScript
  22. };
  23. namespace scriptloader {
  24. nsresult
  25. ChannelFromScriptURLMainThread(nsIPrincipal* aPrincipal,
  26. nsIURI* aBaseURI,
  27. nsIDocument* aParentDoc,
  28. nsILoadGroup* aLoadGroup,
  29. const nsAString& aScriptURL,
  30. nsContentPolicyType aContentPolicyType,
  31. bool aDefaultURIEncoding,
  32. nsIChannel** aChannel);
  33. nsresult
  34. ChannelFromScriptURLWorkerThread(JSContext* aCx,
  35. WorkerPrivate* aParent,
  36. const nsAString& aScriptURL,
  37. nsIChannel** aChannel);
  38. void ReportLoadError(ErrorResult& aRv, nsresult aLoadResult,
  39. const nsAString& aScriptURL);
  40. void LoadMainScript(WorkerPrivate* aWorkerPrivate,
  41. const nsAString& aScriptURL,
  42. WorkerScriptType aWorkerScriptType,
  43. ErrorResult& aRv);
  44. void Load(WorkerPrivate* aWorkerPrivate,
  45. const nsTArray<nsString>& aScriptURLs,
  46. WorkerScriptType aWorkerScriptType,
  47. mozilla::ErrorResult& aRv);
  48. } // namespace scriptloader
  49. END_WORKERS_NAMESPACE
  50. #endif /* mozilla_dom_workers_scriptloader_h__ */