Bug 1850713: remove duplicated setting of early hint preloader id in `ScriptLoader...
[gecko.git] / dom / filesystem / FileSystemUtils.h
blob7f82e8474f9ff3774f781ebb01ae59e29bcbac85
1 /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
2 /* vim: set ts=8 sts=2 et sw=2 tw=80: */
3 /* This Source Code Form is subject to the terms of the Mozilla Public
4 * License, v. 2.0. If a copy of the MPL was not distributed with this file,
5 * You can obtain one at http://mozilla.org/MPL/2.0/. */
7 #ifndef mozilla_dom_FileSystemUtils_h
8 #define mozilla_dom_FileSystemUtils_h
10 #include "nsIGlobalObject.h"
11 #include "nsStringFwd.h"
12 #include "nsTArray.h"
14 class nsIFile;
15 class nsIRunnable;
17 namespace mozilla::dom {
19 #define FILESYSTEM_DOM_PATH_SEPARATOR_LITERAL "/"
20 #define FILESYSTEM_DOM_PATH_SEPARATOR_CHAR '/'
23 * This class is for error handling.
24 * All methods in this class are static.
26 class FileSystemUtils {
27 public:
29 * Return true if aDescendantPath is a descendant of aPath.
31 static bool IsDescendantPath(const nsAString& aPath,
32 const nsAString& aDescendantPath);
34 /**
35 * Return true if this is valid DOMPath. It also splits the path in
36 * subdirectories and stores them in aParts.
38 static bool IsValidRelativeDOMPath(const nsAString& aPath,
39 nsTArray<nsString>& aParts);
41 /**
42 * Helper method. If aGlobal is null, the SystemGroup EventTarget will be
43 * used.
45 static nsresult DispatchRunnable(nsIGlobalObject* aGlobal,
46 already_AddRefed<nsIRunnable>&& aRunnable);
49 } // namespace mozilla::dom
51 #endif // mozilla_dom_FileSystemUtils_h