Bug 863246 - Move resources that need to be exposed to web content to locations that are marked as contentaccessible r=billm

MozReview-Commit-ID: ArhSHKPYOr8

--HG--
extra : rebase_source : 888f7ce8f9db809ad5abbe6340af74e9dfb1d73b
This commit is contained in:
Chung-Sheng Fu 2017-06-08 17:52:46 +08:00
Родитель 6a8ee766d6
Коммит e5b80e9a8f
15 изменённых файлов: 34 добавлений и 17 удалений

Просмотреть файл

@ -683,9 +683,6 @@
@RESPATH@/res/EditorOverride.css
@RESPATH@/res/contenteditable.css
@RESPATH@/res/designmode.css
@RESPATH@/res/ImageDocument.css
@RESPATH@/res/TopLevelImageDocument.css
@RESPATH@/res/TopLevelVideoDocument.css
@RESPATH@/res/table-add-column-after-active.gif
@RESPATH@/res/table-add-column-after-hover.gif
@RESPATH@/res/table-add-column-after.gif
@ -716,6 +713,9 @@
@RESPATH@/res/MainMenu.nib/
#endif
; Content-accessible resources.
@RESPATH@/contentaccessible/*
; svg
@RESPATH@/res/svg.css
@RESPATH@/components/dom_svg.xpt

Просмотреть файл

@ -208,7 +208,7 @@ function initialHTML(doc) {
// The base URI is prepended to all URIs instead of using a <base> element
// because the latter can be blocked by a CSP base-uri directive (bug 1316393)
let baseURI = "resource://devtools/client/jsonview/";
let baseURI = "resource://devtools-client-jsonview/";
let style = doc.createElement("link");
style.rel = "stylesheet";

Просмотреть файл

@ -21,14 +21,14 @@
* of the code base, so it's consistent and modules can be easily reused.
*/
require.config({
baseUrl: "resource://devtools/client/jsonview/",
baseUrl: "resource://devtools-client-jsonview/",
paths: {
"devtools/client/shared": "resource://devtools/client/shared",
"devtools/client/shared": "resource://devtools-client-shared",
"devtools/shared": "resource://devtools/shared",
"devtools/client/shared/vendor/react":
JSONView.debug
? "resource://devtools/client/shared/vendor/react-dev"
: "resource://devtools/client/shared/vendor/react"
? "resource://devtools-client-shared/vendor/react-dev"
: "resource://devtools-client-shared/vendor/react"
}
});

Просмотреть файл

@ -4,6 +4,8 @@
devtools.jar:
% resource devtools %modules/devtools/
% resource devtools-client-jsonview resource://devtools/client/jsonview/ contentaccessible=yes
% resource devtools-client-shared resource://devtools/client/shared/ contentaccessible=yes
# The typical approach would be to list all the resource files in this manifest
# for installation. Instead of doing this, use the DevToolsModules syntax via
# moz.build files to do the installation so that we can enforce correct paths

Просмотреть файл

@ -279,9 +279,9 @@ ImageDocument::SetScriptGlobalObject(nsIScriptGlobalObject* aScriptGlobalObject)
target->AddEventListener(NS_LITERAL_STRING("keypress"), this, false);
if (GetReadyStateEnum() != nsIDocument::READYSTATE_COMPLETE) {
LinkStylesheet(NS_LITERAL_STRING("resource://gre/res/ImageDocument.css"));
LinkStylesheet(NS_LITERAL_STRING("resource://content-accessible/ImageDocument.css"));
if (!nsContentUtils::IsChildOfSameType(this)) {
LinkStylesheet(NS_LITERAL_STRING("resource://gre/res/TopLevelImageDocument.css"));
LinkStylesheet(NS_LITERAL_STRING("resource://content-accessible/TopLevelImageDocument.css"));
LinkStylesheet(NS_LITERAL_STRING("chrome://global/skin/media/TopLevelImageDocument.css"));
}
}

Просмотреть файл

