Skip to content

Commit

Permalink
Bug 863246 - Move resources that need to be exposed to web content to…
Browse files Browse the repository at this point in the history
… locations that are marked as contentaccessible r=billm

MozReview-Commit-ID: ArhSHKPYOr8

--HG--
extra : rebase_source : b0cf8d159ba6bfa6e7bcd9528ae2f9851185ac30
  • Loading branch information
Chung-Sheng Fu authored and Alex Kontos committed Apr 30, 2018
1 parent 9681c08 commit 7d571fe
Show file tree
Hide file tree
Showing 15 changed files with 34 additions and 17 deletions.
6 changes: 3 additions & 3 deletions browser/installer/package-manifest.in
Original file line number Diff line number Diff line change
Expand Up @@ -681,9 +681,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
Expand Down Expand Up @@ -715,6 +712,9 @@
@RESPATH@/res/MainMenu.nib/
#endif

; Content-accessible resources.
@RESPATH@/contentaccessible/*

; svg
@RESPATH@/res/svg.css
@RESPATH@/components/dom_svg.xpt
Expand Down
2 changes: 1 addition & 1 deletion devtools/client/jsonview/converter-child.js
Original file line number Diff line number Diff line change
Expand Up @@ -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";
Expand Down
8 changes: 4 additions & 4 deletions devtools/client/jsonview/viewer-config.js
Original file line number Diff line number Diff line change
Expand Up @@ -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"
}
});

Expand Down
2 changes: 2 additions & 0 deletions devtools/shared/jar.mn
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions dom/html/ImageDocument.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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"));
}
}
Expand Down
2 changes: 1 addition & 1 deletion dom/html/VideoDocument.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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"));
}
Expand Down
2 changes: 1 addition & 1 deletion dom/xml/resources/XMLPrettyPrint.css
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
2 changes: 1 addition & 1 deletion layout/style/jar.mn
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -33,3 +32,4 @@ toolkit.jar:
res/[email protected] (res/[email protected])

% resource gre-resources %res/
% resource content-accessible resource://gre/contentaccessible/ contentaccessible=yes
4 changes: 4 additions & 0 deletions layout/style/moz.build
Original file line number Diff line number Diff line change
Expand Up @@ -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',
]
Expand Down
5 changes: 3 additions & 2 deletions mobile/android/installer/package-manifest.in
Original file line number Diff line number Diff line change
Expand Up @@ -463,8 +463,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
Expand Down Expand Up @@ -495,6 +493,9 @@
@BINPATH@/res/fonts/*.properties
#endif

; Content-accessible resources.
@BINPATH@/contentaccessible/*

; svg
@BINPATH@/res/svg.css
@BINPATH@/components/dom_svg.xpt
Expand Down
2 changes: 1 addition & 1 deletion parser/html/nsHtml5ViewSourceUtils.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
8 changes: 8 additions & 0 deletions python/mozbuild/mozbuild/frontend/context.py
Original file line number Diff line number Diff line change
Expand Up @@ -2086,6 +2086,14 @@ def Program(name):
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.
Expand Down
1 change: 1 addition & 0 deletions python/mozbuild/mozpack/chrome/manifest.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ class ManifestEntry(object):
'xpcnativewrappers',
'tablet',
'process',
'contentaccessible',
]

def __init__(self, base, *flags):
Expand Down
1 change: 1 addition & 0 deletions python/mozbuild/mozpack/packager/formats.py
Original file line number Diff line number Diff line change
Expand Up @@ -339,4 +339,5 @@ def is_resource(self, path):
'greprefs.js',
'hyphenation',
'update.locale',
'contentaccessible',
]
2 changes: 1 addition & 1 deletion toolkit/content/browser-content.js
Original file line number Diff line number Diff line change
Expand Up @@ -1337,7 +1337,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);
Expand Down

0 comments on commit 7d571fe

Please sign in to comment.