fune/dom/script/moz.build
Tom Schuster 01d4cafbb1 Bug 1536094 - Support dynamic import from content scripts (sandboxed code) r=smaug,jonco
Firstly we need to find a usable ScriptLoader for code in the content script sandbox,
for that we use the normal ScriptLoader associated with DOMWindow wrapped by the sandbox.

Secondly we need to execute the module in the global of the sandbox instead of the
"ScriptGlobal" the ScriptLoader is actually associated with. The main
behavior change here comes from using xpc::NativeGlobal in HostImportModuleDynamically
and passing that global around inside ScriptFetchOptions.

To ensure that content-scripts and the webpage don't share imported modules,
the module map (mFetchingModules and mFetchedModules) now uses a complex key
of <URI, Global>. The Global is a nullptr for normal imports from a webpage.

Differential Revision: https://phabricator.services.mozilla.com/D107076
2021-03-23 11:15:11 +00:00

52 lines
1.1 KiB
Python

# -*- Mode: python; indent-tabs-mode: nil; tab-width: 40 -*-
# vim: set filetype=python:
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
with Files("**"):
BUG_COMPONENT = ("Core", "DOM: Core & HTML")
XPIDL_SOURCES += [
"nsIScriptLoaderObserver.idl",
]
XPIDL_MODULE = "dom"
EXPORTS += [
"nsIScriptElement.h",
]
EXPORTS.mozilla.dom += [
"AutoEntryScript.h",
"LoadedScript.h",
"ModuleMapKey.h",
"ScriptDecoding.h",
"ScriptElement.h",
"ScriptKind.h",
"ScriptLoader.h",
"ScriptLoadRequest.h",
"ScriptSettings.h",
]
UNIFIED_SOURCES += [
"AutoEntryScript.cpp",
"LoadedScript.cpp",
"ModuleLoadRequest.cpp",
"ModuleMapKey.cpp",
"nsIScriptElement.cpp",
"ScriptElement.cpp",
"ScriptLoader.cpp",
"ScriptLoadHandler.cpp",
"ScriptLoadRequest.cpp",
"ScriptSettings.cpp",
"ScriptTrace.cpp",
]
LOCAL_INCLUDES += [
"/dom/base",
]
include("/ipc/chromium/chromium-config.mozbuild")
FINAL_LIBRARY = "xul"