Browse Source

pas2js: fixed srcmap header

git-svn-id: trunk@38033 -
Mattias Gaertner 7 years ago
parent
commit
ef7d13d112

+ 2 - 2
packages/fcl-js/src/jssrcmap.pas

@@ -26,7 +26,7 @@ uses
 
 const
   Base64Chars = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/';
-  DefaultSrcMapHeader = ')]}'+LineEnding;
+  DefaultSrcMapHeader = ')]}'''+LineEnding;
 
 type
   EJSSourceMap = class(Exception);
@@ -58,7 +58,7 @@ type
     );
   TSourceMapOptions = set of TSourceMapOption;
 const
-  DefaultSourceMapOptions = [smoAddMonotonous];
+  DefaultSourceMapOptions = [smoAddMonotonous,smoSafetyHeader];
 type
 
   { TSourceMap }

+ 2 - 2
packages/pastojs/src/pas2jscompiler.pp

@@ -104,7 +104,7 @@ type
     );
   TP2jsCompilerOptions = set of TP2jsCompilerOption;
 const
-  DefaultP2jsCompilerOptions = [coShowErrors];
+  DefaultP2jsCompilerOptions = [coShowErrors,coSourceMapXSSIHeader];
   coShowAll = [coShowErrors..coShowUsedTools];
   coO1Enable = [coEnumValuesAsNumbers];
   coO1Disable = [coKeepNotUsedPrivates,coKeepNotUsedDeclarationsWPO];
@@ -3221,7 +3221,7 @@ begin
   l('     -Jmsourceroot=<x> : use x as "sourceRoot", prefix URL for source file names.');
   l('     -Jmbasedir=<x> : write source file names relative to directory x.');
   l('     -Jminclude : include Pascal sources in source map.');
-  l('     -Jmxssiheader : start source map with XSSI protection )]}.');
+  l('     -Jmxssiheader : start source map with XSSI protection )]}'', default.');
   l('     -Jm- : disable generating source maps');
   l('   -Jo<x> : Enable or disable extra option. The x is case insensitive:');
   l('     -JoSearchLikeFPC : search source files like FPC, default: search case insensitive.');

+ 2 - 2
utils/pas2js/docs/translation.html

@@ -2681,8 +2681,8 @@ End.
     <br>
     To show the generated mapping for each line you can use the tool fpc/packages/fcl-js/examples/srcmapdump.<br>
     <li>According to the specifications sourcemap should start with the XSSI
-    (cross site script inclusion) protection header <i>)]}</i>, but some browsers
-    don't support that. Enable it with -Jmxssiheader. See here the specs:
+    (cross site script inclusion) protection header <i>)]}'</i>. If your browser
+    does not support that, disable it with <i>-JmXSSIHeader-</i>. See here the specs:
     https://docs.google.com/document/d/1U1RGAehQwRypUTovF1KRlpiOFze0b-_2gc6fAH0KY0k/edit#heading=h.h7yy76c5il9v
     </li>
     </div>