@@ -565,9 +565,11 @@ Blockly.Xml.appendDomToWorkspace = function(xml, workspace) {
565565 * workspace.
566566 * @param {!Element } xmlBlock XML block element.
567567 * @param {!Blockly.Workspace } workspace The workspace.
568+ * @param {string } uniqueCommentID (used for logging)
568569 * @return {!Blockly.Block } The root block created.
569570 */
570- Blockly . Xml . domToBlock = function ( xmlBlock , workspace , uniqueCommentID = "unapplicable" ) {
571+ Blockly . Xml . domToBlock = function ( xmlBlock , workspace , uniqueCommentID ) {
572+ if ( typeof uniqueCommentID === 'undefined' ) uniqueCommentID = "unapplicable" ;
571573 if ( xmlBlock instanceof Blockly . Workspace ) {
572574 var swap = xmlBlock ;
573575 xmlBlock = workspace ;
@@ -654,10 +656,12 @@ Blockly.Xml.domToVariables = function(xmlVariables, workspace) {
654656 * workspace.
655657 * @param {!Element } xmlBlock XML block element.
656658 * @param {!Blockly.Workspace } workspace The workspace.
659+ * @param {string } uniqueCommentID (used for logging)
657660 * @return {!Blockly.Block } The root block created.
658661 * @private
659662 */
660- Blockly . Xml . domToBlockHeadless_ = function ( xmlBlock , workspace , uniqueCommentID = "unapplicable" ) {
663+ Blockly . Xml . domToBlockHeadless_ = function ( xmlBlock , workspace , uniqueCommentID ) {
664+ if ( typeof uniqueCommentID === 'undefined' ) uniqueCommentID = "unapplicable" ;
661665 var block = null ;
662666 var prototypeName = xmlBlock . getAttribute ( 'type' ) ;
663667 goog . asserts . assert (
@@ -749,7 +753,15 @@ Blockly.Xml.domToBlockHeadless_ = function(xmlBlock, workspace,uniqueCommentID="
749753 if ( ! input ) {
750754 console . warn ( 'Ignoring non-existent input ' + name + ' in block ' +
751755 prototypeName ) ;
752- window . dispatchEvent ( new CustomEvent ( 'blockError' , { detail : { uniqueCommentID :uniqueCommentID , block : block , source : "1" , error : 'Ignoring non-existent input ' + name + ' in block ' + prototypeName } } ) ) ;
756+ window . dispatchEvent ( new CustomEvent ( 'blockError' , {
757+ detail : {
758+ uniqueCommentID : uniqueCommentID ,
759+ block : block ,
760+ source : "1" ,
761+ error : 'Ignoring non-existent input ' + name + ' in block ' + prototypeName
762+ }
763+ }
764+ ) ) ;
753765 break ;
754766 }
755767 if ( childShadowElement ) {
@@ -873,14 +885,24 @@ Blockly.Xml.domToFieldVariable_ = function(workspace, xml, text, field) {
873885 * @param {!Blockly.Block } block The block that is currently being deserialized.
874886 * @param {string } fieldName The name of the field on the block.
875887 * @param {!Element } xml The field tag to decode.
888+ * @param {string } uniqueCommentID (used for logging)
876889 * @private
877890 */
878- Blockly . Xml . domToField_ = function ( block , fieldName , xml , uniqueCommentID = "unapplicable" ) {
891+ Blockly . Xml . domToField_ = function ( block , fieldName , xml , uniqueCommentID ) {
892+ if ( typeof uniqueCommentID === 'undefined' ) uniqueCommentID = "unapplicable" ;
879893 var field = block . getField ( fieldName ) ;
880894 if ( ! field ) {
881895 console . warn ( 'Ignoring non-existent field ' + fieldName + ' in block ' +
882896 block . type ) ;
883- window . dispatchEvent ( new CustomEvent ( 'blockError' , { detail : { block : block , uniqueCommentID :uniqueCommentID , source : "2" , error : 'Ignoring non-existent field ' + fieldName + ' in block ' + block . type } } ) ) ;
897+ window . dispatchEvent ( new CustomEvent ( 'blockError' , {
898+ detail : {
899+ block : block ,
900+ uniqueCommentID : uniqueCommentID ,
901+ source : "2" ,
902+ error : 'Ignoring non-existent field ' + fieldName + ' in block ' + block . type
903+ }
904+ }
905+ ) ) ;
884906 return ;
885907 }
886908
0 commit comments