SlideShare a Scribd company logo
Compatibility Detector Tool  of Chrome extensionsTapir  2011-05-07
Compatibility Detector ProjectCompatibility Detector scans for potential incompatible issues on a web page, for popular desktop browsers(IE, Firefox, Chrome, Opera, etc). The current version launch 14 detector.Compatibility Detectorhttps://chrome.google.com/webstore/detail/fcillahbnhlpombgccogflhmgocfifmaSource Codehttps://code.google.com/p/compatibility-detector/
Degree of project completionCheck the actual document mode in browserCheck CSS box modelCheck new block formatting context and IE hasLayoutCheck MARQUEE's elementCheck CENTER tagCheck "disabled" attributeCheck ': before' and ': after' pseudo-elementsCheck  document.createElement methodCheck document.all……the total number of  about 30 completed, launch 14.Objectives: Detection W3Help all compatibility  root causes.
Chrome extensions
Extensions Featureschrome.*APICross-Origin XMLHttpRequesDesktop NotificationJavaScriptand DOM APIHTML5<canvas>  <audio> <video> ……localStorageWeb DatabaseCSS 3CSS Selector……
Working principle of extensionsExtension ProcessPage ProcessBackground PageContent ScriptPage DOMIPCPage ScriptPopup PageIPCPage ProcessContent ScriptPage DOMOther HTML PagePage Script
Content ScriptProcess ModelContent Script ProcessC++ DOM ObjectV8 Global Context (EcmaScript Environment)Execution flowExtensionsDOMHandlerContent ScriptRun DeferrerCan not AccessV8 Global Context (EcmaScript Environment)append  Global ContextPage ScriptPage Script Process
Compatibility Detector
Compatibility Detector Filesmanifase.jsonbackground.htmlpopup.htmlloader.jsbase_detection.jsframework_shared.jsframework.jsdetectors/*.jsExtension ProcessPage Process Page Process ContentScript ContextPage Script Context
Message ModelPopup.htmlOther HTML pagebackground.htmlextension.sendRequestextension.onRequestPagecontentScriptframewrok.jsframework_shared.jsDetectors/*.jsEventListenerframework_shared.jsCustom Event dispatchInject  to psge Scriptpage Script loader.jscreateElementrunDOM :: <HTML>  <script> chrome_comp_injector () </script>
Detector ModelClasschrome_comp.CompDetect.declareDetectorchrome_comp.CompDetect.ScanDomBaseDetectorchrome_comp.CompDetect.NonScanDomBaseDetectorMethodsconstructorcheckNodepostAnalyze
Detector ModelDetector AlgorithmDetector AlgorithmDetector AlgorithmaddProblemBaseDetector ClasspostAnalyze(empty)extendconstructorNonScanDomBaseDetector ClasspostAnalyzeextendScanDomBaseDetector ClasscheckNodedocument.createNodeIterator for each Nodes
JavaScript Hook ModelInputWrapSame NameNative  CodeDetector CodeerrorokContinue to other codeproblemschrome_comp. CompDetect .registerExistingMethodHookchrome_comp. CompDetect .registerExistingPropertyHook
????How to StartWrite Compatibility Detector Code
mainfest.json……"content_scripts": [  {    "matches": [ "http://*/*", "https://*/*", "file://*" ],    "js": [      "loader.js",      "framework.js",      "framework_shared.js",      "base_detection.js",      "config.js",      "w3help_issues.js",      "non_w3help_issues.js",      // Detector"detectors/sample_check_node.js",……
addScriptToInject(function() {chrome_comp.CompDetect.declareDetector('sample_check_node',chrome_comp.CompDetect.ScanDomBaseDetector,functionconstructor() {  this.CHECK_TAG_NAME = {SPAN: true, DIV: true, TALBE: true};  this.addProblem = function (node) {    node.style.backgroundColor = 'red';  };}, // constructorfunctioncheckNode(node, context) {  if (Node.ELEMENT_NODE != node.nodeType || context.isDisplayNone())    return;  if (node.tagName in this.CHECK_TAG_NAME) {    if (node.hasAttribute('width') || node.hasAttribute('height'))      this.addProblem(node);  }}); // declareDetector});ScanDomBaseDetector checkNode
addScriptToInject(function() {chrome_comp.CompDetect.declareDetector('sample_post_analyze',chrome_comp.CompDetect.NonScanDomBaseDetector,null, // constructorfunctionpostAnalyze() {  var m = chrome_comp.documentMode;   m.hasCommentBeforeDTD && log('There has Comment before DOCTYPE');  m.hasConditionalCommentBeforeDTD && log('There has IE conditional comment before DOCTYPE');  m.isUnusualDocType && log('There is unknown DOCTYPE');  (document.querySelectorAll('meta').length == 0) && log('This page has no Meta tag');  functionlog(str) {    var t = document.createTextNode(str),p = document.createElement('p');    p.appendChild(t);    document.body.appendChild(p); }}); // declareDetector});NonScanDomBaseDetector postAnalyze
addScriptToInject(function() {chrome_comp.CompDetect.declareDetector('sample_hook',chrome_comp.CompDetect.NonScanDomBaseDetector,functionconstructor() {var This = this;  this.log = function(str) {    var t = document.createTextNode(str),p = document.createElement('p');    p.appendChild(t);    document.body.appendChild(p);  };  this.evalHandler_ = function (result, originalArguments, callStack) {    if (originalArguments[0].indexOf('var ') == 0)      window.addEventListener('load',function() {          This.log('Performed using the eval method ' + originalArguments[0] + 'statement.');      },false)  };},function setUp() {  chrome_comp.CompDetect.registerExistingMethodHook(window, 'eval', this.evalHandler_);},function cleanUp() {  chrome_comp.CompDetect.unregisterExistingMethodHook(window, 'eval', this.evalHandler_);}); // declareDetector});NonScanDomBaseDetector Method Hook
addScriptToInject(function() {chrome_comp.CompDetect.declareDetector('sample_hook_2',chrome_comp.CompDetect.NonScanDomBaseDetector,functionconstructor() {  var This = this;  this.log = function(str) {    var t = document.createTextNode(str),p = document.createElement('p');    p.appendChild(t);    document.body.appendChild(p);  };  this.handler_ =function(oldValue, newValue, reason) {    if (reason == 'get') {      This.log('Get document.documentMode value is ' + oldValue);    }    if (reason == 'set') {      This.log('Set document.documentMode value is ' + newValue);    } };},function setUp() {  chrome_comp.CompDetect.registerSimplePropertyHook(document, 'documentMode', this.handler_);},function cleanUp() {  chrome_comp.CompDetect.registerSimplePropertyHook(document, 'documentMode', this.handler_);}); // declareDetector});NonScanDomBaseDetector Property Hook
Build Your Own Test FrameworkMultiplexing Detector Files
More accurate extract the contents in browsers Kernel  Detector AlgorithmDetector AlgorithmDetector AlgorithmIE BotaddProblemWebKit BotBaseDetector ClassconstructorNonScanDomBaseDetector ClassBrowsers BotpostAnalyzeJsonScanDomBaseDetector ClassBrowser APIcheckNodeC++ String implementDesktop appWeb appYour test frameworkPHP ...Local System
Compatibility Test Bot DemoD:\ProgramData\Windows\Desktop\demo>Detect.exe --url=clear_float.htmlcontent-type:problems:[{"id":"RM8002","info":{"repeatedCount":6,"occurrences":[{"details":"Problem Element height is 38px","html":["<div id=\"div1\" style=\"zoom:1;\" expectedproblems=\"RM8002\">\n  div1 zoom:1;\n  <div style=\"float:left;\">div float:left;</div>\n  <div style=\"float:right;\">div float:right;</div>\n</div>","<div style=\"float:left;\">div float:left;</div>"],"stack":""},{"details":"Problem Element height is 16px","html":["<div id=\"div5\" style=\"height:1em;\" expectedproblems=\"RM8002\">\n  div5 height:1em;\n  <div style=\"float:left;\">div float:left;</div>\n  <div style=\"float:right;\">div float:right;</div>\n</div>","<div style=\"float:left;\">div float:left;</div>"],"stack":""}……
Q&AMark huang, Google Chrome team
FinishedThanksZzzz...Tapir

More Related Content

DOCX
My java file
PPT
Automated javascript unit testing
PDF
UA testing with Selenium and PHPUnit - PFCongres 2013
PDF
Easy tests with Selenide and Easyb
PDF
Workshop quality assurance for php projects - ZendCon 2013
ODP
Non Conventional Android Programming En
PPT
Even Faster Web Sites at The Ajax Experience
PDF
DrupalCon Dublin 2016 - Automated browser testing with Nightwatch.js
My java file
Automated javascript unit testing
UA testing with Selenium and PHPUnit - PFCongres 2013
Easy tests with Selenide and Easyb
Workshop quality assurance for php projects - ZendCon 2013
Non Conventional Android Programming En
Even Faster Web Sites at The Ajax Experience
DrupalCon Dublin 2016 - Automated browser testing with Nightwatch.js

What's hot (20)

PDF
Web ui tests examples with selenide, nselene, selene & capybara
PDF
Testing in JavaScript - August 2018 - WebElement Bardejov
PPTX
Building Progressive Web Apps for Windows devices
PDF
Polyglot automation - QA Fest - 2015
PDF
Selenide alternative in Python - Introducing Selene [SeleniumCamp 2016]
PDF
Avinash Kundaliya: Javascript and WordPress
PPTX
AngularJS with TypeScript and Windows Azure Mobile Services
PPTX
Effective C++/WinRT for UWP and Win32
PPTX
Testing ASP.net Web Applications using Ruby
PDF
JS and patterns
PDF
49368010 projectreportontraininganddevelopment(1)
PDF
Redux for ReactJS Programmers
PDF
Introduction to Protractor
PPT
TDD per Webapps
PPTX
What static analyzers can do that programmers and testers cannot
PDF
Your code are my tests
PDF
Kiss PageObjects [01-2017]
PPTX
Protractor Training in Pune by QuickITDotnet
PPTX
Workshop 1: Good practices in JavaScript
PDF
Unit testing PHP apps with PHPUnit
Web ui tests examples with selenide, nselene, selene & capybara
Testing in JavaScript - August 2018 - WebElement Bardejov
Building Progressive Web Apps for Windows devices
Polyglot automation - QA Fest - 2015
Selenide alternative in Python - Introducing Selene [SeleniumCamp 2016]
Avinash Kundaliya: Javascript and WordPress
AngularJS with TypeScript and Windows Azure Mobile Services
Effective C++/WinRT for UWP and Win32
Testing ASP.net Web Applications using Ruby
JS and patterns
49368010 projectreportontraininganddevelopment(1)
Redux for ReactJS Programmers
Introduction to Protractor
TDD per Webapps
What static analyzers can do that programmers and testers cannot
Your code are my tests
Kiss PageObjects [01-2017]
Protractor Training in Pune by QuickITDotnet
Workshop 1: Good practices in JavaScript
Unit testing PHP apps with PHPUnit
Ad

More from Kai Cui (6)

PPTX
做网站需要知道哪些事
PDF
July.2011.w3ctech
PDF
Yui3在美团 2
PPTX
Javascript template
PPTX
谈团队协作的基情和兼情
PPT
腾讯网Web页面设计规范
做网站需要知道哪些事
July.2011.w3ctech
Yui3在美团 2
Javascript template
谈团队协作的基情和兼情
腾讯网Web页面设计规范
Ad

Recently uploaded (20)

PDF
CIFDAQ's Market Insight: SEC Turns Pro Crypto
PDF
Per capita expenditure prediction using model stacking based on satellite ima...
PDF
Machine learning based COVID-19 study performance prediction
PDF
Unlocking AI with Model Context Protocol (MCP)
PPTX
MYSQL Presentation for SQL database connectivity
PDF
Bridging biosciences and deep learning for revolutionary discoveries: a compr...
PDF
Dropbox Q2 2025 Financial Results & Investor Presentation
PDF
Blue Purple Modern Animated Computer Science Presentation.pdf.pdf
PPTX
Detection-First SIEM: Rule Types, Dashboards, and Threat-Informed Strategy
PDF
KodekX | Application Modernization Development
PDF
Mobile App Security Testing_ A Comprehensive Guide.pdf
PDF
Modernizing your data center with Dell and AMD
PDF
Diabetes mellitus diagnosis method based random forest with bat algorithm
PDF
How UI/UX Design Impacts User Retention in Mobile Apps.pdf
PDF
Encapsulation theory and applications.pdf
PDF
Build a system with the filesystem maintained by OSTree @ COSCUP 2025
PPTX
PA Analog/Digital System: The Backbone of Modern Surveillance and Communication
PDF
The Rise and Fall of 3GPP – Time for a Sabbatical?
PPTX
A Presentation on Artificial Intelligence
PDF
NewMind AI Monthly Chronicles - July 2025
CIFDAQ's Market Insight: SEC Turns Pro Crypto
Per capita expenditure prediction using model stacking based on satellite ima...
Machine learning based COVID-19 study performance prediction
Unlocking AI with Model Context Protocol (MCP)
MYSQL Presentation for SQL database connectivity
Bridging biosciences and deep learning for revolutionary discoveries: a compr...
Dropbox Q2 2025 Financial Results & Investor Presentation
Blue Purple Modern Animated Computer Science Presentation.pdf.pdf
Detection-First SIEM: Rule Types, Dashboards, and Threat-Informed Strategy
KodekX | Application Modernization Development
Mobile App Security Testing_ A Comprehensive Guide.pdf
Modernizing your data center with Dell and AMD
Diabetes mellitus diagnosis method based random forest with bat algorithm
How UI/UX Design Impacts User Retention in Mobile Apps.pdf
Encapsulation theory and applications.pdf
Build a system with the filesystem maintained by OSTree @ COSCUP 2025
PA Analog/Digital System: The Backbone of Modern Surveillance and Communication
The Rise and Fall of 3GPP – Time for a Sabbatical?
A Presentation on Artificial Intelligence
NewMind AI Monthly Chronicles - July 2025

Compatibility Detector Tool of Chrome extensions