@ -74,7 +74,7 @@ VideoDocument::SetScriptGlobalObject(nsIScriptGlobalObject* aScriptGlobalObject)
if (aScriptGlobalObject) {
if (!nsContentUtils::IsChildOfSameType(this) &&
GetReadyStateEnum() != nsIDocument::READYSTATE_COMPLETE) {
LinkStylesheet(NS_LITERAL_STRING("resource://gre/res/TopLevelVideoDocument.css"));
LinkStylesheet(NS_LITERAL_STRING("resource://content-accessible/TopLevelVideoDocument.css"));
LinkStylesheet(NS_LITERAL_STRING("chrome://global/skin/media/TopLevelVideoDocument.css"));
LinkScript(NS_LITERAL_STRING("chrome://global/content/TopLevelVideoDocument.js"));
}

Просмотреть файл

@ -3,7 +3,7 @@
* 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/. */
@import url("resource://gre-resources/viewsource.css");
@import url("resource://content-accessible/viewsource.css");
#header {
background-color: #ccc;

Просмотреть файл

@ -7,7 +7,6 @@ toolkit.jar:
* res/html.css (res/html.css)
res/quirk.css (res/quirk.css)
res/plaintext.css (res/plaintext.css)
res/viewsource.css (res/viewsource.css)
res/counterstyles.css (res/counterstyles.css)
res/noscript.css (res/noscript.css)
res/noframes.css (res/noframes.css)
@ -33,3 +32,4 @@ toolkit.jar:
res/accessiblecaret-tilt-right@2.25x.png (res/accessiblecaret-tilt-right@2.25x.png)
% resource gre-resources %res/
% resource content-accessible resource://gre/contentaccessible/ contentaccessible=yes

Просмотреть файл

@ -300,7 +300,11 @@ JAR_MANIFESTS += ['jar.mn']
RESOURCE_FILES += [
'contenteditable.css',
'designmode.css',
]
CONTENT_ACCESSIBLE_FILES += [
'ImageDocument.css',
'res/viewsource.css',
'TopLevelImageDocument.css',
'TopLevelVideoDocument.css',
]

Просмотреть файл

@ -459,8 +459,6 @@
@BINPATH@/res/EditorOverride.css
@BINPATH@/res/contenteditable.css
@BINPATH@/res/designmode.css
@BINPATH@/res/TopLevelImageDocument.css
@BINPATH@/res/TopLevelVideoDocument.css
@BINPATH@/res/table-add-column-after-active.gif
@BINPATH@/res/table-add-column-after-hover.gif
@BINPATH@/res/table-add-column-after.gif
@ -490,6 +488,9 @@
@BINPATH@/res/fonts/*.properties
#endif
; Content-accessible resources.
@BINPATH@/contentaccessible/*
; svg
@BINPATH@/res/svg.css
@BINPATH@/components/dom_svg.xpt

Просмотреть файл

@ -50,7 +50,7 @@ nsHtml5ViewSourceUtils::NewLinkAttributes()
nsHtml5String type = nsHtml5Portability::newStringFromLiteral("text/css");
linkAttrs->addAttribute(nsHtml5AttributeName::ATTR_TYPE, type, -1);
nsHtml5String href = nsHtml5Portability::newStringFromLiteral(
"resource://gre-resources/viewsource.css");
"resource://content-accessible/viewsource.css");
linkAttrs->addAttribute(nsHtml5AttributeName::ATTR_HREF, href, -1);
return linkAttrs;
}

Просмотреть файл

@ -2090,6 +2090,14 @@ SPECIAL_VARIABLES = {
RESOURCE_FILES.fonts += ['bar.res']
"""),
'CONTENT_ACCESSIBLE_FILES': (lambda context: context['FINAL_TARGET_FILES'].contentaccessible, list,
"""List of files which can be accessed by web content through resource:// URIs.
``CONTENT_ACCESSIBLE_FILES`` is used to list the files to be exported
to ``dist/bin/contentaccessible``. Files can also be appended to a
field to indicate which subdirectory they should be exported to.
"""),
'EXTRA_JS_MODULES': (lambda context: context['FINAL_TARGET_FILES'].modules, list,
"""Additional JavaScript files to distribute.

Просмотреть файл

@ -38,6 +38,7 @@ class ManifestEntry(object):
'xpcnativewrappers',
'tablet',
'process',
'contentaccessible',
]
def __init__(self, base, *flags):

Просмотреть файл

@ -340,4 +340,5 @@ class OmniJarSubFormatter(PiecemealFormatter):
'hyphenation',
'localization',
'update.locale',
'contentaccessible',
]

Просмотреть файл

@ -1340,7 +1340,7 @@ var ViewSelectionSource = {
return undefined;
// serialize
const VIEW_SOURCE_CSS = "resource://gre-resources/viewsource.css";
const VIEW_SOURCE_CSS = "resource://content-accessible/viewsource.css";
const BUNDLE_URL = "chrome://global/locale/viewSource.properties";
let bundle = Services.strings.createBundle(BUNDLE_URL);